Skip to content

Commit 2619730

Browse files
committed
Init with unity5.3.5f1
1 parent d87a818 commit 2619730

File tree

126 files changed

+30465
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+30465
-0
lines changed

Assets/Flop.meta

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Flop/Flop.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System.Linq;
2+
using UnityEngine;
3+
using UnityEngine.EventSystems;
4+
public class Flop : UIBehaviour, IDragHandler
5+
{
6+
public float Offset = 64f;
7+
public Transform LookAt;
8+
protected override void Start()
9+
{
10+
base.Start();
11+
for (int i = 0; i < transform.childCount; i++)
12+
{
13+
var x = i * Offset;
14+
Drag(x, transform.GetChild(i));
15+
}
16+
Order();
17+
}
18+
public void Drag(PointerEventData e)
19+
{
20+
foreach (Transform i in transform)
21+
{
22+
var x = i.localPosition.x + e.delta.x;
23+
Drag(x, i);
24+
}
25+
Order();
26+
}
27+
private void Order()
28+
{
29+
var children = GetComponentsInChildren<Transform>();
30+
var sorted = from child in children orderby child.localPosition.z descending select child;
31+
for (int i = 0; i < sorted.Count(); i++)
32+
{
33+
sorted.ElementAt(i).SetSiblingIndex(i);
34+
}
35+
}
36+
private void Drag(float x, Transform t)
37+
{
38+
t.localPosition = new Vector3(x, transform.localPosition.y, x < 0 ? -x : x);
39+
}
40+
public void OnDrag(PointerEventData e)
41+
{
42+
Drag(e);
43+
}
44+
}

Assets/Flop/Flop.cs.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)