public void previewSelected(SimObject preview)
        {
            GuiTextListCtrl CL_levelList = "CL_levelList";
            if (preview.isObject() && preview["levelIndex"] != "")
                CL_levelList.setSelectedRow(preview["levelIndex"].AsInt());
            else
                CL_levelList.setSelectedRow(-1);

            // Set the large preview image
            if (preview.isObject() && preview["bitmap"] != "")
                ((GuiBitmapCtrl) this.findObjectByInternalName("CurrentPreview", false)).setBitmapX(preview["bitmap"]);
            else
                ((GuiBitmapCtrl) this.findObjectByInternalName("CurrentPreview", false)).setBitmapX("art/gui/no-preview");

            // Set the current level name
            if (preview.isObject() && preview["levelName"] != "")
                ((GuiTextCtrl) this.findObjectByInternalName("LevelName", false)).setText(preview["levelName"]);
            else
                ((GuiTextCtrl) this.findObjectByInternalName("LevelName", false)).setText("Level");

            // Set the current level description
            if (preview.isObject() && preview["levelDesc"] != "")
                ((GuiMLTextCtrl) this.findObjectByInternalName("LevelDescription", false)).setText(preview["levelDesc"]);
            else
                ((GuiMLTextCtrl) this.findObjectByInternalName("LevelDescription", false)).setText("A Torque Level");
        }
Esempio n. 2
0
        public void onUnSelect(SimObject obj)
        {
            EditorGui  EditorGui  = "EditorGui";
            Inspector  Inspector  = "Inspector";
            EditorTree EditorTree = "EditorTree";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar  = "EditorGuiStatusBar";
            ETransformSelection          ETransformSelection = "ETransformSelection";

            if (obj.isObject() && obj.isMethod("onEditorUnselect"))
            {
                obj.call("onEditorUnselect");
            }

            EditorGui.currentEditor.onObjectDeselected(obj);

            Inspector.removeInspect(obj);
            EditorTree.removeSelection(obj);

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

            EditorGuiStatusBar.setSelectionObjectsByCount(getSelectionSize().AsString());

            // Update the Transform Selection window

            ETransformSelection.onSelectionChanged();
        }
Esempio n. 3
0
        public virtual string pickCameraSpawnPoint(string spawnGroups)
        {
            SimObject spawnpoint = null;

            String[] lspawngroups = spawnGroups.Split(' ');

            foreach (SimSet group in lspawngroups)
            {
                if (!group.isObject())
                {
                    continue;
                }
                spawnpoint = group.getRandom();
                if (spawnpoint.isObject())
                {
                    return(spawnpoint);
                }
            }
            SpawnSphere DefaultCameraSpawnSphere = "DefaultCameraSpawnSphere";

            if (!DefaultCameraSpawnSphere.isObject())
            {
                ObjectCreator spawn = new ObjectCreator("SpawnSphere", "DefaultCameraSpawnSphere");
                spawn["dataBlock"]      = "SpawnSphereMarker";
                spawn["spawnClass"]     = sGlobal["$Game::DefaultCameraClass"];
                spawn["spawnDatablock"] = sGlobal["$Game::DefaultCameraDataBlock"];
                SpawnSphere spawnobj = spawn.Create();

                ((SimSet)"MissionCleanup").pushToBack(spawnobj);
            }

            return(DefaultCameraSpawnSphere);
        }
Esempio n. 4
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();
        }
Esempio n. 5
0
 public virtual bool hasHumanRider()
 {
     for (int i = 0; i < this.getNumAttachments(); i++)
     {
         SimObject remainingObj = this.getAttachment(i);
         if (remainingObj.isObject() && remainingObj["client"].isObject() && remainingObj["client.player"] == remainingObj)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 6
0
        public override void onDisabled(ShapeBase obj, string lastState)
        {
            //console.print("### AI DEAD ###!");
            Player npc = obj.ID;

            Util.cancelAll(npc);
            ScriptObject aimanager = null;

            aimanager = npc["aiManager"];
            if (!aimanager.isObject())
            {
                console.error("Bad aiManager");
                return;
            }
            npc.setImageTarget(0, false);



            SimObject item = ((SimObject)npc.getMountedImage(iGlobal["$WeaponSlot"]))["item"];

            if (item.isObject())
            {
                //string item = console.GetVarString(ShapeBase.getMountedImage(npc, WeaponSlot).AsString() + ".item");
                if (r.Next(1, 100) > 80)
                {
                    int amount = npc.getInventory(item["image.ammo"]);

                    if (amount.AsBool())
                    {
                        npc.Throw(item["image.clip"], 1);
                    }
                }
            }

            npc.tossPatch();
            npc.playDeathCry();
            npc.playDeathAnimation();
            int ctov = 2000;

            if (AI.lastcount > 0)
            {
                AI.spawnAI(aimanager);
            }

            npc.schedule((ctov - 1000).AsString(), "startFade", "1000", "0", "true");
            Util._schedule("1", "0", "SafeDeleteCallback", npc);
        }
Esempio n. 7
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"]);
            }
        }
            public void inspect(SimObject obj)
            {
                GuiMLTextCtrl MissionAreaFieldInfoControl = "MissionAreaFieldInfoControl";
                string name = "";
                if (obj.isObject())
                    name = obj.getName();
                else
                    MissionAreaFieldInfoControl.setText("");

                //RiverInspectorNameEdit.setValue( %name );
                base.inspect(obj);
            }
