public static void StartSelectedDemo()
        {
            // first unit is filename
            GuiTextListCtrl RecordingsDlgList = "RecordingsDlgList";
            int sel = RecordingsDlgList.getSelectedId();
            string rowText = RecordingsDlgList.getRowTextById(sel);

            string file = omni.sGlobal["$currentMod"] + "/recordings/" + omni.Util.getField(rowText, 0) + ".rec";

            GameConnection ServerConnection = new ObjectCreator("GameConnection", "ServerConnection").Create();
            ((SimGroup) "RootGroup").add(ServerConnection);

            // Start up important client-side stuff, such as the group
            // for particle emitters.  This doesn't get launched during a demo
            // as we short circuit the whole mission loading sequence.
            mission.clientStartMission();

            if (ServerConnection.playDemo(file))
                {
                ((GuiCanvas) "canvas").setContent("PlayGui");
                ((GuiCanvas) "canvas").popDialog("RecordingsDlg");
                ServerConnection.call("prepDemoPlayback");
                }
            else
                {
                messageBox.MessageBoxOK("Playback Failed", "Demo playback failed for file '" + file + "'.", "");
                if ("ServerConnection".isObject())
                    "ServerConnection".delete();
                }
        }
        public override void onWorldEditorStartup()
        {
            EditorGui EditorGui = "EditorGui";
            base.onWorldEditorStartup();
            // Add ourselves to the window menu.

            string accel = EditorGui.addToEditorsMenu("Terrain Painter", "", this);
            // Add ourselves to the ToolsToolbar
            string tooltip = "Terrain Painter (" + accel + ")";

            EditorGui.addToToolsToolbar("TerrainPainterPlugin", "TerrainPainterPalette", Util._expandFilename("tools/worldEditor/images/toolbar/paint-terrain"), tooltip);
            ActionMap map = new ObjectCreator("ActionMap").Create();

            string keyboard = "keyboard";

            map.bindCmd(keyboard, "v", "EWTerrainPainterToolbarBrushType->ellipse.performClick();", ""); // Circle Brush
            map.bindCmd(keyboard, "b", "EWTerrainPainterToolbarBrushType->box.performClick();", ""); // Box Brush
            map.bindCmd(keyboard, "=", "TerrainPainterPlugin.keyboardModifyBrushSize(1);", ""); // +1 Brush Size
            map.bindCmd(keyboard, "+", "TerrainPainterPlugin.keyboardModifyBrushSize(1);", ""); // +1 Brush Size
            map.bindCmd(keyboard, "-", "TerrainPainterPlugin.keyboardModifyBrushSize(-1);", ""); // -1 Brush Size
            map.bindCmd(keyboard, "[", "TerrainPainterPlugin.keyboardModifyBrushSize(-5);", ""); // -5 Brush Size
            map.bindCmd(keyboard, "]", "TerrainPainterPlugin.keyboardModifyBrushSize(5);", ""); // +5 Brush Size

            for (int i = 0; i < 10; i++)
                map.bindCmd(keyboard, i.AsString(), "TerrainPainterPlugin.keyboardSetMaterial(" + (i - 1) + ");", "");

            map.bindCmd(keyboard, "0", "TerrainPainterPlugin.keyboardSetMaterial(10);", "");

            this.map = map;

            //console.Call_Classname("GuiWindowCtrl", "attach", new[] { "TerrainPainter", "TerrainPainterPreview" });
            TerrainPainter TerrainPainter = "TerrainPainter";
            TerrainPainter.attachTo("TerrainPainterPreview");
        }
Beispiel #3
0
        public static void initializeDatablockEditor()
        {
            Omni.self.Print(" % Initializing Datablock Editor");
            gui.CodeBehind.DatablockEditor.initialize();
            DatablockEditorTreeWindow.initialize();
            DatablockEditorInspectorWindow.initialize();
            DatablockEditorCreatePrompt.initialize();

            // Add ourselves to EditorGui, where all the other tools reside
            DatablockEditorInspectorWindow oDatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            oDatablockEditorInspectorWindow.setVisible(false);
            DatablockEditorTreeWindow oDatablockEditorTreeWindow = "DatablockEditorTreeWindow";
            oDatablockEditorTreeWindow.setVisible(false);
            EditorGui EditorGui = "EditorGui";
            EditorGui.add("DatablockEditorInspectorWindow");
            EditorGui.add("DatablockEditorTreeWindow");

            ObjectCreator o = new ObjectCreator("ScriptObject", "DatablockEditorPlugin", typeof (DatablockEditorPlugin));
            o["editorGui"] = "EWorldEditor";
            o.Create();
            DatablockEditorPlugin p = "DatablockEditorPlugin";

            p.initialize();
        }
