public void GuiInit() { GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot("ShopPopups"); m_WeaponLayout = pivot.GetLayout("InfoWeapon_Layout"); m_ItemLayout = pivot.GetLayout("InfoItem_Layout"); m_WeaponPositionPivot = MFGuiManager.Instance.GetPivot("WeaponPosition_Pivot"); m_ItemPositionPivot = MFGuiManager.Instance.GetPivot("ItemPosition_Pivot"); //m_Name_Label = GuiBaseUtils.PrepareLabel(m_Layout, "Name_Label"); }
public void InitGui() { GUIBase_Pivot Pivot = MFGuiManager.Instance.GetPivot("MainResearch"); GUIBase_Layout Layout = Pivot.GetLayout("ResearchScroller_Layout"); GUIBase_Pivot scrollerPivot = GuiBaseUtils.GetChild <GUIBase_Pivot>(Layout, "Scroller"); m_ScrollInventory.InitGui(Layout, scrollerPivot); GUIBase_Widget iconsRoot = Layout.GetWidget("ResearchIcons"); m_Icons = new GUIBase_Sprite[maxScrollItems]; for (int i = 0; i < maxScrollItems; i++) { m_Icons[i] = GuiBaseUtils.GetChildSprite(iconsRoot, "Icon" + i); } // anchor scroll bar to the bottom of the screen if (MFGuiManager.ForcePreserveAspectRatio) { Transform trans = Layout.transform; Vector3 position = trans.position; GUIBase_Widget specialBottomCara = Layout.GetWidget("SpecialBottom_cara"); Rect bbox = specialBottomCara.GetBBox(); bbox.y -= position.y; position.y = Screen.height - bbox.yMax; trans.position = position; } }
public void InitGui() { GUIBase_Pivot Pivot = MFGuiManager.Instance.GetPivot("ShopMenu"); GUIBase_Layout Layout = Pivot.GetLayout("Scroller_Layout"); GUIBase_Pivot scrollerPivot = GuiBaseUtils.GetChild <GUIBase_Pivot>(Layout, "Scroll_Pivot"); m_ScrollInventory.InitGui(Layout, scrollerPivot); /*m_InfoPopup.GuiInit(); * m_ScrollInventory.m_OnHoldBegin = ShowInfoPopup; * m_ScrollInventory.m_OnHoldEnd = HideInfoPopup;*/ // anchor scroll bar to the bottom of the screen if (MFGuiManager.ForcePreserveAspectRatio) { Transform trans = Layout.transform; Vector3 position = trans.position; GUIBase_Widget specialBottomCara = Layout.GetWidget("SpecialBottom_cara"); Rect bbox = specialBottomCara.GetBBox(); bbox.y -= position.y; position.y = Screen.height - bbox.yMax; trans.position = position; } }
protected override bool OnInit() { if (base.OnInit() == false) { return(false); } string s_PivotName = "Console"; m_Pivot = MFGuiManager.Instance.GetPivot(s_PivotName); if (!m_Pivot) { Debug.LogError("'" + s_PivotName + "' not found!"); return(false); } string s_Layout = "Console_Layout"; m_Layout = m_Pivot.GetLayout(s_Layout); if (!m_Layout) { Debug.LogError("'" + s_Layout + "' not found!"); return(false); } for (int idx = 0; idx < maxLines; ++idx) { lines[idx] = new LineInfo(); lines[idx].label = GuiBaseUtils.PrepareLabel(m_Layout, "Console_Line" + idx); } Instance = this; return(true); }
// --------- protected override bool OnInit() { if (base.OnInit() == false) { return(false); } Gadgets = new List <E_ItemID>(); m_PivotMain = MFGuiManager.Instance.GetPivot(s_PivotMainName); if (!m_PivotMain) { Debug.LogError("'" + s_PivotMainName + "' not found!!! Assert should come now"); return(false); } m_LayoutMain = m_PivotMain.GetLayout(s_LayoutMainName); if (!m_LayoutMain) { Debug.LogError("'" + s_LayoutMainName + "' not found!!! Assert should come now"); return(false); } m_SelIndex = 0; return(true); }
// --------------------- // Use this for initialization protected override bool OnInit() { if (base.OnInit() == false) { return(false); } GUIBase_Layout layout1; GUIBase_Layout layout2; m_Labels.Clear(); m_Pivot = MFGuiManager.Instance.GetPivot("MainHUD_ZoneControlLabels"); layout1 = m_Pivot.GetLayout("Labels1"); for (int i = 0; i < 4; i++) { Label l = new Label(); l.Base = layout1.GetWidget("ZoneControlFlag" + i); l.Distance = GuiBaseUtils.GetChildNumber(l.Base, "Number"); l.Transform = l.Base.transform; l.alpha = 0; m_Labels.Add(l); } layout2 = m_Pivot.GetLayout("Labels2"); for (int i = 4; i < 7; i++) { Label l = new Label(); l.Base = layout2.GetWidget("ZoneControlFlag" + i); l.Distance = GuiBaseUtils.GetChildNumber(l.Base, "Number"); l.Transform = l.Base.transform; l.alpha = 0; m_Labels.Add(l); } m_FlagData.Clear(); GameZoneZoneControl zone = Mission.Instance.GameZone as GameZoneZoneControl; for (int i = 0; i < 6; i++) { if (i < zone.Zones.Count) { m_FlagData.Add(new FlagInfo(zone.Zones[i])); } } return(true); }
// --------------------------------------------------------------------------------------------------------------------------------- // P U B L I C P A R T // --------------------------------------------------------------------------------------------------------------------------------- // --------- public void Init() { GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot(s_PivotMainName); GUIBase_Layout layout = pivot.GetLayout(s_LayoutMainName); layout.GetWidget(s_Parent).GetComponent <GUIBase_Widget>(); CombatInfo = new CombatText(layout); }
protected override void OnViewInit() { GUIBase_Pivot Pivot = MFGuiManager.Instance.GetPivot("ShopPopups"); m_ScreenLayout = Pivot.GetLayout("NotFunds_Layout"); base.OnViewInit(); GuiBaseUtils.RegisterButtonDelegate(m_ScreenLayout, "Back_Button", null, OnButtonBack); GuiBaseUtils.RegisterButtonDelegate(m_ScreenLayout, "Accept_Button", null, OnAddFunds); }
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); } m_Pivot = MFGuiManager.Instance.GetPivot("MainHUD"); m_Layout = m_Pivot.GetLayout("HUD_Layout"); m_RegisteredMedkits.Clear(); m_RegisteredAmmokits.Clear(); for (int i = 0; i < 5; i++) { Label l = new Label(); l.Base = m_Layout.GetWidget("FriendName" + i); l.Name = GuiBaseUtils.GetChildLabel(l.Base, "Name"); l.Transform = l.Base.transform; l.OrigNameScale = 0.54f; // l.Name.transform.localScale.x; l.OrigBaseWidth = l.Base.GetWidth(); l.Base.Show(false, true); l.Base.SetModify(true); m_Labels.Add(l); } for (int i = 0; i < 3; i++) { Label l = new Label(); l.Base = m_Layout.GetWidget("Medkit" + i); l.Name = null; //GuiBaseUtils.GetChildLabel(l.Base, "Name"); l.Transform = l.Base.transform; l.OrigNameScale = 0.54f; l.OrigBaseWidth = l.Base.GetWidth(); l.Base.Show(false, true); l.Base.SetModify(true); m_Medkits.Add(l); } for (int i = 0; i < 3; i++) { Label l = new Label(); l.Base = m_Layout.GetWidget("Ammokit" + i); l.Name = null; //GuiBaseUtils.GetChildLabel(l.Base, "Name"); l.Transform = l.Base.transform; l.OrigNameScale = 0.54f; l.OrigBaseWidth = l.Base.GetWidth(); l.Base.Show(false, true); l.Base.SetModify(true); m_Ammokits.Add(l); } return(true); }
// --------- protected override bool OnInit() { if (base.OnInit() == false) { return(false); } GUIBase_Pivot pivotMain = MFGuiManager.Instance.GetPivot(s_PivotMainName); if (!pivotMain) { Debug.LogError("'" + s_PivotMainName + "' not found!!! Assert should come now"); return(false); } GUIBase_Layout layoutMain = pivotMain.GetLayout(s_LayoutMainName); if (!layoutMain) { Debug.LogError("'" + s_LayoutMainName + "' not found!!! Assert should come now"); return(false); } m_EnemyLabel = layoutMain.GetWidget("EnemyName").GetComponent <GUIBase_Widget>(); m_EnemyLabelName = layoutMain.GetWidget("EnemyNameLbl").GetComponent <GUIBase_Label>(); m_EnemyLabelNameOrigScale = 0.7f; //m_EnemyLabelName.transform.localScale.x; m_EnemyLabelOrigWidth = m_EnemyLabel.GetWidth(); m_PrepareForFire = layoutMain.GetWidget("PrepareForFire").GetComponent <GUIBase_Widget>(); m_PrepareForFireA = layoutMain.GetWidget("PrepareForFireA").GetComponent <GUIBase_Widget>(); m_PrepareForFireB = layoutMain.GetWidget("PrepareForFireB").GetComponent <GUIBase_Widget>(); for (int idx = 0; idx < (int)E_CrosshairType.Max; ++idx) { if (s_CrosshairName.Length <= idx) { Debug.LogError("Crosshair names mishmash; there is not any name for " + (E_CrosshairType)idx + " crosshair specified !!!"); break; } m_Crosshair[idx] = PrepareSprite(layoutMain, s_CrosshairName[idx]); } //m_CrosshairTargetChilds = m_Crosshair[(int)E_CrosshairType.Target].GetComponentsInChildren<GUIBase_Widget>(); m_CrosshairHit = PrepareSprite(layoutMain, s_CrosshairHit); m_CrosshairHitTransform = m_CrosshairHit.transform; m_CrosshairType = E_CrosshairType.None; m_MeleeRange = false; return(true); }
protected override void OnViewInit() { GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot("ShopPopups"); m_ScreenLayout = pivot.GetLayout("Buy_Layout"); base.OnViewInit(); m_Caption_Label = GuiBaseUtils.PrepareLabel(m_ScreenLayout, "Caption_Label"); GuiBaseUtils.RegisterButtonDelegate(m_ScreenLayout, "Back_Button", null, OnCloseButton); GuiBaseUtils.RegisterButtonDelegate(m_ScreenLayout, "Accept_Button", null, OnAcceptButton); m_SaleRoot = GetWidget("SaleRoot"); m_Sale_Label = GuiBaseUtils.PrepareLabel(m_ScreenLayout, "Sale_Label"); m_Cost = new GuiShopFunds(GuiBaseUtils.PrepareSprite(m_ScreenLayout, "Cost_Sprite")); }
public void InitGui() { GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot("EquipMenu"); m_Layout = pivot.GetLayout("Main_Layout"); m_Equip_Button = GuiBaseUtils.RegisterButtonDelegate(m_Layout, "Equip_Button", null, OnEquipButton); m_Equip_Label = GuiBaseUtils.PrepareLabel(m_Layout, "Equip_Label"); m_Buy_Button = GuiBaseUtils.RegisterButtonDelegate(m_Layout, "Buy_Button", null, OnBuyButton); m_Cost = new GuiShopFunds(GuiBaseUtils.PrepareSprite(m_Layout, "Cost_Sprite")); m_ItemScroller.InitGui(); m_ItemScroller.RegisterOnSelectionDelegate(OnSelectionChange); m_IsInitialized = true; }
protected GUIBase_Layout GetLayout(string inPivotName, string inLayoutName) { GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot(inPivotName); if (pivot == null) { throw new MFScreenInitException("Can't find pivot with name [ " + inPivotName + " ]"); } GUIBase_Layout layout = pivot.GetLayout(inLayoutName); if (layout == null) { throw new MFScreenInitException("Can't find layout with name [ " + inLayoutName + " ]"); } return(layout); }
// --------------------------------------------------------------------------------------------------------------------------------- // P U B L I C P A R T // --------------------------------------------------------------------------------------------------------------------------------- // --------- protected override bool OnInit() { if (base.OnInit() == false) { return(false); } GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot(s_PivotMainName); GUIBase_Layout layout = pivot.GetLayout(s_LayoutMainName); layout.GetWidget(s_Parent).GetComponent <GUIBase_Widget>(); HealIndicator = new Indicator(layout.GetWidget("Heal").GetComponent <GUIBase_Widget>(), 1.0f); RechargeAmmoIndicator = new Indicator(layout.GetWidget("RechargeAmmo").GetComponent <GUIBase_Widget>(), 2.0f); //AchievementInfo = new AchievementNotify(layout); //Game.Instance.PlayerPersistentInfo.OnRankChanged += ShowNewRank; return(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); }
// --------------------------------------------------------------------------------------------------------------------------------- // P U B L I C P A R T // --------------------------------------------------------------------------------------------------------------------------------- // --------- protected override bool OnInit() { if (base.OnInit() == false) { return(false); } if (Client.Instance == null) { return(false); } if (Client.Instance.GameState.GameType != E_MPGameType.ZoneControl) { return(false); } GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot(s_PivotMainName); GUIBase_Layout layout = pivot.GetLayout(s_LayoutMainName); m_Gadget = new GadgetZoneControlState(layout.GetWidget(s_Parent)); return(true); }
public void Init() { m_initialised = true; m_Pivot = MFGuiManager.Instance.GetPivot("MogaGui_Pivot"); m_Layout = m_Pivot.GetLayout("Connection_Layout"); m_TextLabel = GuiBaseUtils.PrepareLabel(m_Layout, "Text_Label"); //help m_HelpPivot = MFGuiManager.Instance.GetPivot("MogaHelp_Pivot"); m_HelpLayout = m_HelpPivot.GetLayout("MogaHelp_Layout"); m_HelpCloseButton = GuiBaseUtils.GetControl <GUIBase_Button>(m_HelpLayout, "Close_Button"); m_HelpSwitch = GuiBaseUtils.GetControl <GUIBase_Switch>(m_HelpLayout, "ShowHelp_Switch"); m_MogaPocket = GuiBaseUtils.GetChild <GUIBase_Widget>(m_HelpLayout, "Moga", true); m_MogaPro = GuiBaseUtils.GetChild <GUIBase_Widget>(m_HelpLayout, "MogaPro", true); m_TouchWidgets = new List <GUIBase_Widget>(); m_TouchWidgets.Add(m_HelpCloseButton.Widget); foreach (var btn in m_HelpSwitch.m_Buttons) { m_TouchWidgets.Add(btn.Widget); } }
// --------------------------------------------------------------------------------------------------------------------------------- // P U B L I C P A R T // --------------------------------------------------------------------------------------------------------------------------------- // --------- protected override bool OnInit() { if (base.OnInit() == false) { return(false); } //m_DetectedAgents = null; m_FlagData.Clear(); GUIBase_Pivot pivot = MFGuiManager.Instance.GetPivot(s_PivotMainName); if (!pivot) { Debug.LogError("'" + s_PivotMainName + "' not found!!! Assert should come now"); return(false); } GUIBase_Layout layout = pivot.GetLayout(s_LayoutMainName); if (!layout) { Debug.LogError("'" + s_LayoutMainName + "' not found!!! Assert should come now"); return(false); } Radar = layout.GetWidget(s_RadarName).GetComponent <GUIBase_Widget>(); RadarBkg = layout.GetWidget(s_RadarBackgroundName).GetComponent <GUIBase_Sprite>(); RadarCenter = layout.GetWidget(s_RadarCenterName).GetComponent <GUIBase_Sprite>(); Pulse = layout.GetWidget(s_PulseName).GetComponent <GUIBase_Sprite>(); Pulse.transform.localScale = Vector3.zero; Pulse.Widget.SetModify(); PulseTimer = 0; RadarEnemies = new GUIBase_Sprite[s_RadarEnemyNames.Length]; int index = 0; foreach (string name in s_RadarEnemyNames) { RadarEnemies[index++] = layout.GetWidget(name).GetComponent <GUIBase_Sprite>(); } PlayerPersistantInfo ppi = (Player.LocalInstance) ? PPIManager.Instance.GetPPI(Player.LocalInstance.networkView.owner) : null; //E_Team playerTeam = (ppi != null) ? ppi.Team : E_Team.None; RadarFriends = new RadarFriend[s_RadarFriendNames.Length]; index = 0; foreach (string name in s_RadarFriendNames) { RadarFriends[index] = new RadarFriend(layout.GetWidget(name).GetComponent <GUIBase_MultiSprite>()); ++index; } // ------ GameZoneZoneControl zone = Mission.Instance.GameZone as GameZoneZoneControl; if (zone != null) { foreach (ZoneControlFlag flag in zone.Zones) { m_FlagData.Add(new FlagInfo(flag)); } } foreach (FlagInfo flagInfo in m_FlagData) { index = flagInfo.Flag.ZoneNameIndex - 0500480; if ((index < 0) || (index > s_RadarFlagNames.Length)) { Debug.LogWarning("Can't translate Flag.ZoneNameIndex into index for radar!"); m_FlagData.Clear(); break; } else { flagInfo.RadarFlag = layout.GetWidget(s_RadarFlagNames[index]).GetComponent <GUIBase_Sprite>(); } } RadarFlags = new GUIBase_Sprite[s_RadarFlagNames.Length]; index = 0; foreach (string name in s_RadarFlagNames) { RadarFlags[index] = layout.GetWidget(name).GetComponent <GUIBase_Sprite>(); ++index; } // ------ Transform radarTrans = Radar.transform; Vector3 lossyScale = radarTrans.lossyScale; //Debug.Log("Radar.Widget.m_Width: "+Radar.Widget.m_Width); Vector2 size = new Vector2(RadarBkg.Widget.GetWidth() - 60, RadarBkg.Widget.GetWidth() - 60); // layout.LayoutSpaceDeltaToScreen(new Vector2(RadarBkg.Widget.m_Width - 16, RadarBkg.Widget.m_Width - 16)); size.x = size.x * lossyScale.x; size.y = size.y * lossyScale.y; RadarScreenRadius = size.x / 2.0f; size = new Vector2(RadarCenter.Widget.GetWidth(), RadarCenter.Widget.GetWidth()); //layout.LayoutSpaceDeltaToScreen(new Vector2(RadarCenter.Widget.m_Width, RadarCenter.Widget.m_Width)); size.x *= lossyScale.x; size.y *= lossyScale.y; RadarCenterRadius = size.x / 2.0f; RadarScreenRadius -= RadarCenterRadius; RadarRange = RadarMaxRange; HasDetector = false; // ----- if (Player.LocalInstance) { ppi = PPIManager.Instance.GetPPI(Player.LocalInstance.Owner.NetworkView.owner); foreach (PPIItemData d in ppi.EquipList.Items) { ItemSettings item = ItemSettingsManager.Instance.Get(d.ID); if (item.ItemBehaviour == E_ItemBehaviour.Detector) { HasDetector = true; break; } } } return(true); }