Пример #1
0
        public void onSelect(SimObject obj)
        {
            EditorTree EditorTree = "EditorTree";
            EditorTree.addSelection(obj, true);
            Util.setShadowVizLight(obj);
            if (obj.isObject() && obj.isMethod("onEditorSelect"))
                obj.call("onEditorSelect", getSelectionSize().AsString());

            EditorGui EditorGui = "EditorGui";
            EditorGui.currentEditor.onObjectSelected(obj);

            // Inform the camera

            console.commandToServer("EditorOrbitCameraSelectChange", new string[] {getSelectionSize().AsString(), getSelectionCentroid().AsString()});

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            EditorGuiStatusBar.setSelectionObjectsByCount(getSelectionSize().AsString());

            // Update the materialEditorList

            iGlobal["$Tools::materialEditorList"] = obj.getId();

            // Used to help the Material Editor( the M.E doesn't utilize its own TS control )
            // so this dirty extension is used to fake it, just like the women I use to date...
            GuiWindowCollapseCtrl womanIUseToDate = "MaterialEditorPreviewWindow";
            GuiControl theOtherTramp = "MaterialEditorGui";
            if (womanIUseToDate.isVisible())
                theOtherTramp.call("prepareActiveObject");

            // Update the Transform Selection window

            ETransformSelection ETransformSelection = "ETransformSelection";
            ETransformSelection.onSelectionChanged();
        }
Пример #2
0
        public void onSelect(SimObject obj)
        {
            EditorTree EditorTree = "EditorTree";

            EditorTree.addSelection(obj, true);
            Util.setShadowVizLight(obj);
            if (obj.isObject() && obj.isMethod("onEditorSelect"))
            {
                obj.call("onEditorSelect", getSelectionSize().AsString());
            }


            EditorGui EditorGui = "EditorGui";

            EditorGui.currentEditor.onObjectSelected(obj);

            // Inform the camera

            console.commandToServer("EditorOrbitCameraSelectChange",
                                    new string[] { getSelectionSize().AsString(), getSelectionCentroid().AsString() });

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            EditorGuiStatusBar.setSelectionObjectsByCount(getSelectionSize().AsString());

            // Update the materialEditorList

            iGlobal["$Tools::materialEditorList"] = obj.getId();

            // Used to help the Material Editor( the M.E doesn't utilize its own TS control )
            // so this dirty extension is used to fake it, just like the women I use to date...
            GuiWindowCollapseCtrl womanIUseToDate = "MaterialEditorPreviewWindow";
            GuiControl            theOtherTramp   = "MaterialEditorGui";

            if (womanIUseToDate.isVisible())
            {
                theOtherTramp.call("prepareActiveObject");
            }


            // Update the Transform Selection window

            ETransformSelection ETransformSelection = "ETransformSelection";

            ETransformSelection.onSelectionChanged();
        }
        public override void onEnterTrigger(Trigger trigger, GameBase obj)
        {
            //if (!console.isMemberOfClass(obj, "Player"))
            //    return;

            if (obj["isTeleporting"].AsBool())
            {
                return;
            }
            // Get the location of our target position
            Trigger exit = trigger["exit"];

            bool valid = verifyObject(obj, trigger, exit);

            if (!valid)
            {
                return;
            }

            teleFrag(obj, exit);
            // Create our entrance effects on all clients.

            SimObject entranceeffect = trigger["entranceEffect"];

            if (entranceeffect.isObject())
            {
                foreach (GameConnection client in ClientGroup)
                {
                    if (console.isObject(client))
                    {
                        console.commandToClient(client, "PlayTeleportEffect", new[] { trigger["position"], entranceeffect.getId().AsString() });
                    }
                }
            }

            teleportPlayer(obj, exit);
            // Create our exit effects on all clients.

            SimObject exitEffect = trigger["exitEffect"];

            if (exitEffect.isObject())
            {
                foreach (GameConnection client in ClientGroup)
                {
                    if (console.isObject(client))
                    {
                        console.commandToClient(client, "PlayTeleportEffect", new[] { trigger["position"], exitEffect.getId().AsString() });
                    }
                }
            }

            // Record what time we last teleported so we can determine if enough
            // time has elapsed to teleport again
            int tolt = console.getSimTime();

            trigger["timeOfLastTeleport"] = tolt.AsString();

            // If this is a bidirectional teleporter, log it's exit too.
            if (exit["exit"] == trigger["name"])
            {
                exit["timeOfLastTeleport"] = tolt.AsString();
            }

            // Tell the client to play the 2D sound for the player that teleported.
            if (((SimObject)this["teleportSound"]).isObject() && ((GameConnection)obj["client"]).isObject())
            {
                ((GameConnection)obj["client"]).play2D(this["teleportSound"]);
                //GameConnection.play2D(obj, thisobj["teleportSound"]);
            }
        }
