private void OnNearbyPlayerInfoReceived(string data)
    {
        string[] DataArray = data.Split(IOSNative.DATA_SPLITTER);

        string    playerId = DataArray[0];
        GK_Player player   = GameCenterManager.GetPlayerById(playerId);


        bool reachable = Convert.ToBoolean(DataArray[1]);

        if (reachable)
        {
            if (!_NearbyPlayers.ContainsKey(player.Id))
            {
                _NearbyPlayers.Add(player.Id, player);
            }
        }
        else
        {
            if (_NearbyPlayers.ContainsKey(player.Id))
            {
                _NearbyPlayers.Remove(player.Id);
            }
        }

        ActionNearbyPlayerStateUpdated(player, reachable);
    }
示例#2
0
    private void OnUserInfoLoadedEvent(string array)
    {
        Debug.Log("OnUserInfoLoadedEvent");

        string[] data = array.Split(IOSNative.DATA_SPLITTER[0]);

        string playerId    = data[0];
        string alias       = data[1];
        string displayName = data[2];


        GK_Player p = new GK_Player(playerId, displayName, alias);


        if (_players.ContainsKey(playerId))
        {
            _players[playerId] = p;
        }
        else
        {
            _players.Add(playerId, p);
        }

        if (p.Id == _player.Id)
        {
            _player = p;
        }

        Debug.Log("Player Info loaded, for player with id: " + p.Id);

        GK_UserInfoLoadResult result = new GK_UserInfoLoadResult(p);

        OnUserInfoLoaded(result);
        Dispatcher.dispatch(GAME_CENTER_USER_INFO_LOADED, result);
    }
    public UM_PlayerTemplate GetPlayer(string playerId)
    {
        UM_PlayerTemplate player = null;

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GK_Player gk_player = GameCenterManager.GetPlayerById(playerId);
            if (gk_player != null)
            {
                player = new UM_PlayerTemplate(gk_player, null);
            }
            break;

        case RuntimePlatform.Android:
            GooglePlayerTemplate gp_player = GooglePlayManager.Instance.GetPlayerById(playerId);
            if (gp_player != null)
            {
                player = new UM_PlayerTemplate(null, gp_player);
            }
            break;
        }

        return(player);
    }
    private void OnUserInfoLoadedEvent(string array)
    {
        ISN_Logger.Log("OnUserInfoLoadedEvent");

        string[] data = array.Split(SA.Common.Data.Converter.DATA_SPLITTER);

        string playerId    = data[0];
        string alias       = data[1];
        string displayName = data[2];


        GK_Player p = new GK_Player(playerId, displayName, alias);


        if (_players.ContainsKey(playerId))
        {
            _players[playerId] = p;
        }
        else
        {
            _players.Add(playerId, p);
        }

        if (p.Id == _player.Id)
        {
            _player = p;
        }

        ISN_Logger.Log("Player Info loaded, for player with id: " + p.Id);

        GK_UserInfoLoadResult result = new GK_UserInfoLoadResult(p);

        OnUserInfoLoaded(result);
    }
示例#5
0
    public UM_Score(GK_Score gkScore, GPScore gpScore, GC_Score gcScore)
    {
        _GK_Score = gkScore;
        _GP_Score = gpScore;
        _GC_Score = gcScore;
        if (IsValid)
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
                {
                    GC_Player gc_player = SA_AmazonGameCircleManager.Instance.GetPlayerById(_GC_Score.PlayerId);
                    player = new UM_Player(null, null, gc_player);
                }
                else
                {
                    GooglePlayerTemplate gp_player = GooglePlayManager.Instance.GetPlayerById(_GP_Score.PlayerId);
                    player = new UM_Player(null, gp_player, null);
                }
                break;

            case RuntimePlatform.IPhonePlayer:
                GK_Player gk_player = GameCenterManager.GetPlayerById(_GK_Score.PlayerId);
                player = new UM_Player(gk_player, null, null);
                break;
            }
        }
    }
	void HandleActionPlayerRequestedMatchWithRecipients (GK_MatchType matchType, string[] recepientIds, GK_Player[] recepients) {
		if(matchType == GK_MatchType.RealTime) {
			//Optionally you can provide and invitation message
			string invitationMessage = "Come play with me, bro.";

			GameCenter_RTM.Instance.FindMatchWithNativeUI(recepientIds.Length, recepientIds.Length, invitationMessage, recepientIds);
		}
	}
