Toggle navigation
Toggle navigation
This project
Loading...
Sign in
TelusPlayground
/
NestApp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dave Boyle
2016-06-05 18:39:19 -0400
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
080e576f56bc10f1a79598637c37f3fdf708bf25
080e576f
1 parent
e27310c7
Button drag stuff works. Just need to set up client / server stuff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
Assets/_Nest/Prefabs/moviePlayNode.prefab
Assets/_Nest/Prefabs/networkUser.prefab
Assets/_Nest/Scripts/MoviePlayNode.cs
Assets/_Nest/Prefabs/moviePlayNode.prefab
View file @
080e576
No preview for this file type
Assets/_Nest/Prefabs/networkUser.prefab
View file @
080e576
No preview for this file type
Assets/_Nest/Scripts/MoviePlayNode.cs
View file @
080e576
...
...
@@ -6,18 +6,74 @@ public class MoviePlayNode : MonoBehaviour
{
[
SerializeField
]
private
Text
_textNode
;
[
SerializeField
]
private
Transform
_dragTarget
;
[
SerializeField
]
private
float
_moveSpeed
;
[
SerializeField
]
private
Collider2D
_button
;
private
string
_filename
;
private
NetworkUser
_netNode
;
private
Vector3
_initPos
;
private
RectTransform
_xform
;
private
void
Start
()
{
_initPos
=
_button
.
transform
.
position
;
_xform
=
_button
.
transform
.
GetComponent
<
RectTransform
>();
}
public
void
Initialize
(
string
title
,
string
filename
,
NetworkUser
parent
)
{
_textNode
.
text
=
title
;
_filename
=
filename
;
_netNode
=
parent
;
gameObject
.
name
=
title
;
}
private
bool
_isDragging
=
false
;
public
void
Drag
(
UnityEngine
.
EventSystems
.
BaseEventData
test
)
{
_isDragging
=
true
;
iTween
.
Stop
(
_button
.
gameObject
);
var
ped
=
(
UnityEngine
.
EventSystems
.
PointerEventData
)
test
;
_button
.
transform
.
position
+=
Vector3
.
up
*
ped
.
delta
.
y
;
if
(
_button
.
transform
.
position
.
y
>=
_dragTarget
.
position
.
y
)
{
_isDragging
=
false
;
PlayMovie
();
}
if
(
_button
.
transform
.
position
.
y
>
_dragTarget
.
position
.
y
)
_button
.
transform
.
position
=
new
Vector3
(
_button
.
transform
.
position
.
x
,
_dragTarget
.
position
.
y
,
_button
.
transform
.
position
.
z
);
if
(
_button
.
transform
.
position
.
y
<
_initPos
.
y
)
_button
.
transform
.
position
=
new
Vector3
(
_button
.
transform
.
position
.
x
,
_initPos
.
y
,
_button
.
transform
.
position
.
z
);
}
public
void
DragEnd
()
{
iTween
.
MoveTo
(
_button
.
gameObject
,
iTween
.
Hash
(
"y"
,
_initPos
.
y
,
"speed"
,
_moveSpeed
));
_isDragging
=
false
;
_canPlay
=
true
;
}
private
bool
_canPlay
=
true
;
public
void
PlayMovie
()
{
if
(!
_canPlay
||
_isDragging
)
return
;
_netNode
.
CmdLoadVideo
(
_filename
);
_canPlay
=
false
;
}
}
...
...
Please
register
or
sign in
to post a comment