public static void onServerCreated() { // Server::GameType is sent to the master server. // This variable should uniquely identify your game and/or mod. Globals.SetString("Server::GameType", Globals.GetString("appName")); // Server::MissionType sent to the master server. Clients can // filter servers based on mission type. // $Server::MissionType = "Deathmatch"; // GameStartTime is the sim time the game started. Used to calculated // game elapsed time. Globals.SetInt("Game::StartTime", 0); // Create the server physics world. Global.physicsInitWorld("server"); Global.physicsStartSimulation("server"); ArrayObject DatablockFilesList = Sim.FindObject <ArrayObject>("DatablockFilesList"); List <string> datablockFiles = new List <string>(); for (int i = 0; i < DatablockFilesList.count(); i++) { datablockFiles.Add(DatablockFilesList.getKey(i)); } Core.HelperFunctions.loadDatablockFiles(datablockFiles, true); //todo DatablockFilesList //% cnt = DatablockFilesList.count(); //loadDatablockFiles(DatablockFilesList, true); //% cnt = DatablockFilesList.count(); // Keep track of when the game started Globals.SetString("Game::StartTime", "Sim::Time"); }
public void setViewTypeCategorized() { GuiEditorGui.GuiEditor GuiEditor = "GuiEditor"; // Create rollouts for each class category we have and // record the classes in each category in a temporary array // on the rollout so we can later sort the class names before // creating the actual controls in the toolbox. string controls = Util.enumerateConsoleClassesByCategory("Gui"); foreach (string className in controls.Split('\t')) { if (GuiEditor.isFilteredClass(className) || !Util.isMemberOfClass(className, "GuiControl")) { continue; } // Get the class's next category under Gui. string category = Util.getWord(Util.getCategoryOfClass(className), 1); if (category == "") { continue; } // Find or create the rollout for the category. GuiRolloutCtrl rollout = this.getOrCreateRolloutForCategory(category); // Insert the item. if (!rollout["classes"].AsBool()) { rollout["classes"] = new ObjectCreator("ArrayObject").Create().AsString(); } ((ArrayObject)rollout["classes"]).push_back(className, ""); } // Go through the rollouts, sort the class names, and // create the toolbox controls. for (uint i = 0; i < this.getCount(); i++) { GuiRolloutCtrl rollout = this.getObject(i); if (!rollout.isMemberOfClass("GuiRolloutCtrl")) { continue; } // Get the array with the class names and sort it. // Sort in descending order to counter reversal of order // when we later add the controls to the stack. ArrayObject classes = rollout["classes"]; classes.sortk(true); // Add a control for each of the classes to the // rollout's stack control. GuiDynamicCtrlArrayControl stack = rollout.FOT("array"); int numClasses = classes.count(); for (int n = 0; n < numClasses; n++) { string className = classes.getKey(n); #region GuiIconButtonCtrl () oc_Newobject3 ObjectCreator oc_Newobject3 = new ObjectCreator("GuiIconButtonCtrl", "", typeof(GuiEditorToolboxButton)); oc_Newobject3["profile"] = "ToolsGuiIconButtonSmallProfile"; oc_Newobject3["extent"] = "128 18"; oc_Newobject3["text"] = className; oc_Newobject3["iconBitmap"] = console.Call_Classname("EditorIconRegistry", "findIconByClassName", new string[] { className }); oc_Newobject3["buttonMargin"] = "2 2"; oc_Newobject3["iconLocation"] = "left"; oc_Newobject3["textLocation"] = "left"; oc_Newobject3["textMargin"] = "24"; oc_Newobject3["AutoSize"] = new ObjectCreator.StringNoQuote("true"); oc_Newobject3["command"] = "GuiEditor.createControl( " + className + " );"; oc_Newobject3["useMouseEvents"] = new ObjectCreator.StringNoQuote("true"); //TODO doesn't work for every control. //oc_Newobject3["tooltip"] = className + '\n' + "\n" + Util.getDescriptionOfClass( className ); oc_Newobject3["tooltipProfile"] = "ToolsGuiToolTipProfile"; #endregion GuiIconButtonCtrl ctrl = oc_Newobject3.Create(); stack.add(ctrl); } // Delete the temporary array. rollout["classes"] = ""; classes.delete(); } this.currentViewType = "Categorized"; }