// ------------- public SystemTouch(TouchControlPanel panel) { //this.panel = panel; this.touch = new TouchObject(); this.hwId = 0; this.elapsedSinceLastAction = 0; }
// ------------------------- override protected void Awake() { base.Awake(); this.panel = this.GetComponent <TouchControlPanel>(); #if UNITY_EDITOR int eventSysPresence = ControlFreak2Editor.TouchControlWizardUtils.IsThereEventSystemInTheScene(); if (eventSysPresence == 0) { Debug.LogWarning("There's no event system in the scene! If this is not intentional, create one to be able to use CF2 Touch Controls..."); } #endif }
// ------------------------- override protected void Awake() { base.Awake(); this.panel = this.GetComponent <TouchControlPanel>(); #if UNITY_EDITOR int eventSysPresence = ControlFreak2Editor.TouchControlWizardUtils.IsThereEventSystemInTheScene(); if (eventSysPresence == 0) { Debug.LogWarning("There's no event system in the scene!"); } // else if (eventSysPresence < 0) // Debug.LogWarning("There's a event system in the scene, but it doesn't have CF Gamepad Input Module attached!"); #endif }
/** \endcond */ // ----------------------- //! Invalidate Hierarchy after parent change. // ------------------------ virtual public void InvalidateHierarchy() { InputRig newRig = null; TouchControlPanel newPanel = null; Canvas newCanvas = null; // TODO : check IsDestroyed()!!! for (Transform node = this.transform.parent; node != null; node = node.parent) { TouchControlPanel panel = node.GetComponent <TouchControlPanel>(); InputRig rig = node.GetComponent <InputRig>(); Canvas canv = node.GetComponent <Canvas>(); if ((newPanel == null) && (panel != null)) { newPanel = panel; } if ((newRig == null) && (rig != null)) { newRig = rig; } if ((newCanvas == null) && (canv != null)) { newCanvas = canv; } if ((newRig != null) && (newPanel != null) && (newCanvas != null)) { break; } } this.canvas = newCanvas; if (this.rig != newRig) { this.SetRig(newRig); } if (this.panel != newPanel) { this.SetTouchControlPanel(newPanel); } }
// --------------------- public void SetTouchControlPanel(TouchControlPanel panel) { if (this.panel == panel) { return; } if (this.panel != null) { this.panel.RemoveControl(this); } if ((panel != null) && !panel.CanBeUsed()) { panel = null; } this.panel = panel; if (this.panel != null) { this.panel.AddControl(this); } }