示例#7
0
	public GK_Invite(string inviteData) {
		string[] DataArray = inviteData.Split(IOSNative.DATA_SPLITTER); 
		_Id = DataArray[0];
		_Sender = GameCenterManager.GetPlayerById(DataArray[1]);

		_PlayerGroup = System.Convert.ToInt32(DataArray[2]);
		_PlayerAttributes = System.Convert.ToInt32(DataArray[3]);
	}
    private void OnMatchDataReceived(string data)
    {
        string[]  DataArray = data.Split(IOSNative.DATA_SPLITTER);
        string    playerId  = DataArray[0];
        GK_Player player    = GameCenterManager.GetPlayerById(playerId);

        byte[] decodedFromBase64 = System.Convert.FromBase64String(DataArray[1]);
        ActionDataReceived(player, decodedFromBase64);
    }
示例#9
0
    public GK_Invite(string inviteData)
    {
        string[] DataArray = inviteData.Split(IOSNative.DATA_SPLITTER);
        _Id     = DataArray[0];
        _Sender = GameCenterManager.GetPlayerById(DataArray[1]);

        _PlayerGroup      = System.Convert.ToInt32(DataArray[2]);
        _PlayerAttributes = System.Convert.ToInt32(DataArray[3]);
    }
示例#10
0
    private void OnMatchPlayerStateChanged(string data)
    {
        string[]  DataArray = data.Split(IOSNative.DATA_SPLITTER[0]);
        string    playerId  = DataArray[0];
        GK_Player player    = GameCenterManager.GetPlayerById(playerId);

        GK_PlayerConnectionState state = (GK_PlayerConnectionState)Convert.ToInt32(DataArray[1]);

        ActionPlayerStateChanged(player, state, CurrentMatch);
    }
示例#11
0
    // --------------------------------------
    // Native Events
    // --------------------------------------

    private void OnInviteeResponse(string data)
    {
        Debug.Log("OnInviteeResponse");
        string[] DataArray = data.Split(IOSNative.DATA_SPLITTER[0]);

        GK_Player player = GameCenterManager.GetPlayerById(DataArray[0]);
        GK_InviteRecipientResponse responce = (GK_InviteRecipientResponse)Convert.ToInt32(DataArray[1]);

        ActionInviteeResponse(player, responce);
    }
示例#12
0
    public GK_RTM_Match(string matchData)
    {
        string[] MatchData = matchData.Split(new string[] { IOSNative.DATA_SPLITTER2 }, StringSplitOptions.None);
        _ExpectedPlayerCount = Convert.ToInt32(MatchData[0]);

        string[] playersIds = IOSNative.ParseArray(MatchData[1]);
        foreach (string playerId in playersIds)
        {
            GK_Player player = GameCenterManager.GetPlayerById(playerId);
            _Players.Add(player);
        }
    }
    private void onAuthenticateLocalPlayer(string array)
    {
        string[] data = array.Split(IOSNative.DATA_SPLITTER);

        _player = new GK_Player(data[0], data [1], data [2]);


        ISN_CacheManager.SendAchievementCachedRequest();

        ISN_Result result = new ISN_Result(IsPlayerAuthenticated);

        OnAuthFinished(result);
    }
 void HandleActionPlayerStateChanged(GK_Player player, GK_PlayerConnectionState state, GK_RTM_Match macth)
 {
     if (state == GK_PlayerConnectionState.Disconnected)
     {
         IOSNativePopUpManager.showMessage("Disconnect", "Game finished");
         GameCenter_RTM.Instance.Disconnect();
         cleanUpScene();
     }
     else
     {
         CheckMatchState(macth);
     }
 }
