Пример #1
0
    private void OnMatchDataRecieved(string data)
    {
        if (data.Equals(string.Empty))
        {
            Debug.Log("OnMatchDataRecieved, no data avaiable");
            return;
        }

        string[] storeData             = data.Split(AndroidNative.DATA_SPLITTER [0]);
        GP_RTM_Network_Package package = new GP_RTM_Network_Package(storeData[0], storeData [1]);


        ActionDataRecieved(package);
        Debug.Log("GooglePlayManager -> DATA_RECEIVED");
    }
Пример #2
0
    private void OnGCDataReceived(GP_RTM_Network_Package package)
    {
                #if (UNITY_ANDROID && !UNITY_EDITOR) || SA_DEBUG_MODE
        System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
        string str = enc.GetString(package.buffer);


        string name = package.participantId;


        GP_Participant p = GooglePlayRTM.instance.currentRoom.GetParticipantById(package.participantId);
        if (p != null)
        {
            GooglePlayerTemplate player = GooglePlayManager.instance.GetPlayerById(p.playerId);
            if (player != null)
            {
                name = player.name;
            }
        }

        AndroidMessage.Create("Data Eeceived", "player " + name + " \n " + "data: " + str);
                #endif
    }
Пример #3
0
	private void OnGCDataReceived(GP_RTM_Network_Package package) 
	{
		#if (UNITY_ANDROID && !UNITY_EDITOR ) || SA_DEBUG_MODE		
		System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
		string str = enc.GetString(package.buffer);
		string[] string1 = str.Split(","[0]);

		int MsgID = int.Parse(string1[0]);
		if(MsgID == 0)
		{
			int i = int.Parse(string1[1]);
			ESOther = int.Parse(string1[2]);
			GameObject player;
			player = (GameObject) GooglePlayRTM.Instantiate(spawnPrefab[ESOther],spawnPosition[i].transform.position,spawnPosition[i].transform.rotation);	
			spawnPrefab[ESOther] = player;
			player.name = i.ToString();

			if(!teamMatch)
			{
				player.tag = "enemy";
			}

			else
			{
				if(myPlayerPos1 < noOfFriend)
				{
					if( i < noOfFriend)
					{						
						player.tag = "plusFriend";
					}
					
					else
					{
						player.tag = "plusEnemy";
					}
				}

				else
				{
					if( i < noOfFriend)
					{						
						player.tag = "plusEnemy";
					}
					
					else
					{
						player.tag = "plusFriend";
					}
				}
			}
		}

		else if(MsgID == 6)
		{
			int i = int.Parse(string1[1]);
			string method = string1[2];
			if(i != PlayerPrefs.GetInt("myPlayerPos"))
			{
				Invoke(method, 0);
			}
		}

		#endif		
	}
Пример #4
0
	private void OnGCDataReceived(GP_RTM_Network_Package package) {
		#if (UNITY_ANDROID && !UNITY_EDITOR ) || SA_DEBUG_MODE

		
		System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
		string str = enc.GetString(package.buffer);


		string name = package.participantId;

	
		GP_Participant p =  GooglePlayRTM.instance.currentRoom.GetParticipantById(package.participantId);
		if(p != null) {
			GooglePlayerTemplate player = GooglePlayManager.instance.GetPlayerById(p.playerId);
			if(player != null) {
				name = player.name;
			}
		}

		AndroidMessage.Create("Data Eeceived", "player " + name + " \n " + "data: " + str);

		#endif
		
	}
	private void OnGCDataReceived(GP_RTM_Network_Package package) 
	{
		#if (UNITY_ANDROID && !UNITY_EDITOR ) || SA_DEBUG_MODE		
		System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
		string str = enc.GetString(package.buffer);
		string[] string1 = str.Split(","[0]);		
		int MsgID = int.Parse(string1[0]);
		
		if (MsgID == 1)
		{
			int i = int.Parse(string1[1]);
			float x =  float.Parse(string1[2]);
			float y =  float.Parse(string1[3]);
			float z =  float.Parse(string1[4]);
			float rx= gameObject.transform.rotation.eulerAngles.x;
			float ry= gameObject.transform.rotation.eulerAngles.y;
			float rz= gameObject.transform.rotation.eulerAngles.z;
			float vx = 0.0f;
			float vy = 0.0f;
			float vz = 0.0f;
			if(gameObject.name.Equals(i.ToString()))
			{
				_startPos = transform.position;
				_startRot = transform.rotation;

				if(transformationType == tType.transform)
				{
					if(rotationType == rType.x)
					{
						rx = float.Parse(string1[5]);
					}
					
					else if(rotationType == rType.y_Topdown2D)
					{
						ry = float.Parse(string1[5]);
					}
					
					else if(rotationType == rType.z_Sideon2D)
					{
						rz = float.Parse(string1[5]);
					}
					
					else if(rotationType == rType.xY_FPS)
					{
						rx = float.Parse(string1[5]);
						ry = float.Parse(string1[6]);
					}
					
					else if(rotationType == rType.yZ)
					{
						ry = float.Parse(string1[5]);
						rz = float.Parse(string1[6]);
					}
					
					else if(rotationType == rType.xZ)
					{
						rx = float.Parse(string1[5]);
						rz = float.Parse(string1[6]);
					}
					
					else if(rotationType == rType.xYZ_Full3D)
					{					
						rx = float.Parse(string1[5]);
						ry = float.Parse(string1[6]);
						rz = float.Parse(string1[7]);
					}
				}
				
				else
				{
					vx = float.Parse(string1[5]);
					vy = float.Parse(string1[6]);
					vz = float.Parse(string1[7]);

					if(rotationType == rType.x)
					{
						rx = float.Parse(string1[8]);
					}
					
					else if(rotationType == rType.y_Topdown2D)
					{
						ry = float.Parse(string1[8]);
					}
					
					else if(rotationType == rType.z_Sideon2D)
					{
						rz = float.Parse(string1[8]);
					}
					
					else if(rotationType == rType.xY_FPS)
					{
						rx = float.Parse(string1[8]);
						ry = float.Parse(string1[9]);
					}
					
					else if(rotationType == rType.yZ)
					{
						ry = float.Parse(string1[8]);
						rz = float.Parse(string1[9]);
					}
					
					else if(rotationType == rType.xZ)
					{
						rx = float.Parse(string1[8]);
						rz = float.Parse(string1[9]);
					}
					
					else if(rotationType == rType.xYZ_Full3D)
					{
						rx = float.Parse(string1[8]);
						ry = float.Parse(string1[9]);
						rz = float.Parse(string1[10]);
					}
				}

				_lastKnownVel = new Vector3 (vx, vy, vz);
				_destinationPos = new Vector3 (x, y, z);
				_destinationRot = Quaternion.Euler (rx, ry, rz);
				_lastUpdateTime = Time.time;
			}
		}

		else if(MsgID == 5)
		{
			int i = int.Parse(string1[1]);
			Destroy(GameObject.Find(i.ToString()));
		}
		#endif		
	}
 private void HandleActionMatchDataReceived(GP_RTM_Network_Package package)
 {
     MatchDataReceived(package.participantId, package.buffer);
 }