예제 #1
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);
            });
        }
예제 #2
0
        private void OnInsertSubworld(object sender, ItemInsertedEventArgs args)
        {
            GenericClassListAdaptor <World> listAdaptor = args.adaptor as GenericClassListAdaptor <World>;
            World world = listAdaptor[args.itemIndex];

            (_currentDisplayItem as World).SubWorldsID.Add(world.ID);
            GameKit.Config.Worlds.Add(world);
            GameKit.Config.UpdateMapsAndTree();
            (_treeExplorer as WorldTreeExplorer).AddWorld(world);
            ScoreTreeExplorer scoreTreeExplorer = (GameKitEditorWindow.GetInstance().GetTreeExplorer(
                                                       GameKitEditorWindow.TabType.Scores) as ScoreTreeExplorer);

            scoreTreeExplorer.AddWorld(world);
        }
예제 #3
0
        private void OnRemoveScore(object sender, ItemRemovingEventArgs args)
        {
            GenericClassListAdaptor <Score> listAdaptor = args.adaptor as GenericClassListAdaptor <Score>;
            Score score = listAdaptor[args.itemIndex];

            if (listAdaptor != null)
            {
                ScorePropertyInspector scoreInspector = GameKitEditorWindow.GetInstance().GetPropertyInsepctor(
                    GameKitEditorWindow.TabType.Scores) as ScorePropertyInspector;
                IItem[] items = scoreInspector.GetAffectedItems(score.ID);
                if (items.Length > 0)
                {
                    EditorUtility.DisplayDialog("Warning", "Not allowed to delete becase the item is still used by following items: " +
                                                scoreInspector.GetAffectedItemsWarningString(items), "OK");
                    args.Cancel = true;
                }
                else
                {
                    if (EditorUtility.DisplayDialog("Confirm to delete",
                                                    "Confirm to delete score [" + score.ID + "]?", "OK", "Cancel"))
                    {
                        args.Cancel = false;
                        GameKit.Config.UpdateMapsAndTree();
                        GameKitEditorWindow.GetInstance().Repaint();

                        ScoreTreeExplorer scoreTreeExplorer = GameKitEditorWindow.GetInstance().GetTreeExplorer(
                            GameKitEditorWindow.TabType.Scores) as ScoreTreeExplorer;
                        if (scoreTreeExplorer.CurrentSelectedItem == score)
                        {
                            scoreTreeExplorer.SelectItem(null);
                        }
                    }
                    else
                    {
                        args.Cancel = true;
                    }
                }
            }
        }
예제 #4
0
        private void OnRemoveSubworld(object sender, ItemRemovingEventArgs args)
        {
            GenericClassListAdaptor <World> listAdaptor = args.adaptor as GenericClassListAdaptor <World>;
            World world = listAdaptor[args.itemIndex];

            if (listAdaptor != null)
            {
                IItem[] items = GetAffectedItems(world.ID);
                if (items.Length > 0)
                {
                    EditorUtility.DisplayDialog("Warning", "Not allowed to delete becase the item is still used by following items: " +
                                                GetAffectedItemsWarningString(items), "OK");
                    args.Cancel = true;
                }
                else
                {
                    if (EditorUtility.DisplayDialog("Confirm to delete",
                                                    "Confirm to delete world [" + world.ID + "]?", "OK", "Cancel"))
                    {
                        args.Cancel = false;

                        (_currentDisplayItem as World).SubWorldsID.Remove(world.ID);
                        RemoveSubWorldAndSubGateRecursivity(world);

                        (_treeExplorer as WorldTreeExplorer).RemoveWorld(world);
                        ScoreTreeExplorer scoreTreeExplorer = (GameKitEditorWindow.GetInstance().GetTreeExplorer(
                                                                   GameKitEditorWindow.TabType.Scores) as ScoreTreeExplorer);
                        scoreTreeExplorer.RemoveWorld(world);
                        GameKit.Config.UpdateMapsAndTree();
                        GameKitEditorWindow.GetInstance().Repaint();
                    }
                    else
                    {
                        args.Cancel = true;
                    }
                }
            }
        }
예제 #5
0
 public ScorePropertyInspector(ScoreTreeExplorer treeExplorer)
     : base(treeExplorer)
 {
 }