示例#15
0
	//--------------------------------------
	// Init
	//--------------------------------------

	public UM_PlayerTemplate(GK_Player gk, GooglePlayerTemplate gp) {
		_GK_Player = gk;
		_GP_Player = gp;

		if(_GK_Player != null) {
			_GK_Player.OnPlayerPhotoLoaded += HandleOnPlayerPhotoLoaded;
		}

		if(_GP_Player != null) {
			_GP_Player.BigPhotoLoaded += HandleBigPhotoLoaded;
			_GP_Player.SmallPhotoLoaded += HandleSmallPhotoLoaded;
		}
	}
    void HandleActionDataReceived(GK_Player player, byte[] data)
    {
        IOSNativePopUpManager.dismissCurrentAlert();

                #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
        System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
        string str = enc.GetString(data);


        IOSNativePopUpManager.dismissCurrentAlert();

        IOSNativePopUpManager.showMessage("Data received", "player ID: " + player.Id + " \n " + "data: " + str);
                #endif
    }
    private void OnUserPhotoLoadedEvent(string array)
    {
        string[] data = array.Split(SA.Common.Data.Converter.DATA_SPLITTER);

        string       playerId     = data[0];
        GK_PhotoSize size         = (GK_PhotoSize)System.Convert.ToInt32(data[1]);
        string       encodedImage = data[2];

        GK_Player player = GetPlayerById(playerId);

        if (player != null)
        {
            player.SetPhotoData(size, encodedImage);
        }
    }
    private void OnUserPhotoLoadFailedEvent(string data)
    {
        string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None);

        string       playerId  = DataArray[0];
        GK_PhotoSize size      = (GK_PhotoSize)System.Convert.ToInt32(DataArray[1]);
        string       errorData = DataArray[2];

        GK_Player player = GetPlayerById(playerId);

        if (player != null)
        {
            player.SetPhotoLoadFailedEventData(size, errorData);
        }
    }
示例#19
0
    //--------------------------------------
    // Init
    //--------------------------------------

    public UM_Player(GK_Player gk, GooglePlayerTemplate gp)
    {
        _GK_Player = gk;
        _GP_Player = gp;

        if (_GK_Player != null)
        {
            _GK_Player.OnPlayerPhotoLoaded += HandleOnPlayerPhotoLoaded;
        }

        if (_GP_Player != null)
        {
            _GP_Player.BigPhotoLoaded   += HandleBigPhotoLoaded;
            _GP_Player.SmallPhotoLoaded += HandleSmallPhotoLoaded;
        }
    }
示例#20
0
    private void onAuthenticateLocalPlayer(string array)
    {
        string[] data;
        data = array.Split("," [0]);

        _player = new GK_Player(data[0], data [1], data [2]);


        ISN_CacheManager.SendAchievementCachedRequest();

        _IsPlayerAuthenticated = true;


        ISN_Result result = new ISN_Result(_IsPlayerAuthenticated);

        OnAuthFinished(result);
    }
    private void OnMatchPlayerStateChanged(string data)
    {
        if (_CurrentMatch == null)
        {
            return;
        }

        string[]  DataArray = data.Split(SA.Common.Data.Converter.DATA_SPLITTER);
        string    playerId  = DataArray[0];
        GK_Player player    = GameCenterManager.GetPlayerById(playerId);



        GK_PlayerConnectionState state = (GK_PlayerConnectionState)Convert.ToInt32(DataArray[1]);

        ActionPlayerStateChanged(player, state, CurrentMatch);
    }
    void Awake()
    {
        if (!IsInitialized)
        {
            //Initializing Game Center class. This action will trigger authentication flow
            GameCenterManager.Init();
            GameCenterManager.OnAuthFinished += OnAuthFinished;
            IsInitialized = true;
        }

        int ROLE_WIZARD = 0x4;         // 100 in binary

        GameCenter_RTM.Instance.SetPlayerAttributes(ROLE_WIZARD);



        //Required
        int minPlayers = 2;
        int maxPlayers = 2;

        //Optionally you can provide and invitation message
        string invitationMessage = "Come play with me, bro.";

        //Optinally you can predefine invited friends list to the match
        //Teh code bellow assumes that player has atleast one friend, and you already loaded the friend list
        //so we can send an invite to the first player in the firendlist
        string[] invitations = new string[] { GameCenterManager.FriendsList[0] };


        GameCenter_RTM.Instance.FindMatchWithNativeUI(minPlayers, maxPlayers, invitationMessage, invitations);

        GK_Player player = GameCenterManager.Player;

        player.OnPlayerPhotoLoaded += HandleOnPlayerPhotoLoaded;
        player.LoadPhoto(GK_PhotoSize.GKPhotoSizeNormal);

        GameCenter_RTM.ActionMatchStarted += HandleActionMatchStarted;
        GameCenterInvitations.ActionPlayerRequestedMatchWithRecipients += HandleActionPlayerRequestedMatchWithRecipients;
        GameCenterInvitations.ActionPlayerAcceptedInvitation           += HandleActionPlayerAcceptedInvitation;


        GameCenter_RTM.ActionNearbyPlayerStateUpdated += HandleActionNearbyPlayerStateUpdated;
        GameCenter_RTM.Instance.StartBrowsingForNearbyPlayers();
    }
