List <GuiContentData> MakeItemList(IExprContext ctx, VariableInfoData info) { List <GuiContentData> list = new List <GuiContentData>(); List <VariableInfoData.RealValueData> allData = info.GetAllData(ctx); GuiNode.OnVoidFunc f = new GuiNode.OnVoidFunc(this.ClickedItem); for (int i = 0; i < allData.Count; i++) { GuiContentData guiContentData = new GuiContentData(); VariableInfoData.RealValueData realValueData = allData[i]; if (realValueData != null && realValueData.icon != null) { guiContentData.SetValue("itemPic", realValueData.icon); guiContentData.SetValue("hasCount", realValueData.hasCount); guiContentData.SetValue("itemCount", realValueData.count); } else { guiContentData.SetValue("itemPic", false); realValueData = null; } guiContentData.SetValue("itemTag", realValueData); guiContentData.SetValue("itemEvent", new GuiNode.VoidBinding(f, realValueData)); guiContentData.SetValue("itemEnabled", realValueData != null && realValueData.icon != null); list.Add(guiContentData); } return(list); }
public void OutputText(string info) { GuiContentData guiContentData = new GuiContentData(); guiContentData.SetValue("currentInfo", info); this.menuRoot.ApplyContent(guiContentData, true); }
public static void ApplyData(GameObject obj, GuiContentData content) { GuiNode[] componentsInChildren = obj.GetComponentsInChildren <GuiNode>(true); for (int i = componentsInChildren.Length - 1; i >= 0; i--) { componentsInChildren[i].ApplyContent(content, false); } }
protected override bool DoShow(MenuScreen <PauseMenu> previous) { GuiContentData guiContentData = new GuiContentData(); guiContentData.SetValue("itemList", this.MakeItemList(base.Owner.currEnt, base.Owner._itemInfoData)); guiContentData.SetValue("hasItem", false); guiContentData.SetValue("playerSuit", base.Owner.currEnt.GetStateVariable("outfit")); guiContentData.SetValue("hasCards", base.Owner._cards.ShouldShow()); base.Root.ApplyContent(guiContentData, true); return(true); }
protected override bool DoShow(MenuScreen <PauseMenu> previous) { GuiContentData guiContentData = new GuiContentData(); guiContentData.SetValue("infoStr", this.GetHintString()); int stateVariable = base.Owner.currEnt.GetStateVariable("outfit"); guiContentData.SetValue("playerSuit", stateVariable); base.Root.ApplyContent(guiContentData, true); return(true); }
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(); }
public void ApplyContent(GuiContentData content, bool withChildren = false) { List <GuiContentApplier> appliers = this.GetAppliers(); for (int i = appliers.Count - 1; i >= 0; i--) { appliers[i].Apply(content); } if (withChildren) { List <GuiNode> children = this.GetChildren(); for (int j = children.Count - 1; j >= 0; j--) { children[j].ApplyContent(content, true); } } }
void UpdateValue(bool withCaret) { GuiContentData guiContentData = new GuiContentData(); this.hasCaret = false; if (withCaret) { guiContentData.SetValue("currentValue", this.currentText + "|"); this.hasCaret = true; } else { guiContentData.SetValue("currentValue", this.currentText); } this.menuRoot.ApplyContent(guiContentData, true); this.blinkTimer = this._blinkTime; }
void ClickedItem(object ctx) { GuiContentData guiContentData = new GuiContentData(); VariableInfoData.RealValueData realValueData = ctx as VariableInfoData.RealValueData; if (realValueData != null) { guiContentData.SetValue("currItemPic", realValueData.icon); guiContentData.SetValue("currItemName", realValueData.name); guiContentData.SetValue("currItemDesc", realValueData.desc); guiContentData.SetValue("hasItem", true); guiContentData.SetValue("currItemHasCount", realValueData.hasCount); guiContentData.SetValue("currItemCount", realValueData.count); } else { guiContentData.SetValue("hasItem", false); } base.Root.ApplyContent(guiContentData, true); }
protected override bool DoShow(MenuScreen <PauseMenu> previous) { GuiContentData guiContentData = new GuiContentData(); guiContentData.SetValue("showMap", base.Owner._mapWindow.CanShow(base.Owner.currEnt)); bool flag = !PlayerRespawner.RespawnInhibited() && PlayerRespawner.GetActiveInstance() != null; guiContentData.SetValue("canWarp", flag); if (flag) { IDataSaver saver = base.Owner._saver.GetSaver("/local/start", true); if (saver != null) { guiContentData.SetValue("hasWarpTgt", true); guiContentData.SetValue("warpTgt", saver.LoadData("level")); } else { guiContentData.SetValue("hasWarpTgt", false); } } base.Root.ApplyContent(guiContentData, true); return(true); }