public ISN_SKAppStoreReceipt(string data)
 {
     if (data.Length > 0)
     {
         try {
             m_data          = System.Convert.FromBase64String(data);
             m_receiptString = data;
         } catch (System.Exception ex) {
             ISN_Logger.LogError("Can't parce the receipt: " + ex.Message);
         }
     }
 }
Beispiel #2
0
 private void HandleActionDataLoaded(GK_SaveDataLoaded res)
 {
     res.SavedGame.ActionDataLoaded -= HandleActionDataLoaded;
     if (res.IsSucceeded)
     {
         ISN_Logger.Log("Data loaded. data Length: " + res.SavedGame.Data.Length);
     }
     else
     {
         ISN_Logger.Log("Failed: " + res.Error.Message);
     }
 }
Beispiel #3
0
    public static void PrintMatchInfo(GK_TBM_Match match)
    {
        string MatchInfo = string.Empty;

        MatchInfo = MatchInfo + "----------------------------------------" + "\n";
        MatchInfo = MatchInfo + "Printing basic match info, for " + "\n";
        MatchInfo = MatchInfo + "Match ID: " + match.Id + "\n";

        MatchInfo = MatchInfo + "Status:" + match.Status + "\n";

        if (match.CurrentParticipant != null)
        {
            if (match.CurrentParticipant.Player != null)
            {
                MatchInfo = MatchInfo + "CurrentPlayerID: " + match.CurrentParticipant.Player.Id + "\n";
            }
            else
            {
                MatchInfo = MatchInfo + "CurrentPlayerID: ---- \n";
            }
        }
        else
        {
            MatchInfo = MatchInfo + "CurrentPlayerID: ---- \n";
        }


        MatchInfo = MatchInfo + "Data: " + match.UTF8StringData + "\n";
        MatchInfo = MatchInfo + "*******Participants*******" + "\n";
        foreach (GK_TBM_Participant p in match.Participants)
        {
            if (p.Player != null)
            {
                MatchInfo = MatchInfo + "PlayerId: " + p.Player.Id + "\n";
            }
            else
            {
                MatchInfo = MatchInfo + "PlayerId: ---  \n";
            }

            MatchInfo = MatchInfo + "Status: " + p.Status + "\n";
            MatchInfo = MatchInfo + "MatchOutcome: " + p.MatchOutcome + "\n";
            MatchInfo = MatchInfo + "TimeoutDate: " + p.TimeoutDate.ToString("DD MMM YYYY HH:mm:ss") + "\n";
            MatchInfo = MatchInfo + "LastTurnDate: " + p.LastTurnDate.ToString("DD MMM YYYY HH:mm:ss") + "\n";
            MatchInfo = MatchInfo + "**********************" + "\n";
        }


        MatchInfo = MatchInfo + "----------------------------------------" + "\n";

        ISN_Logger.Log(MatchInfo);
    }
    private void OnPlayerRequestedMatchWithRecipients_TBM(string data)
    {
        ISN_Logger.Log("OnPlayerRequestedMatchWithRecipients_TBM");
        string[]         playersIds = SA.Common.Data.Converter.ParseArray(data);
        List <GK_Player> players    = new List <GK_Player>();

        foreach (string playerId in playersIds)
        {
            players.Add(GameCenterManager.GetPlayerById(playerId));
        }

        ActionPlayerRequestedMatchWithRecipients(GK_MatchType.RealTime, playersIds, players.ToArray());
    }
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    void Awake()
    {
        ISN_ReplayKit.ActionRecordStarted     += HandleActionRecordStarted;
        ISN_ReplayKit.ActionRecordStoped      += HandleActionRecordStoped;
        ISN_ReplayKit.ActionRecordInterrupted += HandleActionRecordInterrupted;

        ISN_ReplayKit.ActionShareDialogFinished           += HandleActionShareDialogFinished;
        ISN_ReplayKit.ActionRecorderDidChangeAvailability += HandleActionRecorderDidChangeAvailability;

        IOSNativePopUpManager.showMessage("Welcome", "Hey there, welcome to the ReplayKit testing scene!");

        ISN_Logger.Log("ReplayKit Is Avaliable: " + ISN_ReplayKit.Instance.IsAvailable);
    }
 void HandleActionRecordStarted(SA.Common.Models.Result res)
 {
     if (res.IsSucceeded)
     {
         IOSNativePopUpManager.showMessage("Success", "Record was successfully started!");
     }
     else
     {
         ISN_Logger.Log("Record start failed: " + res.Error.Message);
         IOSNativePopUpManager.showMessage("Fail", "Error: " + res.Error.Message);
     }
     ISN_ReplayKit.ActionRecordStarted -= HandleActionRecordStarted;
 }
        private void OnPickerDidSelectContacts(string data)
        {
            ISN_Logger.Log("[ContactStore] OnPickerDidSelectContacts");
            List <Contact> contacts = ParseContactArray(data);

            ISN_Logger.Log("[ContactStore] Picked " + contacts.Count + " contacts");


            ContactsResult result = new ContactsResult(contacts);

            ContactsPickResult(result);
            ContactsPickResult = delegate {};
        }