示例#23
0
    public UM_Score(GK_Score gkScore, GPScore gpScore)
    {
        _GK_Score = gkScore;
        _GP_Score = gpScore;
        if (IsValid)
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                GooglePlayerTemplate gp_player = GooglePlayManager.Instance.GetPlayerById(_GP_Score.PlayerId);
                player = new UM_Player(null, gp_player);
                break;

            case RuntimePlatform.IPhonePlayer:
                GK_Player gk_player = GameCenterManager.GetPlayerById(_GK_Score.PlayerId);
                player = new UM_Player(gk_player, null);
                break;
            }
        }
    }
示例#24
0
	//--------------------------------------
	//  PUBLIC METHODS
	//--------------------------------------
	
	//--------------------------------------
	//  GET/SET
	//--------------------------------------
	
	//--------------------------------------
	//  EVENTS
	//--------------------------------------


	void HandleActionDataReceived (GK_Player player, byte[] data) {
		ByteBuffer b = new ByteBuffer (data);
		
		int pId = b.readInt();
		
		switch(pId) {
		case 1:
			Debug.Log("Sphere pack");
			Vector3 pos = new Vector3 (0, 0, 1);
			pos.x = b.readFloat ();
			pos.y = b.readFloat ();
			
			
			
			PTPGameController.instance.createRedSphere (pos);
			break;
		default:
			Debug.Log("Got pack wit id: " + pId);
			break;
		}
	}