Beispiel #4
0
        public static void initialize_CS()
        {
            ObjectCreator tch = new ObjectCreator("ShaderData", "AL_ShadowVisualizeShader");
            tch["DXVertexShaderFile"] = "shaders/common/guiMaterialV.hlsl";
            tch["DXPixelShaderFile"] = "shaders/common/lighting/advanced/dbgShadowVisualizeP.hlsl";

            tch["OGLVertexShaderFile"] = "shaders/common/gl/guiMaterialV.glsl";
            tch["OGLPixelShaderFile"] = "shaders/common/lighting/advanced/gl/dbgShadowVisualizeP.glsl";

            tch["pixVersion"] = 2.0;
            tch.Create();

            tch = new ObjectCreator("CustomMaterial", "AL_ShadowVisualizeMaterial");
            tch["shader"] = "AL_ShadowVisualizeShader";
            tch["stateBlock"] = "AL_DepthVisualizeState";

            tch["sampler[\"shadowMap\"]"] = "#AL_ShadowVizTexture";
            tch["sampler[\"depthViz\"]"] = "core/scripts/client/lighting/advanced/depthviz";

            tch["pixVersion"] = 2.0;
            tch.Create();

            SingletonCreator ts = new SingletonCreator("GuiControlProfile", "AL_ShadowLabelTextProfile");
            ts["fontColor"] = "0 0 0";
            ts["autoSizeWidth"] = true;
            ts["autoSizeHeight"] = true;
            ts["justify"] = "left";
            ts["fontSize"] = 14;
            ts.Create();
        }
Beispiel #5
0
        public static void initializeDecalEditor()
        {
            Omni.self.Print(" % - Initializing Decal Editor");
            omni.sGlobal["$decalDataFile"] = "art/decals/managedDecalData.cs";
            gui.DecalEditorGui.initialize();

            // Add ourselves to EditorGui, where all the other tools reside
            DecalEditorGui DecalEditorGui = "DecalEditorGui";

            DecalEditorGui.setVisible(false);

            DecalEditorGui.DecalPreviewWindow DecalPreviewWindow = "DecalPreviewWindow";

            DecalPreviewWindow.setVisible(false);
            DecalEditorGui.DecalEditorWindow DecalEditorWindow = "DecalEditorWindow";
            DecalEditorWindow.setVisible(false);

            EditorGui EditorGui = "EditorGui";
            EditorGui.add(DecalEditorGui);
            EditorGui.add(DecalEditorWindow);
            EditorGui.add(DecalPreviewWindow);

            DecalEditorGui.DecalEditorTabBook DecalEditorTabBook = "DecalEditorTabBook";
            DecalEditorTabBook.selectPage(0);

            ObjectCreator oc = new ObjectCreator("ScriptObject", "DecalEditorPlugin", typeof (DecalEditorPlugin));
            oc["editorGui"] = "DecalEditorGui";
            oc.Create();

            DecalEditorPlugin DecalEditorPlugin = "DecalEditorPlugin";

            DecalEditorPlugin.initialize();
        }
Beispiel #6
0
        public static void initializeRiverEditor()
        {
            Omni.self.Print(" % - Initializing River Editor");
            gui.RiverEditor.initialize();
            RiverEditorGui.initialize();
            RiverEditorToolbar.initialize();
            // Add ourselves to EditorGui, where all the other tools reside
            RiverEditorGui riverEditorGui = "RiverEditorGui";

            riverEditorGui.setVisible(false);

            RiverEditorToolbar oRiverEditorToolbar = "RiverEditorToolbar";

            oRiverEditorToolbar.setVisible(false);
            ((GuiWindowCollapseCtrl) "RiverEditorOptionsWindow").setVisible(false);
            GuiWindowCollapseCtrl RiverEditorTreeWindow = "RiverEditorTreeWindow";
            RiverEditorTreeWindow.setVisible(false);

            EditorGui EditorGui = "EditorGui";

            EditorGui.add("RiverEditorGui");
            EditorGui.add("RiverEditorToolbar");
            EditorGui.add("RiverEditorOptionsWindow");
            EditorGui.add("RiverEditorTreeWindow");

            ObjectCreator oRiverEditorPlugin = new ObjectCreator("ScriptObject", "RiverEditorPlugin", typeof (RiverEditorPlugin));
            oRiverEditorPlugin["editorGui"] = "RiverEditorGui";
            oRiverEditorPlugin.Create();

            RiverEditorPlugin RiverEditorPlugin = "RiverEditorPlugin";

            RiverEditorPlugin.initialize();
        }
