private void InitInputFields()
 {
     if (this.input_fields == null)
     {
         return;
     }
     this.prefs_data = ChatUtility.LoadChatTemplateMessage();
     if (this.prefs_data == null)
     {
         return;
     }
     if (this.prefs_data.messages.Length < this.input_fields.Length)
     {
         string[] strArray = new string[this.input_fields.Length];
         for (int index = 0; index < this.input_fields.Length; ++index)
         {
             strArray[index] = this.prefs_data.messages.Length < index?LocalizedText.Get("sys.CHAT_DEFAULT_TEMPLATE_MESSAGE_" + (object)(index + 1)) : this.prefs_data.messages[index];
         }
         this.prefs_data.messages = strArray;
     }
     for (int index = 0; index < this.prefs_data.messages.Length && this.input_fields.Length > index; ++index)
     {
         this.input_fields[index].SetText(this.prefs_data.messages[index]);
     }
 }
        private void OnClickSubmitButton(SRPG_Button button)
        {
            int result = 0;

            if (!int.TryParse(((Object)button).get_name(), out result))
            {
                return;
            }
            if (this.input_fields[result].get_text().Length <= 0 || this.input_fields[result].get_text() == this.prefs_data.messages[result])
            {
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
            }
            else
            {
                string text = this.input_fields[result].get_text();
                string str  = ChatUtility.ReplaceNGWord(this.input_fields[result].get_text(), this.chat_inspecton_master, "*");
                if (text != str)
                {
                    this.input_fields[result].SetText(this.prefs_data.messages[result]);
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 101);
                }
                else
                {
                    this.input_fields[result].SetText(str);
                    this.prefs_data.messages[result] = str;
                    ChatUtility.SaveTemplateMessage(this.prefs_data);
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
                }
            }
        }
Exemple #3
0
 public static string ReplaceNGWord(string _text, List <ChatUtility.ChatInspectionMaster> _inspection_datas, string _okikae)
 {
     string[] illegalWord = ChatUtility.GetIllegalWord(_text);
     if (illegalWord.Length > 0)
     {
         for (int index = 0; index < illegalWord.Length; ++index)
         {
             string oldValue = illegalWord[index];
             string newValue = new StringBuilder().Insert(0, _okikae, oldValue.Length).ToString();
             _text = _text.Replace(oldValue, newValue);
         }
     }
     if (_inspection_datas != null && _inspection_datas.Count > 0)
     {
         for (int index = 0; index < _inspection_datas.Count; ++index)
         {
             if (!string.IsNullOrEmpty(_inspection_datas[index].word) && _text.Contains(_inspection_datas[index].word))
             {
                 string newValue = new StringBuilder().Insert(0, _okikae, _inspection_datas[index].word.Length).ToString();
                 _text = _text.Replace(_inspection_datas[index].word, newValue);
             }
         }
     }
     return(_text);
 }
Exemple #4
0
        private static ChatUtility.Json_ChatTemplateData CreateNewTemplateMessagePrefsData()
        {
            ChatUtility.Json_ChatTemplateData new_prefs_data = new ChatUtility.Json_ChatTemplateData();
            List <string> templateMessageList = ChatUtility.GetDefaultTemplateMessageList();

            new_prefs_data.messages = templateMessageList.ToArray();
            ChatUtility.SaveTemplateMessage(new_prefs_data);
            return(new_prefs_data);
        }
 private void Init()
 {
     if (!this.is_loaded_inspection_master)
     {
         this.chat_inspecton_master = ChatUtility.LoadInspectionMaster(ref this.is_loaded_inspection_master);
         if (!this.is_loaded_inspection_master)
         {
             DebugUtility.LogError("FAILED : ChatUtility.LoadInspectionMaster");
         }
     }
     this.InitButtons();
     this.InitInputFields();
 }
Exemple #6
0
 public void LoadTemplateMessage()
 {
     if (this.template_message_buttons == null)
     {
         return;
     }
     this.prefs_data = ChatUtility.LoadChatTemplateMessage();
     if (this.prefs_data == null)
     {
         return;
     }
     this.ONE_PAGE_ITEM_MAX = this.template_message_buttons.Length;
     this.LAST_PAGE         = Mathf.Max(this.prefs_data.messages.Length / this.ONE_PAGE_ITEM_MAX + (this.prefs_data.messages.Length % this.ONE_PAGE_ITEM_MAX != 0 ? 1 : 0) - 1, 0);
     this.SetupButtons();
 }
Exemple #7
0
 private void Refresh()
 {
     if (!this.is_active && PunMonoSingleton <MyPhoton> .Instance.IsConnectedInRoom())
     {
         this.SetParam(JSON_MyPhotonRoomParam.Parse(PunMonoSingleton <MyPhoton> .Instance.GetCurrentRoom().json).iname);
         this.is_active = true;
         this.chat_window.ChangeChatTypeTab(ChatWindow.eChatType.Room);
     }
     else if (ChatUtility.IsMultiQuestNow())
     {
         this.is_active = true;
     }
     else if (this.is_active && !PunMonoSingleton <MyPhoton> .Instance.IsConnectedInRoom())
     {
         this.chat_window.ExitRoomSelf();
         this.is_active = false;
     }
     else
     {
         this.is_active = PunMonoSingleton <MyPhoton> .Instance.IsConnectedInRoom();
     }
 }
Exemple #8
0
        public static ChatUtility.Json_ChatTemplateData LoadChatTemplateMessage()
        {
            if (!PlayerPrefsUtility.HasKey(PlayerPrefsUtility.CHAT_TEMPLATE_MESSAGE))
            {
                return(ChatUtility.CreateNewTemplateMessagePrefsData());
            }
            ChatUtility.Json_ChatTemplateData new_prefs_data = (ChatUtility.Json_ChatTemplateData)null;
            try
            {
                if (PlayerPrefsUtility.HasKey(PlayerPrefsUtility.CHAT_TEMPLATE_MESSAGE))
                {
                    new_prefs_data = (ChatUtility.Json_ChatTemplateData)JsonUtility.FromJson <ChatUtility.Json_ChatTemplateData>(PlayerPrefsUtility.GetString(PlayerPrefsUtility.CHAT_TEMPLATE_MESSAGE, string.Empty));
                }
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
            }
            if (new_prefs_data == null)
            {
                new_prefs_data = ChatUtility.CreateNewTemplateMessagePrefsData();
            }
            List <string> templateMessageList = ChatUtility.GetDefaultTemplateMessageList();

            if (new_prefs_data.messages.Length < templateMessageList.Count)
            {
                List <string> stringList = new List <string>((IEnumerable <string>)new_prefs_data.messages);
                for (int length = new_prefs_data.messages.Length; length < templateMessageList.Count; ++length)
                {
                    stringList.Add(templateMessageList[length]);
                }
                new_prefs_data.messages = stringList.ToArray();
                ChatUtility.SaveTemplateMessage(new_prefs_data);
            }
            return(new_prefs_data);
        }