Exemple #1
0
    public void InitGui(GUIBase_Layout bgLayout, GUIBase_Pivot scrollPivot)
    {
        m_ScrollPivot      = scrollPivot;
        m_BackgroundLayout = bgLayout;

        m_SelectionBackground = m_BackgroundLayout.GetWidget("Sprite_selection");
        m_SelectionArrow      = m_BackgroundLayout.GetWidget("Sprite_sipka");

        /*
         * //setup scroll area
         * GUIBase_Sprite areaSprite = GuiBaseUtils.PrepareSprite(m_BackgroundLayout, "ActiveArea_Sprite");
         * Vector2 pos = new Vector2(areaSprite.Widget.transform.localPosition.x - areaSprite.Widget.m_Width/2, areaSprite.Widget.transform.localPosition.y + areaSprite.Widget.m_Height/2);
         * pos = m_BackgroundLayout.LayoutSpacePosToScreen(pos);
         * Vector2 size = new Vector2(areaSprite.Widget.m_Width, areaSprite.Widget.m_Height);
         * size = m_BackgroundLayout.LayoutSpaceDeltaToScreen(size);
         * Rect scrollRect = new Rect(pos.x, pos.y, size.x, size.y);
         */
        GUIBase_Sprite areaSprite = GuiBaseUtils.PrepareSprite(m_BackgroundLayout, "ActiveArea_Sprite");

        m_ScrollRect        = areaSprite.Widget.GetRectInScreenCoords();
        m_ScrollRect.center = new Vector2(m_ScrollRect.center.x, Screen.height - m_ScrollRect.center.y);

        m_DragInput.SetActiveArea(m_ScrollRect);

        //TODO: find distance between items (podle sirky widgetu nebo podle vzdalenosti mezi dvema widgety)
        //ted to delame rucne podle sirky spritu ramecku v 'ShopCore\Scroller_Layout\Graphic_Pivot'
        ItemOffset = 312;

        m_DragInput.isHorizontal = true;
    }
    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 CombatText(GUIBase_Layout layout)
        {
            m_Parent  = layout.GetWidget("NotifyInfo");
            m_Caption = layout.GetWidget("Caption").GetComponent <GUIBase_Label>();
            m_Text    = layout.GetWidget("Text").GetComponent <GUIBase_Label>();

            m_BackGround = layout.GetWidget("Bg");
            m_Icon1      = layout.GetWidget("NotifyIcon");
            //m_Icon2 = layout.GetWidget("IconL");
            //m_Icon3 = layout.GetWidget("IconR");

            Hide();
        }
    // -----
    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);
    }
Exemple #5
0
    // ---------
    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);
    }
Exemple #6
0
    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);
        }

        GUIBase_Layout layout = MFGuiManager.Instance.GetLayout(LAYOUT);

        if (layout == null)
        {
            return(false);
        }

        m_Root = layout.GetWidget(ROOT);
        if (m_Root == null)
        {
            return(false);
        }

        GUIBase_Widget[] widgets = m_Root.GetComponentsInChildren <GUIBase_Widget>();
        for (int idx = 0; idx < (int)E_CommandID.Max; ++idx)
        {
            GUIBase_Widget widget = GetWidget(ITEMS[idx], ref widgets);
            widget.Show(false, true);
            m_Items[idx] = widget;
        }

        if (GuiHUD.ControledByTouchScreen())
        {
            m_Menu = GetWidget(MENU, ref widgets).GetComponent <GUIBase_Button>();
        }

        return(true);
    }
Exemple #8
0
    private static bool ProceedLayoutAndButton(string layoutName, string buttonName, bool probeOnly = false)
    {
        GUIBase_Layout layout = MFGuiManager.Instance.GetLayout(layoutName);

        if (null != layout)
        {
            if (layout.IsEnabled(true) && layout.IsVisible(false))
            {
                GUIBase_Widget widget = layout.GetWidget(buttonName);

                if (null != widget)
                {
                    if (widget.IsEnabled(true) && widget.IsVisible(false))
                    {
                        if (!probeOnly)
                        {
                            m_CoroutineRunning = true;

                            if (null != Game.Instance)
                            {
                                Game.Instance.StartCoroutine(AutoClick(widget));
                            }
                        }

                        return(true);
                    }
                }
            }
        }

        return(false);
    }
    // ---------------------------------------------------------------------------------------------------------------------------------
    //                      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);
    }
