예제 #1
0
 public void SetSelected2P(LtButton ltButton)
 {
     if (ltButton)
     {
         currentSelectable2P = ltButton;
     }
 }
예제 #2
0
        //Update更新
        public virtual void InputUpdate(UIFormLogic ui)
        {
            //Log.Info("{0} {1}", _IsCtrl, StartSelect1P);
            if (!_IsCtrl)
            {
                return;
            }

            if (StartSelect1P != null)
            {
                currentSelectable1P = StartSelect1P;
                SaveSelect1P        = StartSelect1P;
                StartSelect1P       = null;
            }

            if (StartSelect2P != null)
            {
                currentSelectable2P = StartSelect2P;
                SaveSelect2P        = StartSelect2P;
                StartSelect2P       = null;
            }

            Ctrl1P();
            OnBack();
            Ctrl2P();
        }
예제 #3
0
        /// <summary>
        /// 设置当前页面的默认焦点
        /// </summary>
        /// <param UIName="buttonName1P"> 1P的默认选择的名字 </param>
        /// <param UIName="buttonName2P"> 2P的默认选择的名字 </param>
        /// <param UIName="isSaveFocusePos"> 是否保存当前页面按钮光标位置 </param>
        public void ButtonDefaultFocus(string buttonName1P, string buttonName2P, bool isSaveFocusePos = true)
        {
            LtButton button    = gameObject.GetChildComponet <LtButton>(buttonName1P);
            LtButton button_2p = null;

            if (buttonName2P != null)
            {
                button_2p = gameObject.GetChildComponet <LtButton>(buttonName2P);
            }

            ButtonDefaultFocus(button, button_2p, isSaveFocusePos);
        }
예제 #4
0
        /// <summary>
        /// 保存焦点
        /// </summary>
        /// <param UIName="uiForm"></param>
        /// <param UIName="button"></param>
        internal void SaveFocus(UIFormLogic uiForm, LtButton button, LtButton button_2P)
        {
            if (!_UIFormCurrentFocus.ContainsKey(uiForm.name))
            {
                string[] btnCache = new string[2];
                _UIFormCurrentFocus.Add(uiForm.name, btnCache);
            }

            string[] focus = _UIFormCurrentFocus[uiForm.name];

            focus[0] = button.name;
            if (button_2P != null)
            {
                focus[1] = button_2P.name;
            }
            else
            {
                focus[1] = string.Empty;
            }
        }
예제 #5
0
        /// <summary>
        /// 设置当前页面的默认焦点
        /// </summary>
        /// <param UIName="buttonName1P"> 1P的默认选择 </param>
        /// <param UIName="buttonName2P"> 2P的默认选择 </param>
        /// <param UIName="isSaveFocusePos"> 是否保存当前页面按钮光标位置 </param>
        public void ButtonDefaultFocus(LtButton button1p, LtButton button2p, bool isSaveFocusePos = true)
        {
            string[] cacheFocus = null;
            if (isSaveFocusePos)
            {
                //cacheFocus = UIMonoManager.Instance.GetFocus(this);
                //if (cacheFocus == null)
                //{
                //    UIMonoManager.Instance.SaveFocus(this, button1p, button2p);
                //}
            }

            SelectableCtrl.StartSelect1P = button1p;
            SelectableCtrl.StartSelect2P = button2p;
            if (button2p != null)
            {
                CursorType = CursorType.Single;
            }

            SelectableCtrl.IsSaveFocuseButton = isSaveFocusePos;
        }
예제 #6
0
        public void DisableSelect()
        {
            _IsCtrl = false;
            if (currentSelectable1P != null)
            {
                BeforeSelectable1P  = currentSelectable1P;
                currentSelectable1P = null;
            }

            if (currentSelectable2P != null)
            {
                beforeSelectable2P  = currentSelectable2P;
                currentSelectable2P = null;
            }

            for (int i = 0; i < LtButtons.Count; i++)
            {
                if (LtButtons[i])
                {
                    LtButtons[i].enabled = false;
                }
            }
        }
예제 #7
0
 /// <summary>
 /// LtButton注册
 /// </summary>
 /// <param UIName="buttonName">Button的名字</param>
 /// <param UIName="call">1P事件</param>
 /// <param UIName="call2">2P事件</param>
 protected void ButtonOnClick(LtButton button, UnityAction call, UnityAction call2 = null)
 {
     button.OnClick(call, call2);
 }
