Beispiel #1
0
        public override void onDeactivated()
        {
            ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            ForestEditorGui.ForestEditorPalleteWindow    ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";
            ForestEditorGui    ForestEditorGui   = "ForestEditorGui";
            PersistenceManager ForestDataManager = "ForestDataManager";

            //Copyright Winterleaf Entertainment L.L.C. 2013
            if (!this["isActive"].AsBool())
            {
                return;
            }
            this["isActive"] = false.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            ForestEditorGui.setVisible(false);
            ForestEditorPalleteWindow.setVisible(false);
            ForestEditorPropertiesWindow.setVisible(false);

            SimObject tool = ForestEditorGui.getActiveTool();

            if (tool.isObject())
            {
                tool.call("onDeactivated");
            }

            // Also take this opportunity to save.
            ForestDataManager.saveDirty();

            this.map.pop();

            base.onDeactivated();
        }
Beispiel #2
0
        public override void onActivated()
        {
            EditorGui       EditorGui       = "EditorGui";
            ForestEditorGui ForestEditorGui = "ForestEditorGui";

            ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            ForestEditorGui.ForestEditorPalleteWindow    ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";
            ForestEditorGui.ForestEditMeshTree           ForestEditMeshTree           = "ForestEditMeshTree";
            ForestEditorGui.ForestEditBrushTree          ForestEditBrushTree          = "ForestEditBrushTree";
            ForestEditorGui.ForestEditTabBook            ForestEditTabBook            = "ForestEditTabBook";
            SimGroup     ForestBrushGroup   = "ForestBrushGroup";
            SimSet       ForestItemDataSet  = "ForestItemDataSet";
            SimSet       ForestTools        = "ForestTools";
            GizmoProfile GlobalGizmoProfile = "GlobalGizmoProfile";

            GuiBitmapButtonCtrl ForestEditorPaintModeBtn         = "ForestEditorPaintModeBtn";
            GuiBitmapButtonCtrl ForestEditorSelectModeBtn        = "ForestEditorSelectModeBtn";
            GuiBitmapButtonCtrl ForestEditorMoveModeBtn          = "ForestEditorMoveModeBtn";
            GuiBitmapButtonCtrl ForestEditorRotateModeBtn        = "ForestEditorRotateModeBtn";
            GuiBitmapButtonCtrl ForestEditorScaleModeBtn         = "ForestEditorScaleModeBtn";
            GuiBitmapButtonCtrl ForestEditorEraseModeBtn         = "ForestEditorEraseModeBtn";
            GuiBitmapButtonCtrl ForestEditorEraseSelectedModeBtn = "ForestEditorEraseSelectedModeBtn";
            GuiBitmapButtonCtrl ForestEditorDropToGroundModeBtn  = "ForestEditorDropToGroundModeBtn";

            ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool");
            ForestBrushTool     BrushTool     = ForestTools.FOF("BrushTool");

            string mode;

            //Copyright Winterleaf Entertainment L.L.C. 2013
            this["isActive"] = true.AsString();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            EditorGui.bringToFront(ForestEditorGui);
            ForestEditorGui.setVisible(true);
            ForestEditorPalleteWindow.setVisible(true);
            ForestEditorPropertiesWindow.setVisible(true);
            ForestEditorGui.makeFirstResponder(true);
            //ForestEditToolbar.setVisible( true );

            this.map.push();
            base.onActivated();

            ForestEditBrushTree.open(ForestBrushGroup);
            ForestEditMeshTree.open(ForestItemDataSet);

            // Open the Brush tab.
            ForestEditTabBook.selectPage(0);

            // Sync the pallete button state

            // And toolbar.
            SimObject tool = ForestEditorGui.getActiveTool();

            if (tool.isObject())
            {
                tool.call("onActivated");
            }

            if (!tool.isObject())
            {
                ForestEditorPaintModeBtn.performClick();

                if (ForestEditBrushTree.getItemCount() > 0)
                {
                    ForestEditBrushTree.selectItem(0, true);
                }
            }
            else if (tool == SelectionTool)
            {
                mode = GlobalGizmoProfile["mode"];
                switch (mode)
                {
                case "None":
                    ForestEditorSelectModeBtn.performClick();
                    break;

                case "Move":
                    ForestEditorMoveModeBtn.performClick();
                    break;

                case "Rotate":
                    ForestEditorRotateModeBtn.performClick();
                    break;

                case "Scale":
                    ForestEditorScaleModeBtn.performClick();
                    break;
                }
            }
            else if (tool == BrushTool)
            {
                mode = BrushTool["mode"];
                switch (mode)
                {
                case "Paint":
                    ForestEditorPaintModeBtn.performClick();
                    break;

                case "Erase":
                    ForestEditorEraseModeBtn.performClick();
                    break;

                case "EraseSelected":
                    ForestEditorEraseSelectedModeBtn.performClick();
                    break;

                case "DropToGround":
                    ForestEditorDropToGroundModeBtn.performClick();
                    break;
                }
            }

            if (this["showError"].AsBool())
            {
                messageBox.MessageBoxOK("Error",
                                        "Your art/forest folder does not contain a valid brushes.cs. Brushes you create will not be saved!");
            }
        }