Beispiel #8
0
    private void SubmitAchievement(string data)
    {
        string[] arr;
        arr = data.Split("|" [0]);

        float  percent       = System.Convert.ToSingle(arr[0]);
        string achievementId = arr[1];



        ISN_Logger.Log("SubmitAchievement: " + achievementId + "  " + percent.ToString());
        GameCenterManager.SubmitAchievement(percent, achievementId);
    }
Beispiel #9
0
    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    private void HandleOnAuthFinished(SA.Common.Models.Result result)
    {
        GameCenterManager.OnAuthFinished -= HandleOnAuthFinished;

        if (result.IsSucceeded)
        {
            ISN_Logger.Log("Player Authed");
        }
        else
        {
            IOSNativePopUpManager.showMessage("Game Center ", "Player authentication failed");
        }
    }
 void ActionMatchDataUpdated(GK_TBM_MatchDataUpdateResult res)
 {
     GameCenter_TBM.ActionMatchDataUpdated -= ActionMatchDataUpdated;
     ISN_Logger.Log("ActionMatchDataUpdated: " + res.IsSucceeded);
     if (res.IsFailed)
     {
         ISN_Logger.Log(res.Error.Message);
     }
     else
     {
         GameCenter_TBM.PrintMatchInfo(res.Match);
     }
 }
Beispiel #11
0
    void Database_ActionRecordDeleted(CK_RecordDeleteResult res)
    {
        res.Database.ActionRecordDeleted -= Database_ActionRecordDeleted;

        if (res.IsSucceeded)
        {
            ISN_Logger.Log("Database_ActionRecordDeleted, Success: ");
        }
        else
        {
            ISN_Logger.Log("Database_ActionRecordDeleted, Error: " + res.Error.Code + " / " + res.Error.Message);
        }
    }
    private void OnScoreSubmitted(SA.Common.Models.Result result)
    {
        GameCenterManager.OnScoreSubmitted -= OnScoreSubmitted;

        if (result.IsSucceeded)
        {
            ISN_Logger.Log("Score Submitted");
        }
        else
        {
            ISN_Logger.Log("Score Submit Failed");
        }
    }
    void ActionMatchFound(GK_TBM_MatchInitResult result)
    {
        GameCenter_TBM.ActionMatchFound -= ActionMatchFound;
        ISN_Logger.Log("ActionMatchFound IsSucceeded: " + result.IsSucceeded);

        if (result.IsFailed)
        {
            ISN_Logger.Log(result.Error.Message);
        }
        else
        {
            GameCenter_TBM.PrintMatchInfo(result.Match);
        }
    }
Beispiel #14
0
    private void HandleActionSaveRemoved(GK_SaveRemoveResult res)
    {
        ISN_GameSaves.ActionSaveRemoved -= HandleActionSaveRemoved;

        if (res.IsSucceeded)
        {
            ISN_Logger.Log("Deleted game with name " + res.SaveName);
            ISN_Logger.Log("------------------------------------------");
        }
        else
        {
            ISN_Logger.Log("Failed: " + res.Error.Message);
        }
    }
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    public iCloudData(string k, string v)
    {
        _key = k;
        _val = v;

        if (_val.Equals("null"))
        {
            if (!IOSNativeSettings.Instance.DisablePluginLogs)
            {
                ISN_Logger.Log("ISN iCloud Empty set");
            }
            _IsEmpty = true;
        }
    }
    void ActionMacthRemoved(GK_TBM_MatchRemovedResult result)
    {
        GameCenter_TBM.ActionMatchRemoved -= ActionMacthRemoved;
        ISN_Logger.Log("ActionMacthRemoved IsSucceeded: " + result.IsSucceeded);

        if (result.IsFailed)
        {
            ISN_Logger.Log(result.Error.Message);
        }
        else
        {
            ISN_Logger.Log("Match Id: " + result.MatchId);
        }
    }
