コード例 #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);
                    }
                }
            });
        }