Esempio n. 1
0
    void Start()
    {
        tabList.AddRange(GetComponentsInChildren <TabButton>());

        float anchorStart = 1;

        if (startAxis == E_Axis.Horizontal)
        {
            anchorStart = 0;
        }
        else
        {
            anchorStart = 1;
        }
        float anchorinterval = (float)1 / transform.childCount;

        for (int index = 0; index < transform.childCount; index++)
        {
            RectTransform temp = tabList[index].GetComponent <RectTransform>();
            tabList[index].parentManager = this;
            if (startAxis == E_Axis.Horizontal)
            {
                temp.anchorMin  = new Vector2(anchorStart, 0);
                temp.anchorMax  = new Vector2(anchorStart + anchorinterval, 1);
                temp.offsetMax -= nonSelectedOffset;
                anchorStart    += anchorinterval;
            }
            else
            {
                temp.anchorMin  = new Vector2(0, anchorStart - anchorinterval);
                temp.anchorMax  = new Vector2(1, anchorStart);
                temp.offsetMin -= nonSelectedOffset;
                anchorStart    -= anchorinterval;
            }
        }
        if (tabList.Count > 0)
        {
            selectedTab = tabList[0];
            ShowPage(0);
            if (startAxis == E_Axis.Horizontal)
            {
                selectedTab.GetComponent <RectTransform>().offsetMax += nonSelectedOffset;
            }
            else
            {
                selectedTab.GetComponent <RectTransform>().offsetMin += nonSelectedOffset;
            }
            selectedTab.Clicked();
        }
    }
Esempio n. 2
0
        /// <summary>
        /// A tab button was clicked.
        /// </summary>
        /// <param name="buttonText"></param>
        public void OnTabButtonClicked(TabButton tabButton)
        {
            // determine action by the button text
            switch (tabButton.ButtonText)
            {
            case "Cancel":

                // Call the CancelButton_Click event
                CancelButton_Click(this, null);

                // required
                break;
            }
        }
Esempio n. 3
0
    // 难度等级标签页切换
    void OnLevelTabChange(TabButton button)
    {
        if (button.name == "JianDan")
        {
            Diffcult = 1;
        }
        else if (button.name == "KunNan")
        {
            Diffcult = 2;
        }
        else if (button.name == "TiaoZhan")
        {
            Diffcult = 3;
        }

        UpdateTabInfo();

        Tab_SceneClass pSceneClass = TableManager.GetSceneClassByID(CopySceneId, 0);

        if (pSceneClass == null)
        {
            return;
        }

        Tab_CopyScene pCopyScene = TableManager.GetCopySceneByID(pSceneClass.CopySceneID, 0);

        if (pCopyScene == null)
        {
            return;
        }

        Tab_CopySceneRule pCopySceneRule;

        if (CopyMode == 1)
        {
            pCopySceneRule = TableManager.GetCopySceneRuleByID(pCopyScene.GetRulebyIndex(Diffcult - 1), 0);
        }
        else
        {
            pCopySceneRule = TableManager.GetCopySceneRuleByID(pCopyScene.GetRuleTeambyIndex(Diffcult - 1), 0);
        }
        if (pCopySceneRule == null)
        {
            return;
        }
        if (pCopySceneRule.Level > Singleton <ObjManager> .GetInstance().MainPlayer.BaseAttr.Level)
        {
            Singleton <ObjManager> .GetInstance().MainPlayer.SendNoticMsg(false, "#{1351}", pCopySceneRule.Level);
        }
    }
Esempio n. 4
0
 public void Register(TabButton button)
 {
     if (_buttons == null)
     {
         _buttons = new List <TabButton>();
     }
     if (!_buttons.Contains(button))
     {
         _buttons.Add(button);
         button.Clicked      += OnClickedButton;
         button.PointerEnter += OnPointerEnterButton;
         button.PointerExit  += OnPointerExitButton;
     }
 }
        /// <summary>
        /// Get the button associated with given form
        /// </summary>
        /// <param name="form">form</param>
        /// <returns>button</returns>
        private TabButton GetButton(Form form)
        {
            for (int index = ButtonsCount - 1; index >= 0; index--)
            {
                TabButton button = GetButtonAt(index);

                if (button.Page == form)
                {
                    return(button);
                }
            }

            return(null);
        }