Beispiel #7
0
        public override int onThrow(ShapeBase user, int amount)
        {
            if (amount == 0)
                amount = 1;

            if (this["maxInventory"] != string.Empty)
                {
                if (amount > this["maxInventory"].AsInt())
                    amount = this["maxInventory"].AsInt();
                }

            if (!amount.AsBool())
                return 0;

            user.decInventory(this, amount);
            //ShapeBaseShapeBaseDecInventory(player, datablock, amount);

            // Construct the actual object in the world, and add it to
            // the mission group so it's cleaned up when the mission is
            // done.  The object is given a random z rotation.
            ObjectCreator tch = new ObjectCreator("Item", string.Empty);
            tch["datablock"] = this;
            tch["rotation"] = "0 0 1 " + (new Random().Next(0, 360));
            tch["count"] = amount;

            Item item = tch.Create();

            ((SimSet) "MissionGroup").pushToBack(item);

            item.SchedulePop();

            return item;
        }
        public override void onAdd()
        {
            this.createMenuBar();

            ObjectCreator oc = new ObjectCreator("GuiPanel");
            oc["internalName"] = "DocumentContainer";

            GuiPanel panel = oc.Create();

            this.setContent(panel);

            int xOffset = 20;
            int yOffset = 20;

            for (int i = 0; i < 10; i++)
                {
                ObjectCreator oc1 = new ObjectCreator("GuiWindowCtrl");
                oc["extent"] = "200 100";
                oc["position"] = xOffset + ' ' + yOffset;

                GuiWindowCtrl window = oc1.Create();
                panel.add(window);

                xOffset += 30;
                yOffset += 30;
                }
        }
        public void init()
        {
            if (!this.contextMenu.isObject())
                {
                ObjectCreator pop = new ObjectCreator("PopupMenu", "guiTreePop", typeof (MenuBuilder));
                pop["isPopup"] = true;

                pop["item[0]"] = "Rename" + '\t' + "" + '\t' + "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId( guiTreePop.object ) );";
                pop["item[1]"] = "Delete" + '\t' + "" + '\t' + "GuiEditor.deleteControl( guiTreePop.object );";
                pop["item[2]"] = "-";
                pop["item[3]"] = "Locked" + '\t' + "" + '\t' + "guiTreePop.object.setLocked( !guiTreePop.object.locked ); GuiEditorTreeView.update();";
                pop["item[4]"] = "Hidden" + '\t' + "" + '\t' + "guiTreePop.object.setVisible( !guiTreePop.object.isVisible() ); GuiEditorTreeView.update();";
                pop["item[5]"] = "-";
                pop["item[6]"] = "Add New Controls Here" + '\t' + "" + '\t' + "GuiEditor.setCurrentAddSet( guiTreePop.object );";
                pop["item[7]"] = "Add Child Controls to Selection" + '\t' + "" + '\t' + "GuiEditor.selectAllControlsInSet( guiTreePop.object, false );";
                pop["item[8]"] = "Remove Child Controls from Selection" + '\t' + "" + '\t' + "GuiEditor.selectAllControlsInSet( guiTreePop.object, true );";

                pop["object"] = -1;

                this.contextMenu = pop.Create();
                }

            if (!this.contextMenuMultiSel.isObject())
                {
                ObjectCreator multiSel = new ObjectCreator("PopupMenu", "", typeof (MenuBuilder));
                multiSel["isPopup"] = true;

                multiSel["item[0]"] = "Delete" + '\t' + "" + '\t' + "GuiEditor.deleteSelection();";

                this.contextMenuMultiSel = multiSel.Create();
                }
        }
        public void initialize()
        {
            ObjectCreator oc_Newobject3 = new ObjectCreator("SimSet", "ForestTools");

            ObjectCreator oc_Newobject2 = new ObjectCreator("ForestBrushTool");
            oc_Newobject2["internalName"] = "BrushTool";
            oc_Newobject2["toolTip"] = "Paint Tool";
            oc_Newobject2["buttonImage"] = "tools/forest/images/brushTool";

            oc_Newobject3["#Newobject2"] = oc_Newobject2;

            ObjectCreator oc_Newobject1 = new ObjectCreator("ForestSelectionTool");
            oc_Newobject1["internalName"] = "SelectionTool";
            oc_Newobject1["toolTip"] = "Selection Tool";
            oc_Newobject1["buttonImage"] = "tools/forest/images/selectionTool";
            oc_Newobject3["#Newobject1"] = oc_Newobject1;

            oc_Newobject3.Create();

            ActionMap map = new ObjectCreator("ActionMap").Create();
            map.bindCmd("keyboard", "1", "ForestEditorSelectModeBtn.performClick();", ""); // Select
            map.bindCmd("keyboard", "2", "ForestEditorMoveModeBtn.performClick();", ""); // Move
            map.bindCmd("keyboard", "3", "ForestEditorRotateModeBtn.performClick();", ""); // Rotate
            map.bindCmd("keyboard", "4", "ForestEditorScaleModeBtn.performClick();", ""); // Scale
            map.bindCmd("keyboard", "5", "ForestEditorPaintModeBtn.performClick();", ""); // Paint
            map.bindCmd("keyboard", "6", "ForestEditorEraseModeBtn.performClick();", ""); // Erase
            map.bindCmd("keyboard", "7", "ForestEditorEraseSelectedModeBtn.performClick();", ""); // EraseSelected   
            map.bindCmd("keyboard", "8", "ForestEditorDropToGroundModeBtn.performClick();", ""); // DropTheBeat
            //%map.bindCmd( keyboard, "backspace", "ForestEditorGui.onDeleteKey();", "" );
            //%map.bindCmd( keyboard, "delete", "ForestEditorGui.onDeleteKey();", "" );   
            this.map = map;
        }
        public void initialize()
        {
            ActionMap map = new ObjectCreator("ActionMap").Create();
            map.bindCmd("keyboard", "escape", "ToolsToolbarArray->WorldEditorInspectorPalette.performClick();", "");
            map.bindCmd("keyboard", "1", "ShapeEditorNoneModeBtn.performClick();", "");
            map.bindCmd("keyboard", "2", "ShapeEditorMoveModeBtn.performClick();", "");
            map.bindCmd("keyboard", "3", "ShapeEditorRotateModeBtn.performClick();", "");
            //%map.bindCmd( keyboard, "4", "ShapeEditorScaleModeBtn.performClick();", "" ); // not needed for the shape editor
            map.bindCmd("keyboard", "n", "ShapeEditorToolbar->showNodes.performClick();", "");
            map.bindCmd("keyboard", "t", "ShapeEditorToolbar->ghostMode.performClick();", "");
            map.bindCmd("keyboard", "r", "ShapeEditorToolbar->wireframeMode.performClick();", "");
            map.bindCmd("keyboard", "f", "ShapeEditorToolbar->fitToShapeBtn.performClick();", "");
            map.bindCmd("keyboard", "g", "ShapeEditorToolbar->showGridBtn.performClick();", "");
            map.bindCmd("keyboard", "h", "ShapeEdSelectWindow->tabBook.selectPage( 2 );", ""); // Load help tab
            map.bindCmd("keyboard", "l", "ShapeEdSelectWindow->tabBook.selectPage( 1 );", ""); // load Library Tab
            map.bindCmd("keyboard", "j", "ShapeEdSelectWindow->tabBook.selectPage( 0 );", ""); // load scene object Tab
            map.bindCmd("keyboard", "SPACE", "ShapeEdAnimWindow.togglePause();", "");
            map.bindCmd("keyboard", "i", "ShapeEdSequences.onEditSeqInOut(\"in\", ShapeEdSeqSlider.getValue());", "");
            map.bindCmd("keyboard", "o", "ShapeEdSequences.onEditSeqInOut(\"out\", ShapeEdSeqSlider.getValue());", "");
            map.bindCmd("keyboard", "shift -", "ShapeEdSeqSlider.setValue(ShapeEdAnimWindow-->seqIn.getText());", "");
            map.bindCmd("keyboard", "shift =", "ShapeEdSeqSlider.setValue(ShapeEdAnimWindow-->seqOut.getText());", "");
            map.bindCmd("keyboard", "=", "ShapeEdAnimWindow-->stepFwdBtn.performClick();", "");
            map.bindCmd("keyboard", "-", "ShapeEdAnimWindow-->stepBkwdBtn.performClick();", "");

            this.map = map;

            this.initSettings();
        }
        public static void initialize()
        {
            #region GameTSCtrl (HudlessPlayGui)        oc_Newobject1

            ObjectCreator oc_Newobject1 = new ObjectCreator("GameTSCtrl", "HudlessPlayGui", typeof (hudlessGui));
            oc_Newobject1["canSaveDynamicFields"] = "1";
            oc_Newobject1["isContainer"] = "1";
            oc_Newobject1["Profile"] = "GuiContentProfile";
            oc_Newobject1["HorizSizing"] = "right";
            oc_Newobject1["VertSizing"] = "bottom";
            oc_Newobject1["position"] = "0 0";
            oc_Newobject1["Extent"] = "1024 768";
            oc_Newobject1["MinExtent"] = "8 8";
            oc_Newobject1["canSave"] = "1";
            oc_Newobject1["Visible"] = "1";
            oc_Newobject1["tooltipprofile"] = "GuiToolTipProfile";
            oc_Newobject1["hovertime"] = "1000";
            oc_Newobject1["Margin"] = "0 0 0 0";
            oc_Newobject1["Padding"] = "0 0 0 0";
            oc_Newobject1["AnchorTop"] = "1";
            oc_Newobject1["AnchorBottom"] = "0";
            oc_Newobject1["AnchorLeft"] = "1";
            oc_Newobject1["AnchorRight"] = "0";
            oc_Newobject1["cameraZRot"] = "0";
            oc_Newobject1["forceFOV"] = "0";
            oc_Newobject1["Enabled"] = "1";
            oc_Newobject1["helpTag"] = "0";
            oc_Newobject1["noCursor"] = "1";

            #endregion

            oc_Newobject1.Create();
        }
        public override void onRightMouseUp(GuiControl ctrl)
        {
            int fontColorPos, backgroundColorPos, fillColorPos, fontSizePos, lockPos, winSettingsPos, setTitlePos, bitmapPos;
            GuiCanvas Canvas = "Canvas";

            ObjectCreator popupCreator = new ObjectCreator("PopupMenu", "", typeof (MenuBuilder));

            popupCreator["isPopup"] = true.AsString();

            popupCreator["object"] = "-1";

            MenuBuilder popup = popupCreator.Create();

            popup.removeAllItems();
            popup["object"] = ctrl;

            if (ctrl.getName() != "")
                popup.appendItem(ctrl.getName() + '\t' + "" + '\t' + "");
            else
                popup.appendItem(ctrl.getClassName() + '\t' + "" + '\t' + "");

            popup.enableItem(0, false);

            if (ctrl.lockControl)
                {
                lockPos = popup.appendItem("Locked" + '\t' + "" + '\t' + ctrl + ".setControlLock(!" + ctrl + ".getControlLock());");
                popup.checkItem(lockPos, ctrl.getControlLock());
                }

            if (ctrl.contextFontColor)
                fontColorPos = popup.appendItem("Font Color..." + '\t' + "" + '\t' + "getColorI(\"" + ctrl.controlFontColor.AsString() + "\", \"" + ctrl + ".setControlFontColor\", " + ctrl.getRoot() + ", \"" + ctrl + ".setControlFontColor\", \"" + ctrl + ".setControlFontColor\" );");

            if (ctrl.contextBackColor)
                backgroundColorPos = popup.appendItem("Background Color..." + '\t' + "" + '\t' + "IngameContext.transparentCheck(" + ctrl + ", \"backColor\");");

            if (ctrl.contextFillColor)
                fillColorPos = popup.appendItem("Fill Color..." + '\t' + "" + '\t' + "IngameContext.transparentCheck(" + ctrl + ", \"fillColor\");");

            if (ctrl.contextFontSize)
                fontSizePos = popup.appendItem("Font Size..." + '\t' + "" + '\t' + "ChangeFontSize.loadDialog(" + ctrl + ");");

            if (ctrl.windowSettings)
                winSettingsPos = popup.appendItem("Window Settings" + '\t' + "" + '\t' + "WindowSettings.loadDialog(" + ctrl + ");");

            if (ctrl.isMemberOfClass("GuiBitmapCtrl"))
                {
                if (((GuiControl) popup["object"])["setBitmap"].AsBool())
                    bitmapPos = popup.appendItem("Set Bitmap..." + '\t' + "" + '\t' + "getLoadFilename( \"All Image Files|*.png;*.jpeg;*.jpg;*.tga;*.jng;*.mng;*.gif;*.bmp;*.dds|png|*.png|jpeg|*.jpeg|jpg|*.jpg|tga|*.tga|jng|*.jng|mng|*.mng|gif|*.gif|bmp|*.bmp|dds|*.dds\"," + ctrl + "\".setBitmap\", \"\" );");
                }

            if (ctrl.isMemberOfClass("GuiWindowCtrl"))
                {
                if (((GuiControl) popup["object"])["setTitle"].AsBool())
                    setTitlePos = popup.appendItem("Set Title..." + '\t' + "" + '\t' + "SetTitle.loadDialog(" + ctrl + ");");
                }

            popup.showPopup(Canvas);
        }