Esempio n. 10
0
        public void onUnSelect(SimObject obj)
        {
            EditorGui EditorGui = "EditorGui";
            Inspector Inspector = "Inspector";
            EditorTree EditorTree = "EditorTree";
            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            ETransformSelection ETransformSelection = "ETransformSelection";

            if (obj.isObject() && obj.isMethod("onEditorUnselect"))
                obj.call("onEditorUnselect");

            EditorGui.currentEditor.onObjectDeselected(obj);

            Inspector.removeInspect(obj);
            EditorTree.removeSelection(obj);

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

            EditorGuiStatusBar.setSelectionObjectsByCount(getSelectionSize().AsString());

            // Update the Transform Selection window

            ETransformSelection.onSelectionChanged();
        }
Esempio n. 11
0
            public void inspect(SimObject obj)
            {
                string name = "";
                if (obj.isObject())
                    name = obj.getName();
                else
                    ((GuiMLTextCtrl) "RoadFieldInfoControl").setText("");

                //RoadInspectorNameEdit.setValue( %name );
                base.inspect(obj);
            }
        public void deleteMaterial(SimObject materialName, ArrayObject secondFilter, string secondFilterName)
        {
            ArrayObject MaterialFilterAllArray = "MaterialFilterAllArray";
            ArrayObject UnlistedMaterials = "UnlistedMaterials";
            PersistenceManager MaterialSelectorPerMan = "MaterialSelectorPerMan";
            GuiCheckBoxCtrl MaterialFilterAllArrayCheckbox = "MaterialFilterAllArrayCheckbox";

            GuiDynamicCtrlArrayControl filterArray = this.FOT("filterArray");

            if (!materialName.isObject())
                return;

            for (int i = 0; i <= MaterialFilterAllArray.countValue(materialName); i++)
                {
                int index = MaterialFilterAllArray.getIndexFromValue(materialName);
                MaterialFilterAllArray.erase(index);
                }
            MaterialFilterAllArrayCheckbox.setText("All ( " + (MaterialFilterAllArray.count() - 1) + " ) ");

            GuiCheckBoxCtrl checkbox = secondFilter + "Checkbox";
            for (int k = 0; k <= secondFilter.countValue(materialName); k++)
                {
                int index = secondFilter.getIndexFromValue(materialName);
                secondFilter.erase(index);
                }

            checkbox.setText(secondFilterName + " ( " + (secondFilter.count() - 1) + " ) ");

            for (int i = 0; materialName.getFieldValue("materialTag" + i, -1) != ""; i++)
                {
                string materialTag = materialName.getFieldValue("materialTag" + i, -1);

                for (uint j = (uint) this.staticFilterObjects; j < filterArray.getCount(); j++)
                    {
                    if (materialTag == ((SimObject) ((SimSet) filterArray.getObject(j)).getObject(0))["filter"])
                        {
                        int count = Util.getWord(((GuiCheckBoxCtrl) ((SimSet) filterArray.getObject(j)).getObject(0)).getText(), 2).AsInt();
                        count--;
                        ((GuiCheckBoxCtrl) ((SimSet) filterArray.getObject(j)).getObject(0)).setText(materialTag + " ( " + count + " )");
                        }
                    }
                }

            UnlistedMaterials.add("unlistedMaterials", materialName);

            if (materialName.getFilename() != "" && materialName.getFilename() != "tools/gui/MaterialSelector.ed.gui" && materialName.getFilename() != "tools/materialEditor/scripts/materialEditor.ed.cs")
                {
                MaterialSelectorPerMan.removeObjectFromFile(materialName);
                MaterialSelectorPerMan.saveDirty();
                }

            this.preloadFilter();
            //MaterialSelector.selectMaterial( "WarningMaterial" );
        }
Esempio n. 13
0
            public void inspect(SimObject obj)
            {
                string className = "";
                if (obj.isObject())
                    className = obj.getClassName();

                this["showObjectName"] = false.AsString();
                this["showCustomFields"] = false.AsString();

                switch (className)
                    {
                        case "ForestBrush":
                            this["groupFilters"] = "+NOTHING,-Ungrouped";
                            break;

                        case "ForestBrushElement":
                            this["groupFilters"] = "+ForestBrushElement,-Ungrouped";
                            break;

                        case "TSForestItemData":
                            this["groupFilters"] = "+Media,+Wind";
                            break;

                        default:
                            this["groupFilters"] = "";
                            break;
                    }

                base.inspect(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();
            }
Esempio n. 15
0
            public void onObjectCreated(SimObject objId)
            {
                EditorTree EditorTree = "EditorTree";
                EWorldEditor EWorldEditor = "EWorldEditor";

                // Can we submit an undo action?
                if (objId.isObject())
                    Extendable.MECreateUndoAction.submit(objId);

                EditorTree.clearSelection();
                EWorldEditor.clearSelection();
                EWorldEditor.selectObject(objId);

                // When we drop the selection don't store undo
                // state for it... the creation deals with it.
                EWorldEditor.dropSelection(true);
            }