void CreateRoleUI() { if (m_createRolePanel != null) { Destroy(m_createRolePanel.gameObject); m_createRolePanel = null; } if (m_selectRoleData._VocationID == 1) { m_createRolePanel = CreatObjectToNGUI.InstantiateObj(CreateRoleRightUI, transform).GetComponent <CreateRolePanelV4>(); } else { m_createRolePanel = CreatObjectToNGUI.InstantiateObj(CreateRoleLeftUI, transform).GetComponent <CreateRolePanelV4>(); } if (m_createRolePanel != null) { m_createRolePanel.InitData(m_selectRoleData); } }
public override void Close() { if (m_createRolePanel != null) { Destroy(m_createRolePanel.gameObject); m_createRolePanel = null; } if (m_continueNextTips != null) { m_continueNextTips.SetActive(false); } foreach (var item in m_heroList.Keys) { if (OnDoAction != null) { OnDoAction(RoleState.Init, item); } } BackButton.gameObject.SetActive(false); }
void SelectRole(object obj) { var vocation = (int)obj; BreakRoleEvent(); for (int i = 0; i < m_createRoleData.Count; i++) { if (m_createRoleData[i]._VocationID == vocation) { m_selectRoleData = m_createRoleData[i]; } } if (m_createRolePanel != null) { Destroy(m_createRolePanel.gameObject); m_createRolePanel = null; } for (int i = 0; i < m_curRoleEffectList.Count; i++) { if (m_curRoleEffectList[i] != null) { Destroy(m_curRoleEffectList[i]); } } m_curRoleEffectList.Clear(); CancelInvoke(); Invoke("CreateRoleUI", m_selectRoleData._UIDelayTime); m_eventList.Clear(); GameObject.Destroy(m_continueNextTips); for (int i = 0; i < m_selectRoleData._AnimList.Length; i++) { RoleEvent evt = new RoleEvent(); evt.Type = RoleEventType.PlayAnim; evt.m_handled = true; evt.EventTimeAfterLaunch = 0.0f; evt.Param = i; m_eventList.Add(evt); } RoleEvent evt1 = new RoleEvent(); evt1.Type = RoleEventType.PlaySoundEffect; evt1.m_handled = true; evt1.Param = m_selectRoleData._SoundEffectList.Length == 0 ? 0 : Random.Range(0, m_selectRoleData._SoundEffectList.Length); evt1.EventTimeAfterLaunch = 0; m_eventList.Add(evt1); for (int i = 0; i < m_selectRoleData._EffectDelayTime.Length; i++) { RoleEvent evt = new RoleEvent(); evt.Type = RoleEventType.PlayEffect; evt.m_handled = true; evt.Param = i; evt.EventTimeAfterLaunch = m_selectRoleData._EffectDelayTime[i] * 0.001f; m_eventList.Add(evt); } m_onSelect = true; }