Beispiel #14
0
 public static void initializeInGameEditor()
 {
     Omni.self.Print(" % - Initializing In-game GUI Editor");
     SetTitle.initialize();
     WindowSettings.initialize();
     ChangeFontSize.initialize();
     ObjectCreator oIngameContext = new ObjectCreator("GuiControl", "IngameContext, IngameGuiGroup", typeof (InGameContext));
     oIngameContext.Create();
 }
        public static string constructRSSHeadlineCollection()
        {
            RSSHeadlineCollection ret = new ObjectCreator("ScriptObject", "", typeof (RSSHeadlineCollection)).Create();

            // Create sim group for it
            ret._simGroup = new ObjectCreator("SimGroup").Create().AsString();

            return ret;
        }
        public static string constructRSSHeadline(string headline, string link)
        {
            ObjectCreator oc = new ObjectCreator("ScriptObject", "", typeof (RSSHeadline));
            oc["_headline"] = headline;
            oc["_link"] = link;

            RSSHeadline ret = oc.Create();

            return ret;
        }
        public static void intialize()
        {
            //-----------------------------------------------------------------------------
            // Anim flag settings - must match material.h
            // These cannot be enumed through script becuase it cannot
            // handle the "|" operation for combining them together
            // ie. Scroll | Wave does not work.
            //-----------------------------------------------------------------------------
            omni.iGlobal["$scroll"] = 1;
            omni.iGlobal["$rotate"] = 2;
            omni.iGlobal["$wave"] = 4;
            omni.iGlobal["$scale"] = 8;
            omni.iGlobal["$sequence"] = 16;

            // Common stateblock definitions
            ObjectCreator oc = new ObjectCreator("GFXSamplerStateData", "SamplerClampLinear");
            oc["textureColorOp"] = "GFXTOPModulate";
            oc["addressModeU"] = "GFXAddressClamp";
            oc["addressModeV"] = "GFXAddressClamp";
            oc["addressModeW"] = "GFXAddressClamp";
            oc["magFilter"] = "GFXTextureFilterLinear";
            oc["minFilter"] = "GFXTextureFilterLinear";
            oc["mipFilter"] = "GFXTextureFilterLinear";
            oc.Create();

            oc = new ObjectCreator("GFXSamplerStateData", "SamplerClampPoint");
            oc["textureColorOp"] = "GFXTOPModulate";
            oc["addressModeU"] = "GFXAddressClamp";
            oc["addressModeV"] = "GFXAddressClamp";
            oc["addressModeW"] = "GFXAddressClamp";
            oc["magFilter"] = "GFXTextureFilterPoint";
            oc["minFilter"] = "GFXTextureFilterPoint";
            oc["mipFilter"] = "GFXTextureFilterPoint";
            oc.Create();

            oc = new ObjectCreator("GFXSamplerStateData", "SamplerWrapLinear");
            oc["textureColorOp"] = "GFXTOPModulate";
            oc["addressModeU"] = "GFXTextureAddressWrap";
            oc["addressModeV"] = "GFXTextureAddressWrap";
            oc["addressModeW"] = "GFXTextureAddressWrap";
            oc["magFilter"] = "GFXTextureFilterLinear";
            oc["minFilter"] = "GFXTextureFilterLinear";
            oc["mipFilter"] = "GFXTextureFilterLinear";
            oc.Create();

            oc = new ObjectCreator("GFXSamplerStateData", "SamplerWrapPoint");
            oc["textureColorOp"] = "GFXTOPModulate";
            oc["addressModeU"] = "GFXTextureAddressWrap";
            oc["addressModeV"] = "GFXTextureAddressWrap";
            oc["addressModeW"] = "GFXTextureAddressWrap";
            oc["magFilter"] = "GFXTextureFilterPoint";
            oc["minFilter"] = "GFXTextureFilterPoint";
            oc["mipFilter"] = "GFXTextureFilterPoint";
            oc.Create();
        }
