From 6afe1fdba51e8b1429083394120ed9e2223427dc Mon Sep 17 00:00:00 2001 From: harihitode Date: Thu, 7 Jan 2016 21:58:11 +0900 Subject: [PATCH] #25 merge patrick's work for TCP/IP communitcation --- .gitignore | 2 +- Assets/MainMenu.cs | 29 +++--- Assets/_Scenes/MainScene.unity | 178 +++++++++++++++++++-------------- 3 files changed, 117 insertions(+), 92 deletions(-) diff --git a/.gitignore b/.gitignore index 1fe1202..6174a90 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,4 @@ Assets/Plugins *~ log/ -resources + diff --git a/Assets/MainMenu.cs b/Assets/MainMenu.cs index 3819877..ef2f638 100644 --- a/Assets/MainMenu.cs +++ b/Assets/MainMenu.cs @@ -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 (selectGazou(gazou)); pictureR.sprite = Resources.Load (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); diff --git a/Assets/_Scenes/MainScene.unity b/Assets/_Scenes/MainScene.unity index f3b433c..ecbcad1 100644 --- a/Assets/_Scenes/MainScene.unity +++ b/Assets/_Scenes/MainScene.unity @@ -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 @@ -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} @@ -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 @@ -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: @@ -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} @@ -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 @@ -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} @@ -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} @@ -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: @@ -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} @@ -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} @@ -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} @@ -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}