//--------------------------------------------------------------------------------------------------------------
        public ChartLine(GUIBase_Widget inLineWidget)
        {
            m_LineWidget = inLineWidget;

            GUIBase_Label[]       labels  = m_LineWidget.GetComponentsInChildren <GUIBase_Label>();
            GUIBase_MultiSprite[] sprites = m_LineWidget.GetComponentsInChildren <GUIBase_MultiSprite>();

            foreach (GUIBase_Label l in labels)
            {
                if (l.name == "Stand_Enum")
                {
                    m_OrderLabel = l;
                }
                else if (l.name == "RankNumber")
                {
                    m_RankLabel = l;
                }
                else if (l.name == "Name")
                {
                    m_NameLabel = l;
                }
                else if (l.name == "Score_Enum")
                {
                    m_ScoreLabel = l;
                }
                else if (l.name == "Kills_Enum")
                {
                    m_KillsLabel = l;
                }
                else if (l.name == "Deads_Enum")
                {
                    m_DeadsLabel = l;
                }
            }

            foreach (GUIBase_MultiSprite s in sprites)
            {
                if (s.name == "RankPic")
                {
                    m_RankSprite = s;
                }
                else if (s.name == "PlatformPic")
                {
                    m_PlatformSprite = s;
                }
            }

            m_FriendIcon = GuiBaseUtils.GetChild <GUIBase_Widget>(m_LineWidget, "FriendIcon");
        }
    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);
    }
    protected override void OnViewShow()
    {
        base.OnViewShow();

        m_Minimized = false;

        var ppi = PPIManager.Instance.GetLocalPPI();

        if (ppi != null && m_NextSpawn_Dummy != null)
        {
            HSLColor color = ZoneControlFlag.Colors[ppi.Team];
            color.L *= 0.8f;

            GUIBase_Sprite[] sprites = m_NextSpawn_Dummy.GetComponentsInChildren <GUIBase_Sprite>();
            foreach (var sprite in sprites)
            {
                sprite.Widget.Color = color;
            }
        }

        UpdateControlsVisibility();
        UpdateButtonsState();
        UpdateZoneControlState();
        UpdateDeathMatchState();
    }
    void UpdateDecoration(string name, int value)
    {
        GUIBase_Widget decor = GetWidget(name);

        if (decor == null)
        {
            return;
        }

        GUIBase_Widget[] widgets = decor.GetComponentsInChildren <GUIBase_Widget>();
        foreach (GUIBase_Widget widget in widgets)
        {
            if (widget.name.StartsWith(ITEM_PREFIX) == false)
            {
                continue;
            }

            int idx;
            if (int.TryParse(widget.name.Substring(ITEM_PREFIX.Length), out idx) == false)
            {
                continue;
            }

            widget.Show(idx == value, true);
        }
    }
Beispiel #5
0
        public Table(GUIBase_Widget inRootWidget)
        {
            m_RootWidget = inRootWidget;

            GUIBase_Label[]       labels  = m_RootWidget.GetComponentsInChildren <GUIBase_Label>();
            GUIBase_MultiSprite[] sprites = m_RootWidget.GetComponentsInChildren <GUIBase_MultiSprite>();

            foreach (GUIBase_Label l in labels)
            {
                if (l.name == "RankNum")
                {
                    m_RankLabel = l;
                }
                else if (l.name == "Name")
                {
                    m_NameLabel = l;
                }
                else if (l.name == "KilledMe")
                {
                    m_KilledMeLabel = l;
                }
                else if (l.name == "KilledByMe")
                {
                    m_KilledByMeLabel = l;
                }
            }

            foreach (GUIBase_MultiSprite s in sprites)
            {
                if (s.name == "RankPic")
                {
                    m_RankSprite = s;
                }
            }

            m_FriendIcon = GuiBaseUtils.GetChild <GUIBase_Widget>(m_RootWidget, "FriendIcon");
        }
    void SetWidgetInitialVisibility(GUIBase_Widget widget, bool recursive, bool state)
    {
        if (widget == null)
        {
            return;
        }

        widget.m_VisibleOnLayoutShow = state;

        if (recursive == false)
        {
            return;
        }

        GUIBase_Widget[] children = widget.GetComponentsInChildren <GUIBase_Widget>();
        foreach (var child in children)
        {
            child.m_VisibleOnLayoutShow = state;
        }
    }
        // ------
        public void SetAllTransparent(bool transparent)
        {
            float alpha = transparent ? 0.1f : 1.0f;

            m_Button.Widget.FadeAlpha = alpha;
            m_GadgetIcon.FadeAlpha    = alpha;
            m_Progress.FadeAlpha      = alpha;
            m_BarBck.FadeAlpha        = alpha;
            GUIBase_Widget[] widgets = m_Div2.GetComponentsInChildren <GUIBase_Widget>();
            foreach (GUIBase_Widget w in widgets)
            {
                w.FadeAlpha = alpha;
            }
            m_Div2.FadeAlpha = alpha;
            widgets          = m_Div3.GetComponentsInChildren <GUIBase_Widget>();
            foreach (GUIBase_Widget w in widgets)
            {
                w.FadeAlpha = alpha;
            }
            m_Div3.FadeAlpha   = alpha;
            m_Parent.FadeAlpha = alpha;
            m_Button.SetDisabled(transparent);
            m_IsTransparent = transparent;
        }
    void SetHintVisibility(E_Hint hintId, bool state)
    {
        if (state == true)
        {
            if (GuiOptions.showHints == false)
            {
                return;
            }
            if (BuildInfo.Version.Stage == BuildInfo.Stage.Beta)
            {
                return;
            }
        }

        HintInfo info = GetHintInfo(hintId);

        if (info == null)
        {
            return;
        }
        if (info.HintButton == null)
        {
            return;
        }

        info.HintButton.Widget.Show(state, true);

        if (state == true)
        {
            if (m_HintSound != null)
            {
                MFGuiManager.Instance.PlayOneShot(m_HintSound);
            }

            m_CurrentHint = hintId;

            GUIBase_Widget widget = info.HintButton.Widget;
            Transform      trans  = widget.transform;
            Vector3        origin = widget.GetOrigPos();

            origin.y -= info.Offset.y;

            // animate transparency
            Tweener.TweenFromTo(widget,
                                "m_FadeAlpha",
                                0.0f,
                                1.0f,
                                0.2f,
                                Tween.Easing.Quad.EaseIn,
                                (tween, finished) =>
            {
                GUIBase_Widget[] children = widget.GetComponentsInChildren <GUIBase_Widget>();
                foreach (var child in children)
                {
                    child.FadeAlpha = widget.FadeAlpha;
                }
            });

            // animate position
            Tweener.TweenFromTo(this,
                                "m_HintTweenY",
                                origin.y + 25.0f,
                                origin.y,
                                0.15f,
                                Tween.Easing.Sine.EaseInOut,
                                (tween, finished) =>
            {
                trans.position = new Vector3(trans.position.x, m_HintTweenY, trans.position.z);

                if (finished == true)
                {
                    Tweener.TweenFromTo(this,
                                        "m_HintTweenY",
                                        origin.y + 5.0f,
                                        origin.y,
                                        0.15f,
                                        Tween.Easing.Sine.EaseInOut,
                                        (tween1, finished1) => { trans.position = new Vector3(trans.position.x, m_HintTweenY, trans.position.z); });
                }
            });
        }
        else if (m_CurrentHint == hintId)
        {
            m_PreviousHint = m_CurrentHint;
            m_CurrentHint  = E_Hint.Max;

            Tweener.StopTweens(true);
        }
    }