public void createTool(string tool, string cmd, GuiDynamicCtrlArrayControl toolsArray)
        {
            var        oc1       = new ObjectCreator("GuiControl");
            GuiControl container = oc1.Create();

            var oc = new ObjectCreator("GuiBitmapButtonCtrl");

            oc["Extent"]     = "108 81";
            oc["position"]   = "35 0";
            oc["bitmap"]     = "art/gui/no-preview";
            oc["altCommand"] = "ToolsDlg.execute(\\\"" + this["cwd"] + "/" + cmd + ".bat\\\");";
            GuiBitmapButtonCtrl bitmap = oc.Create();

            var oc2 = new ObjectCreator("GuiTextCtrl");

            oc2["text"]     = tool;
            oc2["Extent"]   = "108 30";
            oc2["position"] = "35 85";
            GuiTextCtrl text = oc2.Create();

            container.addGuiControl(bitmap);
            container.addGuiControl(text);

            toolsArray.addGuiControl(container);
        }
Beispiel #2
0
        public static void DbgConsoleEntryReturn()
        {
            DebuggerConsoleView DebuggerConsoleView = "DebuggerConsoleView";
            TCPDebugger         TCPDebugger         = "TCPDebugger";
            GuiTextEditCtrl     DbgConsoleEntry     = "DbgConsoleEntry";
            GuiTextCtrl         DebuggerStatus      = "DebuggerStatus";

            string msg = DbgConsoleEntry.getValue();

            if (msg != "")
            {
                DebuggerConsoleView.print("" + msg);
                if (DebuggerStatus.getValue() == "NOT CONNECTED")
                {
                    DebuggerConsoleView.print("*** Not connected.");
                }
                else if (DebuggerStatus.getValue() == "BREAK")
                {
                    DebuggerConsoleView.print("*** Target is in BREAK mode.");
                }
                else
                {
                    TCPDebugger.send("CEVAL " + msg + "\r\n");
                }
            }
            DbgConsoleEntry.setValue("");
        }
Beispiel #3
0
            public void handleRunning()
            {
                DebuggerFileView  DebuggerFileView  = "DebuggerFileView";
                DebuggerCallStack DebuggerCallStack = "DebuggerCallStack";
                GuiTextCtrl       DebuggerStatus    = "DebuggerStatus";

                DebuggerFileView.setCurrentLine(-1, true);
                DebuggerCallStack.clear();
                DebuggerStatus.setValue("RUNNING...");
            }
Beispiel #4
0
        public static void ClientCmdRefreshWeaponHud(string amount, string preview, string ret, string zoomret,
                                                     string amountInClips)
        {
            amount        = omni.Util.detag(amount);
            preview       = omni.Util.detag(preview);
            ret           = omni.Util.detag(ret);
            zoomret       = omni.Util.detag(zoomret);
            amountInClips = omni.Util.detag(amountInClips);

            GuiTextCtrl AmmoAmount = "AmmoAmount";

            if (!amount.AsBool())
            {
                AmmoAmount.setVisible(false);
            }
            else
            {
                if ("AmmoAmount".isObject())
                {
                    AmmoAmount.setVisible(true);
                    AmmoAmount.setText("Ammo: " + amount + "/" + amountInClips);
                }
            }

            GuiBitmapBorderCtrl WeaponHUD = "WeaponHUD";

            if (preview.Trim() == "")
            {
                WeaponHUD.setVisible(false);
            }
            else
            {
                WeaponHUD.setVisible(true);
                ((GuiBitmapCtrl)"PreviewImage").setBitmapX("art/gui/weaponHud/" + preview);
            }

            GuiCrossHairHud Reticle = "Reticle";

            if (ret.Trim() == "")
            {
                Reticle.setVisible(false);
            }
            else
            {
                Reticle.setVisible(true);
                Reticle.setBitmapX("art/gui/weaponHud/" + ret);
            }

            GuiCrossHairHud ZoomReticle = "ZoomReticle";

            if ("ZoomReticle".isObject())
            {
                ZoomReticle.setBitmapX(zoomret == "" ? "" : "art/gui/weaponHud/" + zoomret);
            }
        }