Beispiel #17
0
    void Database_ActionRecordFetchComplete(CK_RecordResult res)
    {
        res.Database.ActionRecordFetchComplete -= Database_ActionRecordFetchComplete;

        if (res.IsSucceeded)
        {
            ISN_Logger.Log("Database_ActionRecordFetchComplete:");
            ISN_Logger.Log("Post Title: " + res.Record.GetObject("PostTitle"));
        }
        else
        {
            ISN_Logger.Log("Database_ActionRecordFetchComplete, Error: " + res.Error.Code + " / " + res.Error.Message);
        }
    }
 void HandleActionQueueUpdated(MP_MediaPickerResult res)
 {
     if (res.IsSucceeded)
     {
         foreach (MP_MediaItem item in res.Items)
         {
             ISN_Logger.Log("Item: " + item.Title + " / " + item.Id);
         }
     }
     else
     {
         ISN_Logger.Log("Queue Updated failed: " + res.Error.Message);
     }
 }
    void OnLoaderboardsInfoLoaded(ISN_LoadSetLeaderboardsInfoResult res)
    {
        res.LeaderBoardsSet.OnLoaderboardsInfoLoaded -= OnLoaderboardsInfoLoaded;

        if (res.IsSucceeded)
        {
            foreach (GK_LeaderBoardInfo l in res.LeaderBoardsSet.BoardsInfo)
            {
                ISN_Logger.Log(l.Title);
                ISN_Logger.Log(l.Description);
                ISN_Logger.Log(l.Identifier);
            }
        }
    }
Beispiel #20
0
    private void Load()
    {
        ISN_Logger.Log("Start to load game!");
        GK_SavedGame save = GetLoadedSave(test_name);

        if (save == null)
        {
            ISN_Logger.Log("You don't have any saved game!");

            return;
        }

        save.ActionDataLoaded += HandleActionDataLoaded;
        save.LoadData();
    }
        private void OnContactsRetrieveFinished(string data)
        {
            ISN_Logger.Log("[ContactStore] OnContactsRetrieveFinished");


            List <Contact> contacts = ParseContactArray(data);

            ISN_Logger.Log("[ContactStore] Loaded " + contacts.Count + " contacts");


            ContactsResult result = new ContactsResult(contacts);

            ContactsLoadResult(result);
            ContactsLoadResult = delegate {};
        }
    //--------------------------------------
    //  GET/SET
    //--------------------------------------

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

    private void OnAchievementsLoaded(SA.Common.Models.Result result)
    {
        ISN_Logger.Log("OnAchievementsLoaded");
        ISN_Logger.Log(result.IsSucceeded);

        if (result.IsSucceeded)
        {
            ISN_Logger.Log("Achievements were loaded from iOS Game Center");

            foreach (GK_AchievementTemplate tpl in GameCenterManager.Achievements)
            {
                ISN_Logger.Log(tpl.Id + ":  " + tpl.Progress);
            }
        }
    }
 void HandleActionMatchStarted(GK_RTM_MatchStartedResult result)
 {
     if (result.IsSucceeded)
     {
         ISN_Logger.Log("Match is successfully created");
         if (result.Match.ExpectedPlayerCount == 0)
         {
             //we should start the match
         }
     }
     else
     {
         ISN_Logger.Log("Match is creation failed with error: " + result.Error.Message);
     }
 }
    void ActionTrunEnded(GK_TBM_EndTrunResult result)
    {
        GameCenter_TBM.ActionTrunEnded -= ActionTrunEnded;
        ISN_Logger.Log("ActionTrunEnded IsSucceeded: " + result.IsSucceeded);

        if (result.IsFailed)
        {
            IOSMessage.Create("ActionTrunEnded", result.Error.Message);
            ISN_Logger.Log(result.Error.Message);
        }
        else
        {
            GameCenter_TBM.PrintMatchInfo(result.Match);
        }
    }
