public bool apply(SimGroup qualityGroup, bool testNeedApply) { string quality = getText(); int index = findText(quality); if (index == -1) return false; GraphicsQualityLevel level = qualityGroup.getObject((uint) index); if (level.isObject() && !level.isCurrent()) { if (testNeedApply) return true; level.apply(); } return false; }
public void init(SimGroup qualityGroup) { // Clear the existing content first. this.clear(); // Fill it. int select = -1; for (uint i = 0; i < qualityGroup.getCount(); i++) { GraphicsQualityLevel level = qualityGroup.getObject(i); if (level.isCurrent()) select = (int) i; this.add(level.getInternalName(), (int) i); } // Setup a default selection. if (select == -1) this.setText("Custom"); else this.setSelected(select); //this.setText(select.AsString()); }
public static void IODropdown(string title, string message, SimGroup simgroup, string callback, string cancelCallback) { ((GuiWindowCtrl) "IODropdownFrame").text = title; //bug GuiCanvas.pushDialog doesn't seem to work the mouse right. ((GuiCanvas) "Canvas").pushDialog("IODropdownDlg"); MBSetText("IODropdownText", "IODropdownFrame", message); GuiPopUpMenuCtrl IODropdownMenu = "IODropdownMenu"; if (simgroup.isObject()) { for (uint i = 0; i < simgroup.getCount(); i++) IODropdownMenu.add(simgroup.getObject(i).getName()); } IODropdownMenu.sort(); IODropdownMenu.setFirstSelected(false); ((GuiControl) "IODropdownDlg")["callback"] = callback; ((GuiControl) "IODropdownDlg")["cancelCallback"] = cancelCallback; }
// Return the first active SFXState in the given SimSet/SimGroup. public static SFXState sfxGetActiveStateInGroup(SimGroup group) { for (uint i = 0; i < group.getCount(); i++) { SFXState obj = group.getObject(i); if (!obj.isMemberOfClass("SFXState")) continue; if (obj.isActive()) return obj; } return "0"; }
public virtual void scanGroup(SimGroup group, GuiPopUpMenuCtrl list, int indentLevel) { // Create a display name for the group. string text = group.getName(); if (text == "") text = group.getClassName(); string internalName = group.getInternalName(); if (internalName != "") text = text + "[" + internalName + "]"; // Indent the name according to the depth in the hierarchy. if (indentLevel > 0) text = Util.strrepeat(" ", indentLevel, "") + text; // Add it to the list. list.add(text, group.getId()); // Recurse into SimSets with at least one child. for (uint i = 0; i < group.getCount(); i++) { SimObject obj = group.getObject(i); if (!obj.isMemberOfClass("SimSet") || obj.call("getCount").AsInt() == 0) continue; scanGroup(obj.GetID(), list, indentLevel + 1); } }