Beispiel #18
0
        public static void initialize()
        {
            ObjectCreator tch = new ObjectCreator("ShaderData", "BlurDepthShader");
            tch["DXVertexShaderFile"] = "shaders/common/lighting/shadowMap/boxFilterV.hlsl";
            tch["DXPixelShaderFile"] = "shaders/common/lighting/shadowMap/boxFilterP.hlsl";

            tch["OGLVertexShaderFile"] = "shaders/common/lighting/shadowMap/gl/boxFilterV.glsl";
            tch["OGLPixelShaderFile"] = "shaders/common/lighting/shadowMap/gl/boxFilterP.glsl";
            tch["pixVersion"] = 2.0;
            tch.Create();
        }
        public string create(string treeView)
        {
            omni.Util.pushInstantGroup();
            ObjectCreator undoObject = new ObjectCreator("UndoScriptAction", "", typeof (UndoActionReparentObjects));
            //undoObject["class"] = "UndoActionReparentObjects";
            undoObject["numObjects"] = "0";
            undoObject["treeView"] = treeView;
            UndoActionReparentObjects action = undoObject.Create();
            omni.Util.popInstantGroup();

            return action;
        }
Beispiel #20
0
        public virtual SceneObject respawnTurret(SimDataBlock datablock, string classname, TransformF transform, string isstatic, string respawn)
        {
            ObjectCreator tch = new ObjectCreator(classname);
            tch["datablock"] = datablock;
            tch["static"] = isstatic;
            tch["respawn"] = respawn;

            SceneObject turret = tch.Create();

            turret.setTransform(transform);
            ((SimGroup) "MissionGroup").add(turret);
            return turret;
        }
        public override int onThrow(ShapeBase player, int amount)
        {
            if (amount == 0)
                amount = 1;

            if (this["maxInventory"] != string.Empty)
                {
                if (amount > this["maxInventory"].AsInt())
                    amount = this["maxInventory"].AsInt();
                }

            if (amount == 0)
                return 0;

            player.decInventory(this, amount);
            TransformF rot = new TransformF(player.getEulerRotation());

            ObjectCreator tc_obj = new ObjectCreator("AITurretShape", string.Empty);
            tc_obj["datablock"] = this.getName();
            tc_obj["rotation"] = "0 0 1 " + rot.mPositionZ;
            tc_obj["count"] = "1";
            tc_obj["sourceObject"] = player;
            tc_obj["client"] = player["client"];
            tc_obj["isAiControlled"] = true;

            AITurretShape obj = tc_obj.Create();
            ((SimSet) "MissionGroup").pushToBack(obj);

            //todo change to csharp
            obj.addToIgnoreList(player);

            GameConnection client = player["client"];
            if (client.isObject())
                {
                if (client["ownedTurrets"] == string.Empty)
                    client["ownedTurrets"] = new ObjectCreator("SimSet", string.Empty).Create().AsString();

                SimSet SimSet_id = client["ownedTurrets"];
                int countofitems = SimSet_id.getCount();
                for (uint i = 0; i < countofitems; i++)
                    {
                    AITurretShape turret = SimSet_id.getObject(i);
                    turret.addToIgnoreList(obj);
                    obj.addToIgnoreList(turret);
                    }
                SimSet_id.pushToBack(obj);
                }

            return obj;
        }
