public static void Debug(string msg) { if (!NetConfig.getInstance().isFormal) { ETModel.Log.Debug(msg); } }
public async Task getAllData() { UINetLoadingComponent.showNetLoading(); try { await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/tips.json", TipsConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/prop.json", PropConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/zhuanpan.json", ZhuanPanConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/notice.json", NoticeConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/friendRoomConfig.json", FriendRoomConfig.getInstance().init); //await SensitiveWordUtil.Req("http://fwdown.hy51v.com/online/file/stopwords.txt"); string data = CommonUtil.getTextFileByBundle("config", "stopwords"); SensitiveWordUtil.WordsDatas = data.Split(','); } catch (Exception ex) { Log.Error(ex); } UINetLoadingComponent.closeNetLoading(); }
public async void Awake() { await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/chat.json", ChatConfig.getInstance().init); ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); ExpressionBtn = rc.Get <GameObject>("ExpressionBtn").GetComponent <Button>(); ShortBtn = rc.Get <GameObject>("ShortBtn").GetComponent <Button>(); Mask = rc.Get <GameObject>("Mask").GetComponent <Button>(); ExceptionTxt = rc.Get <GameObject>("ExceptionTxt").GetComponent <Text>(); ExpressionGrid = ExpressionBtn.transform.Find("Select_Btn/Scroll/ExpressionGrid").gameObject; ShortGrid = ShortBtn.transform.Find("Select_Btn/Scroll/ShortGrid").gameObject; ExpressionBtn.onClick.Add(() => { CreatExpressions(); }); CommonUtil.SetTextFont(this.GetParent <UI>().GameObject); Mask.onClick.Add(() => { CloseOrOpenChatUI(false); }); ShortBtn.onClick.Add(() => { CreateChatItems(); }); ExpressionItem = CommonUtil.getGameObjByBundle(UIType.UIExpression); ChatItem = CommonUtil.getGameObjByBundle(UIType.UIChatItem); isOpen = false; //选中表情包界面 CreatExpressions(); }
public async void Awake() { // 获取配置文件 { string fileName = "otherConfig-" + PlatformHelper.GetVersionName() + ".json"; await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/" + fileName, OtherConfig.getInstance().init); } ToastScript.clear(); Instance = this; initData(); CommonUtil.SetTextFont(panel_start.transform.parent.gameObject); }
public async void onClickGetPhoneCode() { if (inputField_Phone.text.CompareTo("") == 0) { ToastScript.createToast("请输入手机号"); return; } if (!VerifyRuleUtil.CheckPhone(inputField_Phone.text)) { ToastScript.createToast("请输入正确的手机号"); return; } btn_yanzhengma.transform.localScale = Vector3.zero; text_yanzhengmadaojishi.transform.localScale = new Vector3(1, 1, 1); UINetLoadingComponent.showNetLoading(); Session sessionWrap = null; try { //IPEndPoint connetEndPoint = NetworkHelper.ToIPEndPoint(GlobalConfigComponent.Instance.GlobalProto.Address); IPEndPoint connetEndPoint = ToIPEndPointWithYuMing(NetConfig.getInstance().getServerPort()); ETModel.Session session = ETModel.Game.Scene.GetComponent <NetOuterComponent>().Create(connetEndPoint); sessionWrap = ComponentFactory.Create <Session, ETModel.Session>(session); R2C_SendSms r2CData = (R2C_SendSms)await sessionWrap.Call(new C2R_SendSms() { Phone = inputField_Phone.text }); UINetLoadingComponent.closeNetLoading(); if (r2CData.Error != ErrorCode.ERR_Success) { ToastScript.createToast(r2CData.Message); } sessionWrap.Dispose(); startPhoneCodeTimer(); } catch (Exception e) { sessionWrap?.Dispose(); Log.Error(e); } }
public async void Start() { try { await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/activity.json", ActivityConfig.getInstance().init); ReferenceCollector rc = GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); returnBtn = rc.Get <GameObject>("ReturnBtn").GetComponent <Button>(); ActivityGrid = rc.Get <GameObject>("ActivityGrid"); NoticeBtn = rc.Get <GameObject>("NoticeBtn").GetComponent <Button>(); ActivityBtn = rc.Get <GameObject>("ActivityBtn").GetComponent <Button>(); Panel = rc.Get <GameObject>("Panel"); Activity = rc.Get <GameObject>("Activity"); Notice = rc.Get <GameObject>("Notice"); noticeItem = CommonUtil.getGameObjByBundle(UIType.UINoticeItem); activityItem = CommonUtil.getGameObjByBundle(UIType.UIActivityItem); Grid = rc.Get <GameObject>("Grid"); CommonUtil.SetTextFont(this.GetParent <UI>().GameObject); GetActivityItemList(); //返回 returnBtn.onClick.Add(() => { Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIActivity); }); //点击显示通知栏 NoticeBtn.onClick.Add(() => { NoticeBtn.transform.GetChild(0).gameObject.SetActive(true); ActivityBtn.transform.GetChild(0).gameObject.SetActive(false); Notice.SetActive(true); Activity.SetActive(false); CreateNoticeItems(); }); //点击显示活动栏 ActivityBtn.onClick.Add(() => { GetActivityItemList(); }); } catch (Exception e) { Log.Error(e); } }
public static IPEndPoint ToIPEndPointWithYuMing(int port) { string serverUrl = NetConfig.getInstance().getServerUrl(); IPAddress ip; IPHostEntry IPinfo = Dns.GetHostEntry(serverUrl); if (IPinfo.AddressList.Length <= 0) { ToastScript.createToast("域名解析出错"); return(null); } ip = IPinfo.AddressList[0]; return(new IPEndPoint(ip, port)); }
public string GetUrl() { string url = NetConfig.getInstance().getWebUrl() + "/AssetBundle/" + PlatformHelper.GetVersionName() + "/"; #if UNITY_ANDROID url += "Android/"; #elif UNITY_IOS url += "IOS/"; #elif UNITY_WEBGL url += "WebGL/"; #else url += "PC/"; #endif return(url); }
public static void Start() { try { Game.Scene.ModelScene = ETModel.Game.Scene; // 注册热更层回调 ETModel.Game.Hotfix.Update = () => { Update(); }; ETModel.Game.Hotfix.LateUpdate = () => { LateUpdate(); }; ETModel.Game.Hotfix.OnApplicationQuit = () => { OnApplicationQuit(); }; Game.Scene.AddComponent <UIComponent>(); Game.Scene.AddComponent <OpcodeTypeComponent>(); Game.Scene.AddComponent <MessageDispatherComponent>(); Game.Scene.AddComponent <PlayerInfoComponent>(); Game.Scene.AddComponent <UIIconComponent>(); Game.Scene.AddComponent <SessionComponent>(); //第三方退出 Game.Scene.AddComponent <ThirdSDKQuitComponent>(); // 加载热更配置 ETModel.Game.Scene.GetComponent <ResourcesComponent>().LoadBundle("config.unity3d"); Game.Scene.AddComponent <ConfigComponent>(); ETModel.Game.Scene.GetComponent <ResourcesComponent>().UnloadBundle("config.unity3d"); // UnitConfig unitConfig = (UnitConfig)Game.Scene.GetComponent<ConfigComponent>().Get(typeof(UnitConfig), 1001); // Log.Debug($"config {JsonHelper.ToJson(unitConfig)}"); Game.EventSystem.Run(EventIdType.InitSceneStart); Application.targetFrameRate = 30; // 永不息屏 Screen.sleepTimeout = SleepTimeout.NeverSleep; if (NetConfig.getInstance().isFormal) { GameObject.Destroy(GameObject.Find("Reporter")); } } catch (Exception e) { Log.Error(e); } }
public static async void onClickChangeAccount() { Session sessionWrap = null; try { //IPEndPoint connetEndPoint = NetworkHelper.ToIPEndPoint(GlobalConfigComponent.Instance.GlobalProto.Address); IPEndPoint connetEndPoint = NetConfig.getInstance().ToIPEndPointWithYuMing(); ETModel.Session session = ETModel.Game.Scene.GetComponent <NetOuterComponent>().Create(connetEndPoint); sessionWrap = ComponentFactory.Create <Session, ETModel.Session>(session); R2C_ChangeAccount r2CData = (R2C_ChangeAccount)await SessionComponent.Instance.Session.Call(new C2R_ChangeAccount() { Uid = PlayerInfoComponent.Instance.uid }); sessionWrap.Dispose(); PlayerPrefs.SetString("Phone", ""); PlayerPrefs.SetString("Token", ""); Game.Scene.GetComponent <UIComponent>().RemoveAll(); Game.Scene.GetComponent <UIComponent>().Create(UIType.UILogin); //给android发送切换账号回调 if ("qihoo360".Equals(PlatformHelper.GetChannelName())) { PlatformHelper.setLogoutCallback("", "", ""); } HeartBeat.getInstance().stopHeartBeat(); } catch (Exception e) { PlayerPrefs.SetString("Phone", ""); PlayerPrefs.SetString("Token", ""); Game.Scene.GetComponent <UIComponent>().RemoveAll(); Game.Scene.GetComponent <UIComponent>().Create(UIType.UILogin); HeartBeat.getInstance().stopHeartBeat(); sessionWrap?.Dispose(); Log.Error(e); } }
public void initData() { ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); panel_start = rc.Get <GameObject>("Start"); panel_phoneLogin = rc.Get <GameObject>("PhoneLogin"); btn_phone = rc.Get <GameObject>("Button_phone").GetComponent <Button>(); btn_wechat = rc.Get <GameObject>("Button_wechat").GetComponent <Button>(); btn_guest = rc.Get <GameObject>("Button_guest").GetComponent <Button>(); btn_login = rc.Get <GameObject>("Button_Login").GetComponent <Button>(); btn_third = rc.Get <GameObject>("Button_Third").GetComponent <Button>(); btn_yanzhengma = rc.Get <GameObject>("Button_YanZhengMa").GetComponent <Button>(); btn_backToStart = rc.Get <GameObject>("Button_back").GetComponent <Button>(); inputField_Phone = rc.Get <GameObject>("InputField_Phone").GetComponent <InputField>(); inputField_YanZhengMa = rc.Get <GameObject>("InputField_YanZhengMa").GetComponent <InputField>(); text_yanzhengmadaojishi = rc.Get <GameObject>("Text_yanzhengmadaojishi").GetComponent <Text>(); btn_phone.onClick.Add(onClickOpenPhoneLogin); btn_wechat.onClick.Add(onClickWechatLogin); btn_third.onClick.Add(onClickWechatLogin); btn_guest.onClick.Add(onClickGuestLogin); btn_login.onClick.Add(onClickPhoneCodeLogin); btn_yanzhengma.onClick.Add(onClickGetPhoneCode); btn_backToStart.onClick.Add(onClickBackStart); // 四个UI层级画布 { OtherData.s_loginCanvas = panel_start.transform.parent.parent.parent.Find("LoginCanvas").gameObject; OtherData.s_mainCanvas = panel_start.transform.parent.parent.parent.Find("MainCanvas").gameObject; OtherData.s_roomCanvas = panel_start.transform.parent.parent.parent.Find("RoomCanvas").gameObject; OtherData.s_commonCanvas = panel_start.transform.parent.parent.parent.Find("CommonCanvas").gameObject; } #region 登录按钮设置 { // 测试服开启游客登录按钮 if (!NetConfig.getInstance().isFormal) { btn_guest.transform.localScale = new Vector3(1, 1, 1); } if (ChannelHelper.IsThirdChannel() && PlatformHelper.IsThirdLogin()) { btn_third.transform.localScale = new Vector3(1, 1, 1); btn_third.GetComponentInChildren <Text>().text = ChannelHelper.GetChannelAllName() + "登录"; } else { btn_phone.transform.localScale = new Vector3(1, 1, 1); btn_wechat.transform.localScale = new Vector3(1, 1, 1); if (OtherData.getIsShiedPhoneLogin()) { btn_phone.transform.localScale = Vector3.zero; } else if (OtherData.getIsShiedWeChatLogin()) { btn_wechat.transform.localScale = Vector3.zero; } } } #endregion #region 压力测试 // pressTestButton = rc.Get<GameObject>("PressTestButton").GetComponent<Button>(); // pressTestButton.onClick.Add(this.OnClickPressTest); // if (!NetConfig.getInstance().isFormal) // { // pressTestButton.gameObject.SetActive(true); // } // else // { // pressTestButton.gameObject.SetActive(false); // } #endregion }
public async Task OnThirdLogin(string third_id, string name, string head) { //加锁 if (isLogining) { return; } isLogining = true; Session sessionWrap = null; try { UINetLoadingComponent.showNetLoading(); // IPEndPoint connetEndPoint = NetworkHelper.ToIPEndPoint(GlobalConfigComponent.Instance.GlobalProto.Address); IPEndPoint connetEndPoint = NetConfig.getInstance().ToIPEndPointWithYuMing(); #if Localhost connetEndPoint = NetworkHelper.ToIPEndPoint("10.224.5.74:10002"); #endif ETModel.Session session = ETModel.Game.Scene.GetComponent <NetOuterComponent>().Create(connetEndPoint); sessionWrap = ComponentFactory.Create <Session, ETModel.Session>(session); name = name.Replace("'", "*"); R2C_ThirdLogin r2CLogin = (R2C_ThirdLogin)await sessionWrap.Call(new C2R_ThirdLogin() { Third_Id = third_id, MachineId = PlatformHelper.GetMacId(), ChannelName = PlatformHelper.GetChannelName(), ClientVersion = PlatformHelper.GetVersionName(), Name = name, Head = head }); sessionWrap.Dispose(); UINetLoadingComponent.closeNetLoading(); if (r2CLogin.Error != ErrorCode.ERR_Success) { ToastScript.createToast(r2CLogin.Message); return; } UINetLoadingComponent.showNetLoading(); // connetEndPoint = NetworkHelper.ToIPEndPoint(r2CLogin.Address); // connetEndPoint = NetConfig.getInstance().ToIPEndPointWithYuMing(); string[] temp = r2CLogin.Address.Split(':'); connetEndPoint = ToIPEndPointWithYuMing(Convert.ToInt32(temp[1])); // connetEndPoint = NetworkHelper.ToIPEndPoint(r2CLogin.Address); #if Localhost connetEndPoint = NetworkHelper.ToIPEndPoint("10.224.5.74:10002"); #endif ETModel.Session gateSession = ETModel.Game.Scene.GetComponent <NetOuterComponent>().Create(connetEndPoint); Game.Scene.GetComponent <SessionComponent>().Session = ComponentFactory.Create <Session, ETModel.Session>(session); ETModel.Game.Scene.GetComponent <ETModel.SessionComponent>().Session = gateSession; // Log.Info("gateSession:"+ connetEndPoint.ToString()); G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await SessionComponent.Instance.Session.Call(new C2G_LoginGate() { Key = r2CLogin.Key }); ToastScript.createToast("登录成功"); //挂心跳包 Game.Scene.GetComponent <SessionComponent>().Session.AddComponent <HeartBeatComponent>(); UINetLoadingComponent.closeNetLoading(); await getAllData(); isLoginSuccess = true; Game.Scene.GetComponent <PlayerInfoComponent>().uid = g2CLoginGate.Uid; PlayerInfoComponent.Instance.SetShopInfoList(g2CLoginGate.ShopInfoList); PlayerInfoComponent.Instance.SetBagInfoList(g2CLoginGate.BagList); PlayerInfoComponent.Instance.ownIcon = g2CLoginGate.ownIcon; Game.Scene.GetComponent <UIComponent>().Create(UIType.UIMain); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UILogin); isLogining = false; } catch (Exception e) { sessionWrap?.Dispose(); Log.Error("OnThirdLogin:" + e); isLogining = false; } }
public async Task OnLoginPhone(string phone, string code, string token) { Session sessionWrap = null; try { UINetLoadingComponent.showNetLoading(); //IPEndPoint connetEndPoint = NetworkHelper.ToIPEndPoint(GlobalConfigComponent.Instance.GlobalProto.Address); IPEndPoint connetEndPoint = ToIPEndPointWithYuMing(NetConfig.getInstance().getServerPort()); ETModel.Session session = ETModel.Game.Scene.GetComponent <NetOuterComponent>().Create(connetEndPoint); sessionWrap = ComponentFactory.Create <Session, ETModel.Session>(session); R2C_PhoneLogin r2CLogin = (R2C_PhoneLogin)await sessionWrap.Call(new C2R_PhoneLogin() { Phone = phone, Code = code, Token = token, MachineId = PlatformHelper.GetMacId(), ChannelName = PlatformHelper.GetChannelName(), ClientVersion = PlatformHelper.GetVersionName() }); //R2C_PhoneLogin r2CLogin = (R2C_PhoneLogin)await sessionWrap.Call(new C2R_PhoneLogin() { Phone = phone, Code = code, Token = token, MachineId = "1234", ChannelName = "jav", ClientVersion = "1.1.0" }); sessionWrap.Dispose(); UINetLoadingComponent.closeNetLoading(); if (r2CLogin.Error != ErrorCode.ERR_Success) { ToastScript.createToast(r2CLogin.Message); if (r2CLogin.Error == ErrorCode.ERR_TokenError) { PlayerPrefs.SetString("Phone", ""); PlayerPrefs.SetString("Token", ""); panel_phoneLogin.transform.localScale = new Vector3(1, 1, 1); } if (r2CLogin.Message.CompareTo("用户不存在") == 0) { panel_phoneLogin.transform.localScale = new Vector3(1, 1, 1); } return; } UINetLoadingComponent.showNetLoading(); //connetEndPoint = NetworkHelper.ToIPEndPoint(r2CLogin.Address); //connetEndPoint = NetConfig.getInstance().ToIPEndPointWithYuMing(); string[] temp = r2CLogin.Address.Split(':'); connetEndPoint = ToIPEndPointWithYuMing(Convert.ToInt32(temp[1])); ETModel.Session gateSession = ETModel.Game.Scene.GetComponent <NetOuterComponent>().Create(connetEndPoint); Game.Scene.GetComponent <SessionComponent>().Session = ComponentFactory.Create <Session, ETModel.Session>(session); ETModel.Game.Scene.GetComponent <ETModel.SessionComponent>().Session = gateSession; G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await SessionComponent.Instance.Session.Call(new C2G_LoginGate() { Key = r2CLogin.Key }); UINetLoadingComponent.closeNetLoading(); ToastScript.createToast("登录成功"); //挂心跳包 Game.Scene.GetComponent <SessionComponent>().Session.AddComponent <HeartBeatComponent>(); UINetLoadingComponent.closeNetLoading(); await getAllData(); isLoginSuccess = true; { // 保存Phone PlayerPrefs.SetString("Phone", phone); // 保存Token PlayerPrefs.SetString("Token", r2CLogin.Token); } Game.Scene.GetComponent <PlayerInfoComponent>().uid = g2CLoginGate.Uid; PlayerInfoComponent.Instance.SetShopInfoList(g2CLoginGate.ShopInfoList); PlayerInfoComponent.Instance.SetBagInfoList(g2CLoginGate.BagList); PlayerInfoComponent.Instance.ownIcon = g2CLoginGate.ownIcon; ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>(); await resourcesComponent.LoadBundleAsync($"UIMain.unity3d"); await resourcesComponent.LoadBundleAsync($"Image_Main.unity3d"); Game.Scene.GetComponent <UIComponent>().Create(UIType.UIMain); Game.Scene.GetComponent <UIComponent>().Remove(UIType.UILogin); } catch (Exception e) { sessionWrap?.Dispose(); Log.Error(e); } }
public void Awake() { ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>(); GamersPanel[0] = rc.Get <GameObject>("Bottom"); GamersPanel[1] = rc.Get <GameObject>("Right"); GamersPanel[2] = rc.Get <GameObject>("Top"); GamersPanel[3] = rc.Get <GameObject>("Left"); this.players = rc.Get <GameObject>("Players"); this.treasure = rc.Get <GameObject>("Treasure"); this.treasure.SetActive(false); this.desk = rc.Get <GameObject>("Desk"); this.head = rc.Get <GameObject>("Head"); this.baoxiang = rc.Get <GameObject>("Baoxiang"); HeadPanel[0] = head.Get <GameObject>("Bottom"); HeadPanel[1] = head.Get <GameObject>("Right"); HeadPanel[2] = head.Get <GameObject>("Top"); HeadPanel[3] = head.Get <GameObject>("Left"); ChatBtn = rc.Get <GameObject>("ChatBtn").GetComponent <Button>(); this.restText = rc.Get <GameObject>("RestText").GetComponent <Text>(); this.roomConfigText = rc.Get <GameObject>("RoomConfigText").GetComponent <Text>(); this.currentJuCountText = rc.Get <GameObject>("CurrentJuCountText").GetComponent <Text>(); this.settingBtn = rc.Get <GameObject>("SettingBtn").GetComponent <Button>(); this.changeTableBtn = rc.Get <GameObject>("ChangeTableBtn").GetComponent <Button>(); this.readyBtn = rc.Get <GameObject>("ReadyBtn").GetComponent <Button>(); this.exitBtn = rc.Get <GameObject>("ExitBtn").GetComponent <Button>(); this.timeImage = rc.Get <GameObject>("Time").GetComponent <Image>(); this.giveUpBtn = rc.Get <GameObject>("ImageGiveUp").GetComponent <Button>(); this.huBtn = rc.Get <GameObject>("ImageHu").GetComponent <Button>(); this.gangBtn = rc.Get <GameObject>("ImageGang").GetComponent <Button>(); this.pengBtn = rc.Get <GameObject>("ImagePeng").GetComponent <Button>(); pengBtn.onClick.Add(() => OnOperate(0)); gangBtn.onClick.Add(() => OnOperate(1)); huBtn.onClick.Add(() => OnOperate(2)); giveUpBtn.onClick.Add(() => OnOperate(3)); this.settingBtn.onClick.Add(OnSetting); this.exitBtn.onClick.Add(OnExit); this.readyBtn.onClick.Add(OnReady); CommonUtil.SetTextFont(this.GetParent <UI>().GameObject); #region 托管 this.trustship = rc.Get <GameObject>("Trustship"); trustship.SetActive(false); trustship.GetComponent <Button>().onClick.Add(() => { SessionComponent.Instance.Session.Send(new Actor_GamerCancelTrusteeship()); trustship.SetActive(false); }); #endregion #region 作弊 this.cheat = rc.Get <GameObject>("Cheat"); Button cheatButton = this.cheat.Get <GameObject>("CheatButton").GetComponent <Button>(); Button sendButton = this.cheat.Get <GameObject>("SendButton").GetComponent <Button>(); this.cheatInput = this.cheat.Get <GameObject>("InputField").GetComponent <InputField>(); sendButton.gameObject.SetActive(false); cheatInput.gameObject.SetActive(false); cheatButton.onClick.Add(() => { sendButton.gameObject.SetActive(true); cheatInput.gameObject.SetActive(true); }); sendButton.onClick.Add(() => { SessionComponent.Instance.Session.Call(new Actor_GamerCheat() { Info = this.cheatInput.text }); sendButton.gameObject.SetActive(false); cheatInput.gameObject.SetActive(false); }); if (NetConfig.getInstance().isFormal) { this.cheat.SetActive(false); } else { this.cheat.SetActive(true); } #endregion #region 聊天 Game.Scene.GetComponent <UIComponent>().Create(UIType.UIChatShow); UI ui = Game.Scene.GetComponent <UIComponent>().Create(UIType.UIChat); ui.GameObject.SetActive(false); ChatBtn.onClick.Add(() => { if (ui != null) { if (ui.GetComponent <UIChatComponent>().isOpen) { ui.GetComponent <UIChatComponent>().CloseOrOpenChatUI(false); } else { ui.GetComponent <UIChatComponent>().CloseOrOpenChatUI(true); } } }); #endregion #region 花牌显示 this.faceCardObj = rc.Get <GameObject>("FaceCardObj"); faceCardObj.SetActive(false); FacePanel[0] = this.faceCardObj.Get <GameObject>("Bottom"); FacePanel[1] = this.faceCardObj.Get <GameObject>("Right"); FacePanel[2] = this.faceCardObj.Get <GameObject>("Top"); FacePanel[3] = this.faceCardObj.Get <GameObject>("Left"); Button backBtn = this.faceCardObj.Get <GameObject>("Button_back").GetComponent <Button>(); backBtn.onClick.Add(() => { faceCardObj.gameObject.SetActive(false); }); #endregion #region 骰子 this.dice = rc.Get <GameObject>("Dice"); #endregion #region 提示 this.tip = rc.Get <GameObject>("Tip"); #endregion #region 四连风等 this.showAnimImage = rc.Get <GameObject>("ShowAnim").GetComponent <Image>(); this.showAnimImage.gameObject.SetActive(false); #endregion }