Esempio n. 1
0
 //发送聊天文字
 public void SendChatData(string str)
 {
     if (BWFManager.isReady && BWFManager.Contains(str))
     {
         str = BWFManager.ReplaceAll(str);
     }
     if (str.Length > ChatDataLenght)
     {
         GameSceneUIHandler.ShowLog("文字长度过长,请重新输入!");
     }
     else if (str.Length == 0)
     {
         GameSceneUIHandler.ShowLog("输入信息不能为空!");
     }
     else
     {
         var temp = Encoding.GetEncoding(936).GetBytes(str);
         //byte[] data = new byte[40];
         //Array.Clear(data, 0, 40);
         var kernel = (GameScene)CServerItem.get().GetClientKernelSink();
         if (kernel == null)
         {
             return;
         }
         //Buffer.BlockCopy(temp, 0, data, 0, temp.Length);
         kernel.SendChatData(temp);
     }
     chat = "";
 }
Esempio n. 2
0
    ////获取文本框中的文字
    //public void GetChatData(string str)
    //{
    //    m_chatText = "";
    //    m_chatText = str;
    //}

    //发送聊天文字
    public void SendChatData(string chatText)
    {
        if (BWFManager.isReady && BWFManager.Contains(chatText))
        {
            chatText = BWFManager.ReplaceAll(chatText);
        }
        if (chatText.Length > LobbyChatDataLenght)
        {
            GameSceneUIHandler.ShowLog("文字长度过长,请重新输入!");
        }
        else if (chatText.Length == 0)
        {
            GameSceneUIHandler.ShowLog("输入信息不能为空!");
        }
        else
        {
            //var kernel = (GameScene)CServerItem.get().GetClientKernelSink();
            //if (kernel == null) { return; }
            //Buffer.BlockCopy(temp, 0, data, 0, temp.Length);
            //kernel.SendChatData(data);

            CGPLobbyMission kGPLobbyMission = CGPLobbyMission.GetInstance();
            if (kGPLobbyMission != null)
            {
                if (!kGPLobbyMission.isLobbyChatSystemSetted())
                {
                    kGPLobbyMission.setLobbyChatSystem(this);
                }

                kGPLobbyMission.SendChatData(chatText);
            }
        }
        //m_chatText = "";
    }
Esempio n. 3
0
    public void registerButtonCallback()
    {
        string userName = loginPanel.loginInput.text;

        if (userName != "")
        {
            if (!BWFManager.Contains(userName) && userName != "Rookie")
            {
                loginPanel.ErrorString = "";
                loginPanel.loginStarted();

                Debug.Log("Updating Player...");
//                new GameSparks.Api.Requests.RegistrationRequest()
//                              .SetDisplayName(userName)
//                              .SetUserName(SystemInfo.deviceUniqueIdentifier)
//                              .SetPassword("")
//                              .Send(RegisterGameSparksResponse);
                newName = userName;
                new GameSparks.Api.Requests.ChangeUserDetailsRequest()
                .SetDisplayName(userName)
                .Send(ChangeDisplayNameResponse);
            }
            else
            {
                loginPanel.ErrorString = socialErrorManager.GetErrorMessage("BAD_WORD");
            }
        }
        else
        {
            loginPanel.ErrorString = socialErrorManager.GetErrorMessage("EMPTY_INPUT_LOGIN");
        }
    }