Beispiel #22
0
        public virtual int GetNearestPlayerTarget()
        {
            if (!isObject())
                return -1;

            if ((this["CurrentTarget"] != "") && (this["CurrentTarget"] != "-1"))
                {
                if (this["CurrentTarget"].isObject())
                    {
                    if (((Player) this["CurrentTarget"]).getState() != "Dead")
                        {
                        if (TargetIsInLos(this["CurrentTarget"]))
                            return this["CurrentTarget"].AsInt();
                        }
                    }

                this["CurrentTarget"] = "";
                }

            SimSet mobSearchGroup = this["aiteam"] == "1" ? "MobSearchGroup_2" : "MobSearchGroup_1";

            SimSet mobSearchGroupResult = "MobSearchGroupResult";
            if (!mobSearchGroupResult.isObject())
                mobSearchGroupResult = new ObjectCreator("SimSet", "MobSearchGroupResult").Create();

            AISearchSimSet(180, 50, mobSearchGroup, mobSearchGroupResult);

            int closesttarget = -1;
            float closestdist = 51;

            for (uint i = 0; i < mobSearchGroupResult.getCount(); i++)
                {
                Player target = mobSearchGroupResult.getObject(i);
                if (!target.isObject())
                    continue;
                if (target.getState() == "Dead")
                    continue;
                float dist = GetTargetDistance(target);
                if (dist >= closestdist)
                    continue;
                closestdist = dist;
                closesttarget = target;
                }
            mobSearchGroupResult.clear();

            this["CurrentTarget"] = closesttarget.AsString();

            return closesttarget;
        }
        public override void onWake()
        {
            if (!this["array"].isObject())
                this["array"] = new ObjectCreator("ArrayObject").Create().AsString();

            // Create the array if it
            // doesn't already exist.

            if (!this["classArray"].isObject())
                {
                this["classArray"] = new ObjectCreator("ArrayObject").Create().AsString();
                this.addClassOptions();
                }
            this.updateOptions();
        }
