void Start(){ //set chat group name newGroup1 = group1; newGroup2 = group2; //randomly select two different fake names int s = Random.Range(0,names.Length),s2=Random.Range(0,names.Length); n1 = names[s]; while(s==s2){s2 = Random.Range(0,names.Length);} n2 = names[s2]; //initialize the SimChat objects sc = new SimChat("default","hat",gameObject.GetComponent<MonoBehaviour>(),n1); sc2 = new SimChat("default","hatalso",gameObject.GetComponent<MonoBehaviour>(),n2); //tell the SimChat Objects to continuously check for new messages sc.continueCheckMessages(); sc2.continueCheckMessages(); //set the functions to call when a new message is received sc.setReceiveFunction(receiveMessage1); sc2.setReceiveFunction(receiveMessage2); //set the new password values to the current password values newPass1 = sc.password; newPass2 = sc2.password; //initialize the word filter TextAsset wd = Resources.Load("words", typeof(TextAsset)) as TextAsset; if(wd==null) UnityEngine.Debug.LogWarning("File Not Found 'words'"); wf = new TWordFilter(wd.text); }
void Start() { //set chat group name newGroup1 = group1; newGroup2 = group2; //randomly select two different fake names int s = Random.Range(0, names.Length), s2 = Random.Range(0, names.Length); n1 = names[s]; while (s == s2) { s2 = Random.Range(0, names.Length); } n2 = names[s2]; //initialize the SimChat objects sc = new SimChat("default", "hat", gameObject.GetComponent <MonoBehaviour>(), n1); sc2 = new SimChat("default", "hatalso", gameObject.GetComponent <MonoBehaviour>(), n2); //tell the SimChat Objects to continuously check for new messages sc.continueCheckMessages(); sc2.continueCheckMessages(); //set the functions to call when a new message is received sc.setReceiveFunction(receiveMessage1); sc2.setReceiveFunction(receiveMessage2); //set the new password values to the current password values newPass1 = sc.password; newPass2 = sc2.password; //initialize the word filter TextAsset wd = Resources.Load("words", typeof(TextAsset)) as TextAsset; if (wd == null) { UnityEngine.Debug.LogWarning("File Not Found 'words'"); } wf = new TWordFilter(wd.text); }
public SimpleChat(string identifier,string password,MonoBehaviour currentMonoBehaviour,string senderName):base(identifier,password,currentMonoBehaviour,senderName){ continueCheckMessages(); rt = -messageTime; setReceiveFunction(receive); TextAsset s = Resources.Load("words", typeof(TextAsset)) as TextAsset; if(s==null) UnityEngine.Debug.LogWarning("File Not Found 'words'"); wf = new TWordFilter(s.text); }
public SimpleChat(string identifier, string password, MonoBehaviour currentMonoBehaviour, string senderName) : base(identifier, password, currentMonoBehaviour, senderName) { continueCheckMessages(); rt = -messageTime; setReceiveFunction(receive); TextAsset s = Resources.Load("words", typeof(TextAsset)) as TextAsset; if (s == null) { UnityEngine.Debug.LogWarning("File Not Found 'words'"); } wf = new TWordFilter(s.text); }