public void PlayGuiOnWake(string thisobj) { // Turn off any shell sounds... // sfxStop( ... ); bGlobal["$enableDirectInput"] = true; Util._activateDirectInput(); coGuiCanvas canvas = "canvas"; // Message hud dialog coGuiControl MainChatHud = "MainChatHud"; if (MainChatHud.isObject()) { coGuiMessageVectorCtrl chatHud = "chatHud"; canvas.pushDialog(MainChatHud); chatHud.attach("HudMessageVector"); } // just update the action map here (( coActionMap)"moveMap").push(); // hack city - these controls are floating around and need to be clamped if (console.isFunction("refreshCenterTextCtrl")) { Util._schedule("0", "0", "refreshCenterTextCtrl"); } if (console.isFunction("refreshBottomTextCtrl")) { Util._schedule("0", "0", "refreshBottomTextCtrl"); } }
public void GuiCanvasSetContent(coGuiCanvas thisobj, string ctrl) { //since the parent execute is actually calling the c++ function and not a script function we do not want it to pass //depth since it will be too many params console.ParentExecute(thisobj, "setContent", 1, new string[] { thisobj, ctrl }, true); GuiCanvascheckCursor(thisobj); }
public void PlayGuiOnSleep(string thisobj) { coGuiCanvas canvas = "canvas"; if (canvas.isObject()) { canvas.popDialog("MainChatHud"); } (( coActionMap)"moveMap").pop(); }
public void resetCanvas() { coGuiCanvas Canvas = "Canvas"; if (Canvas.isObject()) { Canvas.repaint(0); } //if (console.isObject("Canvas")) // ((coGuiCanvas) "Canvas").repaint(0); }
public void PlayGuiclearHud(coGameTSCtrl thisobj) { coGuiCanvas canvas = "canvas"; if (canvas.isObject()) { canvas.popDialog("MainChatHud"); } while (thisobj.getCount() > 0) { thisobj.getObject(0).delete(); } }
public void attemptFullscreenToggle(coGuiCanvas thisobj) { if (EditorIsActive() && !console.Call(thisobj, "isFullScreen").AsBool()) { console.Call("MessageBoxOk", new[] { "Windowed Mode Required", "Please exit the Mission Editor to switch to full screen." }); return; } if (GuiEditorIsActive() && !console.Call(thisobj, "isFullScreen").AsBool()) { console.Call("MessageBoxOk", new[] { "Windowed Mode Required", "Please exit the GUI Editor to switch to full screen." }); return; } thisobj.toggleFullscreen(); }
public string LoadMainMenu() { coGuiCanvas Canvas = "Canvas"; // Startup the client with the Main menu... if (console.isObject("MainMenuGui")) { Canvas.setContent("MainMenuGui"); } else if (console.isObject("UnifiedMainMenuGui")) { Canvas.setContent("UnifiedMainMenuGui"); } Canvas.setCursor("DefaultCursor"); // first check if we have a level file to load if (console.GetVarString("$levelToLoad") != "") { string levelFile = "levels/"; string level2Load = console.GetVarString("$levelToLoad"); string ext = level2Load.Substring(level2Load.Length - 3, 3); if (ext != "mis") { levelFile = string.Format("{0}{1}.mis", levelFile, level2Load); } else { levelFile = levelFile + level2Load; } // Clear out the $levelToLoad so we don't attempt to load the level again // later on. console.SetVar("$levelToLoad", ""); // let's make sure the file exists string file = Util.findFirstFile(levelFile, false); if (file != "") { console.Call("createAndConnectToLocalServer", new[] { "SinglePlayer", file }); } } return(string.Empty); }
public void GuiCanvascheckCursor(coGuiCanvas thisobj) { for (uint i = 0; i < thisobj.getCount(); i++) { coSimObject control = thisobj.getObject(i); if ((control["noCursor"] != "") && (control["noCursor"].AsBool())) { continue; } showCursor(); return; } hideCursor(); }
public void recordMovie(string movieName, string fps, string encoder) { if (!console.isObject("Canvas")) { return; } if (encoder == "") { encoder = "THEORA"; } coGuiCanvas canvas = "Canvas"; string resolution = canvas.getVideoMode(); Util.startVideoCapture(canvas, movieName, encoder, fps.AsFloat(), new Point2I(resolution)); }
public void configureCanvas() { coGuiCanvas canvas = "Canvas"; // Setup a good default if we don't have one already. if (sGlobal["$pref::Video::mode"] == "") { sGlobal["$pref::Video::mode"] = "800 600 false 32 60 0"; } string data = sGlobal["$pref::Video::mode"]; string resX = Util.getWord(data, iGlobal["$WORD::RES_X"]); string resY = Util.getWord(data, iGlobal["$WORD::RES_Y"]); string fs = Util.getWord(data, iGlobal["$WORD::FULLSCREEN"]); string bpp = Util.getWord(data, iGlobal["$WORD::BITDEPTH"]); string rate = Util.getWord(data, iGlobal["$WORD::REFRESH"]); string fsaa = Util.getWord(data, iGlobal["$WORD::AA"]); console.print("--------------"); console.print("Attempting to set resolution to \"" + console.GetVarString("$pref::Video::mode") + "\""); string deskRes = Util.getDesktopResolution().AsString(); string deskResX = Util.getWord(deskRes, iGlobal["$WORD::RES_X"]); string deskResY = Util.getWord(deskRes, iGlobal["$WORD::RES_Y"]); string deskResBPP = Util.getWord(deskRes, 2); // We shouldn't be getting this any more but just in case... if (bpp == "Default") { bpp = deskResBPP; } // Make sure we are running at a valid resolution if (fs == "0" || fs == "false") { // Windowed mode has to use the same bit depth as the desktop bpp = deskResBPP; if (resX.AsInt() >= deskResX.AsInt() || resY.AsInt() >= deskResY.AsInt()) { console.print("Warning: The requested windowed resolution is equal to or larger than the current desktop resolution. Attempting to find a better resolution"); string rescount = ((coGuiCanvas)"Canvas").getModeCount().AsString(); for (int i = (rescount.AsInt() - 1); i >= 0; i--) { string testRes = canvas.getMode(i); string testResX = Util.getWord(testRes, iGlobal["$WORD::RES_X"]); string testResY = Util.getWord(testRes, iGlobal["$WORD::RES_Y"]); string testBPP = Util.getWord(testRes, iGlobal["$WORD::BITDEPTH"]); if (testBPP != bpp) { continue; } if ((testResX.AsInt() >= deskResX.AsInt()) || (testResY.AsInt() >= deskResY.AsInt())) { continue; } // This will work as our new resolution resX = testResX; resY = testResY; console.warn("Warning: Switching to \"" + resX + " " + resY + " " + bpp + "\""); break; } } } sGlobal["$pref::Video::mode"] = resX + " " + resY + " " + fs + " " + bpp + " " + rate + " " + fsaa; string fsLabel = ""; if (fs.AsInt() == 1 || fs == "true") { fsLabel = "Yes"; } else { fsLabel = "No"; } console.print("Accept Mode: \n" + "--Resolution : " + resX + " " + resY + "\n" + "--Full Screen : " + fsLabel + "\n" + "--Bits Per Pixel: " + bpp + "\n" + "--Refresh Rate : " + rate + "\n" + "--FSAA Level : " + fsaa + "\n" + "---------------------------"); // Actually set the new video mode canvas.setVideoMode(resX, resY, fs, bpp, rate, fsaa); // FXAA piggybacks on the FSAA setting in $pref::Video::mode. coPostEffect FXAA_PostEffect = "FXAA_PostEffect"; if (FXAA_PostEffect.isObject()) { FXAA_PostEffect.isEnabled = fsaa.AsInt() > 0; } //if (console.isObject("FXAA_PostEffect")) // new coPostEffect("FXAA_PostEffect")["isEnabled"] = (fsaa.AsInt() > 0 ? true.AsString() : false.AsString()); if (bGlobal["$pref::Video::autoDetect"]) { GraphicsQualityAutodetect(); } }
public void GuiCanvaspopLayer(coGuiCanvas thisobj, string layer) { thisobj.popLayer(layer); GuiCanvascheckCursor(thisobj); }
public void GuiCanvaspopDialog(coGuiCanvas thisobj, string ctrl) { thisobj.popDialog(ctrl); GuiCanvascheckCursor(thisobj); }
public void GuiCanvaspushDialog(coGuiCanvas thisobj, string ctrl, string layer, string center) { thisobj.pushDialog(ctrl, layer, center); GuiCanvascheckCursor(thisobj); }