Esempio n. 1
0
        private void OnRemoveMission(object sender, ItemRemovingEventArgs args)
        {
            GenericClassListAdaptor <Mission> listAdaptor = args.adaptor as GenericClassListAdaptor <Mission>;
            Mission mission = listAdaptor[args.itemIndex];

            if (listAdaptor != null)
            {
                if (EditorUtility.DisplayDialog("Confirm to delete",
                                                "Confirm to delete mission [" + mission.ID + "]?", "OK", "Cancel"))
                {
                    args.Cancel = false;
                    GameKit.Config.UpdateMapsAndTree();
                    GameKitEditorWindow.GetInstance().Repaint();

                    MissionTreeExplorer missionTreeExplorer = GameKitEditorWindow.GetInstance().GetTreeExplorer(
                        GameKitEditorWindow.TabType.Missions) as MissionTreeExplorer;
                    if (missionTreeExplorer.CurrentSelectedItem == mission)
                    {
                        missionTreeExplorer.SelectItem(null);
                    }
                }
                else
                {
                    args.Cancel = true;
                }
            }
        }
Esempio n. 2
0
        protected override void DoOnExplorerSelectionChange(IItem item)
        {
            World world = item as World;

            if (world == null)
            {
                return;
            }

            _gateView.UpdateDisplayItem(world.Gate);

            world.RefreshSubWorlds();
            _subWorldListAdaptor = new GenericClassListAdaptor <World>(world.SubWorlds, 20,
                                                                       () => { return(new World()); },
                                                                       (position, theItem, index) =>
            {
                var size = GUI.skin.GetStyle("label").CalcSize(new GUIContent(theItem.ID));
                GUI.Label(new Rect(position.x, position.y, size.x, position.height), theItem.ID);
                if (GUI.Button(new Rect(position.x + size.x + 10, position.y, 50, position.height), "Edit"))
                {
                    _treeExplorer.SelectItem(theItem);
                }
                return(theItem);
            });
            _scoreListAdaptor = new GenericClassListAdaptor <Score>(world.Scores, 20,
                                                                    () => { return(new Score()); },
                                                                    (position, theItem, index) =>
            {
                var size = GUI.skin.GetStyle("label").CalcSize(new GUIContent(theItem.ID));
                GUI.Label(new Rect(position.x, position.y, size.x, position.height), theItem.ID);
                if (GUI.Button(new Rect(position.x + size.x + 10, position.y, 50, position.height), "Edit"))
                {
                    ScoreTreeExplorer scoreTreeExplorer = (GameKitEditorWindow.GetInstance().GetTreeExplorer(
                                                               GameKitEditorWindow.TabType.Scores) as ScoreTreeExplorer);
                    GameKitEditorWindow.GetInstance().SelectTab(GameKitEditorWindow.TabType.Scores);
                    scoreTreeExplorer.SelectItem(theItem);
                }
                return(theItem);
            });
            _missionListAdaptor = new GenericClassListAdaptor <Mission>(world.Missions, 20,
                                                                        () => { return(new Mission()); },
                                                                        (position, theItem, index) =>
            {
                var size = GUI.skin.GetStyle("label").CalcSize(new GUIContent(theItem.ID));
                GUI.Label(new Rect(position.x, position.y, size.x, position.height), theItem.ID);
                if (GUI.Button(new Rect(position.x + size.x + 10, position.y, 50, position.height), "Edit"))
                {
                    MissionTreeExplorer missionTreeExplorer = (GameKitEditorWindow.GetInstance().GetTreeExplorer(
                                                                   GameKitEditorWindow.TabType.Missions) as MissionTreeExplorer);
                    GameKitEditorWindow.GetInstance().SelectTab(GameKitEditorWindow.TabType.Missions);
                    missionTreeExplorer.SelectItem(theItem);
                }
                return(theItem);
            });
        }