Beispiel #24
0
        public static UInt32 Spawn(string name, TransformF spawnpoint)
            {
            ObjectCreator npcScriptObject = new ObjectCreator("AIPlayer", "", typeof(CustomDemoPlayer));
            npcScriptObject["dataBlock"] = "DemoPlayer";
            npcScriptObject["path"] = "";
            AIPlayer npc = npcScriptObject.Create();
            if (npc != 0)
                {
                ((SimSet)"MissionCleanup").pushToBack(npc);
                npc.setShapeName(name);
                npc.setTransform(spawnpoint);
                }

            return npc;
            }
        public void createNewParameter(string name)
        {
            ObjectCreator sfxCreator = new ObjectCreator("SFXParameter");
            sfxCreator["internalName"] = name;

            SFXParameter parameter = sfxCreator.Create();

            if (!parameter.isObject())
                return;

            parameter.setFilename(sGlobal["$SFX_PARAMETER_FILE"]);
            this.persistenceMgr.setDirty(parameter);
            this.persistenceMgr.saveDirty();

            this.addParameter(parameter);
        }
        public static string getLevelDisplayName(string levelFile)
        {
            ObjectCreator oc = new ObjectCreator("FileObject");

            FileObject file = oc.Create();

            string MissionInfoObject = "";

            if (file.openForRead(levelFile))
                {
                bool inInfoBlock = false;
                while (!file.isEOF())
                    {
                    string line = file.readLine();
                    line = line.Trim();

                    if (line == "new ScriptObject(MissionInfo) {")
                        inInfoBlock = true;
                    else if (line == "new LevelInfo(theLevelInfo) {")
                        inInfoBlock = true;
                    else if (inInfoBlock && line == "};")
                        {
                        inInfoBlock = false;
                        MissionInfoObject = MissionInfoObject + line;
                        break;
                        }

                    if (inInfoBlock)
                        MissionInfoObject = MissionInfoObject + line + " ";
                    }
                file.close();
                }
            MissionInfoObject = "%MissionInfoObject = " + MissionInfoObject + "; return %MissionInfoObject;";
            MissionInfoObject = omni.console.Eval(MissionInfoObject, true);

            file.delete();
            string name = "";
            if (((SimObject) MissionInfoObject)["LevelName"] != "")
                name = ((SimObject) MissionInfoObject)["LevelName"];
            else
                name = omni.Util.fileBase(levelFile);

            MissionInfoObject.delete();

            return name;
        }
