protected void updateView() { this.removeAllChildren(); if (vo.isEmpty) { return; } updateEventConnectionUI(); ISkillEvent skillEvent = vo.evt; EditorToggleGroup box; box = new EditorToggleGroup(); box.data = skillEvent; box.addEventListener(EventX.CHANGE, toggleHandle); box.addEventListener(EventX.REPAINT, itemRepaintHandle); Type type; if (eventMaping.TryGetValue(skillEvent.GetType(), out type)) { IEventUI ui = Activator.CreateInstance(type) as IEventUI; box.label = ui.label; box.toggle = skillEvent.enabled; ui.createUI(skillEvent, box); } EditorButton btn = new EditorButton("delete"); btn.style = EditorStyles.miniButton; btn.data = skillEvent; btn.addEventListener(EventX.ITEM_CLICK, deleteHandle); box.addChild(btn); this.addChild(box); }
private void toggleHandle(EventX e) { EditorToggleGroup eui = e.target as EditorToggleGroup; ISkillEvent skilEvent = eui.data as ISkillEvent; bool b = EditorUtility.DisplayDialog("提示", "确定要更改状态", "是", "否"); if (b) { skilEvent.enabled = eui.toggle; } else { eui.toggle = skilEvent.enabled; } }