public void Initialize() { //Set TextMesh and switchable nameTextMesh = gameObject.GetComponentInChildren <TextMesh>(); switchable = gameObject.GetComponentInChildren <GuiSwitchable>(); //Find existing GUI node GuiNode node = gameObject.GetComponentInChildren <GuiNode>(true); if (node == null) { return; } //Link this component to the node GuiBindInData inData = new GuiBindInData(null, null); GuiBindData guiBindData = GuiNode.Connect(this.gameObject, inData); string trackerID = "CheckBox" + UIElement.GetNewTrackerID(); guiBindData.AddTracker(trackerID, node); //Set delegate function IGuiOnchangeBool tryfind = guiBindData.GetTrackerEvent <IGuiOnchangeBool>(trackerID); if (tryfind == null) { return; } tryfind.onchange = new GuiNode.OnBoolFunc(CheckBoxClicked); DefLineSize = 185f; OriginalTextSize = nameTextMesh.transform.localScale; AutoTextResize = true; }
public void Initialize() { //Set TextMesh nameTextMesh = gameObject.GetComponentInChildren <TextMesh>(); //Find existing GUI node GuiNode node = gameObject.GetComponentInChildren <GuiNode>(true); if (node == null) { return; } //Link this component to the node GuiBindInData inData = new GuiBindInData(null, null); GuiBindData guiBindData = GuiNode.Connect(this.gameObject, inData); string trackerID = "Button" + UIElement.GetNewTrackerID(); guiBindData.AddTracker(trackerID, node); //Set delegate function IGuiOnclick tryfind = guiBindData.GetTrackerEvent <IGuiOnclick>(trackerID); if (tryfind == null) { return; } tryfind.onclick = new GuiNode.OnVoidFunc(ButtonClicked); //Set text resizing variables DefLineSize = 275f; OriginalTextSize = nameTextMesh.transform.localScale; AutoTextResize = true; }
public void Initialize() { //Set slidable //nameTextMesh = gameObject.GetComponentInChildren<TextMesh>(); slidable = gameObject.GetComponentInChildren <GuiSlidable>(); //Find existing GUI node GuiNode node = gameObject.GetComponentInChildren <GuiNode>(true); if (node == null) { return; } //Link this component to the node GuiBindInData inData = new GuiBindInData(null, null); GuiBindData guiBindData = GuiNode.Connect(this.gameObject, inData); string trackerID = "ScrollBar" + UIElement.GetNewTrackerID(); guiBindData.AddTracker(trackerID, node); //Set delegate function IGuiOnchangeFloat tryfind = guiBindData.GetTrackerEvent <IGuiOnchangeFloat>(trackerID); if (tryfind == null) { return; } tryfind.onchange = new GuiNode.OnFloatFunc(SliderMoved); //Set default step SliderStep = 0.01f; AllowScroll = true; _scrollMultiplier = 1; }
private Config() { Gui = GuiNode.GetDefault(); ContextMenu = ContextMenuNode.GetDefault(); Overlay = OverlayNode.GetDefault(); Diagnostics = DiagnosticsNode.GetDefault(); }
List <GuiNode> GetChildren() { if (this.savedChildren == null) { this.savedChildren = GuiNode.GatherChildren(base.transform, null); } return(this.savedChildren); }
List <GuiContentApplier> GetAppliers() { if (this.savedAppliers == null) { this.savedAppliers = GuiNode.GatherAppliers(base.transform, null); for (int i = this.savedAppliers.Count - 1; i >= 0; i--) { this.savedAppliers[i].Enable(this); } } return(this.savedAppliers); }
void Setup() { GuiBindInData inData = new GuiBindInData(null, null); GuiBindData guiBindData = GuiNode.Connect(this._layout, inData); this.menuRoot = guiBindData.GetTracker <GuiWindow>("debugRoot"); guiBindData.GetTrackerEvent <IGuiOnclick>("debug.done").onclick = new GuiNode.OnVoidFunc(this.ClickedDone); guiBindData.GetTrackerEvent <IGuiOnclick>("debug.back").onclick = new GuiNode.OnVoidFunc(this.ClickedCancel); GuiContentData guiContentData = new GuiContentData(); guiContentData.SetValue("version", this._version.GetVersion()); this.menuRoot.ApplyContent(guiContentData, true); // Modify the HUD to make it better ModifyUI(); }
static List <GuiContentApplier> GatherAppliers(Transform root, List <GuiContentApplier> list) { if (list == null) { list = new List <GuiContentApplier>(); } list.AddRange(root.GetComponents <GuiContentApplier>()); for (int i = root.childCount - 1; i >= 0; i--) { Transform child = root.GetChild(i); if (child.GetComponent <GuiNode>() == null) { GuiNode.GatherAppliers(child, list); } } return(list); }
private void InitFileSystem() { treeView1.Nodes.Clear(); FolderNode root = new FolderNode("root"); foreach (var file in ArcFile.GetFileList()) { string[] path = file.Split('/'); ProcessFile(root, path, 0); } foreach (var file in ArcFile.GetStreamFileList()) { string[] path = file.Split('/'); ProcessFile(root, path, 0); } Root = new GuiNode(root); treeView1.Nodes.Add(Root); }
void Start() { // Enable Unity debug logging DebugManager.EnableDebugging(); // TEMP Utility.LoadLevel("MainMenu"); GuiBindInData guiBindInData = new GuiBindInData(null, null); guiBindInData.Content.SetValue("gameLoading", false); MainMenu.ApplyUIData(PlatformInfo.Current.GetDataForUI("splash"), guiBindInData.Content); GuiBindData guiBindData = GuiNode.Connect(this._layout, guiBindInData); this.mainWnd = guiBindData.GetTracker <GuiWindow>("startRoot"); this.mainWnd.Show(null, null); this.timer = this._time; }
static List <GuiNode> GatherChildren(Transform root, List <GuiNode> list) { if (list == null) { list = new List <GuiNode>(); } for (int i = root.childCount - 1; i >= 0; i--) { Transform child = root.GetChild(i); GuiNode component = child.GetComponent <GuiNode>(); if (component == null) { GuiNode.GatherChildren(child, list); } else { list.Add(component); } } return(list); }
public void RenderUI() { List <Geometry2D> GuiGeometries = GuiNode.GetAllGeometries(); GuiGeometries = GuiGeometries.OrderBy(x => x.Z).ToList(); //GuiGeometries = GuiGeometries.OrderBy(x => x.Shader == null).ThenBy(x => x.Z).ToList(); for (int i = 0; i < GuiGeometries.Count; i++) { if (GuiGeometries[i].Shader == null) { Batch2D.Begin(); //Debug.WriteLine(GuiGeometries[i].TextureName); Texture2D Texture = Textures[GuiGeometries[i].TextureName]; Microsoft.Xna.Framework.Rectangle TextureBounds = new Microsoft.Xna.Framework.Rectangle((int)(GuiGeometries[i].TX * Texture.Width), (int)(GuiGeometries[i].TY * Texture.Height), (int)(GuiGeometries[i].TSX * Texture.Width), (int)(GuiGeometries[i].TSY * Texture.Height)); Microsoft.Xna.Framework.Rectangle Bounds = new Microsoft.Xna.Framework.Rectangle((int)GuiGeometries[i].PX, (int)GuiGeometries[i].PY, (int)GuiGeometries[i].SX, (int)GuiGeometries[i].SY); Batch2D.Draw(Texture, Bounds, TextureBounds, Microsoft.Xna.Framework.Color.White); Batch2D.End(); } else { Geometry2D Geom = GuiGeometries[i]; Effect Shader = GuiGeometries[i].Shader; Texture2D Texture = Textures["StandardMenu"]; Microsoft.Xna.Framework.Rectangle Bounds = new Microsoft.Xna.Framework.Rectangle((int)GuiGeometries[i].PX, (int)GuiGeometries[i].PY, (int)GuiGeometries[i].SX, (int)GuiGeometries[i].SY); Batch2D.Begin(0, BlendState.Opaque, null, null, null, Shader); for (int j = 0; j < Shader.CurrentTechnique.Passes.Count; j++) { Shader.CurrentTechnique.Passes[j].Apply(); Batch2D.Draw(Texture, Bounds, Color.Transparent); } Batch2D.End(); } } }
public static Config TryParse(ConfigNode node) { if (node != null) { var gui = GuiNode.TryParse(node.GetNode("GUI")) ?? GuiNode.GetDefault(); var contextMenu = ContextMenuNode.TryParse(node.GetNode("CONTEXT_MENU")) ?? ContextMenuNode.GetDefault(); var overlay = OverlayNode.TryParse(node.GetNode("OVERLAY")) ?? OverlayNode.GetDefault(); var diagnostics = DiagnosticsNode.TryParse(node.GetNode("DIAGNOSTICS")) ?? DiagnosticsNode.GetDefault(); return(new Config(gui, contextMenu, overlay, diagnostics)); } Log.Debug("Could not parse missing HOT_SPOT node"); return(null); }
void Setup() { GuiBindInData inData = new GuiBindInData(null, null); PrefabReplacer[] componentsInChildren = this._layout.GetComponentsInChildren <PrefabReplacer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].Apply(); } GuiBindData data; if (this._layoutIsPrefab) { data = GuiNode.CreateAndConnect(this._layout, inData); } else { data = GuiNode.Connect(this._layout, inData); } this.menuImpl = new MenuImpl <PauseMenu>(this); this.menuImpl.AddScreen(new PauseMenu.MainScreen(this, "pauseRoot", data)); this.menuImpl.AddScreen(new PauseMenu.OptionsScreen(this, "optionsRoot", data)); this.menuImpl.AddScreen(new PauseMenu.MapScreen(this, "mapRoot", data)); this.menuImpl.AddScreen(new PauseMenu.InfoScreen(this, "infoRoot", data)); this.menuImpl.AddScreen(new PauseMenu.ItemScreen(this, "itemRoot", data)); this.menuImpl.AddScreen(new PauseMenu.CardsScreen(this, "cardsRoot", data)); if (this._debugMenu != null) { this.menuImpl.AddScreen(new PauseMenu.DebugScreen(this, "debugRoot", data)); } PerPlatformData.DebugCodeData debugCode = PlatformInfo.Current.DebugCode; if (debugCode != null && debugCode.useOverride) { this._debugStartCode = debugCode.startCode; this._debugStartSequence = debugCode.sequence; } }
public void Initialize() { //Set TextMesh, slidable and textframe nameTextMesh = gameObject.GetComponentInChildren <TextMesh>(); slidable = gameObject.GetComponentInChildren <GuiSlidable>(); _display = gameObject.GetComponentInChildren <UITextFrame>(); UpdateDisplayValue(); //Find existing GUI node GuiNode node = gameObject.GetComponentInChildren <GuiNode>(true); if (node == null) { return; } //Link this component to the node GuiBindInData inData = new GuiBindInData(null, null); GuiBindData guiBindData = GuiNode.Connect(this.gameObject, inData); string trackerID = "Slider" + UIElement.GetNewTrackerID(); guiBindData.AddTracker(trackerID, node); //Set delegate function IGuiOnchangeFloat tryfind = guiBindData.GetTrackerEvent <IGuiOnchangeFloat>(trackerID); if (tryfind == null) { return; } tryfind.onchange = new GuiNode.OnFloatFunc(SliderMoved); //Text resizing DefLineSize = 200f; OriginalTextSize = nameTextMesh.transform.localScale; AutoTextResize = true; }
public void AppendChild(GuiNode node) { TransformUtility.SetParent(node.transform, base.transform, true); }
public static GuiBindData CreateAndConnect(GameObject prefab, GuiBindInData inData) { GameObject obj = GameObjectUtility.TransformInstantiate(prefab, inData.Root); return(GuiNode.Connect(obj, inData)); }