Beispiel #5
0
        public static void ClientCmdSetAmmoAmountHud(string amount, string amountInClips)
        {
            GuiTextCtrl AmmoAmount = "AmmoAmount";

            if (!amount.AsBool())
            {
                AmmoAmount.setVisible(false);
            }
            else
            {
                AmmoAmount.setVisible(true);
                AmmoAmount.setText("Ammo: " + amount + "/" + amountInClips);
            }
        }
Beispiel #6
0
        public static void onMissionDownloadPhase(string phase)
        {
            if (!Global.isObject("LoadingProgress"))
            {
                return;
            }

            GuiProgressBitmapCtrl LoadingProgress    = Sim.FindObject <GuiProgressBitmapCtrl>("LoadingProgress");
            GuiTextCtrl           LoadingProgressTxt = Sim.FindObject <GuiTextCtrl>("LoadingProgressTxt");

            LoadingProgress.setValue("0");
            LoadingProgressTxt.setValue(phase);
            Canvas.GameCanvas.repaint();
        }
Beispiel #7
0
        public static void DbgSetCursorWatch(string expr)
        {
            GuiTextCtrl DebuggerCursorWatch = "DebuggerCursorWatch";
            TCPDebugger TCPDebugger         = "TCPDebugger";

            DebuggerCursorWatch["expr"] = expr;
            if (DebuggerCursorWatch["expr"] == "")
            {
                DebuggerCursorWatch.setText("");
            }
            else
            {
                TCPDebugger.send("EVAL -1 0 " + DebuggerCursorWatch["expr"] + "\r\n");
            }
        }
Beispiel #8
0
            public void handlePass(string message)
            {
                DebuggerConsoleView DebuggerConsoleView = "DebuggerConsoleView";
                GuiTextCtrl         DebuggerStatus      = "DebuggerStatus";

                if (message == "WrongPass")
                {
                    DebuggerConsoleView.print("Disconnected - wrong password.");
                    this.disconnect();
                }
                else if (message == "Connected.")
                {
                    DebuggerConsoleView.print("Connected.");
                    DebuggerStatus.setValue("CONNECTED");
                    this.send("FILELIST\r\n");
                }
            }
Beispiel #9
0
            public void handleBreak(string line)
            {
                GuiTextCtrl       DebuggerStatus    = "DebuggerStatus";
                GuiTextListCtrl   DebuggerWatchView = "DebuggerWatchView";
                DebuggerCallStack DebuggerCallStack = "DebuggerCallStack";

                DebuggerStatus.setValue("BREAK");

                // Query all the watches.
                for (int i = 0; i < DebuggerWatchView.rowCount(); i++)
                {
                    int    id   = DebuggerWatchView.getRowId(i);
                    string row  = DebuggerWatchView.getRowTextById(id);
                    string expr = Util.getField(row, 0);
                    this.send("EVAL " + id + " 0 " + expr + "\r\n");
                }

                // Update the call stack window.
                DebuggerCallStack.clear();

                string file       = Util.getWord(line, 0);
                string lineNumber = Util.getWord(line, 1);
                string funcName   = Util.getWord(line, 2);

                DbgOpenFile(file, lineNumber.AsInt(), true);

                int nextWord = 3;
                //int rowId = 0;
                int iD = 0;

                while (true)
                {
                    DebuggerCallStack.setRowById(iD, file + "\t" + lineNumber + "\t" + funcName);
                    iD++;
                    file       = Util.getWord(line, nextWord);
                    lineNumber = Util.getWord(line, nextWord + 1);
                    funcName   = Util.getWord(line, nextWord + 2);
                    nextWord  += 3;
                    if (file == "")
                    {
                        break;
                    }
                }
            }