示例#25
0
    //--------------------------------------
    // Init
    //--------------------------------------

    public UM_Player(GK_Player gk, GooglePlayerTemplate gp, GC_Player gc)
    {
        _GK_Player = gk;
        _GP_Player = gp;
        _GC_Player = gc;

        if (_GK_Player != null)
        {
            _GK_Player.OnPlayerPhotoLoaded += HandleOnPlayerPhotoLoaded;
        }

        if (_GP_Player != null)
        {
            _GP_Player.BigPhotoLoaded   += HandleBigPhotoLoaded;
            _GP_Player.SmallPhotoLoaded += HandleSmallPhotoLoaded;
        }

        if (_GC_Player != null)
        {
            _GC_Player.AvatarLoaded += AmazonPlayerAvatarLoaded;
        }
    }
    private void onAuthenticateLocalPlayer(string array)
    {
        string[] data = array.Split(SA.Common.Data.Converter.DATA_SPLITTER);

        _player = new GK_Player(data[0], data [1], data [2]);


        ISN_CacheManager.SendAchievementCachedRequest();

        SA.Common.Models.Result result;
        if (IsPlayerAuthenticated)
        {
            result = new SA.Common.Models.Result();
        }
        else
        {
            result = new SA.Common.Models.Result(new SA.Common.Models.Error());
        }


        OnAuthFinished(result);
    }
    public UM_Player GetPlayer(string playerId)
    {
        UM_Player player = null;

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GK_Player gk_player = GameCenterManager.GetPlayerById(playerId);
            if (gk_player != null)
            {
                player = new UM_Player(gk_player, null, null);
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                GC_Player gc_player = SA_AmazonGameCircleManager.Instance.GetPlayerById(playerId);
                if (gc_player != null)
                {
                    player = new UM_Player(null, null, gc_player);
                }
            }
            else
            {
                GooglePlayerTemplate gp_player = GooglePlayManager.Instance.GetPlayerById(playerId);
                if (gp_player != null)
                {
                    player = new UM_Player(null, gp_player, null);
                }
            }
            break;
        }

        return(player);
    }
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    //--------------------------------------
    //  GET/SET
    //--------------------------------------

    //--------------------------------------
    //  EVENTS
    //--------------------------------------


    void HandleActionDataReceived(GK_Player player, byte[] data)
    {
        ByteBuffer b = new ByteBuffer(data);

        int pId = b.readInt();

        switch (pId)
        {
        case 1:
            ISN_Logger.Log("Sphere pack");
            Vector3 pos = new Vector3(0, 0, 1);
            pos.x = b.readFloat();
            pos.y = b.readFloat();



            PTPGameController.instance.createRedSphere(pos);
            break;

        default:
            ISN_Logger.Log("Got pack wit id: " + pId);
            break;
        }
    }
 void HandleActionNearbyPlayerStateUpdated(GK_Player player, bool IsAvaliable)
 {
     ISN_Logger.Log("Player: " + player.DisplayName + "IsAvaliable: " + IsAvaliable);
     ISN_Logger.Log("Nearby Players Count: " + GameCenter_RTM.Instance.NearbyPlayers.Count);
 }
	void HandleActionDataReceived (GK_Player player, byte[] data) {
		IOSNativePopUpManager.dismissCurrentAlert();

		#if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE

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


		IOSNativePopUpManager.dismissCurrentAlert();

		IOSNativePopUpManager.showMessage ("Data received", "player ID: " + player.Id + " \n " + "data: " + str);
		#endif
	}
	//--------------------------------------
	//  GET/SET
	//--------------------------------------
	
	//--------------------------------------
	//  EVENTS
	//--------------------------------------



	void HandleActionPlayerStateChanged (GK_Player player, GK_PlayerConnectionState state, GK_RTM_Match match) {


		Debug.Log("Player State Changed " +  player.Alias + " state: " + state.ToString() + "\n  ExpectedPlayerCount: " + match.ExpectedPlayerCount);

	}
示例#32
0
    void OnGUI()
    {
        GUI.Label(new Rect(10, 20, 400, 40), "Custom Leaderboard GUI Example", headerStyle);

        if (GUI.Button(new Rect(400, 10, 150, 50), "Load Friends Scores"))
        {
            GameCenterManager.LoadScore(leaderboardId, 1, 10, GK_TimeSpan.ALL_TIME, GK_CollectionType.FRIENDS);
        }

        if (GUI.Button(new Rect(600, 10, 150, 50), "Load Global Scores"))
        {
            GameCenterManager.LoadScore(leaderboardId, 50, 150, GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL);
        }

        Color defaultColor = GUI.color;

        if (displayCollection == GK_CollectionType.GLOBAL)
        {
            GUI.color = Color.green;
        }
        if (GUI.Button(new Rect(800, 10, 170, 50), "Displaying Global Scores"))
        {
            displayCollection = GK_CollectionType.GLOBAL;
        }
        GUI.color = defaultColor;



        if (displayCollection == GK_CollectionType.FRIENDS)
        {
            GUI.color = Color.green;
        }
        if (GUI.Button(new Rect(800, 70, 170, 50), "Displaying Friends Scores"))
        {
            displayCollection = GK_CollectionType.FRIENDS;
        }
        GUI.color = defaultColor;

        GUI.Label(new Rect(10, 90, 100, 40), "rank", boardStyle);
        GUI.Label(new Rect(100, 90, 100, 40), "score", boardStyle);
        GUI.Label(new Rect(200, 90, 100, 40), "playerId", boardStyle);
        GUI.Label(new Rect(400, 90, 100, 40), "name ", boardStyle);
        GUI.Label(new Rect(550, 90, 100, 40), "avatar ", boardStyle);

        if (loadedLeaderboard != null)
        {
            for (int i = 1; i < 10; i++)
            {
                GK_Score score = loadedLeaderboard.GetScore(i, GK_TimeSpan.ALL_TIME, displayCollection);
                if (score != null)
                {
                    GUI.Label(new Rect(10, 90 + 70 * i, 100, 40), i.ToString(), boardStyle);
                    GUI.Label(new Rect(100, 90 + 70 * i, 100, 40), score.GetLongScore().ToString(), boardStyle);
                    GUI.Label(new Rect(200, 90 + 70 * i, 100, 40), score.playerId, boardStyle);


                    GK_Player player = GameCenterManager.GetPlayerById(score.playerId);
                    if (player != null)
                    {
                        GUI.Label(new Rect(400, 90 + 70 * i, 100, 40), player.Alias, boardStyle);
                        if (player.SmallPhoto != null)
                        {
                            GUI.DrawTexture(new Rect(550, 75 + 70 * i, 50, 50), player.SmallPhoto);
                        }
                        else
                        {
                            GUI.Label(new Rect(550, 90 + 70 * i, 100, 40), "no photo ", boardStyle);
                        }
                    }

                    if (GUI.Button(new Rect(650, 90 + 70 * i, 100, 30), "Challenge"))
                    {
                        GameCenterManager.IssueLeaderboardChallenge(leaderboardId, "Your message here", score.playerId);
                    }
                }
            }
        }
    }
	//--------------------------------------
	// init
	//--------------------------------------

	public GameServicePlayerTemplate(GK_Player gc, GooglePlayerTemplate ps) {
		gc_player = gc;
		ps_player = ps;

	}
