Beispiel #1
0
	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);
	}
Beispiel #2
0
    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);
    }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        //amigoData = new UserData();
        GameObject GM = GameObject.Find("MainController");

        GMS = GM.GetComponent <MainController>();

        string amigoId = PlayerPrefs.GetString("chatUserId");

        chatImage.sprite = GMS.spriteSquareFromFile(GMS.amigoData.foto);
        chatNombre.text  = GMS.amigoData.nombre;

        /*GMS.db.OpenDB("millasperrunas.db");
         * ArrayList result = GMS.db.BasicQueryArray ("select familia.id, familia.email, familia.nombre, familia.foto, perros_usuarios.chat_group from familia " +
         *                                         "inner join perros_usuarios on perros_usuarios.usuarios_id = familia.id where familia.id = "+amigoId+" ");
         * GMS.db.CloseDB ();*/

        //Debug.Log ("amigo id: " + ((string[])result [0]) [0]);

        /*amigoData.id = GMS.amigoData.id;
         * amigoData.email = GMS.amigoData.email;
         * amigoData.nombre = GMS.amigoData.nombre;
         * amigoData.foto =  GMS.amigoData.foto;*/

        amigoImage = GMS.spriteSquareFromFile(GMS.amigoData.foto);
        userImage  = GMS.spriteSquareFromFile(GMS.userData.foto);

        Application.runInBackground = true;
        //string chatGroup = ((string[])result [0]) [4];

        string chatGroup = GMS.amigoData.chat_group;

        /*Debug.Log ("chat group vals: " + ((string[])result [0]) [4] + " | " + GMS.perro.chat_group);
         * Debug.Log ("chat group: " + chatGroup);*/

        sender = GMS.userData.nombre;
        sc     = new SimChat(chatGroup, gameObject.GetComponent <MonoBehaviour>(), sender);

        sc.continueCheckMessages();
        sc.setReceiveFunction(receiveMessage1);

        chatYo.SetActive(false);
        chatEl.SetActive(false);
        //displayChat2 ();

        //myScrollRect.verticalNormalizedPosition = 0.5f;
        yChatCount = chatYo.transform.position.y;
        //RectTransform rectTransform = GetComponent<RectTransform>();
        //rectTransform.pivot = new Vector2(transform.pivot.x, 0);
    }
Beispiel #4
0
	// Use this for initialization
	void Start () {
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();

		string chatGroup = GMS.amigoData.chat_group;

		sender = GMS.userData.nombre/* + "-" + GMS.userData.id*/;
		sc = new SimChat(chatGroup, gameObject.GetComponent<MonoBehaviour>(), sender);
		
		sc.continueCheckMessages();
		sc.setReceiveFunction(receiveMessage1);

		chatNombre.text = GMS.amigoData.nombre;
		chatImage.sprite = GMS.spriteFromFile (GMS.amigoData.foto);
	}
Beispiel #5
0
	// Use this for initialization
	void Start () {
		//amigoData = new UserData();
		GameObject GM = GameObject.Find ("MainController");
		GMS = GM.GetComponent<MainController>();
		
		string amigoId = PlayerPrefs.GetString ("chatUserId");

		chatImage.sprite = GMS.spriteSquareFromFile ( GMS.amigoData.foto );
		chatNombre.text = GMS.amigoData.nombre;
		
		/*GMS.db.OpenDB("millasperrunas.db");
		ArrayList result = GMS.db.BasicQueryArray ("select familia.id, familia.email, familia.nombre, familia.foto, perros_usuarios.chat_group from familia " +
		                                           "inner join perros_usuarios on perros_usuarios.usuarios_id = familia.id where familia.id = "+amigoId+" ");
		GMS.db.CloseDB ();*/
		
		//Debug.Log ("amigo id: " + ((string[])result [0]) [0]);
		
		/*amigoData.id = GMS.amigoData.id;
		amigoData.email = GMS.amigoData.email;
		amigoData.nombre = GMS.amigoData.nombre;
		amigoData.foto =  GMS.amigoData.foto;*/
		
		amigoImage = GMS.spriteSquareFromFile ( GMS.amigoData.foto );
		userImage = GMS.spriteSquareFromFile ( GMS.userData.foto );
		
		Application.runInBackground = true;
		//string chatGroup = ((string[])result [0]) [4];
		
		string chatGroup = GMS.amigoData.chat_group;
		
		/*Debug.Log ("chat group vals: " + ((string[])result [0]) [4] + " | " + GMS.perro.chat_group);
		Debug.Log ("chat group: " + chatGroup);*/
		
		sender = GMS.userData.nombre;
		sc = new SimChat(chatGroup, gameObject.GetComponent<MonoBehaviour>(), sender);
		
		sc.continueCheckMessages();
		sc.setReceiveFunction(receiveMessage1);
		
		chatYo.SetActive (false);
		chatEl.SetActive (false);
		//displayChat2 ();
		
		//myScrollRect.verticalNormalizedPosition = 0.5f;
		yChatCount = chatYo.transform.position.y;
		//RectTransform rectTransform = GetComponent<RectTransform>();
		//rectTransform.pivot = new Vector2(transform.pivot.x, 0);
	}
Beispiel #6
0
    // Use this for initialization
    void Start()
    {
        GameObject GM = GameObject.Find("MainController");

        GMS = GM.GetComponent <MainController>();

        string chatGroup = GMS.amigoData.chat_group;

        sender = GMS.userData.nombre /* + "-" + GMS.userData.id*/;
        sc     = new SimChat(chatGroup, gameObject.GetComponent <MonoBehaviour>(), sender);

        sc.continueCheckMessages();
        sc.setReceiveFunction(receiveMessage1);

        chatNombre.text  = GMS.amigoData.nombre;
        chatImage.sprite = GMS.spriteFromFile(GMS.amigoData.foto);
    }
Beispiel #7
0
    public networkTicTacToe(string group, string password, MonoBehaviour mono, string name)
    {
        //initialize the SimChat
        sc = new SimChat("%" + group, password, mono, name);    // "%" is used so people using the example online can not spam a message stream (unless the message stream group starts with % and they knew that)
        //Continue to check for new messages
        sc.continueCheckMessages();
        //set the receive function
        sc.setReceiveFunction(receive);
        //used as a starting message, used to ensure that firstInfo is triggered
        sc.sendMessage("Start");
        //set the delay between checking for new messages, default is 0.5;
        sc.delay = 0.1f;

        //paths to check for victory
        victoryPaths.Add(new int[] { 0, 1, 2 });
        victoryPaths.Add(new int[] { 3, 4, 5 });
        victoryPaths.Add(new int[] { 6, 7, 8 });
        victoryPaths.Add(new int[] { 0, 3, 6 });
        victoryPaths.Add(new int[] { 1, 4, 7 });
        victoryPaths.Add(new int[] { 2, 5, 8 });
        victoryPaths.Add(new int[] { 0, 4, 8 });
        victoryPaths.Add(new int[] { 6, 4, 2 });
    }
Beispiel #8
0
    void Start()
    {
        //set chat group name
        newGroup = chatGroup;
        //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", gameObject.GetComponent <MonoBehaviour>(), n1);
        sc2 = new SimChat("default", 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);
    }
Beispiel #9
0
 void Start()
 {
     //set chat group name
     newGroup = chatGroup;
     //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",gameObject.GetComponent<MonoBehaviour>(),n1);
     sc2 = new SimChat("default",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);
 }