示例#1
0
        /// <summary>
        /// 查找茶馆房间
        /// </summary>
        /// <param name="teaId">茶馆ID</param>
        /// <param name="msgBoxName">提示框名称</param>
        /// <param name="successCall">成功回调</param>
        /// <param name="openTeapanel"></param>
        /// <param name="defTeaHouseName">默认茶馆窗口名称</param>
        public static void FindTeaHouse(string teaId, string msgBoxName = null, TwCallBack successCall = null, bool openTeapanel = true, string defTeaHouseName = KeyDefTeaHouseName)
        {
            var dic = new Dictionary <string, object>();

            dic[KeyTeaId] = teaId;
            Facade.Instance <TwManager>().SendAction(KeyFindTeaHouseAction, dic, message =>
            {
                if (successCall != null)
                {
                    successCall(message);
                }
                if (openTeapanel)
                {
                    Dictionary <string, object> successDic = (Dictionary <string, object>)message;
                    YxWindow window = YxWindowManager.GetWindowInstance <TeaPanel>(defTeaHouseName);
                    if (window == null)
                    {
                        window = YxTools.OpenWindowWithData(null, defTeaHouseName, successDic);
                    }
                    else
                    {
                        window.UpdateView(successDic);
                    }
                    if (window)
                    {
                        TeaPanel panel = window.GetComponent <TeaPanel>();
                        panel.SetTeaCode(int.Parse(teaId));
                        Util.SetString(KeySaveTeaKey, teaId);
                    }
                }
            });
        }
示例#2
0
        private void GetInTea(object msg)
        {
            Dictionary <string, object> dic = (Dictionary <string, object>)msg;
            long value = (long)dic["mstatus"];

            if (value != 4)
            {
                YxWindow obj   = CreateOtherWindow("TeaPanel");
                TeaPanel panel = obj.GetComponent <TeaPanel>();
                panel.UpdateView(dic);
                panel.SetTeaCode(_currentRoomId);
                Util.SetString("TeaId", _currentRoomId.ToString());
            }
            else
            {
                YxMessageBox.Show(string.Format("{0}不存在", CurrentName));
            }
        }
示例#3
0
        private void GetInTea(object msg)
        {
            Dictionary <string, object> dic = (Dictionary <string, object>)msg;
            long value = (long)dic["mstatus"];

            if (value != 4)
            {
                string   tea_name = (string)dic["name"];
                YxWindow obj      = CreateOtherWindow("TeaPanel");
                TeaPanel panel    = obj.GetComponent <TeaPanel>();
                panel.UpdateView(dic);
                if (dic.ContainsKey("only_owner"))
                {
                    panel.onlyOwner = Convert.ToInt32(dic["only_owner"]);
                }
                else
                {
                    panel.onlyOwner = -1;
                }
                panel.CasePower((int)value);
                if (dic.ContainsKey("roomNum"))
                {
                    panel.roomNum = Convert.ToInt32(dic["roomNum"]);
                }
                panel.SetTeaName(tea_name);
                panel.SetTeaCode(int.Parse(GetCurRoomId()));
                panel.TeaState = (int)value;
                PlayerPrefs.SetString(SaveTeaId, GetCurRoomId());
                Close();
            }
            else
            {
                YxMessageBox.Show("茶馆不存在");
            }
            Clear();
        }