示例#34
0
 public void CancelPendingInviteToPlayer(GK_Player player)
 {
             #if (UNITY_IPHONE && !UNITY_EDITOR && GAME_CENTER_ENABLED) || SA_DEBUG_MODE
     ISN_RTM_CancelPendingInviteToPlayerWithId(player.Id);
             #endif
 }
示例#35
0
	void HandleActionPlayerStateChanged (GK_Player player, GK_PlayerConnectionState state, GK_RTM_Match macth) {
		if(state == GK_PlayerConnectionState.Disconnected) {
			IOSNativePopUpManager.showMessage ("Disconnect", "Game finished");
			GameCenter_RTM.Instance.Disconnect();
			cleanUpScene ();
		} else {
			CheckMatchState(macth);
		}
	}
示例#36
0
	private void onAuthenticateLocalPlayer(string  array) {
		string[] data = array.Split(IOSNative.DATA_SPLITTER);

		_player = new GK_Player (data[0], data [1], data [2]);


		ISN_CacheManager.SendAchievementCachedRequest();

		_IsPlayerAuthenticated = true;


		ISN_Result result = new ISN_Result (_IsPlayerAuthenticated);
		OnAuthFinished (result);
	}
	public GK_UserInfoLoadResult(GK_Player tpl):base(true) {
		_tpl = tpl;
	}
    void OnGUI()
    {
        GUI.Label(new Rect(10, 20, 400, 40), "Friend List Load Example", headerStyle);

        if (GUI.Button(new Rect(300, 10, 150, 50), "Load Friends"))
        {
            GameCenterManager.OnFriendsListLoaded += OnFriendsListLoaded;
            GameCenterManager.RetrieveFriends();
        }


        if (GUI.Button(new Rect(500, 10, 150, 50), "Invite Friends"))
        {
            GK_FriendRequest r = new GK_FriendRequest();
            r.Send();
        }

        if (GUI.Button(new Rect(700, 10, 150, 50), "Invite with Emails"))
        {
            GK_FriendRequest r = new GK_FriendRequest();
            r.addRecipientsWithEmailAddresses("*****@*****.**", "*****@*****.**");
            r.Send();
        }



        if (!renderFriendsList)
        {
            return;
        }

        if (GUI.Button(new Rect(500, 10, 180, 50), "Leaberboard Challenge All"))
        {
            GameCenterManager.IssueLeaderboardChallenge(ChallengeLeaderboard, "Your message here", GameCenterManager.FriendsList.ToArray());
        }


        if (GUI.Button(new Rect(730, 10, 180, 50), "Achievement Challenge All"))
        {
            GameCenterManager.IssueAchievementChallenge(ChallengeAchievement, "Your message here", GameCenterManager.FriendsList.ToArray());
        }


        GUI.Label(new Rect(10, 90, 100, 40), "id", boardStyle);
        GUI.Label(new Rect(150, 90, 100, 40), "name", boardStyle);;
        GUI.Label(new Rect(300, 90, 100, 40), "avatar ", boardStyle);

        int i = 1;

        foreach (string FriendId in GameCenterManager.FriendsList)
        {
            GK_Player player = GameCenterManager.GetPlayerById(FriendId);
            if (player != null)
            {
                GUI.Label(new Rect(10, 90 + 70 * i, 100, 40), player.Id, boardStyle);
                GUI.Label(new Rect(150, 90 + 70 * i, 100, 40), player.Alias, boardStyle);
                if (player.SmallPhoto != null)
                {
                    GUI.DrawTexture(new Rect(300, 75 + 70 * i, 50, 50), player.SmallPhoto);
                }
                else
                {
                    GUI.Label(new Rect(300, 90 + 70 * i, 100, 40), "no photo ", boardStyle);
                }

                if (GUI.Button(new Rect(450, 90 + 70 * i, 150, 30), "Challenge Leaderboard"))
                {
                    GameCenterManager.IssueLeaderboardChallenge(ChallengeLeaderboard, "Your message here", FriendId);
                }

                if (GUI.Button(new Rect(650, 90 + 70 * i, 150, 30), "Challenge Achievement"))
                {
                    GameCenterManager.IssueAchievementChallenge(ChallengeAchievement, "Your message here", FriendId);
                }


                i++;
            }
        }
    }
