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 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; }
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; }
void Connect(GuiBindInData inData, GuiBindData outData) { if (!string.IsNullOrEmpty(this._trackId)) { outData.AddTracker(this._trackId, this); } this.ApplyContent(inData.Content, false); this.OnConnected(inData, outData); }
public static GuiBindData Connect(GameObject obj, GuiBindInData inData) { GuiBindData guiBindData = new GuiBindData(); GuiNode[] componentsInChildren = obj.GetComponentsInChildren <GuiNode>(true); for (int i = componentsInChildren.Length - 1; i >= 0; i--) { componentsInChildren[i].Connect(inData, guiBindData); } return(guiBindData); }
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(); }
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; }
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; }
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; } }
protected virtual void OnConnected(GuiBindInData inData, GuiBindData outData) { }
public static GuiBindData CreateAndConnect(GameObject prefab, GuiBindInData inData) { GameObject obj = GameObjectUtility.TransformInstantiate(prefab, inData.Root); return(GuiNode.Connect(obj, inData)); }