Exemple #10
0
    internal void ShowName()
    {
        string labelName = s_BossLabelNames[(int)BossName];
        //Debug.Log(labelName + " " + BossName);
        GUIBase_Widget tmpWidget = m_Layout.GetWidget(labelName);

        MFGuiManager.Instance.ShowWidget(tmpWidget, true, true);
    }
Exemple #11
0
    public GUIBase_Widget GetWidget(GUIBase_Layout inLayout, string inName)
    {
        GUIBase_Widget widget = inLayout.GetWidget(inName);

        if (widget == null)
        {
            throw new MFScreenInitException("Can't find widget with name [ " + inName + " ]");
        }
        return(widget);
    }
    // ---------------------------------------------------------------------------------------------------------------------------------
    //                      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);
    }
Exemple #13
0
    // ------
    GUIBase_Sprite PrepareSprite(GUIBase_Layout layout, string name)
    {
        GUIBase_Sprite sprite    = null;
        GUIBase_Widget tmpWidget = layout.GetWidget(name);

        if (tmpWidget)
        {
            sprite = tmpWidget.GetComponent <GUIBase_Sprite>();
        }

        return(sprite);
    }
    // ------
    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);
    }
    protected override bool OnInit()
    {
        if (base.OnInit() == false)
        {
            return(false);
        }

        GUIBase_Layout layout = MFGuiManager.Instance.GetLayout(LAYOUT);

        m_Gadget = new GadgetDeathMatchState(layout.GetWidget(ROOT));

        return(true);
    }
Exemple #16
0
    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;
    }
Exemple #17
0
    void UpdateView()
    {
        var primaryKey = CloudUser.instance.primaryKey;
        var ppiList    = PPIManager.Instance.GetPPIList();
        var friends    = GameCloudManager.friendList.friends;
        var pendings   = GameCloudManager.friendList.pendingFriends;

        List <FriendInfo> list = new List <FriendInfo>();

        foreach (var ppi in ppiList)
        {
            if (ppi.PrimaryKey == primaryKey)
            {
                continue;
            }

            bool isFriend = friends.Find(obj => obj.PrimaryKey == ppi.PrimaryKey) != null ? true : false;
            if (isFriend == false)
            {
                isFriend = pendings.Find(obj => obj.PrimaryKey == ppi.PrimaryKey) != null ? true : false;
            }
            if (isFriend == true)
            {
                continue;
            }

            list.Add(new FriendInfo()
            {
                PrimaryKey = ppi.PrimaryKey,
                Nickname   = ppi.Name,
                Rank       = ppi.Rank,
            });
        }

        list.Sort((x, y) => { return(string.Compare(x.PrimaryKey, y.PrimaryKey)); });

        m_Friends        = list.ToArray();
        m_Table.MaxItems = m_Friends.Length;
        m_Table.Widget.SetModify();

        m_View.GetWidget("Hint_Label").Show(m_Friends.Length == 0 ? true : false, true);
    }
Exemple #18
0
    //---------------------------------------------------------
    public static T GetControl <T>(GUIBase_Layout layout, string widgetName, bool verbose = true) where T : GUIBase_Callback
    {
        GUIBase_Widget widget = layout != null?layout.GetWidget(widgetName, verbose) : null;

        if (widget == null)
        {
            if (verbose == true)
            {
                if (layout != null)
                {
                    Debug.LogError("Can't find widget '" + widgetName + "' within layout '" + layout.name + "'");
                }
                else
                {
                    Debug.LogError("Thers is not any layout specified while trying to find widget '" + widgetName + "'");
                }
            }
            return(null);
        }
        return(widget.GetComponent <T>());
    }
