// ----- protected override void OnViewInit() { base.OnViewInit(); if (m_ScreenLayout == null) { Debug.LogError("GuiConfirmDialog<" + name + "> :: There is not any layout specified for dialog!"); return; } GUIBase_Button.TouchDelegate[] upgradeDlgts = new GUIBase_Button.TouchDelegate[] { Upgrade1Touch, Upgrade2Touch, Upgrade3Touch, Upgrade4Touch }; for (int i = 0; i < ResearchItem.MAX_PARAMS; i++) { m_Params[i] = new Param(); m_Params[i].Parent = GuiBaseUtils.GetChild <GUIBase_Widget>(Layout, "Param" + (i + 1)); m_Params[i].OrigPos = m_Params[i].Parent.transform.localPosition; m_Params[i].Name = GuiBaseUtils.GetChildLabel(m_Params[i].Parent, "ParamName"); m_Params[i].Value = GuiBaseUtils.GetChildLabel(m_Params[i].Parent, "ParamValue"); } m_UpgradeArea = GetWidget(Layout, "Upgrade_Area").GetComponent <GUIBase_Widget>(); for (int i = 0; i < ResearchItem.MAX_UPGRADES; i++) { GUIBase_Widget parent = GuiBaseUtils.GetChild <GUIBase_Widget>(m_UpgradeArea, "Upgrade" + (i + 1)); m_Upgrades[i].m_Parent = parent; m_Upgrades[i].m_UpgradeIcon.Relink(parent); m_Upgrades[i].m_Button = GuiBaseUtils.GetChild <GUIBase_Button>(parent, "Button"); m_Upgrades[i].m_Button.RegisterTouchDelegate(upgradeDlgts[i]); m_Upgrades[i].m_CostGold = GuiBaseUtils.GetChild <GUIBase_Widget>(parent, "CostGold"); m_Upgrades[i].m_CostMoney = GuiBaseUtils.GetChild <GUIBase_Widget>(parent, "CostMoney"); m_Upgrades[i].m_CostVal = GuiBaseUtils.GetChild <GUIBase_Label>(parent, "CostVal"); m_Upgrades[i].m_Name = GuiBaseUtils.GetChild <GUIBase_Label>(parent, "Name"); m_Upgrades[i].m_Researched = GuiBaseUtils.GetChild <GUIBase_Widget>(parent, "Researched"); } m_ResearchButton = PrepareButton(m_ScreenLayout, "Research_Button", null, Delegate_Research); PrepareButton(m_ScreenLayout, "Close_Button", null, Delegate_Close); PrepareButton(m_ScreenLayout, "Funds_Button", null, (widget) => { if (BuildInfo.Version.Stage != BuildInfo.Stage.Beta) { IViewOwner owner = Owner; owner.Back(); owner.ShowScreen("Shop:3"); } }); m_Name = PrepareLabel(m_ScreenLayout, "Name"); m_Explanation = PrepareTextArea(m_ScreenLayout, "Explanation"); m_Description = PrepareTextArea(m_ScreenLayout, "Description"); m_Price = PrepareLabel(m_ScreenLayout, "Price"); m_PriceArea = GetWidget(Layout, "Price_Area").GetComponent <GUIBase_Widget>(); m_Image = GetWidget(Layout, "Image").GetComponent <GUIBase_Sprite>(); }
//--------------------------------------------------------- public static GUIBase_TextArea PrepareTextArea(GUIBase_Layout layout, string name) { GUIBase_TextArea control = GetControl <GUIBase_TextArea>(layout, name); if (control == null) { Debug.LogWarning("Can't find textArea '" + name + "'"); } return(control); }
// GUIVIEW INTERFACE protected override void OnViewInit() { base.OnViewInit(); m_CaptionLabel = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, CAPTION_LABEL); m_MessageText = GuiBaseUtils.GetControl <GUIBase_TextArea>(Layout, MESSAGE_TEXT); m_MessageButton = GuiBaseUtils.GetControl <GUIBase_Button>(Layout, MESSAGE_BUTTON); AddTextField(m_MessageButton, Delegate_OnKeyboardClose, m_MessageText, MAX_MESSAGE_LENGTH, 8); }
protected GUIBase_TextArea PrepareTextArea(GUIBase_Layout inLayout, string inName) { GUIBase_TextArea textarea = GetWidget(inLayout, inName).GetComponent <GUIBase_TextArea>(); if (textarea == null) { throw new MFScreenInitException("Widget [ " + inName + " } dosn't have TextArea component"); } return(textarea); }
public void Init(GUIBase_Widget root, MessageActionDelegate dlgt) { m_MessageActionDelegate = dlgt; Transform trans = root.transform; m_Subject = trans.GetChildComponent <GUIBase_Label>("Subject"); m_Date = trans.GetChildComponent <GUIBase_Label>("Date"); m_Text = trans.GetChildComponent <GUIBase_TextArea>("Text"); m_Reply = trans.GetChildComponent <GUIBase_Button>("Reply_Button"); m_Reply.RegisterTouchDelegate(() => { OnMessageAction(E_MessageAction.Reply); }); }
public void AddTextField(GUIBase_Button textfield, GuiScreen.KeyboardClose update, GUIBase_TextArea multilineTextArea = null, int maxLength = -1, int maxLines = -1) { #if MADFINGER_KEYBOARD_MOUSE textfield.SetTextField(this, update, multilineTextArea, maxLength, maxLines); if (!m_TextFields.Contains(textfield)) { m_TextFields.Add(textfield); } #endif }
// ----- public void Init(GUIBase_Layout layout) { m_Layout = layout; for (int i = 0; i < ResearchItem.MAX_PARAMS; i++) { m_Params[i] = new Param(); m_Params[i].Parent = GuiBaseUtils.GetChild <GUIBase_Widget>(m_Layout, "Param" + (i + 1)); m_Params[i].OrigPos = m_Params[i].Parent.transform.localPosition; m_Params[i].Name = GuiBaseUtils.GetChildLabel(m_Params[i].Parent, "ParamName"); m_Params[i].Value = GuiBaseUtils.GetChildLabel(m_Params[i].Parent, "ParamValue"); } m_Description = GuiBaseUtils.GetChild <GUIBase_TextArea>(m_Layout, "Description"); m_Key = GuiBaseUtils.GetChild <GUIBase_TextArea>(m_Layout, "Key"); }
public override void Initialize(GUIBase_Layout layout, string rootName, float fadeInTime, float fadeOutTime) { base.Initialize(layout, rootName, fadeInTime, fadeOutTime); m_Caption = GuiBaseUtils.GetChild <GUIBase_Label>(m_Root, CAPTION_LABEL); m_Text = GuiBaseUtils.GetChild <GUIBase_TextArea>(m_Root, TEXT_LABEL); m_Close = GuiBaseUtils.GetChild <GUIBase_Button>(m_Root, CLOSE_BUTTON); m_SkipThis = GuiBaseUtils.GetChild <GUIBase_Button>(m_Root, SKIPTHIS_BUTTON); m_SkipAll = GuiBaseUtils.GetChild <GUIBase_Button>(m_Root, SKIPALL_BUTTON); m_Close.RegisterTouchDelegate2(OnButtonPressed); m_SkipThis.RegisterTouchDelegate2(OnButtonPressed); m_SkipAll.RegisterTouchDelegate2(OnButtonPressed); m_DefaultTextScale = m_Text.textScale; }
public void InitGui(GUIBase_Layout Layout) { m_Layout = Layout; m_NameLabel = GuiBaseUtils.PrepareLabel(Layout, NAME_LABEL); //m_PictureSprite = GuiBaseUtils.PrepareSprite(Layout, PICTURE_SPRITE); m_Cost = new GuiShopFunds(GuiBaseUtils.PrepareSprite(Layout, COST_SPRITE)); m_CostBeforeSale = GuiBaseUtils.PrepareLabel(Layout, COST_BEFORE_SALE); m_DescArea = GuiBaseUtils.PrepareTextArea(Layout, DESCR_LABEL); m_OwnedSprite = GuiBaseUtils.PrepareSprite(Layout, OWNED_SPRITE); m_Sale = GuiBaseUtils.FindLayoutWidget <GUIBase_Widget>(Layout, WIDGET_SALE); m_SaleLabel = GuiBaseUtils.PrepareLabel(Layout, SALE_LABEL); m_SpecInfoLabel = GuiBaseUtils.PrepareLabel(Layout, SPEC_INFO_LABEL); m_IAP_Widget = GuiBaseUtils.FindLayoutWidget <GUIBase_Widget>(Layout, WIDGET_IAP); m_IAP_Cost_Label = GuiBaseUtils.PrepareLabel(Layout, IAP_COST); }
IEnumerator UpdateHint() { while (IsVisible) { int textID = #if MADFINGER_KEYBOARD_MOUSE m_TextIDsPC.Length > 0 ? m_TextIDsPC[Random.Range(0, m_TextIDsPC.Length)] : (m_TextIDs.Length > 0 ? m_TextIDs[Random.Range(0, m_TextIDs.Length)] : 0); #else m_TextIDs.Length > 0 ? m_TextIDs[Random.Range(0, m_TextIDs.Length)] : 0; #endif GUIBase_TextArea hint = GuiBaseUtils.GetControl <GUIBase_TextArea>(Layout, "Hint_Label"); hint.SetNewText(textID); yield return(new WaitForSeconds(10)); } }
protected override void OnViewInit() { base.OnViewInit(); if (m_ScreenLayout == null) { Debug.LogError("GuiPopupMigrateGuestDialo :: There is not any layout specified for this dialog!"); return; } m_MigrateButton = GuiBaseUtils.GetControl <GUIBase_Button>(m_ScreenLayout, "Migrate_Button"); m_CancelButton = GuiBaseUtils.GetControl <GUIBase_Button>(m_ScreenLayout, "Cancel_Button"); m_EmailButton = GuiBaseUtils.GetControl <GUIBase_Button>(m_ScreenLayout, "Email_Button"); m_Caption = PrepareLabel(m_ScreenLayout, "Caption"); m_Message = PrepareTextArea(m_ScreenLayout, "Message"); AddTextField(m_EmailButton, Delegate_OnKeyboardClose, null); }
void CollectControls(Transform trans) { foreach (Transform child in trans) { switch (child.name) { case "Name": m_Name = child.GetComponent <GUIBase_Label>(); break; case "Text": m_Text = child.GetComponent <GUIBase_TextArea>(); break; case "PlayerRankPic": m_RankIcon = child.GetComponent <GUIBase_MultiSprite>(); break; case "TextRank": m_RankText = child.GetComponent <GUIBase_Label>(); break; case "HighlightBackground": m_HighlightBkg = child.GetComponent <GUIBase_Widget>(); break; case "Buttons": //m_ButtonsHolder = child.GetComponent<GUIBase_Widget>(); CollectButtons(child); break; case "Content": m_ContentHolder = child.GetComponent <GUIBase_Widget>(); CollectControls(child); break; default: break; } } }