Beispiel #10
0
        public void open()
        {
            const int offset = 6;

            if (isVisible())
            {
                return;
            }

            string text = this[this + ".isTeamMsg"].AsBool() ? "TEAM:" : "GLOBAL:";

            GuiTextCtrl MessageHud_Text = "MessageHud_Text";

            MessageHud_Text.setValue(text);

            GuiBitmapBorderCtrl outerChatHud     = "outerChatHud";
            GuiBitmapBorderCtrl MessageHud_Frame = "MessageHud_Frame";

            Point2I windowPos = new Point2I(0, (outerChatHud.position.y + outerChatHud.extent.y + 1));

            Point2I windowExt = new Point2I(outerChatHud.extent.x, MessageHud_Frame.extent.y);

            int textExtent = MessageHud_Text.extent.x + 14;

            int ctrlExtent = MessageHud_Frame.extent.x;

            ((GuiCanvas)"Canvas").pushDialog(this);

            MessageHud_Frame.position = windowPos;

            MessageHud_Frame.extent = windowExt;

            GuiTextEditCtrl MessageHud_Edit = "MessageHud_Edit";

            MessageHud_Edit.position = new Point2I(textExtent + offset, MessageHud_Edit.position.y);

            MessageHud_Edit.extent = new Point2I(ctrlExtent - textExtent - (2 * offset), MessageHud_Edit.extent.y);

            setVisible(true);

            MessageHud_Edit.makeFirstResponder(true);
        }
Beispiel #11
0
        public static void JoinGame(uint serverIndex)
        {
            GuiProgressBitmapCtrl LoadingProgress    = Sim.FindObject <GuiProgressBitmapCtrl>("LoadingProgress");
            GuiTextCtrl           LoadingProgressTxt = Sim.FindObject <GuiTextCtrl>("LoadingProgressTxt");

            // The server info index is stored in the row along with the
            // rest of displayed info.
            if (Global.setServerInfo(serverIndex))
            {
                Core.Canvas.GameCanvas.setContent("LoadingGui");
                LoadingProgress.setValue("1");
                LoadingProgressTxt.setValue("WAITING FOR SERVER");
                Core.Canvas.GameCanvas.repaint();

                GameConnection ServerConnection = new GameConnection("ServerConnection", true);
                ServerConnection.setConnectArgs(Globals.GetString("pref::Player::Name"));
                ServerConnection.setJoinPassword(Globals.GetString("Client::Password"));
                ServerConnection.connect(Globals.GetString("ServerInfo::Address"));
            }
        }
Beispiel #12
0
        public static void onPhaseComplete(string text = null)
        {
            if (!Global.isObject("LoadingProgress"))
            {
                return;
            }

            GuiTextCtrl LoadingProgressTxt = Sim.FindObject <GuiTextCtrl>("LoadingProgressTxt");

            if (!string.IsNullOrEmpty(text))
            {
                LoadingProgressTxt.setValue(text);
            }


            GuiProgressBitmapCtrl LoadingProgress = Sim.FindObject <GuiProgressBitmapCtrl>("LoadingProgress");

            LoadingProgress.setValue("1");
            Canvas.GameCanvas.repaint();
        }
Beispiel #13
0
        public static void StartGame(string mission = null, string hostingType = null)
        {
            if (string.IsNullOrEmpty(mission))
            {
                GuiTextListCtrl CL_levelList = Sim.FindObject <GuiTextListCtrl>("CL_levelList");
                int             id           = CL_levelList.getSelectedId();
                mission = Global.getField(CL_levelList.getRowTextById(id), 1);
                // Alternatively:
                //error("Cannot start a level with no level selected!");
            }

            string serverType = hostingType;

            if (string.IsNullOrEmpty(hostingType))
            {
                if (Globals.GetBool("pref::HostMultiPlayer"))
                {
                    serverType = "MultiPlayer";
                }
                else
                {
                    serverType = "SinglePlayer";
                }
            }

            // Show the loading screen immediately.
            if (Global.isObject("LoadingGui"))
            {
                Core.Canvas.GameCanvas.setContent("LoadingGui");
                GuiProgressBitmapCtrl LoadingProgress    = Sim.FindObject <GuiProgressBitmapCtrl>("LoadingProgress");
                GuiTextCtrl           LoadingProgressTxt = Sim.FindObject <GuiTextCtrl>("LoadingProgressTxt");
                LoadingProgress.setValue("1");
                LoadingProgressTxt.setValue("LOADING MISSION FILE");
                Core.Canvas.GameCanvas.repaint();
            }

            Server.Server.createAndConnectToLocalServer(serverType, mission);
        }
