From 9a656f3b6cf1a0b4cc8ad607b2ebfcba6e0c7ac7 Mon Sep 17 00:00:00 2001 From: tigerchen Date: Thu, 5 Dec 2019 16:35:04 +0800 Subject: [PATCH] add dictionary --- .../Assets/Prefabs/RawImage.prefab | 43 +++- .../Assets/Scenes/DarkSea.unity | 229 ++---------------- .../Assets/Scripts/movieController.cs | 78 +++--- .../Assets/Scripts/tuio_event.cs | 53 +++- 4 files changed, 139 insertions(+), 264 deletions(-) diff --git a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Prefabs/RawImage.prefab b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Prefabs/RawImage.prefab index 0b68d93..27e5695 100644 --- a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Prefabs/RawImage.prefab +++ b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Prefabs/RawImage.prefab @@ -12,6 +12,8 @@ GameObject: - component: {fileID: 2142686115215515799} - component: {fileID: 2142686115215515798} - component: {fileID: 2829506254029656376} + - component: {fileID: 1996081109} + - component: {fileID: 1996081110} m_Layer: 5 m_Name: RawImage m_TagString: onFoot @@ -28,7 +30,7 @@ RectTransform: m_GameObject: {fileID: 2142686115215515793} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 1, y: -1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -53,7 +55,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2142686115215515793} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: -98529514, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: @@ -83,8 +85,39 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0a7db5ab031d8b640914e599456b9b21, type: 3} m_Name: m_EditorClassIdentifier: - totalTime: 0.5 id: 0 - tuio_event: {fileID: 0} - fade_speed: 0.02 + fade_speed: 0.05 stat: 0 +--- !u!114 &1996081109 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2142686115215515793} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 03dae28dfe6734f4eb76c922ac72dd34, type: 3} + m_Name: + m_EditorClassIdentifier: + target: 0 + materials: [] + attributeName: + targetObject: {fileID: 2142686115215515793} +--- !u!114 &1996081110 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2142686115215515793} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 10f07b3f9fb96524db93eb42d89c229c, type: 3} + m_Name: + m_EditorClassIdentifier: + VideoAsset: {fileID: 11400000, guid: 232980c200b699741a54e99e165d86a2, type: 2} + LoadOnAwake: 1 + PlayOnStart: 1 + Looping: 1 + AudioVolume: 0 diff --git a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity index fda58ba..a8407bd 100644 --- a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity +++ b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity @@ -202,7 +202,7 @@ Transform: m_LocalScale: {x: 2.585, y: 1, z: 1.2} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} --- !u!1 &299496350 GameObject: @@ -294,153 +294,8 @@ Transform: m_LocalScale: {x: 2.585, y: 1, z: 1.2} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &490275147 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 798465533} - m_Modifications: - - target: {fileID: 2142686115215515793, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_Name - value: RawImage - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515793, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_SizeDelta.x - value: 300 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_SizeDelta.y - value: 300 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_AnchorMin.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_AnchorMin.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_AnchorMax.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_AnchorMax.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: m_LocalScale.y - value: -1 - objectReference: {fileID: 0} - - target: {fileID: 2829506254029656376, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: tuio_event - value: - objectReference: {fileID: 914806966} - - target: {fileID: 2829506254029656376, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - propertyPath: fade_speed - value: 0.05 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 8bbc036a3be21954681613cbe4f0e9a8, type: 3} ---- !u!224 &490275148 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 2142686115215515796, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - m_PrefabInstance: {fileID: 490275147} - m_PrefabAsset: {fileID: 0} --- !u!1 &503604495 GameObject: m_ObjectHideFlags: 0 @@ -471,7 +326,7 @@ RectTransform: m_LocalScale: {x: 1, y: -1, z: 1} m_Children: [] m_Father: {fileID: 798465533} - m_RootOrder: 1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -552,7 +407,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4472652550524646, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3} propertyPath: m_RootOrder - value: 8 + value: 9 objectReference: {fileID: 0} - target: {fileID: 4472652550524646, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -690,7 +545,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -764,7 +619,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} --- !u!1 &797223803 GameObject: @@ -796,7 +651,7 @@ RectTransform: m_LocalScale: {x: 1, y: -1, z: 1} m_Children: [] m_Father: {fileID: 798465533} - m_RootOrder: 2 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -926,30 +781,17 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - - {fileID: 490275148} - {fileID: 503604496} - {fileID: 797223804} - {fileID: 1959362813} m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} ---- !u!114 &846725642 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 114218046520840180, guid: 1f68bf7cec2600e49a46d2f0554453c8, - type: 3} - m_PrefabInstance: {fileID: 513889829} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cdf0798800151dc4e813b97f862d3d10, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &914806964 GameObject: m_ObjectHideFlags: 0 @@ -979,7 +821,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 9 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &914806966 MonoBehaviour: @@ -993,10 +835,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e7eda42473bde25468ccb55d2b565cf9, type: 3} m_Name: m_EditorClassIdentifier: - img: {fileID: 1996081105} - canvas: {fileID: 798465529} - tuio_input: {fileID: 846725642} - isLocked: 0 + img: {fileID: 2142686115215515793, guid: 8bbc036a3be21954681613cbe4f0e9a8, type: 3} + canvas: {fileID: 798465533} --- !u!1 &963194225 GameObject: m_ObjectHideFlags: 0 @@ -1078,7 +918,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &963194229 MonoBehaviour: @@ -1165,7 +1005,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1203,7 +1043,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 798465533} - m_RootOrder: 3 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1259,45 +1099,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1959362812} m_CullTransparentMesh: 0 ---- !u!1 &1996081105 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 2142686115215515793, guid: 8bbc036a3be21954681613cbe4f0e9a8, - type: 3} - m_PrefabInstance: {fileID: 490275147} - m_PrefabAsset: {fileID: 0} ---- !u!114 &1996081109 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1996081105} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 03dae28dfe6734f4eb76c922ac72dd34, type: 3} - m_Name: - m_EditorClassIdentifier: - target: 0 - materials: [] - attributeName: - targetObject: {fileID: 1996081105} ---- !u!114 &1996081110 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1996081105} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 10f07b3f9fb96524db93eb42d89c229c, type: 3} - m_Name: - m_EditorClassIdentifier: - VideoAsset: {fileID: 11400000, guid: 232980c200b699741a54e99e165d86a2, type: 2} - LoadOnAwake: 1 - PlayOnStart: 1 - Looping: 1 - AudioVolume: 0 --- !u!1 &2044104306 GameObject: m_ObjectHideFlags: 0 @@ -1378,5 +1179,5 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs index 6e1149c..ba8738e 100644 --- a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs +++ b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/movieController.cs @@ -7,95 +7,93 @@ using UltraCombos; public class movieController : MonoBehaviour { - //[RequireComponent(typeof(DShowMoviePlayer))] DShowMoviePlayer player; public int id; - public tuio_event tuio_event; + //public tuio_event tuio_event; public float fade_speed = 0.02f; public int stat; float c; - Vector2 pos, pre_pos; - bool first_time = false; + //Vector2 pos, pre_pos; + //public Transform trans; void Awake() { player = GetComponent(); + //trans = GetComponent(); } void Start() { //player = GetComponent(); GetComponent().color = Color.clear; - pos = Vector2.zero; + //pos = Vector2.zero; } // Update is called once per frame void Update() { +#if false + transform.gameObject.SetActive(true); + + trans = GetComponent(); //Debug.Log(stat); pre_pos = pos; - if (name == "RawImage") - { - GetComponent().enabled = false; - } - else - { - GetComponent().enabled = true; - } - - bool _isLocked = tuio_event.isLocked; - if (tuio_event.tuio_input.touchCount > 0 && _isLocked == false && id != -1) + if (tuio_event.tuio_input.touchCount > 0 && id != -1) { transform.gameObject.SetActive(true); ////////////////////// + /// + /* int t_c = tuio_event.tuio_input.touchCount; if (id == t_c) { - id -= 1; + //id -= 1; Debug.Log("error"); } //Debug.Log("id = " + id + " / touch count = " + t_c); - if (stat == 1 && id >= 0 && id < t_c) + if (id >= 0) { pos = tuio_event.tuio_input.GetTouch(id).position; } - else if (stat == 2) + else pos = pre_pos; GetComponent().position = new Vector3(pos.x, pos.y, 0); + */ } - if(stat == 1) +#endif + if (stat == 1) { c += fade_speed; - } - else if (stat == 2) - { - c -= fade_speed; - if (c < 0f) Destroy(gameObject); - } - c = Mathf.Clamp(c, 0f, 1f); - GetComponent().color = new Color(1f, 1f, 1f, c); + if(c > 1) + { + c = 1; + stat = 2; + } + GetComponent().color = new Color(1f, 1f, 1f, c); + } + } void OnEnable() { - Debug.Log("Hi"); - stat = 1; - //c = 0f; - if (first_time == false) - { - Vector3 rot_axis = new Vector3(0, 0, 1); - Vector3 mid_pt = new Vector3(GetComponent().position.x, GetComponent().position.y, 0); - float rand_deg = Random.Range(0, 360); - //GetComponent().Rotate(rot_axis, rand_deg); + if (name != "RawImage") { + + GetComponent().enabled = true; } - first_time = true; + //Debug.Log("Hi"); + //Debug.Log(id.ToString()); + stat = 1; + c = 0f; + Vector3 rot_axis = new Vector3(0, 0, 1); + Vector3 mid_pt = new Vector3(GetComponent().position.x, GetComponent().position.y, 0); + float rand_deg = Random.Range(0, 360); + GetComponent().Rotate(rot_axis, rand_deg); } void OnDestroy() { - Debug.Log("Bye"); - player.Stop(); + //Debug.Log("Bye"); } } diff --git a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs index 5847aa7..96b730e 100644 --- a/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs +++ b/08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/tuio_event.cs @@ -4,11 +4,53 @@ using UnityEngine; public class tuio_event : MonoBehaviour { +#if true + public GameObject img; + public Transform canvas; + //public UltraCombos.GlobalMKHookInput tuio_input; + Dictionary movies = new Dictionary(); + void Update() + { + var touches = TUIOManager.Instance.touches; + foreach (var id in touches.Keys) + { + movieController movie = null; + if (movies.ContainsKey(id) == false) // Add + { + Debug.Log("Add"); + GameObject g = Instantiate(img, canvas); + g.name = id.ToString(); + movie = g.AddComponent(); + movie.id = id; + movies.Add(id, movie); + } + else //update + movie = movies[id]; + + //update or after adding + //Debug.Log("Update"); + movie.transform.position = touches[id].position; + + } + var removes = new HashSet(); + foreach (var id in movies.Keys) + { + if (touches.ContainsKey(id) == false) // remove + { + Debug.Log("Remove"); + Destroy(movies[id].gameObject); + //movies.Remove(id); + removes.Add(id); + } + } + foreach (var id in removes) + movies.Remove(id); + } +#else // Start is called before the first frame update public GameObject img; public GameObject canvas; public UltraCombos.GlobalMKHookInput tuio_input; - public bool isLocked; List cur_ids = new List(); List pre_ids = new List(); @@ -21,9 +63,9 @@ public class tuio_event : MonoBehaviour cur_count = 0; } - // Update is called once per frame void Update() { + reset_id(); pre_count = cur_count; pre_ids.Clear(); cur_ids.ForEach(i => pre_ids.Add(i)); @@ -53,22 +95,21 @@ public class tuio_event : MonoBehaviour } else if (cur_count < pre_count) // Remove { - isLocked = true; //Debug.Log("Remove"); + int exit_id; for (int i = 0; i < pre_count; i++) { int _id = pre_ids[i]; bool isExitTouch = !cur_ids.Contains(_id); if (isExitTouch) { + exit_id = _id; //GameObject.Find(_id.ToString()).GetComponent().stat = 2; Destroy(GameObject.Find(_id.ToString())); } } } reset_id(); - isLocked = false; - Debug.Log(GameObject.Find("RawImage").GetComponent().id); } void reset_id() @@ -78,6 +119,8 @@ public class tuio_event : MonoBehaviour for (int i = 0; i < objs.Length; i++) { objs[i].GetComponent().id = i - 1; + Debug.Log(objs[i].name + " / id = " + objs[i].GetComponent().id.ToString()); } } +#endif }