void UnbindEvent() { if (uiObjSet != null) { uiObjSet.onInstructorClicked -= SetInstructor; uiObjSet.onTraineeClicked -= SetTrainee; uiObjSet.onLabelChanged -= SetCount; } if (uiObjTrain != null) { uiObjTrain.OnStartTrainingEvent -= OnStartTraining; uiObjTrain.OnStopTrainingEvent -= OnStopTraining; } uiObjSet = null; uiObjTrain = null; }
void BindEvent() { if (uiObjSet == null && GameUI.Instance != null && GameUI.Instance.mCSUI_MainWndCtrl != null && GameUI.Instance.mCSUI_MainWndCtrl.PersonnelUI != null && GameUI.Instance.mCSUI_MainWndCtrl.PersonnelUI.m_NpcInstructor != null && GameUI.Instance.mCSUI_MainWndCtrl.TrainUI) { uiObjSet = GameUI.Instance.mCSUI_MainWndCtrl.PersonnelUI.m_NpcInstructor; uiObjSet.onInstructorClicked += SetInstructor; uiObjSet.onTraineeClicked += SetTrainee; uiObjSet.onLabelChanged += SetCount; uiObjTrain = GameUI.Instance.mCSUI_MainWndCtrl.TrainUI; uiObjTrain.OnStartTrainingEvent += OnStartTraining; uiObjTrain.OnStopTrainingEvent += OnStopTraining; } }