Пример #4
0
            public override bool handleRenameObject(string name, SimObject obj)
            {
                SimGroup ForestBrushGroup = "ForestBrushGroup";
                EWorldEditor EWorldEditor = "EWorldEditor";
                editor Editor = "Editor";

                if (name != "")
                    {
                    string found = ForestBrushGroup.findObjectByInternalName(name, false);
                    if (found.isObject() && found.getID() != obj.getId())
                        {
                        messageBox.MessageBoxOK("Error", "Brush or Element with that name already exists.", "");

                        // true as in, we handled it, don't rename the object.      
                        return true;
                        }
                    }
                // Since we aren't showing any groups whens inspecting a ForestBrushGroup
                // we can't push this event off to the inspector to handle.

                //return GuiTreeViewCtrl::handleRenameObject( this, name, obj );      

                // The instant group will try to add our
                // UndoAction if we don't disable it.   
                Util.pushInstantGroup();

                string nameOrClass = obj.getName();
                if (nameOrClass == "")
                    nameOrClass = obj.getClassName();

                ObjectCreator actionCreator = new ObjectCreator("InspectorFieldUndoAction");
                actionCreator["actionName"] = nameOrClass + "." + "internalName" + " Change";
                actionCreator["objectId"] = obj.getId().AsString();
                actionCreator["fieldName"] = "internalName";
                actionCreator["fieldValue"] = obj["internalName"];
                actionCreator["arrayIndex"] = "0";

                actionCreator["inspectorGui"] = "";

                InspectorFieldUndoAction action = actionCreator.Create();

                // Restore the instant group.
                Util.popInstantGroup();

                action.addToManager(Editor.getUndoManager());
                EWorldEditor.isDirty = true;

                return false;
            }
Пример #5
0
        public static void Inspect(SimObject obj)
        {
            GuiInspector InspectFields = "InspectFields";
            GuiTextEditCtrl InspectObjectName = "InspectObjectName";
            GuiTextEditCtrl InspectObjectInternalName = "InspectObjectInternalName";
            GuiTextCtrl InspectObjectSimID = "InspectObjectSimID";

            // Don't inspect the root group.
            if (obj == -1)
                return;

            InspectFields.inspect(obj);

            // Update selected object properties
            InspectObjectName.setValue(obj.getName());
            InspectObjectInternalName.setValue(obj.getInternalName());
            InspectObjectSimID.setValue(obj.getId().AsString());

            // Store Object Reference
            InspectObjectName["refObj"] = obj;
        }
            public void loadNewParticle(SimObject particle)
            {
                GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector";
                ParticleData PE_ParticleEditor_NotDirtyParticle = "PE_ParticleEditor_NotDirtyParticle";

                if (particle.isObject())
                    particle = particle.getId().AsString();
                else
                    particle = PEP_ParticleSelector.getSelected().AsString();

                this.currParticle = particle;

                particle.call("reload");

                PE_ParticleEditor_NotDirtyParticle.assignFieldsFrom(particle);
                PE_ParticleEditor_NotDirtyParticle["originalName"] = particle.getName();

                this.guiSync();
                this.setParticleNotDirty();
            }
Пример #7
0
            public void setProfileDirty(SimObject profile, bool value, bool noCheck)
            {
                PersistenceManager GuiEditorProfilesPM = "GuiEditorProfilesPM";
                GuiEditorProfiles.GuiEditorProfilesTree GuiEditorProfilesTree = "GuiEditorProfilesTree";
                GuiEditorProfiles.GuiEditorProfileChangeManager GuiEditorProfileChangeManager = "GuiEditorProfileChangeManager";

                if (!GuiEditorProfilesPM.isObject())
                    GuiEditorProfilesPM = new ObjectCreator("PersistenceManager", "GuiEditorProfilesPM").Create();

                if (value)
                    {
                    if (!GuiEditorProfilesPM.isDirty(profile) || noCheck)
                        {
                        // If the profile hasn't yet been associated with a file,
                        // put it in the default file.

                        if (profile.getFilename() == "")
                            profile.setFilename(sGlobal["$GUI_EDITOR_DEFAULT_PROFILE_FILENAME"]);

                        // Add the profile to the dirty set.

                        GuiEditorProfilesPM.setDirty(profile);

                        // Show the item as dirty in the tree.

                        int id = GuiEditorProfilesTree.findItemByValue(profile.getId().AsString());
                        GuiEditorProfilesTree.editItem(id, GuiEditorProfilesTree.getItemText(id) + ' ' + "*", profile.getId().AsString());

                        // Count the number of unsaved profiles.  If this is
                        // the first one, indicate in the window title that
                        // we have unsaved profiles.

                        this.increaseNumDirtyProfiles();
                        }
                    }
                else
                    {
                    if (GuiEditorProfilesPM.isDirty(profile) || noCheck)
                        {
                        // Remove from dirty list.

                        GuiEditorProfilesPM.removeDirty(profile);

                        // Clear the dirty marker in the tree.

                        int id = GuiEditorProfilesTree.findItemByValue(profile.getId().AsString());
                        string text = GuiEditorProfilesTree.getItemText(id);
                        GuiEditorProfilesTree.editItem(id, Util.getSubStr(text, 0, Util.strlen(text) - 2), profile.getId().AsString());

                        // Count saved profiles.  If this was the last unsaved profile,
                        // remove the unsaved changes indicator from the window title.

                        this.decreaseNumDirtyProfiles();

                        // Remove saved edits from the change manager.

                        GuiEditorProfileChangeManager.clearEdits(profile);
                        }
                    }
            }