123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Text;
- public class ChangeStrings {
- private static List<string> oldValues = new List<string> { "%NPC_Name%", "%Player_Name%" , "<Gig_Timer>" , "[he/she]" , "[him/her]", "[Boy/girl]", "[boy/girl]", "[Queen/King]", "[his/her]", "[guy/girl]", "[He/she]" };
- public static string ChangeText(string _text)
- {
- string newValues = null;
- string text = _text;
- if (_text.Contains(oldValues[0]))
- {
- newValues = GameGlobal.Instance.CurrentNpc;
- text = text.Replace(oldValues[0], newValues);
- Debug.Log("Text 1 " + text);
- }
- if(_text.Contains(oldValues[1]))
- {
- newValues = GameGlobal.Instance.PlayerName;
- text = text.Replace(oldValues[1], newValues);
- }
- //[Gig_Timer]
- if (_text.Contains(oldValues[2]))
- {
- newValues = GameGlobal.Instance.GetGigTimer;
- text = text.Replace(oldValues[2], newValues);
- }
- if (_text.Contains(oldValues[3]))
- {
- newValues = GameGlobal.Instance.PlayerGender.ToLower();
- text = text.Replace(oldValues[3], newValues);
- }
- if(_text.Contains(oldValues[4]))
- {
- newValues = GameGlobal.Instance.PlayerGender;
- if (newValues == "She")
- newValues = "her";
- else
- newValues = "him";
- text = text.Replace(oldValues[4], newValues);
- }
- //[Boy/girls]
- if (_text.Contains(oldValues[5]) || _text.Contains(oldValues[6]))
- {
- newValues = GameGlobal.Instance.PlayerSex;
- if (newValues == "Male")
- newValues = "Boy";
- else
- newValues = "Girl";
- text = text.Replace(oldValues[5], newValues);
- text = text.Replace(oldValues[6], newValues);
- }
- if (_text.Contains(oldValues[6]))
- {
- newValues = GameGlobal.Instance.PlayerSex;
- if (newValues == "Male")
- newValues = "boy";
- else
- newValues = "girl";
- text = text.Replace(oldValues[5], newValues);
- text = text.Replace(oldValues[6], newValues);
- }
- if (_text.Contains(oldValues[7]))
- {
- newValues = GameGlobal.Instance.PlayerSex;
- if (newValues == "Male")
- newValues = "King";
- else
- newValues = "Queen";
- text = text.Replace(oldValues[7], newValues);
- }
- if (_text.Contains(oldValues[8]))
- {
- newValues = GameGlobal.Instance.PlayerGender;
- if (newValues == "She")
- newValues = "her";
- else
- newValues = "his";
- text = text.Replace(oldValues[8], newValues);
- }
- if (_text.Contains(oldValues[9]))
- {
- newValues = GameGlobal.Instance.PlayerSex;
- if (newValues == "Male")
- newValues = "guy";
- else
- newValues = "girl";
- text = text.Replace(oldValues[9], newValues);
- }
- if (_text.Contains(oldValues[10]))
- {
- newValues = GameGlobal.Instance.PlayerSex;
- if (newValues == "Male")
- newValues = "He";
- else
- newValues = "She";
- text = text.Replace(oldValues[10], newValues);
- }
- return text;
- }
- public static string ChangeText(string _text, string _oldValue, string _newValue)
- {
- return _text.Replace(_oldValue, _newValue);
- }
- public static bool WordsBannedFilter(string _text)
- {
- List<string> wordsBanned = WordsBanned.Instance.GetWordsBanned;
- string textw = _text.ToLower();
- for (int i = 0; i < wordsBanned.Count; i++)
- {
- if (textw.Contains(wordsBanned[i].ToLower()))
- {
- return true;
- }
- }
- return false;
- }
- }
|