Exemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape) && _curMsgBox == null)
     {
         if (App.GameKey == App.Skin.Hall)
         {
             if (App.History.CurrentHistory() < YxEHistoryPathType.Hall || !App.Config.QuitToLogin)
             {
                 _curMsgBox = ShowQuitMessagebox();
             }
             else
             {
                 if (ResourceManager.HasRes(App.Skin.Hall, "QuitWindow"))
                 {
                     _curMsgBox = ShowQuitWindow();
                 }
                 else
                 {
                     _curMsgBox = ShowQuitMessagebox();
                 }
             }
         }
         else
         {
             _curMsgBox = App.QuitGameWithMsgBox();
         }
     }
 }
Exemplo n.º 2
0
 protected virtual void OnChageTab(YxView view, TabData tabData)
 {
     if (view == null)
     {
         return;
     }
     view.ShowWithData(tabData);
 }
Exemplo n.º 3
0
 protected override void OnChageTab(YxView view, TabData tabData)
 {
     if (view == null)
     {
         return;
     }
     view.ShowWithData(tabData.Data);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 移动筹码到指定位置
        /// </summary>
        /// <param name="view"></param>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="time"></param>
        private void TweenFromTo(YxView view, Vector3 from, Vector3 to, float time)
        {
            var tween = view.GetComponent <TweenPosition>() ?? view.gameObject.AddComponent <TweenPosition>();

            tween.@from    = from;
            tween.duration = time;
            tween.to       = to;
            tween.ResetToBeginning();
            tween.PlayForward();
        }
Exemplo n.º 5
0
 /// <summary>
 /// 获取对应父级的子物体
 /// </summary>
 /// <param name="index"></param>
 /// <param name="prefabView"></param>
 /// <param name="tranParent"></param>
 /// <returns></returns>
 public static YxView GetChildView(int index, YxView prefabView, Transform tranParent)
 {
     if (tranParent.childCount > index)
     {
         var returnView = tranParent.GetChild(index).GetComponent <YxView>();
         returnView.gameObject.SetActive(true);
         return(returnView);
     }
     return(YxWindowUtils.CreateItem(prefabView, tranParent));
 }
Exemplo n.º 6
0
        protected override void OnChageTab(YxView view, TabData tabData)
        {
            if (view == null)
            {
                return;
            }
            var parm = new Dictionary <string, object>();

            parm["type"] = tabData.Id;
            CurTwManager.SendAction(TabActionName, parm, view.UpdateView);
        }
Exemplo n.º 7
0
 private void UpdateItemView(RuleInfo info, YxView itemView)
 {
     if (info == null)
     {
         return;
     }
     _selectedGameKey  = info.GameKey;
     _selectedRuleId   = info.Id;
     _curRuleInfo      = info;
     _selectedGameName = info.Name;
     itemView.UpdateView(info);
 }
Exemplo n.º 8
0
        private void SetPrice(YxView view, string consumeId, string price)
        {
            if (view == null)
            {
                return;
            }
            var data = new YxKeyValueData
            {
                IconUrl = consumeId,
                Value   = price
            };

            view.UpdateView(data);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 打开窗口并传递数据
        /// </summary>
        /// <param name="mainView">主窗口</param>
        /// <param name="windowName">打开窗口名称</param>
        /// <param name="data">传递数据</param>
        /// <param name="callBack">数据回调</param>
        public static YxWindow OpenWindowWithData(this YxView mainView, string windowName, object data, Action <object> callBack = null)
        {
            if (string.IsNullOrEmpty(windowName))
            {
                return(null);
            }
            var mainWindow = mainView as YxWindow;
            var window     = mainWindow ? mainWindow.CreateChildWindow(windowName) : YxWindowManager.OpenWindow(windowName);

            if (window)
            {
                window.UpdateViewWithCallBack(data, callBack);
            }
            return(window);
        }
Exemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        public void ShowTip()
        {
            if (_curView == this)
            {
                UITooltip.Hide();
                _curView = null;
                return;
            }
            _curView = this;
            var itemData = GetData <ItemData>();

            if (itemData == null)
            {
                return;
            }
            UITooltip.Show(itemData.Tip);
        }
Exemplo n.º 11
0
 /// <summary>
 /// 获取对应父级的子物体
 /// </summary>
 /// <param name="index"></param>
 /// <param name="prefabView"></param>
 /// <param name="tranParent"></param>
 /// <returns></returns>
 public static YxView GetChildView(this Transform tranParent, int index, YxView prefabView)
 {
     if (tranParent.childCount > index)
     {
         var returnView = tranParent.GetChild(index).GetComponent <YxView>();
         if (returnView)
         {
             returnView.gameObject.SetActive(true);
         }
         else
         {
             YxDebug.LogError(string.Format("Child Item is not a YxView,index is :{0},please check again!", index));
             returnView = YxWindowUtils.CreateItem(prefabView, tranParent);
         }
         return(returnView);
     }
     return(YxWindowUtils.CreateItem(prefabView, tranParent));
 }
Exemplo n.º 12
0
        /// <summary>
        /// 刷新页面
        /// </summary>
        /// <param name="info"></param>
        /// <param name="itemView"></param>
        private void UpdateItemView(CreateRoomRuleInfo info, YxView itemView)
        {
            if (info == null)
            {
                return;
            }
            SelectedGameKey = info.GameKey;
            SelectedRuleId  = info.Id;
            CurRuleInfo     = info;
            info.Reset();
            SelectedGameName = info.Name;
//            if (_curRuleInfo != null)
//            {
//                var cArgs = _curRuleInfo.CreateArgs;
//                var allCreateData = GetAllRp(cArgs);
//                UpdataAllState(allCreateData, cArgs);
//            }
            itemView.UpdateView(info);
        }
Exemplo n.º 13
0
        protected override void OnAwake()
        {
            var gdata = App.GameData;

            if (gdata == null)//空  隐藏所有
            {
                ShowLineView();
                if (MorePView != null)
                {
                    MorePView.gameObject.SetActive(false);
                }
                if (BackGround != null)
                {
                    BackGround.SetActive(false);
                }
                return;
            }
            var count     = gdata.SeatTotalCount;
            var lineCount = LinePViews.Length;

            if (count >= (lineCount + MinPlayerCount))//更多模式
            {
                if (MorePView != null)
                {
                    ShowLineView();
                    MorePView.gameObject.SetActive(true);
                    _curView = MorePView;
                    return;
                }
            }
            if (lineCount < 1)//todo 全屏连线模式
            {
                if (BackGround != null)
                {
                    BackGround.SetActive(false);
                }
                return;
            }
            //连线模式
            _curView = ShowLineView(count - MinPlayerCount);
        }
Exemplo n.º 14
0
        private YxView ShowLineView(int index = -1)
        {
            YxView view = null;
            var    len  = LinePViews.Length;

            for (var i = 0; i < len; i++)
            {
                var v = LinePViews[i];
                if (v == null)
                {
                    continue;
                }
                var flag = i == index;
                v.gameObject.SetActive(flag);
                if (flag)
                {
                    view = v;
                }
            }
            return(view);
        }
Exemplo n.º 15
0
        private void ShowPreviewListView()
        {
            YxView view   = PreviewGameListView;
            var    gm     = GameListModel.Instance;
            var    gGroup = gm.GetGroup(0);

            if (PreviewGameListView != null)
            {
                var arr        = PreviewGameListView.SpecialDataFormat;
                var arrCount   = arr.Length;
                var groups     = gm.Groups;
                var groupCount = groups.Count;
                if (groupCount > 1)//多个组
                {
                    var gmSgroup     = gm.GetSpecialGroup();
                    var gmGroupCount = gmSgroup.Length;
                    if (arrCount > 0)//是不是支持group
                    {
                        if (gmGroupCount < 1)
                        {
                            PreviewGameListView.SpecialDataFormat = new int[0];
                            PreviewGameListView.StartDataIndex    = 0;
                        }
                        else
                        {
                            if (GameListStartIndex > 0)
                            {
                                PreviewGameListView.StartDataIndex = GameListStartIndex - arrCount + gmGroupCount;
                            }
                            PreviewGameListView.SpecialDataFormat = gmSgroup;
                        }
                    }
                    else//只显示一个组
                    {
                        PreviewGameListView.StartDataIndex    = GameListStartIndex;
                        PreviewGameListView.SpecialDataFormat = new int[0];
                    }
                }
                else//一个组
                {
                    PreviewGameListView.StartDataIndex = GameListStartIndex;
                    if (arrCount > 0)
                    {
                        PreviewGameListView.SpecialDataFormat = new int[0];
                    }
                }
            }
            else if (PreviewListView != null)
            {
                view = PreviewListView;
            }
            else
            {
                return;
            }
            IList list = null;

            if (gGroup != null)
            {
                list = gGroup.GameListModels;
            }
            view.UpdateView(list);
        }