public static SkillJoyStick Get(GameObject go) { SkillJoyStick skill = go.GetComponent <SkillJoyStick>(); if (skill == null) { skill = go.AddComponent <SkillJoyStick>(); } return(skill); }
public override void Init() { base.Init(); GameObject move = m_root.FindChild("panel/dynamic/move").gameObject; m_move = MoveJoyStick.Get(move); m_SkillBtn = new SkillJoyStick[5]; Transform skillParent = m_root.FindChild("panel/dynamic/skill"); for (int i = 0; i < skillParent.childCount; i++) { GameObject go = skillParent.FindChild(i.ToString()).gameObject; m_SkillBtn[i] = SkillJoyStick.Get(go); m_SkillBtn[i].Init(); } m_cancelBtn = m_root.FindChild("panel/dynamic/cancel").gameObject; m_cancelBtn.SetActiveNew(false); }