예제 #8
0
        protected void ButtonOnClick(GameObject buttonObj, UnityAction call, UnityAction call2 = null)
        {
            LtButton button = buttonObj.GetComponent <LtButton>();

            button.ButtonOnClick(call, call2);
        }
예제 #9
0
        /// <summary>
        /// 当前页面的LtButton注册
        /// </summary>
        /// <param UIName="buttonName">Button的名字</param>
        /// <param UIName="call">1P事件</param>
        /// <param UIName="call2">2P事件</param>
        protected void ButtonOnClick(string buttonName, UnityAction call, UnityAction call2 = null)
        {
            LtButton button = gameObject.GetChildComponet <LtButton>(buttonName);

            button.ButtonOnClick(call, call2);
        }
예제 #10
0
 /// <summary>
 /// 设置当前页面的默认焦点
 /// </summary>
 /// <param UIName="buttonName1P"> 1P的默认选择 </param>
 /// <param UIName="isSaveFocusePos"> 是否保存当前页面按钮光标位置 </param>
 public void ButtonDefaultFocus(LtButton button1p, bool isSaveFocusePos = true)
 {
     ButtonDefaultFocus(button1p, null, isSaveFocusePos);
 }
예제 #11
0
 /// <summary>
 /// 按键自动导航的回调
 /// 执行在导航之前
 /// </summary>
 /// <param UIName="currentButton">当前选择的按钮</param>
 /// <param UIName="autoSelecteButton">自动导航将要设置的按钮</param>
 /// <param UIName="is2P">false 为1P操作,true 为2P操作</param>
 /// <returns> 你需要修改的导航按钮 </returns>
 public virtual LtButton OnDownSelected(LtButton currentButton, LtButton autoSelecteButton, CtrlHandler ctrl)
 {
     return(autoSelecteButton);
 }
예제 #12
0
 /// <summary>
 /// 当按钮取消选中的回调
 /// </summary>
 /// <param UIName="button"> 取消选中的按钮 </param>
 /// <param UIName="ctrl"> 操作者 </param>
 public virtual void OnDisSelected(LtButton button, CtrlHandler ctrl)
 {
 }
예제 #13
0
        //2p控制
        void Ctrl2P()
        {
            if (_UIForm.CursorType == CursorType.Single)
            {
                if (currentSelectable2P == null)
                {
                    return;
                }
                if (UIFrameInput.GetKey_Up_Down_2P)
                {
                    LtButton button = null;
                    if (currentSelectable2P.FindSelectableOnUp2P())
                    {
                        button = currentSelectable2P.FindSelectableOnUp2P().GetComponent <LtButton>();
                    }

                    button = _UIForm.OnUpSelected(currentSelectable2P, button, CtrlHandler.P2);
                    if (button)
                    {
                        SetSelected2P(button);
                    }
                }
                else if (UIFrameInput.GetKey_Down_Down_2P)
                {
                    LtButton button = null;
                    if (currentSelectable2P.FindSelectableOnDown2P())
                    {
                        button = currentSelectable2P.FindSelectableOnDown2P().GetComponent <LtButton>();
                    }

                    button = _UIForm.OnDownSelected(currentSelectable2P, button, CtrlHandler.P2);
                    if (button)
                    {
                        SetSelected2P(button);
                    }
                }
                else if (UIFrameInput.GetKey_Left_Down_2P)
                {
                    LtButton button = null;
                    if (currentSelectable2P.FindSelectableOnLeft2P())
                    {
                        button = currentSelectable2P.FindSelectableOnLeft2P().GetComponent <LtButton>();
                    }

                    button = _UIForm.OnLeftSelected(currentSelectable2P, button, CtrlHandler.P2);
                    if (button)
                    {
                        SetSelected2P(button);
                    }
                }
                else if (UIFrameInput.GetKey_Right_Down_2P)
                {
                    LtButton button = null;
                    if (currentSelectable2P.FindSelectableOnRight2P())
                    {
                        button = currentSelectable2P.FindSelectableOnRight2P().GetComponent <LtButton>();
                    }

                    button = _UIForm.OnRightSelected(currentSelectable2P, button, CtrlHandler.P2);
                    if (button)
                    {
                        SetSelected2P(button);
                    }
                }

                if (UIFrameInput.GetKey_A_Down_2P)
                {
                    if (currentSelectable2P == null)
                    {
                        return;
                    }

                    currentSelectable2P.OnClickBy2P();
                }
            }
            else if (_UIForm.CursorType == CursorType.Both)
            {
                if (currentSelectable1P == null)
                {
                    return;
                }

                if (UIFrameInput.GetKey_Up_Down_2P)
                {
                    LtButton button = null;
                    if (currentSelectable1P.FindSelectableOnUp())
                    {
                        button = currentSelectable1P.FindSelectableOnUp().GetComponent <LtButton>();
                    }

                    button = _UIForm.OnUpSelected(currentSelectable1P, button, CtrlHandler.P1);
                    if (button)
                    {
                        SetSelected1P(button);
                    }
                }
                else if (UIFrameInput.GetKey_Down_Down_2P)
                {
                    LtButton button = null;
                    if (currentSelectable1P.FindSelectableOnDown())
                    {
                        button = currentSelectable1P.FindSelectableOnDown().GetComponent <LtButton>();
                    }

                    button = _UIForm.OnDownSelected(currentSelectable1P, button, CtrlHandler.P1);
                    if (button)
                    {
                        SetSelected1P(button);
                    }
                }
                else if (UIFrameInput.GetKey_Left_Down_2P)
                {
                    LtButton button = null;
                    if (currentSelectable1P.FindSelectableOnLeft())
                    {
                        button = currentSelectable1P.FindSelectableOnLeft().GetComponent <LtButton>();
                    }

                    button = _UIForm.OnLeftSelected(currentSelectable1P, button, CtrlHandler.P1);
                    if (button)
                    {
                        SetSelected1P(button);
                    }
                }
                else if (UIFrameInput.GetKey_Right_Down_2P)
                {
                    LtButton button = null;
                    if (currentSelectable1P.FindSelectableOnRight())
                    {
                        button = currentSelectable1P.FindSelectableOnRight().GetComponent <LtButton>();
                    }

                    button = _UIForm.OnRightSelected(currentSelectable1P, button, CtrlHandler.P1);
                    if (button)
                    {
                        SetSelected1P(button);
                    }
                }

                if (UIFrameInput.GetKey_A_Down_2P)
                {
                    if (currentSelectable1P == null)
                    {
                        return;
                    }
                    currentSelectable1P.OnClickBy1P();
                }
            }
        }