Beispiel #14
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;
        }
Beispiel #15
0
            public void handleEvalOut(string line)
            {
                GuiTextCtrl     DebuggerCursorWatch = "DebuggerCursorWatch";
                GuiTextListCtrl DebuggerWatchView   = "DebuggerWatchView";

                int    id    = Util.firstWord(line).AsInt();
                string value = Util.restWords(line);

                // See if it's the cursor watch, or from the watch window.
                if (id < 0)
                {
                    DebuggerCursorWatch.setText(DebuggerCursorWatch["expr"] + ' ' + "=" + ' ' + value);
                }
                else
                {
                    string row = DebuggerWatchView.getRowTextById(id);
                    if (row == "")
                    {
                        return;
                    }
                    string expr = Util.getField(row, 0);
                    DebuggerWatchView.setRowById(id, expr + "\t" + value);
                }
            }
Beispiel #16
0
        public static void InspectDelete()
        {
            GuiInspector    InspectFields             = "InspectFields";
            GuiTextEditCtrl InspectObjectName         = "InspectObjectName";
            GuiTextEditCtrl InspectObjectInternalName = "InspectObjectInternalName";
            GuiTextCtrl     InspectObjectSimID        = "InspectObjectSimID";

            SimObject obj = InspectObjectName["refObj"];

            if (!obj.isObject())
            {
                return;
            }

            obj.delete();

            // Update inspected object information.
            InspectFields.inspect("0");

            // Update selected object properties
            InspectObjectName.setValue("");
            InspectObjectInternalName.setValue("");
            InspectObjectSimID.setValue("0");
        }
        public static void updateTSShapeLoadProgress(string pProgress, string pMsg)
        {
            float           progress     = float.Parse(pProgress);
            GuiProgressCtrl progressCtrl = null;
            GuiTextCtrl     textCtrl     = null;

            // Check if the loading GUI is visible and use that instead of the
            // separate import progress GUI if possible
            GuiControl LoadingGui = Sim.FindObject <GuiControl>("LoadingGui");

            if (Global.isObject("LoadingGui") && LoadingGui.isAwake())
            {
                // Save/Restor load progress at the start/end of the import process
                if (Math.Abs(progress) < 0.000001)
                {
                    GuiProgressCtrl ColladaImportProgress = Sim.FindObject <GuiProgressCtrl>("ColladaImportProgress");
                    //todo colladaImportProgress

                    /*
                     *  ColladaImportProgress.savedProgress = LoadingProgress.getValue();
                     *  ColladaImportProgress.savedText = LoadingProgressTxt.getValue();
                     *
                     *  ColladaImportProgress.msgPrefix = "Importing " @ %msg;
                     *  %msg = "Reading file into memory...";
                     */
                }
                else if (Math.Abs(progress - 1.0) < 0.000001)
                {
                    /*
                     *    LoadingProgress.setValue( ColladaImportProgress.savedProgress );
                     *    LoadingProgressTxt.setValue( ColladaImportProgress.savedText );
                     */
                }

                /*
                 *  %msg = ColladaImportProgress.msgPrefix @ ": " @ %msg;
                 *
                 *  %progressCtrl = LoadingProgress;
                 *  %textCtrl = LoadingProgressTxt;
                 */
            }
            else
            {
                // It's probably the editors using it
                if (Global.isFunction("updateToolTSShapeLoadProgress"))
                {
                    Global.call("updateToolTSShapeLoadProgress", pProgress, pMsg);
                }
            }

            // Update progress indicators
            if (Math.Abs(progress) < 0.000001)
            {
                progressCtrl.setValue("0.001f");
                textCtrl.setText(pMsg);
            }
            else if (progress < 1.0f)
            {
                progressCtrl.setValue(pProgress);
                textCtrl.setText(pMsg);
            }

            GuiCanvas Canvas = Sim.FindObject <GuiCanvas>("Canvas");

            Canvas.repaint(33);
        }