Esempio n. 4
0
        private void showTestDrive()
        {
            if (Util.Helper.isEditorMode)
            {
                if (BWFManager.isReady)
                {
                    scrollPosTD = EditorGUILayout.BeginScrollView(scrollPosTD, false, false);
                    {
                        GUILayout.Label("Test-Drive", EditorStyles.boldLabel);

                        inputText = EditorGUILayout.TextField(new GUIContent("Input Text", "Text to check."), inputText);

                        EditorHelper.ReadOnlyTextField("Output Text", outputText);
                    }
                    EditorGUILayout.EndScrollView();

                    EditorHelper.SeparatorUI();

                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button(new GUIContent(" Contains", EditorHelper.Icon_Contains, "Contains any bad words?")))
                        {
                            BWFManager.Load();
                            outputText = BWFManager.Contains(inputText).ToString();
                        }

                        if (GUILayout.Button(new GUIContent(" Get", EditorHelper.Icon_Get, "Get all bad words.")))
                        {
                            BWFManager.Load();
                            outputText = string.Join(", ", BWFManager.GetAll(inputText).ToArray());
                        }

                        if (GUILayout.Button(new GUIContent(" Replace", EditorHelper.Icon_Replace, "Check and replace all bad words.")))
                        {
                            BWFManager.Load();
                            outputText = BWFManager.ReplaceAll(inputText);
                        }

                        if (GUILayout.Button(new GUIContent(" Mark", EditorHelper.Icon_Mark, "Mark all bad words.")))
                        {
                            BWFManager.Load();
                            outputText = BWFManager.Mark(inputText, BWFManager.GetAll(inputText));
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                else
                {
                    EditorHelper.BWFUnavailable();
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Disabled in Play-mode!", MessageType.Info);
            }
        }
Esempio n. 5
0
 public void SetNickNameForRegister(string str)
 {
     if (!BWFManager.Contains(str))
     {
         CustomNameWindow.transform.Find("UserName").GetComponent <InputField>().text = str;
         LoginScene.m_kNickName = str;
     }
     else
     {
         GameSceneUIHandler.ShowLog("该昵称包含敏感词汇,无法使用");
         CustomNameWindow.transform.Find("UserName").GetComponent <InputField>().text = LoginScene.m_kNickName;
     }
 }
Esempio n. 6
0
        protected override void speedTest(Model.ManagerMask mask)
        {
            stopWatch.Reset();
            stopWatch.Start();

            for (int ii = 0; ii < Iterations; ii++)
            {
                BWFManager.Contains(createRandomString(TextStartLength + (TextGrowPerIteration * ii)), mask, TestSources);
            }

            stopWatch.Stop();

            Debug.Log("## " + mask + ": " + stopWatch.ElapsedMilliseconds + ";" + ((float)stopWatch.ElapsedMilliseconds / Iterations) + " ##");
        }
Esempio n. 7
0
    // Token: 0x06002364 RID: 9060 RVA: 0x000E7EBC File Offset: 0x000E60BC
    public bool CheckName()
    {
        if (this.MBPHKDQMJJH.BGBMIEJJQKC.Length < 3)
        {
            this.QHNLDODGGQB.PIDLOFMIEFQ = "Username is too short";
            this.QHNLDODGGQB.gameObject.SetActive(true);
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().ResetToBeginning();
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().enabled = true;
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().PlayForward();
            return(false);
        }
        int num = 0;

        for (int i = 0; i < this.MBPHKDQMJJH.BGBMIEJJQKC.Length; i++)
        {
            if (char.IsUpper(this.MBPHKDQMJJH.BGBMIEJJQKC[i]))
            {
                num++;
            }
        }
        if (num > 3)
        {
            this.QHNLDODGGQB.PIDLOFMIEFQ = "Username can only contain 3 capitals";
            this.QHNLDODGGQB.gameObject.SetActive(true);
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().ResetToBeginning();
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().enabled = true;
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().PlayForward();
            return(false);
        }
        if (BWFManager.Contains(this.MBPHKDQMJJH.BGBMIEJJQKC, ManagerMask.BadWord, Array.Empty <string>()))
        {
            this.QHNLDODGGQB.PIDLOFMIEFQ = "You can not use this username";
            this.QHNLDODGGQB.gameObject.SetActive(true);
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().ResetToBeginning();
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().enabled = true;
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().PlayForward();
            return(false);
        }
        this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().enabled = false;
        this.QHNLDODGGQB.gameObject.SetActive(false);
        return(true);
    }
Esempio n. 8
0
    // Token: 0x06002359 RID: 9049 RVA: 0x000E777C File Offset: 0x000E597C
    public bool MJBMBBFOQPF()
    {
        if (this.MBPHKDQMJJH.BGBMIEJJQKC.Length < 3)
        {
            this.QHNLDODGGQB.LKPOBCBOFIC(" days ago");
            this.QHNLDODGGQB.gameObject.SetActive(false);
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().ResetToBeginning();
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().enabled = false;
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().PlayForward();
            return(true);
        }
        int num = 0;

        for (int i = 1; i < this.MBPHKDQMJJH.BGBMIEJJQKC.Length; i += 0)
        {
            if (char.IsUpper(this.MBPHKDQMJJH.HJMJDJKOILH()[i]))
            {
                num++;
            }
        }
        if (num > 0)
        {
            this.QHNLDODGGQB.PIDLOFMIEFQ = "50/50";
            this.QHNLDODGGQB.gameObject.SetActive(false);
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().ResetToBeginning();
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().enabled = false;
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().PlayForward();
            return(false);
        }
        if (BWFManager.Contains(this.MBPHKDQMJJH.HJMJDJKOILH(), ManagerMask.None, Array.Empty <string>()))
        {
            this.QHNLDODGGQB.PIDLOFMIEFQ = "a";
            this.QHNLDODGGQB.gameObject.SetActive(true);
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().ResetToBeginning();
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().enabled = false;
            this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().PlayForward();
            return(false);
        }
        this.QHNLDODGGQB.GetComponent <EPIJJNOIKEK>().enabled = false;
        this.QHNLDODGGQB.gameObject.SetActive(false);
        return(false);
    }
Esempio n. 9
0
        protected override void sanityTest(Model.ManagerMask mask)
        {
            //null test
            if (!BWFManager.Contains(null, mask))
            {
                if (Util.Config.DEBUG)
                {
                    Debug.Log("Nullable test passed");
                }
            }
            else
            {
                Debug.LogError("Nullable test failed");
                failCounter++;
            }

            //empty test
            if (!BWFManager.Contains(string.Empty))
            {
                if (Util.Config.DEBUG)
                {
                    Debug.Log("Empty test passed");
                }
            }
            else
            {
                Debug.LogError("Empty test failed");
                failCounter++;
            }

            if ((mask & Model.ManagerMask.Domain) == Model.ManagerMask.Domain || (mask & Model.ManagerMask.BadWord) == Model.ManagerMask.BadWord || (mask & Model.ManagerMask.All) == Model.ManagerMask.All)
            {
                //wrong 'source' test
                if (!BWFManager.Contains(scunthorpe, mask, "test"))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Wrong 'source' test passed");
                    }
                }
                else
                {
                    Debug.LogError("Wrong 'source' test failed");
                    failCounter++;
                }

                //null for 'source' test
                if (!BWFManager.Contains(scunthorpe, mask, null))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Null for 'source' test passed");
                    }
                }
                else
                {
                    Debug.LogError("Null for 'source' test failed");
                    failCounter++;
                }

                //Zero-length array for 'source' test
                if (!BWFManager.Contains(scunthorpe, mask, new string[0]))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Zero-length array for 'source' test passed");
                    }
                }
                else
                {
                    Debug.LogError("Zero-length array for 'source' test failed");
                    failCounter++;
                }
            }

            if ((mask & Model.ManagerMask.BadWord) == Model.ManagerMask.BadWord || (mask & Model.ManagerMask.All) == Model.ManagerMask.All)
            {
                //normal bad word match test
                if (BWFManager.Contains(badword, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Normal bad word match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Normal bad word match failed");
                    failCounter++;
                }

                //normal bad word non-match test
                if (!BWFManager.Contains(scunthorpe, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Normal bad word non-match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Normal bad word non-match word test failed");
                    failCounter++;
                }
                //bad word resource match test
                if (BWFManager.Contains(badword, mask, "english"))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Bad word resource match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Bad word resource match failed");
                    failCounter++;
                }

                //bad word resource non-match test
                if (!BWFManager.Contains(noBadword, mask, "english"))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Bad word resource non-match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Bad word resource non-match word test failed");
                    failCounter++;
                }

                //arabic match test
                if (BWFManager.Contains(arabicBadword, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Arabic bad word match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Arabic bad word match failed");
                    failCounter++;
                }

                //global match test
                if (BWFManager.Contains(globalBadword, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Global bad word match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Global bad word match failed");
                    failCounter++;
                }

                //name match test
                if (BWFManager.Contains(nameBadword, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Name match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Name match failed");
                    failCounter++;
                }

                //emoji match test
                if (BWFManager.Contains(emoji, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Emoji match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Emoji match failed");
                    failCounter++;
                }
            }

            if ((mask & Model.ManagerMask.Domain) == Model.ManagerMask.Domain || (mask & Model.ManagerMask.All) == Model.ManagerMask.All)
            {
                //domain match test
                if (BWFManager.Contains(domain, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Domain match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Domain match failed");
                    failCounter++;
                }

                //domain match test
                if (BWFManager.Contains(email, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Email match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Email match failed");
                    failCounter++;
                }

                //domain non-match test
                if (!BWFManager.Contains(noDomain, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Domain non-match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Domain non-match word test failed");
                    failCounter++;
                }
            }

            if ((mask & Model.ManagerMask.Capitalization) == Model.ManagerMask.Capitalization)
            {
                string caps   = new string('A', Crosstales.BWF.Manager.CapitalizationManager.CharacterNumber);
                string noCaps = new string('A', Crosstales.BWF.Manager.CapitalizationManager.CharacterNumber - 1);

                //capital match test
                if (BWFManager.Contains(caps, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Capital match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Capital match failed");
                    failCounter++;
                }

                //capital non-match test
                if (!BWFManager.Contains(noCaps, mask))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Capital non-match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Capital non-match word test failed");
                    failCounter++;
                }
            }

            if ((mask & Model.ManagerMask.Punctuation) == Model.ManagerMask.Punctuation)
            {
                string punc   = new string('!', Crosstales.BWF.Manager.PunctuationManager.CharacterNumber);
                string noPunc = new string('!', Crosstales.BWF.Manager.PunctuationManager.CharacterNumber - 1);

                //punctuation match test
                if (BWFManager.Contains(punc))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Punctuation match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Punctuation match failed");
                    failCounter++;
                }

                //punctuation non-match test
                if (!BWFManager.Contains(noPunc))
                {
                    if (Util.Config.DEBUG)
                    {
                        Debug.Log("Punctuation non-match test passed");
                    }
                }
                else
                {
                    Debug.LogError("Punctuation non-match word test failed");
                    failCounter++;
                }
            }
        }
Esempio n. 10
0
    public void SetUserInfo()
    {
        GlobalUserInfo    pGlobalUserInfo = GlobalUserInfo.GetInstance();
        tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData();

        CMD_GP_ModUserInfo pData = new CMD_GP_ModUserInfo();

        pData.Init();

        if (strName == null)
        {
            Buffer.BlockCopy(pGlobalUserData.szNickName, 0, pData.szNickName, 0, pGlobalUserData.szNickName.Length);
        }
        else
        {
            byte[] szNickName = Encoding.GetEncoding(936).GetBytes(strName);
            Buffer.BlockCopy(szNickName, 0, pData.szNickName, 0, szNickName.Length);
        }
        if (headIndex == -1)  //预留自定义头像,使用自定义头像时headIndex需置为-1
        {
            Buffer.BlockCopy(pGlobalUserData.szHeadHttp, 0, pData.szHeadHttp, 0, pGlobalUserData.szHeadHttp.Length);
        }
        else
        {
            byte[] szHeadIndex = Encoding.GetEncoding(936).GetBytes(headIndex.ToString());
            Buffer.BlockCopy(szHeadIndex, 0, pData.szHeadHttp, 0, szHeadIndex.Length);
        }

        if (!BWFManager.Contains(strName))
        {
            bool   isNameEquals = true;
            bool   isHeadEquals = true;
            string name1        = Encoding.Default.GetString(pData.szNickName);
            string name2        = Encoding.Default.GetString(pGlobalUserData.szNickName);
            string head1        = Encoding.Default.GetString(pData.szHeadHttp);
            string head2        = Encoding.Default.GetString(pGlobalUserData.szHeadHttp);
            if (name1.Length != name2.Length)
            {
                isNameEquals = false;
            }
            else
            {
                for (int i = 0; i < name1.Length; i++)
                {
                    if (name1[i] == name2[i])
                    {
                        continue;
                    }
                    else
                    {
                        isNameEquals = false;
                        break;
                    }
                }
            }
            if (head1.Length != head2.Length)
            {
                isHeadEquals = false;
            }
            else
            {
                for (int i = 0; i < head1.Length; i++)
                {
                    if (head1[i] == head2[i])
                    {
                        continue;
                    }
                    else
                    {
                        isHeadEquals = false;
                        break;
                    }
                }
            }
            if (!isNameEquals || !isHeadEquals)
            {
                UserInfo.getInstance().modeUserInfo(pData);
                //修改玩资料后,临时变量清空
                strName = null;
                Canvas.transform.Find("Window/UserEditorWindow/UserInfo/UserNameField").GetComponent <InputField>().text = "";
            }
            else if (isNameEquals)
            {
                GameSceneUIHandler.ShowLog("您当前正在使用该昵称!");
            }
        }
        else
        {
            GameSceneUIHandler.ShowLog("该昵称包含敏感词汇,无法使用");
        }
    }
Esempio n. 11
0
        public override void OnInspectorGUI()
        {
            if (script.isActiveAndEnabled)
            {
                GUILayout.Label("Stats", EditorStyles.boldLabel);

                GUILayout.Label("Ready:\t" + (BWFManager.isReady ? "Yes" : "No"));

                EditorHelper.SeparatorUI();

                GUILayout.Label("Test-Drive", EditorStyles.boldLabel);

                if (Util.Helper.isEditorMode)
                {
                    inputText = EditorGUILayout.TextField(new GUIContent("Input Text", "Text to check."), inputText);

                    EditorHelper.ReadOnlyTextField("Output Text", outputText);

                    GUILayout.Space(8);

                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button(new GUIContent(" Contains", EditorHelper.Icon_Contains, "Contains any bad words?")))
                    {
                        //Manager.BadWordManager.Load();
                        outputText = BWFManager.Contains(inputText).ToString();

                        GAApi.Event(typeof(BWFManagerEditor).Name, "Contains");
                    }

                    if (GUILayout.Button(new GUIContent(" Get", EditorHelper.Icon_Get, "Get all bad words.")))
                    {
                        //Manager.BadWordManager.Load();
                        outputText = string.Join(", ", BWFManager.GetAll(inputText).ToArray());

                        GAApi.Event(typeof(BWFManagerEditor).Name, "Get");
                    }

                    if (GUILayout.Button(new GUIContent(" Replace", EditorHelper.Icon_Replace, "Check and replace all bad words.")))
                    {
                        //Manager.BadWordManager.Load();
                        outputText = BWFManager.ReplaceAll(inputText);

                        GAApi.Event(typeof(BWFManagerEditor).Name, "Replace");
                    }

                    if (GUILayout.Button(new GUIContent(" Mark", EditorHelper.Icon_Mark, "Mark all bad words.")))
                    {
                        //Manager.BadWordManager.Load();
                        outputText = BWFManager.Mark(inputText, BWFManager.GetAll(inputText));

                        GAApi.Event(typeof(BWFManagerEditor).Name, "Mark");
                    }
                    GUILayout.EndHorizontal();
                }
                else
                {
                    EditorGUILayout.HelpBox("Disabled in Play-mode!", MessageType.Info);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Script is disabled!", MessageType.Info);
            }
        }