// ------ protected override void OnDestroy() { Parent = null; MainWeapon = null; AmmoClip = null; AmmoWeapon = null; base.OnDestroy(); }
//--------------------------------------------------------- public static GUIBase_Number PrepareNumber(GUIBase_Layout layout, string name) { GUIBase_Number control = GetControl <GUIBase_Number>(layout, name); if (control == null) { Debug.LogError("Can't find number '" + name + "'"); } return(control); }
protected GUIBase_Number PrepareNumber(GUIBase_Layout inLayout, string inName) { GUIBase_Number number = GetWidget(inLayout, inName).GetComponent <GUIBase_Number>(); if (number == null) { throw new MFScreenInitException("Widget [ " + inName + " } dosn't have number component"); } return(number); }
void GuiInit() { if (BuildInfo.Version.Stage == BuildInfo.Stage.Release) { return; } if (!MFGuiManager.Instance) { return; } GUIBase_Platform p = MFGuiManager.Instance.FindPlatform("Gui_16_9"); if (!p) { return; } m_PivotOther = MFGuiManager.Instance.GetPivot(s_PivotOtherName); if (!m_PivotOther) { //Debug.LogError("'" + s_PivotOtherName + "' not found!!! Assert should come now"); return; } m_LayoutOther = m_PivotOther.GetLayout(s_LayoutOtherName); if (!m_LayoutOther) { //Debug.LogError("'" + s_LayoutOtherName + "' not found!!! Assert should come now"); return; } // DIRTY fix if (m_LayoutOther.GetWidget(s_FPSName, false) == null) { return; } m_FPS = GuiBaseUtils.PrepareNumber(m_LayoutOther, s_FPSName); if (!m_FPS) { return; } Show(true); Initialised = true; }
// ------ protected override bool OnInit() { if (base.OnInit() == false) { return(false); } GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot("MainHUD"); Layout = pivot.GetLayout("HUD_Layout"); Weapons = new List <E_WeaponID>(); // ------ Parent = Layout.GetWidget(s_ParentName, false); MainWeapon = Layout.GetWidget(s_WeaponButtonName, false); AmmoClip = GuiBaseUtils.GetChildNumber(MainWeapon, s_AmmoClipName); AmmoWeapon = GuiBaseUtils.GetChildNumber(MainWeapon, s_AmmoWeaponName); WeaponLabel = GuiBaseUtils.GetChildLabel(MainWeapon, s_WeaponLabelName); GUIBase_Sprite s = GuiBaseUtils.GetChildSprite(MainWeapon, s_MainIconName); WeaponIcon = s.Widget; WeaponIconOrigColor = Color.white; // WeaponIcon.Color; // ------ for (int i = 0; i < s_InventoryItemName.Length; ++i) { int weaponIdx = i; InventoryItem[i] = new Item(); InventoryItem[i].Button = GuiBaseUtils.RegisterButtonDelegate(Layout, s_InventoryItemName[i], () => { SelectWeapon(weaponIdx); }, null); InventoryItem[i].Sprite = GuiBaseUtils.GetChildSprite(InventoryItem[i].Button.Widget, s_IconName).Widget; InventoryItem[i].OrigSpriteColor = Color.white; //InventoryItem[i].Sprite.Color; //InventoryItem[i].Ammo = GuiBaseUtils.GetChildNumber(InventoryItem[i].Button,s_AmmoName); } GuiBaseUtils.RegisterButtonDelegate(Layout, "CycleWeapon", () => { CycleWeapons(); }, null); CurrentWeapon = E_WeaponID.None; //Hide(); return(true); }
void SetTimeValue(GUIBase_Number number, ref AccountInfo acct) { int hours = Mathf.RoundToInt((float)acct.Duration.TotalHours); int days = Mathf.RoundToInt((float)acct.Duration.TotalDays); int weeks = Mathf.RoundToInt(days / 7.0f); int months = Mathf.RoundToInt(weeks / 4.0f); if (hours < 24) { number.Value = hours; } else if (days < 7) { number.Value = days; } else if (weeks < 4) { number.Value = weeks; } else { number.Value = months; } }