Ejemplo n.º 1
0
        /// <summary>
        /// 是否包含敏感字
        /// </summary>
        public bool SensitiveWordJudge(string SensitiveWord_type, string SensitiveWord_Str)
        {
            if (null == SensitiveWord_type)
            {
                return(false);
            }
            if (null == SensitiveWord_Str)
            {
                return(false);
            }
            string senstr = Regex.Replace(SensitiveWord_Str, "[ \\[ \\] \\^ \\-_*×――(^)|'$%~!@#$…&%¥—+=<>《》!!???::•`·、。,;,.;\"‘’“”-]", "").ToUpper();

            //遍历判定是否含有敏感字
            foreach (string str in txtString)
            {
                if (str.Trim().Length == 0)
                {
                    continue;
                }
                if (senstr.IndexOf(str.Trim(), StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    UIComponent.Instance.Toast(CPErrorCode.LanguageDescription(20075, new List <object>()
                    {
                        SensitiveWord_type
                    }));
                    return(true);
                }
            }

            return(false);
        }
            public override void Run(int errorStatus)
            {
                UI mUILogin = UIComponent.Instance.Get(UIType.UILogin);

                if (null != mUILogin && null != mUILogin.GameObject)
                {
                    UILoginComponent mUILoginComponent = mUILogin.UiBaseComponent as UILoginComponent;
                    if (null != mUILoginComponent)
                    {
                        if (mUILoginComponent.IsAutoLogin)
                        {
                            mUILoginComponent.UsingSprite();
                            mUILoginComponent.RC.gameObject.SetActive(true);
                            GameObject defaultObj = GameObject.Find("Global/UI/LobbyCanvas/UIDefault(Clone)");
                            if (null != defaultObj)
                            {
                                GameObject.Destroy(defaultObj);
                            }
                        }
                        else
                        {
                            UIComponent.Instance.ShowNoAnimation(UIType.UIDialog, new UIDialogComponent.DialogData()
                            {
                                type = UIDialogComponent.DialogData.DialogType.Commit,
                                // title = $"温馨提示",
                                title = CPErrorCode.LanguageDescription(10007),
                                // content = $"当前线路不稳定,已为您切换线路重新连接",
                                content = CPErrorCode.LanguageDescription(20071),
                                // contentCommit = "知道了",
                                contentCommit = CPErrorCode.LanguageDescription(10024),
                                contentCancel = "",
                                actionCommit  = null,
                                actionCancel  = null
                            });
                        }
                    }
                }
            }
Ejemplo n.º 3
0
        private void OnCheckUpdateSwithInfo(string info, bool isIM, bool isUserChoice)
        {
            NetLineSwitchComponent.NetLineSwitchData lineSwitchData = JsonHelper.FromJson <NetLineSwitchComponent.NetLineSwitchData>(info);

            int selectID;

            string userChoice = PlayerPrefsMgr.mInstance.GetString($"{PlayerPrefsKeys.CURRENT_SERVER_USER_CHOICEID}{serverType}", null);

            if (!string.IsNullOrEmpty(userChoice))
            {
                //优先使用用户选择的线路
                selectID = Convert.ToInt32(userChoice);
            }
            else
            {
                if (isIM)
                {
                    //IM切换的,不要使用接口返回的默认线路,使用上次的线路即可,如无则用线路1
                    selectID = PlayerPrefsMgr.mInstance.GetInt($"{PlayerPrefsKeys.CURRENT_VIP_DNS_SERVERID}{serverType}", 1);
                }
                else
                {
                    selectID = lineSwitchData.selector;
                    PlayerPrefsMgr.mInstance.SetInt($"{PlayerPrefsKeys.CURRENT_VIP_DNS_SERVERID}{serverType}", selectID);
                }
            }

            PlayerPrefsMgr.mInstance.SetInt($"{PlayerPrefsKeys.CURRENT_USING_SERVERID}{serverType}", selectID);
            PlayerPrefs.Save();

            foreach (NetLineSwitchComponent.LineInfo lineInfo in lineSwitchData.list)
            {
                if (lineInfo.id == selectID)
                {
                    bool hadChange = false;
                    if (!string.IsNullOrEmpty(lineInfo.http))
                    {
                        if (lineInfo.http != HTTP)
                        {
                            hadChange = true;
                        }
                        PlayerPrefsMgr.mInstance.SetString($"{PlayerPrefsKeys.CURRENT_SERVER_HTTP_DOMAIN}{serverType}", lineInfo.http);
                        PlayerPrefs.Save();
                    }
                    if (!string.IsNullOrEmpty(lineInfo.sck))
                    {
                        if (lineInfo.sck != LoginHost)
                        {
                            hadChange = true;
                        }
                        PlayerPrefsMgr.mInstance.SetString($"{PlayerPrefsKeys.CURRENT_SERVER_SCK_DOMAIN}{serverType}", lineInfo.sck);
                        PlayerPrefs.Save();
                    }
                    Refresh();
                    if (hadChange && GameCache.Instance.nUserId > 0 && !isUserChoice)
                    {
                        //重连
                        NetworkDetectionComponent mNetworkDetectionComponent = Game.Scene.GetComponent <NetworkDetectionComponent>();
                        if (null != mNetworkDetectionComponent)
                        {
                            Game.Scene.GetComponent <NetworkDetectionComponent>().Reconnect();
                        }
                        // UIComponent.Instance.ShowNoAnimation(UIType.UIDialog, new UIDialogComponent.DialogData()
                        // {
                        //     type = UIDialogComponent.DialogData.DialogType.Commit,
                        //     title = $"温馨提示",
                        //     content = $"当前线路不稳定,已为您切换线路重新连接。",
                        //     contentCommit = "好的",
                        //     actionCommit = null
                        // });
                        UIComponent.Instance.ShowNoAnimation(UIType.UIDialog, new UIDialogComponent.DialogData()
                        {
                            type = UIDialogComponent.DialogData.DialogType.Commit,
                            // title = $"温馨提示",
                            title = CPErrorCode.LanguageDescription(10007),
                            // content = $"当前线路不稳定,已为您切换线路重新连接",
                            content = CPErrorCode.LanguageDescription(20072),
                            // contentCommit = "知道了",
                            contentCommit = CPErrorCode.LanguageDescription(10024),
                            contentCancel = "",
                            actionCommit  = null,
                            actionCancel  = null
                        });
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public async void Send(string _apiUrl, string jsonData, Action <string> _call, string customHost = null, Action pFinishedNoSuccess = null)
        {
            if (WebMessageHelper.IsNeedShowJuhua(_apiUrl))
            {
                UIComponent.Instance.Prompt();
            }
            string url = customHost == null ? $"{GlobalData.Instance.WebURL}{_apiUrl}" : $"{customHost}{_apiUrl}";

            Log.Debug($"send-> url = {url}");

            requests.Add(GameUtil.HttpsPost(url, jsonData, (request, response) =>
            {
                RemoveRequest(request);
                switch (request.State)
                {
                case HTTPRequestStates.Finished:
                    if (response.IsSuccess)
                    {
                        Log.Debug($"response-> url = {url} jsonData = {jsonData} 结果= {response.DataAsText}");
                        CommonResponseData data = JsonHelper.FromJson <CommonResponseData>(response.DataAsText);
                        if (data.status == 105)
                        {
                            //维护弹窗
                            UIComponent.Instance.ShowNoAnimation(UIType.UIDialog,
                                                                 new UIDialogComponent.DialogData()
                            {
                                type          = UIDialogComponent.DialogData.DialogType.Commit,
                                title         = "",
                                content       = string.Format(LanguageMgr.mInstance.GetLanguageForKey("ServerMaintenance"), data.msg),
                                contentCommit = CPErrorCode.LanguageDescription(10008),
                                actionCommit  = null,
                                actionCancel  = null
                            });
                        }
                        if (_call != null)
                        {
                            _call(response.DataAsText);
                        }
                    }
                    else
                    {
                        UIComponent.Instance.Toast(response.StatusCode);
                        if (pFinishedNoSuccess != null)
                        {    //追加的.下拉列表 不成功时 收缩下(加载中...)
                            pFinishedNoSuccess();
                        }
                    }
                    break;

                case HTTPRequestStates.Error:
                    string exception = request.Exception != null
                                ? (request.Exception.Message + "\n" + request.Exception.StackTrace) : "No Exception";
                    Log.Debug($"Request Finished with Error!  {exception}");
                    // UIComponent.Instance.Toast("请求错误");
                    if (pFinishedNoSuccess != null)
                    {
                        pFinishedNoSuccess();
                    }
                    break;

                case HTTPRequestStates.Aborted:
                    Log.Debug($"Request Aborted!");
                    // UIComponent.Instance.Toast("请求拒绝");
                    if (pFinishedNoSuccess != null)
                    {
                        pFinishedNoSuccess();
                    }
                    break;

                case HTTPRequestStates.ConnectionTimedOut:
                    Log.Debug($"Connection Timed Out!");
                    // UIComponent.Instance.Toast("连接超时");
                    if (pFinishedNoSuccess != null)
                    {
                        pFinishedNoSuccess();
                    }
                    break;

                case HTTPRequestStates.TimedOut:
                    Log.Debug($"Processing the request Timed Out!");
                    // UIComponent.Instance.Toast("网络超时");
                    if (pFinishedNoSuccess != null)
                    {
                        pFinishedNoSuccess();
                    }
                    break;

                default:
                    UIComponent.Instance.Toast($"未知错误 State = {request.State} ");
                    if (pFinishedNoSuccess != null)
                    {
                        pFinishedNoSuccess();
                    }
                    break;
                }
            }), (int)HTTPRequestStates.Initial);
        }