Exemple #19
0
    // ---------------------------------------------------------------------------------------------------------------------------------
    //                      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);
    }
    // -----------
    //create gadgets buttons
    public void CreateGadgetInventory(PlayerPersistantInfo ppi)
    {
        ResetGadgetsList();

        // ----------
        foreach (PPIItemData d in ppi.EquipList.Items)
        {
            if (d.ID == E_ItemID.None)
            {
                continue;
            }

            Gadgets[d.EquipSlotIdx] = d.ID;
        }

        for (int i = 0; i < m_GuiGadgets.Length; i++)
        {
            m_GuiGadgets[i] = new GuiGadget <ItemSettings>();
            GUIBase_Widget parent = PrepareWidget(m_LayoutMain, "Gadget_" + (i + 1));
            m_GuiGadgets[i].m_Parent     = parent;
            m_GuiGadgets[i].m_Button     = GuiBaseUtils.GetButton(m_LayoutMain, s_GadgetsBtnNames[i]);
            m_GuiGadgets[i].m_GadgetIcon = GuiBaseUtils.GetChildSprite(parent, "GadgetIcon").Widget;
            m_GuiGadgets[i].m_BarBck     = GuiBaseUtils.GetChildSprite(parent, "Meter_Back").Widget;
            m_GuiGadgets[i].m_Progress   = GuiBaseUtils.GetChildSprite(parent, "Meter_BAR").Widget;
            m_GuiGadgets[i].m_Div2       = GuiBaseUtils.GetChildSprite(parent, "Meter_Div2").Widget;
            m_GuiGadgets[i].m_Div3       = GuiBaseUtils.GetChildSprite(parent, "Meter_Div3").Widget;
            m_GuiGadgets[i].m_PrevScale  = -1;

            if (i >= Gadgets.Count || Gadgets[i] == E_ItemID.None)
            {
                m_GuiGadgets[i].m_Parent.Show(false, true);
                continue;
            }

            m_GuiGadgets[i].m_Settings = ItemSettingsManager.Instance.Get(Gadgets[i]);
            GuiBaseUtils.RegisterButtonDelegate(m_LayoutMain, s_GadgetsBtnNames[i], s_GadgetsBtnDelegates[i], null);
            GUIBase_Sprite s = GuiBaseUtils.GetChildSprite(parent, "GadgetIcon");
            s.Widget.CopyMaterialSettings(m_GuiGadgets[i].m_Settings.HudWidget);
            m_GuiGadgets[i].m_Parent.Show(true, true);
            m_GuiGadgets[i].SetAllTransparent(false);

            Item gadget = LocalPlayer.Owner.GadgetsComponent.GetGadget(Gadgets[i]);
            UpdateGuiGadgetBar(m_GuiGadgets[i], gadget.Timer, m_GuiGadgets[i].m_Settings.Timer, gadget.Count, gadget.OrigCount, false);
        }

        // ----------
        m_Perk              = new GuiGadget <PerkSettings>();
        m_Perk.m_Parent     = PrepareWidget(m_LayoutMain, "Perk");
        m_Perk.m_Button     = GuiBaseUtils.GetButton(m_LayoutMain, "GButton");
        m_Perk.m_GadgetIcon = GuiBaseUtils.GetChildSprite(m_Perk.m_Parent, "GadgetIcon").Widget;
        m_Perk.m_BarBck     = GuiBaseUtils.GetChildSprite(m_Perk.m_Parent, "Meter_Back").Widget;
        m_Perk.m_Progress   = GuiBaseUtils.GetChildSprite(m_Perk.m_Parent, "Meter_BAR").Widget;
        m_Perk.m_Div2       = GuiBaseUtils.GetChildSprite(m_Perk.m_Parent, "Meter_Div2").Widget;
        m_Perk.m_Div3       = GuiBaseUtils.GetChildSprite(m_Perk.m_Parent, "Meter_Div3").Widget;
        m_Perk.m_PrevScale  = -1;

        PerkInfo perk = LocalPlayer.Owner.GadgetsComponent.Perk;

        m_Perk.m_Settings = PerkSettingsManager.Instance.Get(ppi.EquipList.Perk);
        if (!perk.IsEmpty())
        {
            GUIBase_Sprite s = GuiBaseUtils.GetChildSprite(m_Perk.m_Parent, "GadgetIcon");
            s.Widget.CopyMaterialSettings(m_Perk.m_Settings.HudWidget);
            m_Perk.m_Parent.Show(true, true);
            UpdateGuiGadgetBar(m_Perk, perk.Timer, m_Perk.m_Settings.Timer, 0, 0, perk.IsSprint());
        }
        else
        {
            m_Perk.m_Parent.Show(false, true);
        }
        //m_Perk.SetAllTransparent(false);

        m_SelIndex        = SelectFirst();
        m_SelectionWidget = m_LayoutMain.GetWidget("GadgetSelection_Sprite", true);
        ShowSelection(true);

        m_Initialised = true;
        UpdateControlsPosition();

        RegisterFloatingFireInteractions();
    }
Exemple #21
0
    // ---------------------------------------------------------------------------------------------------------------------------------
    //                      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);
    }
    // ------
    GUIBase_Widget PrepareWidget(GUIBase_Layout layout, string name)
    {
        GUIBase_Widget tmpWidget = layout.GetWidget(name);

        return(tmpWidget);
    }