예제 #14
0
        //1p控制
        void Ctrl1P()
        {
            if (currentSelectable1P == null)
            {
                return;
            }

            if (UIFrameInput.GetKey_Up_Down)
            {
                LtButton button = null;
                if (currentSelectable1P.FindSelectableOnUp())
                {
                    button = currentSelectable1P.FindSelectableOnUp().GetComponent <LtButton>();
                }

                button = _UIForm.OnUpSelected(currentSelectable1P, button, CtrlHandler.P1);
                if (button)
                {
                    SetSelected1P(button);
                }
            }
            else if (UIFrameInput.GetKey_Down_Down)
            {
                LtButton button = null;
                if (currentSelectable1P.FindSelectableOnDown())
                {
                    button = currentSelectable1P.FindSelectableOnDown().GetComponent <LtButton>();
                }

                button = _UIForm.OnDownSelected(currentSelectable1P, button, CtrlHandler.P1);
                if (button)
                {
                    SetSelected1P(button);
                }
            }
            else if (UIFrameInput.GetKey_Left_Down)
            {
                LtButton button = null;
                if (currentSelectable1P.FindSelectableOnLeft())
                {
                    button = currentSelectable1P.FindSelectableOnLeft().GetComponent <LtButton>();
                }

                button = _UIForm.OnLeftSelected(currentSelectable1P, button, CtrlHandler.P1);
                if (button)
                {
                    SetSelected1P(button);
                }
            }
            else if (UIFrameInput.GetKey_Right_Down)
            {
                LtButton button = null;
                if (currentSelectable1P.FindSelectableOnRight())
                {
                    button = currentSelectable1P.FindSelectableOnRight().GetComponent <LtButton>();
                }

                button = _UIForm.OnRightSelected(currentSelectable1P, button, CtrlHandler.P1);
                if (button)
                {
                    SetSelected1P(button);
                }
            }

            if (UIFrameInput.GetKey_A_Down)
            {
                if (currentSelectable1P == null)
                {
                    return;
                }
                currentSelectable1P.OnClickBy1P();
            }
        }
예제 #15
0
 public static void ButtonOnClick(this LtButton button, UnityAction call, UnityAction call2 = null)
 {
     button.AddListener1P(call);
     button.AddListener2P(call2);
 }