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 static void StartLevel(string mission, string hostingType) { GuiTextListCtrl CL_levelList = "CL_levelList"; if (mission == "") { mission = omni.Util.getField(CL_levelList.getRowTextById(CL_levelList.getSelectedId()), 1); } string serverType = hostingType; if (serverType == "") { if (omni.bGlobal["$pref::HostMultiPlayer"]) { serverType = "MultiPlayer"; } else { serverType = "SinglePlayer"; } } // Show the loading screen immediately. if ("LoadingGui".isObject()) { ((GuiCanvas)"Canvas").setContent("LoadingGui"); ((GuiProgressBitmapCtrl)"LoadingProgress").setValue("1"); ((GuiTextCtrl)"LoadingProgressTxt").setValue("LOADING MISSION FILE"); ((GuiCanvas)"Canvas").repaint(-1); } server.createAndConnectToLocalServer(serverType, mission); }
public static void DbgWatchDialogEdit() { GuiTextEditCtrl EditWatchDialogValue = "EditWatchDialogValue"; GuiTextListCtrl DebuggerWatchView = "DebuggerWatchView"; DebuggerEditWatchDlg DebuggerEditWatchDlg = "DebuggerEditWatchDlg"; TCPDebugger TCPDebugger = "TCPDebugger"; GuiCanvas Canvas = "Canvas"; string newValue = EditWatchDialogValue.getValue(); int id = DebuggerWatchView.getSelectedId(); if (id >= 0) { string row = DebuggerWatchView.getRowTextById(id); string expr = omni.Util.getField(row, 0); string assignment; if (newValue == "") { assignment = expr + " = \"\""; } else { assignment = expr + " = " + newValue; } TCPDebugger.send("EVAL " + id + " 0 " + assignment + "\r\n"); } Canvas.popDialog(DebuggerEditWatchDlg); }
public static void DbgDeleteSelectedWatch() { GuiTextListCtrl DebuggerWatchView = "DebuggerWatchView"; int selectedWatch = DebuggerWatchView.getSelectedId(); int rowNum = DebuggerWatchView.getRowNumById(selectedWatch); DebuggerWatchView.removeRow(rowNum); }
public void removeOpacitymap() { GuiTextListCtrl opacityList = ((GuiControl)"TerrainImportGui").findObjectByInternalName("OpacityLayerTextList", true); int itemIdx = opacityList.getSelectedId(); if (itemIdx < 0) { return; } ArrayObject namesArray = this["namesArray"]; ArrayObject channelsArray = this["channelsArray"]; namesArray.erase(itemIdx); channelsArray.erase(itemIdx); opacityList.removeRowById(itemIdx); }
public void onOpacityListDblClick() { GuiTextListCtrl opacityList = ((GuiControl)"TerrainImportGui").findObjectByInternalName("OpacityLayerTextList", true); int itemIdx = opacityList.getSelectedId(); if (itemIdx < 0) { return; } this["activeIdx"] = itemIdx.AsString(); string rowTxt = opacityList.getRowTextById(itemIdx); string matTxt = Util.getField(rowTxt, 2); string matID = Util.getField(rowTxt, 3); "TerrainMaterialDlg".call("showByObjectId", new string[] { matID, "TerrainImportGui_TerrainMaterialApplyCallback" }); }
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); }