Beispiel #25
0
    private void onDialogClose(IOSDialogResult result)
    {
        //parsing result
        switch (result)
        {
        case IOSDialogResult.YES:
            ISN_Logger.Log("Yes button pressed");
            break;

        case IOSDialogResult.NO:
            ISN_Logger.Log("No button pressed");
            break;
        }

        IOSNativePopUpManager.showMessage("Result", result.ToString() + " button pressed");
    }
Beispiel #26
0
 void Database_ActionQueryComplete(CK_QueryResult res)
 {
     if (res.IsSucceeded)
     {
         ISN_Logger.Log("Database_ActionQueryComplete, total records found: " + res.Records.Count);
         foreach (CK_Record r  in res.Records)
         {
             Debug.Log(r.Id.Name);
             ISN_Logger.Log("Post Title: " + r.GetObject("PostTitle"));
         }
     }
     else
     {
         ISN_Logger.Log("Database_ActionRecordFetchComplete, Error: " + res.Error.Code + " / " + res.Error.Message);
     }
 }
Beispiel #27
0
        public override void OnLeaderboardReady(ISN_GKLeaderboard leaderboard)
        {
            ISN_Logger.Log("leaderboard.LocalPlayerScore.Rank: " + leaderboard.LocalPlayerScore.Rank);
            ISN_Logger.Log("leaderboard.LocalPlayerScore.Value: " + leaderboard.LocalPlayerScore.Value);


            ISN_GKScore scoreReporter = new ISN_GKScore(leaderboard.Identifier);

            scoreReporter.Value   = leaderboard.LocalPlayerScore.Value++;
            scoreReporter.Context = 1;


            scoreReporter.Report((result) => {
                SetAPIResult(result);
            });
        }
        public override void Test()
        {
            ISN_GKLocalPlayer player = ISN_GKLocalPlayer.LocalPlayer;

            player.GenerateIdentityVerificationSignatureWithCompletionHandler((signatureResult) => {
                if (signatureResult.IsSucceeded)
                {
                    ISN_Logger.Log("signatureResult.PublicKeyUrl: " + signatureResult.PublicKeyUrl);
                    ISN_Logger.Log("signatureResult.Timestamp: " + signatureResult.Timestamp);
                    ISN_Logger.Log("signatureResult.Salt.Length: " + signatureResult.Salt.Length);
                    ISN_Logger.Log("signatureResult.Signature.Length: " + signatureResult.Signature.Length);
                }

                SetAPIResult(signatureResult);
            });
        }
Beispiel #29
0
        public override void Test()
        {
            ISN_GKLocalPlayer.setAuthenticateHandler((SA_Result result) => {
                if (result.IsSucceeded)
                {
                    ISN_GKLocalPlayer player = ISN_GKLocalPlayer.LocalPlayer;
                    ISN_Logger.Log("player.PlayerID: " + player.PlayerID);
                    ISN_Logger.Log("player.Alias: " + player.Alias);
                    ISN_Logger.Log("player.DisplayName: " + player.DisplayName);
                    ISN_Logger.Log("player.Authenticated: " + player.Authenticated);
                    ISN_Logger.Log("player.Underage: " + player.Underage);
                }

                SetAPIResult(result);
            });
        }
Beispiel #30
0
    /// <summary>
    /// Call this method separately for each set of saved game conflicts.
    /// For example, if you have multiple saved game files with the name of “savedgame1” and “savedgame2”,
    /// you need to call this method twice—once with an array containing the GKSavedGame objects with the “savedgame1”
    /// name and once for the “savedgame2” objects. All saved game conflicts are resolved asynchronously.
    /// </summary>
    /// <returns>The count conflicts.</returns>
    private void ResolveConflicts()
    {
        ISN_Logger.Log("Trying to fix conflicts");
        List <GK_SavedGame> conflicts = GetConflict();

        if (conflicts == null)
        {
            ISN_Logger.Log("You don't have any conflicts!");

            return;
        }

        ISN_GameSaves.ActionSavesResolved += HandleActionSavesResolved;
        byte[] data = System.Text.Encoding.UTF8.GetBytes("Some data after resolving");         //data to be taken as final {money, exp, lvl, etc.}
        ISN_GameSaves.Instance.ResolveConflictingSavedGames(conflicts, data);
    }