Esempio n. 6
0
 protected void OnEnable()
 {
     //Initialize all tabs to an unpicked state
     foreach (TabPair tp in TabCollection)
     {
         SetTabState(tp.TabButton, false);
     }
     //Pick the default tab
     if (TabCollection.Length > 0)
     {
         CurrentTab = DefaultTab;
         SetTabState(CurrentTab, true);
     }
 }
Esempio n. 7
0
 GameObject DoChangeTab(TabButton curTab)
 {
     if (null != curHighLightTab)
     {
         curHighLightTab.HighLightTab(false);
     }
     curTab.HighLightTab(true);
     curHighLightTab = curTab;
     if (null != delTabChanged)
     {
         delTabChanged(curTab);
     }
     return(curHighLightTab.GetComponent <TabButton>().targetObject);
 }
Esempio n. 8
0
    public void OnTabClicked(TabButton curTab)
    {
        if (!m_bEnableClick)
        {
            return;
        }

        if (curHighLightTab == curTab)
        {
            #region
            //策划需求双击主界面上任务界面的任务按钮和组队按钮,分别打开任务界面和组队界面。
            if (curTab != null)
            {
                switch (curTab.name)
                {
                case "Tab1-Mission":
                    MissionLogLogic.IsOpenFromMissionDialog = true;
                    if (PlayerFrameLogic.Instance() != null)
                    {
                        PlayerFrameLogic.Instance().PlayerFrameHeadOnClick();
                    }
                    UIManager.ShowUI(UIInfo.MissionLogRoot);
                    break;

                case "Tab2-Team":
                    RelationLogic.m_OpenWay = RelationLogic.OPEN_WAY.MISSION_TEAM;
                    if (GameManager.gameManager.PlayerDataPool.TeamInfo != null && Games.GlobeDefine.GlobeVar.INVALID_ID != GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID)
                    {
                        RelationLogic.OpenTeamWindow(RelationTeamWindow.TeamTab.TeamTab_TeamInfo);
                    }
                    else
                    {
                        RelationLogic.OpenTeamWindow(RelationTeamWindow.TeamTab.TeamTab_NearTeam);
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion
            return;
        }
        if (RelationFriendWindow.Instance() != null && RelationFriendWindow.Instance().m_OtherWindows.activeSelf)
        {
            RelationFriendWindow.Instance().m_OtherWindows.SetActive(false);
        }
        DoChangeTab(curTab);
    }
Esempio n. 9
0
    void OnTabChange(TabButton button)
    {
        // if (button.name == "Button1-Award")
        if (button.name == "Button1_Denglu")
        {
            UpdateTitles(0);
            // ShowNewServerAward();
        }
        else if (button.name == "Button2_Meiri")
        //else if(button.name == "Button09-AwardSign")
        {
            UpdateTitles(1);
            //ShowEveryDaySignInAward();
        }
        else if (button.name == "Button3_Tiandaochouqin")
        {
            UpdateTitles(2);
            //ShowTianDao();
        }
        else if (button.name == "Button2-Award")
        {
            ShowOnlineAward();
        }
        else if (button.name == "Button3-Award")
        {
            ShowDayAward();
        }
        else if (button.name == "Button4-Award")
        {
            ShowNewOnlineAward();
        }
        else if (button.name == "Button7-Jihuo-Award")
        {
            ShowCDkey();
        }
        else if (button.name == "Button8-Award")
        {
            Show7DayNewOnlineAward();
        }

        else if (button.name == "Button9-Pingjia")
        {
            if (null != m_ReviewNumTip)
            {
                m_ReviewNumTip.SetActive(false);
                PlayerPreferenceData.ClientClickReview = 1;
            }
        }
    }
Esempio n. 10
0
    void OnDianQuanTabClick(TabButton value)
    {
        if (value.name == "timelimit")
        {
            CurShopType = ShopTypeEnum.TimeLimitShop;
        }
        else if (value.name == "medical")
        {
            CurShopType = ShopTypeEnum.DianQuanShop;
            m_pageList  = pageListForDianQuanShop;
            m_curShopID = DIANQUAN_SHOP_ID;

            //ShowPage(0);
        }
    }
Esempio n. 11
0
        public void MoveTabsTo(DockedTabControl target)
        {
            var children = TabStrip.Children.ToArray(); // copy because collection will be modified

            foreach (ControlBase child in children)
            {
                TabButton button = child as TabButton;
                if (button == null)
                {
                    continue;
                }
                target.AddPage(button);
            }
            Invalidate();
        }
Esempio n. 12
0
    public void OnTabSelect(TabButton tab)
    {
        this.selectedTab = tab;
        this.ResetTabs();
        tab.sprite.color = TabPanel.activeColor;

        int index = tab.transform.GetSiblingIndex();

        for (int i = 0; i < this.pages.Count; i++)
        {
            this.pages[i].SetActive(i == index);
        }

        GameLogger.LogMessage($"Selected tab {this.pages[index].name}", "TabPanel");
    }
 void TabOnClick(TabButton value)
 {
     if (value.name == "Tab1-Mission")
     {
         SwitchToMission();
     }
     else if (value.name == "Tab2-Team")
     {
         SwitchToTeam();
     }
     else if (value.name == "Tab1-Mubiao")
     {
         SwitchToStarCondition();
     }
 }
Esempio n. 14
0
    void TabChangedDelegate(TabButton curButton)
    {
        int selectedChapterIdx = -1;

        if (int.TryParse(curButton.name, out selectedChapterIdx))
        {
            currentSelectedChapterIdx = selectedChapterIdx;
            UpdateLevels();
        }

        if (TabBg != null)
        {
            TabBg.SetActive(false);
        }
    }
Esempio n. 15
0
 void OnTabChange(TabButton button)
 {
     if (button.name == "Button1_Denglu")
     {
         UpdateTitles(0);
     }
     else if (button.name == "Button2_Meiri")
     {
         UpdateTitles(1);
     }
     else if (button.name == "Button3_Tiandaochouqin")
     {
         UpdateTitles(2);
     }
 }
Esempio n. 16
0
 public virtual void OnTabSelected(TabButton button)
 {
     if (active == button)
     {
         return;
     }
     else if (active)
     {
         active.Exit();
         active.background.color = tabIdle;
     }
     active = button;
     active.background.color = tabActive;
     active.Select();
 }
Esempio n. 17
0
    public override void Start()
    {
        base.Start();
        Canvas c = GameObject.Find("CanvasUI").GetComponent <Canvas>();

        vp = Instantiate(victoryPanel, c.transform);

        victoryText = vp.transform.Find("Victory").GetComponent <Text>();
        vp.gameObject.SetActive(false);
        grid = FindObjectOfType <Grid>();

        tabButton          = gameObject.AddComponent <TabButton>();
        tabButton.tabID    = 3;
        tabButton.tabGroup = FindObjectOfType <TabGroup>();
    }
    public void OnTabSelected(TabButton button)
    {
        Debug.Log(button.name);
        ResetButtons();

        if (selectedTab != null)
        {
            Debug.Log("deselcting selected tab");
            selectedTab.Deselect();
            button.GetComponent <Image>().sprite = idleImg;
        }
        selectedTab = button;
        button.Select();
        button.GetComponent <Image>().sprite = selectedImg;
    }
Esempio n. 19
0
    public void RegisterTab(TabButton button)
    {
        if (TabButtons == null)
        {
            TabButtons = new List <TabButton>();
        }

        if (TabFields == null)
        {
            TabFields = new List <GameObject>();
        }
        TabButtons.Add(button);
        TabFields.Add(button.MyTabField);
        button.backgroundImage.color = IdleColor;
    }
        /// <summary>
        /// Checks if this panel contains give panel
        /// </summary>
        /// <param name="panel">panel to check</param>
        /// <returns>true if this panel contains given pane</returns>
        public bool ContainsPanel(AutoHidePanel panel)
        {
            for (int index = ButtonsCount - 1; index >= 0; index--)
            {
                TabButton button = GetButtonAt(index);

                FormsTabbedView view = HierarchyUtility.GetTabbedView((Form)button.Page);
                if (view.Parent == panel)
                {
                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="form">form</param>
        /// <param name="allowedDock">allowed dock mode</param>
        /// <param name="identifier">identifier of the form info</param>
        internal DockableFormInfo(Form form, zAllowedDock allowedDock, Guid identifier)
        {
            if (identifier == Guid.Empty)
            {
                throw new ArgumentException("Err");
            }

            _identifier                = identifier;
            _dockableForm              = form;
            _allowedDock               = allowedDock;
            _button                    = new TabButton(form);
            _button.ExplicitDisposing += OnButtonDisposing;

            form.GotFocus += OnFormGotFocus;
        }
Esempio n. 22
0
    void OnTabChanged(TabButton curButton)
    {
        for (int i = 0; i < m_TeamMemberSortSprite.Length; i++)
        {
            m_TeamMemberSortSprite[i].gameObject.SetActive(false);
        }
        for (int i = 0; i < m_AroundPlayerSortSprite.Length; i++)
        {
            m_AroundPlayerSortSprite[i].gameObject.SetActive(false);
        }
        for (int i = 0; i < m_AroundTeamSortSprite.Length; i++)
        {
            m_AroundTeamSortSprite[i].gameObject.SetActive(false);
        }
        if (null == Singleton <ObjManager> .GetInstance().MainPlayer)
        {
            Module.Log.LogModule.ErrorLog("OnTabChanged:: MainPlayer is null");
            return;
        }
        GameObject curTab = m_TabController.GetHighlightTab().gameObject;

        if (null == curTab)
        {
            Module.Log.LogModule.ErrorLog("OnTabChanged:: curTab is null");
            return;
        }

        if (curTab.name == "0")
        {
            UpdateTeamInfo(Singleton <ObjManager> .GetInstance().MainPlayer.GUID);
        }
        else if (curTab.name == "1")
        {
            DestroyPartnerFakeObj();
            Utils.CleanGrid(m_AroundPlayerGrid);
            SelectPlayerListItem(null);
            // 服务器如果发现周围没有玩家就不会回包,所以先清空人数
            m_AroundPlayerSumLabel.text = "0";
            ReqNearbyPlayer();
        }
        else if (curTab.name == "2")
        {
            DestroyPartnerFakeObj();
            Utils.CleanGrid(m_AroundTeamGrid);
            SelectPlayerListItem(null);
            ReqNearbyTeam();
        }
    }
        private void CreateFrameTab()
        {
            frameTapCount = 0;
            TabButton button = new TabButton()
            {
                Text = "Frame",
            };

            View view = new View
            {
                Layout = new LinearLayout()
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    CellPadding       = new Size2D(30, 30),
                },
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            View image = new View
            {
                BackgroundColor = Color.White,
                Size            = new Size(200, 200),

                BorderlineWidth = 5f,
                BorderlineColor = Color.Red,
            };

            TextLabel label = new TextLabel
            {
                Text      = "tap the frame!",
                PointSize = 8,
            };

            view.Add(image);
            view.Add(label);

            tabView.AddTab(button, view);

            frameTapDetector = new TapGestureDetector();
            frameTapDetector.Attach(image);
            frameTapDetector.Detected += (obj, e) =>
            {
                ++frameTapCount;
                label.Text = frameTapCount + " taps so far!";
            };
        }
Esempio n. 24
0
 public override void Start()
 {
     base.Start();
     if (PlayerType == PlayerTypes.AIPlayer)
     {
         this.gameObject.AddComponent <AIMercenary>();
         Animator animator = this.gameObject.AddComponent <Animator>();
         animator.runtimeAnimatorController = (RuntimeAnimatorController)Resources.Load("AIMercenaryStates", typeof(RuntimeAnimatorController));
     }
     else
     {
         tabButton          = gameObject.AddComponent <TabButton>();
         tabButton.tabID    = 5;
         tabButton.tabGroup = FindObjectOfType <TabGroup>();
     }
 }
Esempio n. 25
0
 private void OnNumTabChange(TabButton button)
 {
     if (button.name == "DanRen")
     {
         CopyScenePlayerMode = GameDefine_Globe.CopyScene_PlayType.SINGLE;
     }
     else if (button.name == "DuiWu")
     {
         CopyScenePlayerMode = GameDefine_Globe.CopyScene_PlayType.MULTIPLE;
         UpdateButtonAutoTeamLabel();
     }
     UpdateInfo();
     UpdateButton();
     InitSweepCangJingGeItem();
     HuodongRedPoint();
 }
Esempio n. 26
0
    private void SwapObjects(TabButton button)
    {
        int index = button.transform.GetSiblingIndex();

        for (int i = 0; i < objectsToSwap.Count; i++)
        {
            if (i == index)
            {
                objectsToSwap[i].SetActive(true);
            }
            else
            {
                objectsToSwap[i].SetActive(false);
            }
        }
    }
Esempio n. 27
0
    private void OpenTabMenu(TabButton tab)
    {
        int index = tab.transform.GetSiblingIndex();

        _tabMenus[index].SetActive(true);
        if (_animateComponents)
        {
            _tabMenus[index].transform.DOScale(1, _tweenTime)
            .SetEase(Ease.OutBack)
            .SetUpdate(true);
        }
        else
        {
            _tabMenus[index].transform.localScale = Vector3.one;
        }
    }
Esempio n. 28
0
        public void TabButtonConstructor()
        {
            tlog.Debug(tag, $"TabButtonConstructor START");

            TabButtonStyle style = new TabButtonStyle()
            {
                BackgroundColor = Color.Cyan,
            };
            var testingTarget = new TabButton(style);

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <TabButton>(testingTarget, "Should return TabButton instance.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"TabButtonConstructor END (OK)");
        }
Esempio n. 29
0
        public void AddTabButton(TabButton tabButton)
        {
            _tabButtons.Add(tabButton);
            tabButton.AddOnButtonSelectEventListener(OnButtonSelectEventListener);

            tabButton.SetRoot(_root);
            _activeButton = tabButton;

            foreach (var button in _tabButtons)
            {
                if (button != tabButton)
                {
                    button.Unselect();
                }
            }
        }
Esempio n. 30
0
        void Start()
        {
            if (toggle == null)
            {
                toggle = GetComponent <TabButton>();
            }

            if (War.isGameing)
            {
                SetValue(toggle.IsSelect);
            }
            else
            {
                War.signal.sGameBegin += OnWarStarted;
            }
        }
Esempio n. 31
0
        public void Add(string text, Form f)
        {
            TabButton but = new TabButton();
            //			but.y = 2;

            TabPage panel = new TabPage();

            Control c = f.Controls[0];

            c.Parent = null;

            panel.Controls.Add(c);

            but.panel = panel;
            but.panel.text = f.Text; //text;
            this.Controls.Add(panel);
            //panel.Visible = true;
            Activate(but);

            panel.tabControl = this;
            panel.Location = new System.Drawing.Point(2, 24);
            panel.Size = new System.Drawing.Size(this.Width-4, this.Height - 26);

            this.buttonList.Add(but);
            if (this.selected >= 0)
            {
                ResizeButton(this.selected, false);
            }
            this.selected = this.buttonList.Count - 1;
            ResizeButton(this.selected, true);
            PlaceButtons();
            Invalidate();

            this.cxButton1.Enabled = this.SelectedTab.IsCloseable;

            if (null != this.SelectedIndexChanged) this.SelectedIndexChanged(this, null);

            panel.Activate();
        }
Esempio n. 32
0
        private void Activate(TabButton b)
        {
            foreach (TabButton b1 in this.buttonList)
            {
                if (b == b1)
                {
                    b1.panel.Visible = true;
                    b1.panel.Activate();
                }
                else
                {
                    b1.panel.Visible = false;
                }

            }
        }
Esempio n. 33
0
 public void OnSelected(TabButton tabButton)
 {
     OnSelected((int)tabButton);
 }
Esempio n. 34
0
 public void SetTabButtonEnable(TabButton tabButton)
 {
     buttons[(int)tabButton].gameObject.SetActive(true);
 }