Skip to content

Commit

Permalink
#25 merge patrick's work for TCP/IP communitcation
Browse files Browse the repository at this point in the history
  • Loading branch information
harihitode committed Jan 7, 2016
1 parent 802492f commit 6afe1fd
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ Assets/Plugins
*~

log/
resources

29 changes: 14 additions & 15 deletions Assets/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,41 +55,40 @@ void Start () {
listener.Start();
}
void disableSpace(){
System.Threading.Thread.Sleep (200);
Thread.Sleep (200);
spaceEnable = true;
}
void showImages () {
if (spaceEnable) {
spaceEnable = false;
Thread exeOnce = new Thread (disableSpace);
exeOnce.Start ();
} else {
return;
}
if(messages.Count > 0){
message last = messages.Peek();
int gazou = last.gazou;
pictureL.sprite = Resources.Load <Sprite>(selectGazou(gazou));
pictureR.sprite = Resources.Load <Sprite>(selectGazou(gazou));
pictureL.enabled = linemode;
pictureR.enabled = linemode;
}
pictureL.enabled = linemode;
pictureR.enabled = linemode;
}

// Update is called once per frame
void Update () {
Leap.Frame frame = controller.Frame ();
tsr.InvokeIfRecognized (frame);

if (Input.GetKey(KeyCode.Space)) {
linemode = !linemode;

if (Input.GetKey(KeyCode.D)) {
if (spaceEnable) {
linemode = !linemode;
spaceEnable = false;
Thread exeOnce = new Thread (disableSpace);
exeOnce.Start ();
Debug.Log (linemode);
}
Debug.Log ("press D!!");
} else if (Input.GetKey(KeyCode.A)){
message t = new message();
t.gazou = UnityEngine.Random.Range (0, 4);
t.you = true;
messages.Push(t);
}
if (Input.GetKeyDown(KeyCode.S)) {
} else if (Input.GetKeyDown(KeyCode.S)) {
if(messages.Count > 0){
message last = messages.Peek();
sendMessage(last);
Expand Down
178 changes: 102 additions & 76 deletions Assets/_Scenes/MainScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ GameObject:
- 114: {fileID: 173194053}
- 114: {fileID: 173194052}
- 114: {fileID: 173194055}
- 114: {fileID: 173194056}
m_Layer: 0
m_Name: ClockL
m_TagString: Untagged
Expand All @@ -121,9 +122,9 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 519960593}
- {fileID: 894178635}
- {fileID: 2077585945}
- {fileID: 1844150653}
- {fileID: 894178635}
- {fileID: 888295800}
- {fileID: 1252612103}
m_Father: {fileID: 0}
Expand Down Expand Up @@ -202,6 +203,18 @@ MonoBehaviour:
i2: {fileID: 1844150654}
i3: {fileID: 888295798}
i4: {fileID: 1252612104}
--- !u!114 &173194056
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 173194050}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -1200242548, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &182829581
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -308,14 +321,14 @@ RectTransform:
m_GameObject: {fileID: 519960591}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3, y: 3, z: 3}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 173194051}
m_Father: {fileID: 2077585945}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: -16, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 10, y: 10}
m_Pivot: {x: .5, y: .5}
--- !u!222 &519960594
CanvasRenderer:
Expand Down Expand Up @@ -492,7 +505,6 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 911096439}
- {fileID: 1240260310}
- {fileID: 1814841066}
- {fileID: 1252303352}
Expand Down Expand Up @@ -624,77 +636,16 @@ RectTransform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 894178632}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0, z: -5.78795007e-05}
m_LocalScale: {x: .0799999982, y: .150000006, z: 1}
m_Children: []
m_Father: {fileID: 173194051}
m_RootOrder: 1
m_RootOrder: 2
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -200, y: 280}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
--- !u!1 &911096438
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 911096439}
- 222: {fileID: 911096441}
- 114: {fileID: 911096440}
m_Layer: 0
m_Name: stampR
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &911096439
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 911096438}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3, y: 3, z: 3}
m_Children: []
m_Father: {fileID: 891978379}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: -16.0000038, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: .5, y: .5}
--- !u!114 &911096440
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 911096438}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 21300000, guid: 266078b78849d4b59b8b2540780b03ed, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &911096441
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 911096438}
--- !u!1 &1240260307
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -750,7 +701,7 @@ RectTransform:
m_LocalScale: {x: .0799999982, y: .150000006, z: 1}
m_Children: []
m_Father: {fileID: 891978379}
m_RootOrder: 1
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -200, y: 280}
Expand Down Expand Up @@ -784,7 +735,7 @@ RectTransform:
m_LocalScale: {x: .0799999982, y: .150000006, z: 1}
m_Children: []
m_Father: {fileID: 891978379}
m_RootOrder: 3
m_RootOrder: 2
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 100, y: 280}
Expand Down Expand Up @@ -924,7 +875,7 @@ Prefab:
- target: {fileID: 11483406, guid: 3ec5dd60dda4e49ba89053ede7744b29, type: 2}
propertyPath: pictureR
value:
objectReference: {fileID: 911096440}
objectReference: {fileID: 0}
- target: {fileID: 11483406, guid: 3ec5dd60dda4e49ba89053ede7744b29, type: 2}
propertyPath: pictureL
value:
Expand Down Expand Up @@ -960,7 +911,7 @@ RectTransform:
m_LocalScale: {x: .0799999982, y: .150000006, z: 1}
m_Children: []
m_Father: {fileID: 891978379}
m_RootOrder: 4
m_RootOrder: 3
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 200, y: 280}
Expand Down Expand Up @@ -1021,7 +972,7 @@ RectTransform:
m_LocalScale: {x: .0799999982, y: .150000006, z: 1}
m_Children: []
m_Father: {fileID: 891978379}
m_RootOrder: 2
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -100, y: 280}
Expand Down Expand Up @@ -1082,7 +1033,7 @@ RectTransform:
m_LocalScale: {x: .0799999982, y: .150000006, z: 1}
m_Children: []
m_Father: {fileID: 173194051}
m_RootOrder: 2
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -100, y: 280}
Expand Down Expand Up @@ -1115,3 +1066,78 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1844150652}
--- !u!1 &2077585944
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 2077585945}
- 222: {fileID: 2077585948}
- 114: {fileID: 2077585947}
- 114: {fileID: 2077585946}
m_Layer: 0
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2077585945
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2077585944}
m_LocalRotation: {x: 0, y: -.342020184, z: 0, w: .939692616}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 10, y: 10, z: 10}
m_Children:
- {fileID: 519960593}
m_Father: {fileID: 173194051}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: -275, y: 0}
m_SizeDelta: {x: 10, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &2077585946
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2077585944}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -1200242548, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!114 &2077585947
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2077585944}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &2077585948
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2077585944}

0 comments on commit 6afe1fd

Please sign in to comment.