Beispiel #27
0
        public static void initializeMeshRoadEditor()
        {
            Omni.self.Print(" % - Initializing Mesh Road Editor");

            //exec( "./meshRoadEditor.cs" );
            //MeshRoadEditor_initialize();
            gui.MeshRoadEditor.initialize();
            //exec( "./meshRoadEditorGui.gui" );
            //MeshRoadEditorGui_initialize();
            MeshRoadEditorGui.initialize();
            //exec( "./meshRoadEditorToolbar.gui");
            //MeshRoadEditorToolbar_initialize();
            MeshRoadEditorToolbar.initialize();
            //exec( "./meshRoadEditorGui.cs" );

            MeshRoadEditorGui xMeshRoadEditorGui = "MeshRoadEditorGui";

            xMeshRoadEditorGui.setVisible(false);

            GuiWindowCollapseCtrl MeshRoadEditorOptionsWindow = "MeshRoadEditorOptionsWindow";

            MeshRoadEditorOptionsWindow.setVisible(false);
            MeshRoadEditorToolbar oMeshRoadEditorToolbar = "MeshRoadEditorToolbar";

            oMeshRoadEditorToolbar.setVisible(false);

            MeshRoadEditorGui.MeshRoadEditorTreeWindow MeshRoadEditorTreeWindow = "MeshRoadEditorTreeWindow";

            MeshRoadEditorTreeWindow.setVisible(false);

            EditorGui EditorGui = "EditorGui";

            EditorGui.add("MeshRoadEditorGui");
            EditorGui.add("MeshRoadEditorOptionsWindow");
            EditorGui.add("MeshRoadEditorToolbar");
            EditorGui.add("MeshRoadEditorTreeWindow");

            ObjectCreator oMeshRoadEditorPlugin = new ObjectCreator("ScriptObject", "MeshRoadEditorPlugin", typeof (MeshRoadEditorPlugin));
            oMeshRoadEditorPlugin["editorGui"] = "MeshRoadEditorGui";
            oMeshRoadEditorPlugin.Create();

            MeshRoadEditorPlugin mrep = "MeshRoadEditorPlugin";

            mrep.initialize();
        }
        public void initialize()
        {
            ActionMap map = new ObjectCreator("ActionMap").Create();
            map.bindCmd("keyboard", "1", "EWorldEditorNoneModeBtn.performClick();", ""); // Select
            map.bindCmd("keyboard", "2", "EWorldEditorMoveModeBtn.performClick();", ""); // Move
            map.bindCmd("keyboard", "3", "EWorldEditorRotateModeBtn.performClick();", ""); // Rotate
            map.bindCmd("keyboard", "4", "EWorldEditorScaleModeBtn.performClick();", ""); // Scale

            this.map = map;

            new ObjectCreator("ScriptObject", "ParticleEditor", typeof (ParticleEditor)).Create();

            new ObjectCreator("PersistenceManager", "PE_EmitterSaver").Create();
            new ObjectCreator("PersistenceManager", "PE_ParticleSaver").Create();

            new ObjectCreator("SimSet", "PE_UnlistedParticles").Create();
            new ObjectCreator("SimSet", "PE_UnlistedEmitters").Create();
        }
Beispiel #29
0
        public static void initialize()
        {
            //-----------------------------------------------------------------------------
            // Message Hud
            //-----------------------------------------------------------------------------

            // chat hud sizes in lines
            omni.iGlobal["$outerChatLenY[1]"] = 4;
            omni.iGlobal["$outerChatLenY[2]"] = 9;
            omni.iGlobal["$outerChatLenY[3]"] = 13;
            omni.iGlobal["$LastHudTarget"] = 0;

            // Only play sound files that are <= 5000ms in length.
            omni.iGlobal["$MaxMessageWavLength"] = 5000;
            //new MessageVector(HudMessageVector);
            ObjectCreator oc = new ObjectCreator("MessageVector", "HudMessageVector");
            oc.Create();
        }
Beispiel #30
0
        public static void initializePhysicsTools()
        {
            Omni.self.Print(" % - Initializing Physics Tools");

            if (!omni.Util.physicsPluginPresent())
                {
                omni.Util._echo("No physics plugin exists.");
                return;
                }
            ActionMap globalactionmap = "globalactionmap";

            globalactionmap.bindCmd("keyboard", "alt t", "physicsToggleSimulation();", "");
            globalactionmap.bindCmd("keyboard", "alt r", "physicsRestoreState();", "");

            ObjectCreator o = new ObjectCreator("ScriptObject", "PhysicsEditorPlugin", typeof (PhysicsEditorPlugin));
            o["editorGui"] = "EWorldEditor";
            o.Create();
        }