Example #1
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;
        }
    }
Example #2
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;
    }
Example #3
0
 // we need to keep this for back-compatibility
 // remove it later
 public void ShowLayout(GUIBase_Layout layout, bool show)
 {
     if (layout != null)
     {
         layout.Show(show);
     }
 }
Example #4
0
    //---------------------------------------------------------------------------------------------
    //
    // FindLayoutForWidget
    //
    // Finds layout where widget is laying (GUIBase_Widget should be child of GUIBase_Layout or of another GUIBase_Widget)
    //
    //---------------------------------------------------------------------------------------------
    public static GUIBase_Layout FindLayoutForWidget(GUIBase_Widget widget)
    {
        if (widget)
        {
            // Iterate over all layouts from scene
            GUIBase_Layout[] layouts = Object.FindObjectsOfType(typeof(GUIBase_Layout)) as GUIBase_Layout[];

            foreach (GUIBase_Layout l in layouts)
            {
                // Enumerate widgets of this layout
                GUIBase_Widget[] children = l.GetComponentsInChildren <GUIBase_Widget>();

                foreach (GUIBase_Widget w in children)
                {
                    if (w == widget)
                    {
                        return(l);
                    }
                }
            }

            Transform parent = widget.transform.parent;
            while (parent != null)
            {
                GUIBase_Layout layout = parent.GetComponent <GUIBase_Layout>();
                if (layout != null)
                {
                    return(layout);
                }
                parent = parent.parent;
            }
        }

        return(null);
    }
Example #5
0
    // =========================================================================================================================
    // === public interface ====================================================================================================
    public void GUIView_Init(GUIBase_Layout inView, GUIBase_List inList)
    {
        m_View  = inView;
        m_Table = GuiBaseUtils.GetControl <GUIBase_List>(m_View, "Table");

        InitGuiLines(inList);
    }
    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;
        }
    }
    IEnumerator ShowHelp_Coroutine(GUIBase_Layout layout)
    {
        GUIBase_Button[] buttons = layout.GetComponentsInChildren <GUIBase_Button>();
        System.Array.Sort(buttons, (x, y) => { return(string.Compare(x.name, y.name)); });

        foreach (var button in buttons)
        {
            button.Widget.SetFadeAlpha(0.0f, true);
        }

        yield return(new WaitForSeconds(m_FirstHelpDelay));

        foreach (var button in buttons)
        {
            if (button.Widget.Visible == false)
            {
                continue;
            }

            if (m_ShowHelpSound != null)
            {
                PlayOneShotWithFade(m_ShowHelpSound, 0.05f);
            }

            while (button.Widget.FadeAlpha < 1.0f)
            {
                button.Widget.SetFadeAlpha(button.Widget.FadeAlpha + Time.deltaTime / m_FadeInHelpTime, true);

                yield return(new WaitForEndOfFrame());
            }

            yield return(new WaitForSeconds(m_NextHelpDelay));
        }
    }
Example #8
0
    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 void OnViewInit()
    {
        base.OnViewInit();

        m_Button_Overall = PrepareButton("01_Button", null, OnSelectLeaderBoard, true, true);
        m_Button_Friends = PrepareButton("04_Button", null, OnSelectLeaderBoard, true, true);

        m_Button_Day  = PrepareButton("02_Button", null, OnSelectLeaderBoard, true, true);
        m_Button_Week = PrepareButton("03_Button", null, OnSelectLeaderBoard, true, true);

        m_LeaderBoard_Overall = new LeaderBoard("Default", 8);
        m_LeaderBoard_Day     = new LeaderBoard("Daily", 8);
        m_LeaderBoard_Week    = new LeaderBoard("Default", 8);
        m_LeaderBoard_Friends = new LeaderBoardFriends("Default", 8);

//      m_LeaderBoard_Overall = new LeaderBoard("Overall", 8);
//		m_LeaderBoard_Day     = new LeaderBoard("Day"    , 8);
//      m_LeaderBoard_Week    = new LeaderBoard("Week"   , 8);
//		m_LeaderBoard_Friends = new LeaderBoard("Friends", 8);

        // initialize view
        {
            GUIBase_Layout l    = GetLayout("MainMenu", "LeaderBoards_Layout");
            GUIBase_List   list = GetWidget(l, "Table").GetComponent <GUIBase_List>();

            m_LeaderBoardView = gameObject.AddComponent <LeaderBoardListView>();
            m_LeaderBoardView.GUIView_Init(l, list);
        }
    }
Example #10
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);
    }
    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);
    }
Example #12
0
    // ---------
    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);
    }