示例#39
0
    private void OnDiconnectedPlayerReinvited(string playerId)
    {
        GK_Player player = GameCenterManager.GetPlayerById(playerId);

        ActionDiconnectedPlayerReinvited(player);
    }
    //--------------------------------------
    //  GET/SET
    //--------------------------------------

    //--------------------------------------
    //  EVENTS
    //--------------------------------------



    void HandleActionPlayerStateChanged(GK_Player player, GK_PlayerConnectionState state, GK_RTM_Match match)
    {
        Debug.Log("Player State Changed " + player.Alias + " state: " + state.ToString() + "\n  ExpectedPlayerCount: " + match.ExpectedPlayerCount);
    }
	void HandleActionNearbyPlayerStateUpdated (GK_Player player, bool IsAvaliable) {
		Debug.Log("Player: " + player.DisplayName + "IsAvaliable: " + IsAvaliable);
		Debug.Log("Nearby Players Count: " + GameCenter_RTM.Instance.NearbyPlayers.Count);
	}
示例#42
0
	private void OnUserInfoLoadedEvent(string array) {
		Debug.Log("OnUserInfoLoadedEvent");

		string[] data = array.Split(IOSNative.DATA_SPLITTER);

		string playerId = data[0];
		string alias = data[1];
		string displayName = data[2];


		GK_Player p =  new GK_Player(playerId, displayName, alias);


		if(_players.ContainsKey(playerId)) {
			_players[playerId] = p;
		} else {
			_players.Add(playerId, p);
		}

		if(p.Id == _player.Id) {
			_player = p;
		}

		Debug.Log("Player Info loaded, for player with id: " + p.Id);

		GK_UserInfoLoadResult result = new GK_UserInfoLoadResult (p);
		OnUserInfoLoaded (result);

	}    
	//--------------------------------------
	//  GET/SET
	//--------------------------------------
	
	//--------------------------------------
	//  EVENTS
	//--------------------------------------



	void HandleActionPlayerStateChanged (GK_Player player, GK_PlayerConnectionState state, GK_RTM_Match match) {
		IOSNativePopUpManager.dismissCurrentAlert();
		IOSNativePopUpManager.showMessage ("Player State Changed", player.Alias + " state: " + state.ToString() + "\n  ExpectedPlayerCount: " + match.ExpectedPlayerCount);
	}