Example #13
0
 //---------------------------------------------------------
 public static void RegisterFocusDelegate(GUIBase_Layout layout, GUIBase_Layout.FocusDelegate d)
 {
     if (layout)
     {
         layout.RegisterFocusDelegate(d);
     }
 }
Example #14
0
 public void InitGui(GUIBase_Layout layout, GUIBase_Widget widget)
 {
     m_RootWidget = widget;
     m_NameLabel  = GuiBaseUtils.GetChildLabel(widget, "Label");
     m_PerkSprite = GuiBaseUtils.GetChildSprite(widget, "Perk_Sprite");
     m_LockSprite = GuiBaseUtils.GetChildSprite(widget, "Lock_Sprite");
     m_EmptyLabel = GuiBaseUtils.GetChildLabel(widget, "Empty_Label");
 }
Example #15
0
        public virtual void Initialize(GUIBase_Layout layout, string rootName, float fadeInTime, float fadeOutTime)
        {
            m_Root           = GuiBaseUtils.FindLayoutWidget <GUIBase_Widget>(layout, rootName);
            m_Root.FadeAlpha = Alpha;

            m_FadeInTime  = fadeInTime;
            m_FadeOutTime = fadeOutTime;
        }
Example #16
0
    // =========================================================================================================================
    // === public interface ====================================================================================================
    public void GUIView_Init(GUIBase_Layout inView, GUIBase_List inList, GUIBase_Button inPrev, GUIBase_Button inNext)
    {
        m_View       = inView;
        m_PrevButton = inPrev;
        m_NextButton = inNext;

        InitGuiLines(inList);
    }
Example #17
0
    // ==================================================================================================
    // === internal GUI functions =======================================================================
    internal void InitHealthBar()
    {
        m_Pivot       = MFGuiManager.Instance.GetPivot("HealthBar");
        m_Layout      = GuiBaseUtils.GetLayout("HealthBar_Layout", m_Pivot);
        m_ProgressBar = GuiBaseUtils.PrepareProgressBar(m_Layout, "GUIBase_ProgressBar");

        m_Initialised = true;
    }
Example #18
0
 //---------------------------------------------------------
 public void RegisterLayout(GUIBase_Layout layout)
 {
     if (m_Layouts.Contains(layout) == true)
     {
         return;
     }
     m_Layouts.Add(layout);
 }
Example #19
0
    // ---------------------------------------------------------------------------------------------------------------------------------
    //                      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);
    }
Example #20
0
    //---------------------------------------------------------
    public static GUIBase_ProgressBar PrepareProgressBar(GUIBase_Layout layout, string name)
    {
        GUIBase_ProgressBar control = GetControl <GUIBase_ProgressBar>(layout, name);

        if (control == null)
        {
            Debug.LogError("Can't find progressBar '" + name + "'");
        }
        return(control);
    }
Example #21
0
    //---------------------------------------------------------
    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);
    }
Example #22
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);
    }
Example #23
0
    //---------------------------------------------------------
    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);
    }
Example #24
0
    //---------------------------------------------------------
    public static GUIBase_Label PrepareLabel(GUIBase_Layout layout, string name)
    {
        GUIBase_Label control = GetControl <GUIBase_Label>(layout, name);

        if (control == null)
        {
            Debug.LogWarning("Can't find label '" + name + "'");
        }
        return(control);
    }
Example #25
0
    //---------------------------------------------------------
    public static GUIBase_Sprite PrepareSprite(GUIBase_Layout layout, string name)
    {
        GUIBase_Sprite control = GetControl <GUIBase_Sprite>(layout, name);

        if (control == null)
        {
            Debug.LogWarning("Can't find sprite '" + name + "'");
        }
        return(control);
    }
Example #26
0
    //---------------------------------------------------------
    public static GUIBase_Button GetButton(GUIBase_Layout layout, string buttonName)
    {
        GUIBase_Button control = GetControl <GUIBase_Button>(layout, buttonName);

        if (control == null)
        {
            Debug.LogWarning("Can't find button '" + buttonName + "'");
        }
        return(control);
    }
Example #27
0
        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_Label>(m_Root, TEXT_LABEL);
            m_ShowInfo = GuiBaseUtils.GetChild <GUIBase_Button>(m_Root, SHOWINFO_BUTTON);

            m_ShowInfo.RegisterTouchDelegate2(OnButtonPressed);
        }
Example #28
0
    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);
    }
Example #29
0
    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);
    }
Example #30
0
    protected void ButtonDisable(GUIBase_Layout inLayout, string inName, bool inDisable)
    {
        GUIBase_Button button = GetWidget(inLayout, inName).GetComponent <GUIBase_Button>();

        if (button == null)
        {
            throw new MFScreenInitException("Widget [ " + inName + " } dosn't have button component");
        }

        button.SetDisabled(inDisable);
    }