public long GetCurrentPlayerScore(UM_Leaderboard leaderboard)
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GK_Leaderboard board = GameCenterManager.GetLeaderboard(leaderboard.IOSId);
            if (board != null)
            {
                GK_Score score = board.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL);
                if (score != null)
                {
                    return(score.GetLongScore());
                }
            }
            break;

        case RuntimePlatform.Android:
            GPLeaderBoard gBoard = GooglePlayManager.instance.GetLeaderBoard(leaderboard.AndroidId);
            if (gBoard != null)
            {
                GPScore score = gBoard.GetCurrentPlayerScore(GPBoardTimeSpan.ALL_TIME, GPCollectionType.GLOBAL);
                if (score != null)
                {
                    return(score.score);
                }
            }
            break;
        }

        return(0);
    }
    public int GetCurrentPlayerRank(UM_Leaderboard leaderboard)
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GK_Leaderboard board = GameCenterManager.GetLeaderboard(leaderboard.IOSId);
            if (board != null)
            {
                return(board.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.GLOBAL).rank);
            }
            else
            {
                return(0);
            }

        case RuntimePlatform.Android:
            GPLeaderBoard gBoard = GooglePlayManager.instance.GetLeaderBoard(leaderboard.AndroidId);
            if (gBoard != null)
            {
                return(gBoard.GetCurrentPlayerScore(GPBoardTimeSpan.ALL_TIME, GPCollectionType.GLOBAL).rank);
            }
            else
            {
                return(0);
            }
        }

        return(0);
    }
    private void OnLoaderBoardInfoRetrived(string data)
    {
        string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None);


        string            leaderboardId = DataArray[0];
        GK_TimeSpan       timeSpan      = (GK_TimeSpan)System.Convert.ToInt32(DataArray[1]);
        GK_CollectionType collection    = (GK_CollectionType)System.Convert.ToInt32(DataArray[2]);
        int requestId = System.Convert.ToInt32(DataArray[3]);

        long   scoreVal    = System.Convert.ToInt64(DataArray[4]);
        int    rank        = System.Convert.ToInt32(DataArray[5]);
        int    context     = System.Convert.ToInt32(DataArray[6]);
        int    maxRange    = System.Convert.ToInt32(DataArray[7]);
        string title       = DataArray[8];
        string describtion = DataArray[9];



        GK_Leaderboard board = GetLeaderboard(leaderboardId);

        board.UpdateMaxRange(maxRange);
        board.Info.Title       = title;
        board.Info.Description = describtion;


        GK_Score score = new GK_Score(scoreVal, rank, context, timeSpan, collection, leaderboardId, Player.Id);

        board.ReportLocalPlayerScoreUpdate(score, requestId);
    }
    public static void LoadLeaderboardInfo(string leaderboardId)
    {
                #if ((UNITY_IPHONE || UNITY_TVOS) && !UNITY_EDITOR && GAME_CENTER_ENABLED) || SA_DEBUG_MODE
        int            requestId   = SA.Common.Util.IdFactory.NextId;
        GK_Leaderboard leaderboard = GetLeaderboard(leaderboardId);
        leaderboard.CreateScoreListener(requestId, false);

        _ISN_loadLeaderboardInfo(leaderboardId, requestId);
                #endif
    }
예제 #5
0
 private void OnScoresListLoaded(ISN_Result res)
 {
     if (res.IsSucceeded)
     {
         Debug.Log("Scores loaded");
         loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId);
     }
     else
     {
         Debug.Log("Failed to load scores");
     }
 }
 private void OnScoresListLoaded(SA.Common.Models.Result res)
 {
     if (res.IsSucceeded)
     {
         loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId_1);
         IOSMessage.Create("Success", "Scores loaded");
     }
     else
     {
         IOSMessage.Create("Fail", "Failed to load scores");
     }
 }
    private IEnumerator LoadLeaderboardInfoLocal(string leaderboardId)
    {
        yield return(new WaitForSeconds(4f));

                #if ((UNITY_IPHONE || UNITY_TVOS) && !UNITY_EDITOR && GAME_CENTER_ENABLED) || SA_DEBUG_MODE
        int            requestId   = SA.Common.Util.IdFactory.NextId;
        GK_Leaderboard leaderboard = GetLeaderboard(leaderboardId);
        leaderboard.CreateScoreListener(requestId, true);

        _ISN_loadLeaderboardInfo(leaderboardId, requestId);
                #endif
    }
예제 #8
0
 public static GK_Leaderboard GetLeaderboard(string id)
 {
     if (_leaderboards.ContainsKey(id))
     {
         return(_leaderboards[id]);
     }
     else
     {
         GK_Leaderboard board = new GK_Leaderboard(id);
         _leaderboards.Add(id, board);
         return(board);
     }
 }
    public void onScoreSubmittedFailed(string data)
    {
        string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None);

        string leaderboardId = DataArray[0];
//		long submittedScore = System.Convert.ToInt64(DataArray[1]);
        string errorData = DataArray[2];

        GK_Leaderboard       board  = GetLeaderboard(leaderboardId);
        GK_LeaderboardResult result = new GK_LeaderboardResult(board, new SA.Common.Models.Error(errorData));

        OnScoreSubmitted(result);
    }
    public static GK_Leaderboard GetLeaderboard(string id)
    {
        foreach (GK_Leaderboard leaderboard in Leaderboards)
        {
            if (leaderboard.Id.Equals(id))
            {
                return(leaderboard);
            }
        }

        GK_Leaderboard new_leaderboard = new GK_Leaderboard(id);

        Leaderboards.Add(new_leaderboard);

        return(new_leaderboard);
    }
    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    private void OnLoaderBoardInfoRetrivedFail(string data)
    {
        string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None);

        string leaderboardId = DataArray[0];
//		GK_TimeSpan timeSpan            = (GK_TimeSpan) System.Convert.ToInt32(DataArray[1]);
//		GK_CollectionType collection    = (GK_CollectionType) System.Convert.ToInt32(DataArray[2]);
        int    requestId = System.Convert.ToInt32(DataArray[3]);
        string errorData = DataArray[4];



        GK_Leaderboard board = GetLeaderboard(leaderboardId);

        board.ReportLocalPlayerScoreUpdateFail(errorData, requestId);
    }
예제 #12
0
    private void onLeaderboardScoreListLoaded(string array)
    {
        string[] data;
        data = array.Split("," [0]);

        string            lbId       = data[0];
        GK_TimeSpan       timeSpan   = (GK_TimeSpan)System.Convert.ToInt32(data[1]);
        GK_CollectionType collection = (GK_CollectionType)System.Convert.ToInt32(data[2]);

        GK_Leaderboard board;

        if (_leaderboards.ContainsKey(lbId))
        {
            board = _leaderboards[lbId];
        }
        else
        {
            board = new GK_Leaderboard(lbId);
            _leaderboards.Add(lbId, board);
        }



        for (int i = 3; i < data.Length; i += 3)
        {
            string playerId = data[i];
            string scoreVal = data[i + 1];
            int    rank     = System.Convert.ToInt32(data[i + 2]);

            GK_Score score = new GK_Score(scoreVal, rank, timeSpan, collection, lbId, playerId);
            board.UpdateScore(score);
            if (Player != null)
            {
                if (Player.Id.Equals(playerId))
                {
                    board.UpdateCurrentPlayerRank(rank, timeSpan, collection);
                }
            }
        }



        ISN_Result result = new ISN_Result(true);

        OnScoresListLoaded(result);
        Dispatcher.dispatch(GAME_CENTER_LEADERBOARD_SCORE_LIST_LOADED, result);
    }
    private void OnLeaderboardScoreListLoadFailed(string data)
    {
        string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None);

        string leaderboardId = DataArray[0];
        //GK_TimeSpan timeSpan = (GK_TimeSpan) System.Convert.ToInt32(DataArray[1]);
        //GK_CollectionType collection = (GK_CollectionType) System.Convert.ToInt32(DataArray[2]);

        string errorData = DataArray[3];

        GK_Leaderboard board = GetLeaderboard(leaderboardId);


        GK_LeaderboardResult result = new GK_LeaderboardResult(board, new SA.Common.Models.Error(errorData));

        OnScoresListLoaded(result);
    }
예제 #14
0
    private void OnLeaderboardMaxRangeUpdate(string array)
    {
        string[] data = array.Split("|" [0]);

        string identifier = data[0];
        int    MaxRange   = System.Convert.ToInt32(data[1]);

        GK_Leaderboard board;

        if (_leaderboards.ContainsKey(identifier))
        {
            board = _leaderboards[identifier];
        }
        else
        {
            board = new GK_Leaderboard(identifier);
        }

        board.UpdateMaxRange(MaxRange);
    }
    //--------------------------------------
    // Private Methods
    //--------------------------------------

    private void DispatchUpdate()
    {
        if (Scores.Count == 6)
        {
            GK_Leaderboard       board = GameCenterManager.GetLeaderboard(_leaderboardId);
            GK_LeaderboardResult result;


            if (_ErrorData != null)
            {
                result = new GK_LeaderboardResult(board, _ErrorData);
            }
            else
            {
                board.UpdateCurrentPlayerScore(Scores);
                result = new GK_LeaderboardResult(board);
            }

            GameCenterManager.DispatchLeaderboardUpdateEvent(result, _IsInternal);
        }
    }
    private void OnLeaderboardScoreListLoaded(string data)
    {
        string[] DataArray = data.Split(new string[] { SA.Common.Data.Converter.DATA_SPLITTER2 }, StringSplitOptions.None);



        string            leaderboardId = DataArray[0];
        GK_TimeSpan       timeSpan      = (GK_TimeSpan)System.Convert.ToInt32(DataArray[1]);
        GK_CollectionType collection    = (GK_CollectionType)System.Convert.ToInt32(DataArray[2]);

        GK_Leaderboard board = GetLeaderboard(leaderboardId);



        for (int i = 3; i < DataArray.Length; i += 4)
        {
            string   playerId = DataArray[i];
            long     scoreVal = System.Convert.ToInt64(DataArray[i + 1]);
            int      rank     = System.Convert.ToInt32(DataArray[i + 2]);
            int      context  = System.Convert.ToInt32(DataArray[i + 3]);
            GK_Score score    = new GK_Score(scoreVal, rank, context, timeSpan, collection, leaderboardId, playerId);
            board.UpdateScore(score);


            if (Player != null)
            {
                if (Player.Id.Equals(playerId))
                {
                    board.UpdateCurrentPlayerScore(score);
                }
            }
        }



        GK_LeaderboardResult result = new GK_LeaderboardResult(board);

        OnScoresListLoaded(result);
    }
예제 #17
0
    private void onLeaderboardScore(string array)
    {
        string[] data;
        data = array.Split("," [0]);

        string lbId     = data[0];
        string scoreVal = data[1];
        int    rank     = System.Convert.ToInt32(data[2]);


        GK_TimeSpan       timeSpan   = (GK_TimeSpan)System.Convert.ToInt32(data[3]);
        GK_CollectionType collection = (GK_CollectionType)System.Convert.ToInt32(data[4]);

        GK_Leaderboard board;

        if (_leaderboards.ContainsKey(lbId))
        {
            board = _leaderboards[lbId];
        }
        else
        {
            board = new GK_Leaderboard(lbId);
            _leaderboards.Add(lbId, board);
        }


        GK_Score score = new GK_Score(scoreVal, rank, timeSpan, collection, lbId, Player.Id);

        board.UpdateScore(score);
        board.UpdateCurrentPlayerRank(rank, timeSpan, collection);


        GK_PlayerScoreLoadedResult result = new GK_PlayerScoreLoadedResult(score);

        OnPlayerScoreLoaded(result);
        Dispatcher.dispatch(GAME_CENTER_LEADERBOARD_SCORE_LOADED, result);
    }
예제 #18
0
    private void GameServiceSettings()
    {
        EditorGUI.indentLevel = 0;
        settings.IsGameServiceOpen = EditorGUILayout.Foldout(settings.IsGameServiceOpen, "Game Service");
        if(settings.IsGameServiceOpen) {
            EditorGUI.indentLevel++; {

                Dictionary<string, string> resources = new Dictionary<string, string>();
                if (FileStaticAPI.IsFileExists ("Plugins/Android/AN_Res/res/values/ids.xml")) {
                    //Parse XML file with PlayService Settings ID's
                    XmlDocument doc = new XmlDocument();
                    doc.Load(Application.dataPath + "/Plugins/Android/AN_Res/res/values/ids.xml");

                    XmlNode rootResourcesNode = doc.DocumentElement;
                    foreach(XmlNode chn in rootResourcesNode.ChildNodes) {
                        if (chn.Name.Equals("string")) {
                            if (chn.Attributes["name"] != null) {
                                if (!chn.Attributes["name"].Value.Equals("app_id")) {
                                    resources.Add(chn.Attributes["name"].Value, chn.InnerText);
                                }
                            }
                        }
                    }
                }

                settings.IsLeaderBoardsOpen = EditorGUILayout.Foldout(settings.IsLeaderBoardsOpen, "Leaderboards");
                if(settings.IsLeaderBoardsOpen) {
                    if(settings.Leaderboards.Count == 0) {
                        EditorGUILayout.HelpBox("No Leaderboards Added", MessageType.Warning);
                    }
                    foreach(UM_Leaderboard leaderbaord in settings.Leaderboards) {
                        GPLeaderBoard gpLb = GetAndroidLeaderboard(leaderbaord.AndroidId);
                        GK_Leaderboard gkLb = GetIOSLeaderboard(leaderbaord.IOSId);

                        EditorGUILayout.BeginVertical (GUI.skin.box);
                        EditorGUILayout.BeginHorizontal();

                        GUIStyle s =  new GUIStyle();
                        s.padding =  new RectOffset();
                        s.margin =  new RectOffset();
                        s.border =  new RectOffset();

                        if(leaderbaord.Texture != null) {
                            GUILayout.Box(leaderbaord.Texture, s, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(18)});
                        }

                        leaderbaord.IsOpen = EditorGUILayout.Foldout(leaderbaord.IsOpen, leaderbaord.id);
                        bool ItemWasRemoved = DrawSortingButtons((object) leaderbaord, settings.Leaderboards,
                                                                 (object) gpLb, AndroidNativeSettings.Instance.Leaderboards,
                                                                 (object) gkLb, IOSNativeSettings.Instance.Leaderboards);
                        if(ItemWasRemoved) {
                            return;
                        }
                        EditorGUILayout.EndHorizontal();

                        if(leaderbaord.IsOpen) {
                            EditorGUI.indentLevel++; {

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(LID);
                                leaderbaord.id	 	= EditorGUILayout.TextField(leaderbaord.id);
                                if(leaderbaord.id.Length > 0) {
                                    leaderbaord.id		= leaderbaord.id.Trim();
                                }
                                gkLb.Info.Title = leaderbaord.id;
                                gpLb.Name = leaderbaord.id;
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(IOSLID);
                                leaderbaord.IOSId	 	= EditorGUILayout.TextField(leaderbaord.IOSId);
                                if(leaderbaord.IOSId.Length > 0) {
                                    leaderbaord.IOSId 		= leaderbaord.IOSId.Trim();
                                }
                                EditorGUILayout.EndHorizontal();
                                gkLb.Info.Identifier = leaderbaord.IOSId;

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(ANDROIDLID);

                                EditorGUI.BeginChangeCheck();

                                bool doesntMatch = false;
                                bool fileDoesntExists = false;

                                string name = string.Empty;
                                string[] names = new string[resources.Keys.Count + 1];
                                names[0] = "[None]";
                                resources.Keys.CopyTo(names, 1);
                                List<string> listNames = new List<string>(names);
                                if (leaderbaord.AndroidId.Equals(string.Empty)) {
                                    name = names[EditorGUILayout.Popup(0, names)];
                                } else {
                                    if (FileStaticAPI.IsFileExists ("Plugins/Android/AN_Res/res/values/ids.xml")) {
                                        if (resources.ContainsValue(leaderbaord.AndroidId)) {
                                            name = names[EditorGUILayout.Popup(listNames.IndexOf(GetKeyForValue(resources, leaderbaord.AndroidId)), names)];
                                        } else {
                                            doesntMatch = true;
                                            name = names[EditorGUILayout.Popup(0, names)];
                                        }
                                    } else {
                                        fileDoesntExists = true;
                                    }
                                }

                                if (EditorGUI.EndChangeCheck()){
                                    if (!name.Equals("[None]")) {
                                        leaderbaord.AndroidId = resources[name];
                                    }
                                }

                                if(leaderbaord.AndroidId.Length > 0) {
                                    leaderbaord.AndroidId 		= leaderbaord.AndroidId.Trim();
                                }
                                gpLb.Id = leaderbaord.AndroidId;
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                if (fileDoesntExists) {
                                    EditorGUILayout.HelpBox("XML file with PlayService ID's DOESN'T exist", MessageType.Warning);
                                }
                                if (doesntMatch) {
                                    EditorGUILayout.HelpBox("Leaderboard ID doesn't match any PlayService ID of ids.xml file", MessageType.Warning);
                                }
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.Space();
                                EditorGUILayout.Space();

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(LeaderboardDescriptionLabel);
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                leaderbaord.Description	 = EditorGUILayout.TextArea(leaderbaord.Description,  new GUILayoutOption[]{GUILayout.Height(60), GUILayout.Width(200)} );
                                gkLb.Info.Description = leaderbaord.Description;
                                gpLb.Description = leaderbaord.Description;
                                leaderbaord.Texture = (Texture2D) EditorGUILayout.ObjectField("", leaderbaord.Texture, typeof (Texture2D), false);
                                gkLb.Info.Texture = leaderbaord.Texture;
                                gpLb.Texture = leaderbaord.Texture;
                                EditorGUILayout.EndHorizontal();
                                EditorGUILayout.Space();
                            } EditorGUI.indentLevel--;
                        }
                        EditorGUILayout.EndVertical();
                    }

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.Space();
                    if(GUILayout.Button("Add new",  GUILayout.Width(80))) {
                        UM_Leaderboard lb = new UM_Leaderboard();

                        int index = 0;
                        do {
                            index++;
                        } while (IsLeaderboardExists(lb.id + index.ToString()));
                        lb.id = lb.id + index.ToString();
                        lb.AndroidId = lb.id;
                        lb.IOSId = lb.id;

                        settings.AddLeaderboard(lb);
                        AndroidNativeSettings.Instance.Leaderboards.Add(new GPLeaderBoard(lb.AndroidId, lb.id));
                        GK_Leaderboard iOSLb = new GK_Leaderboard(lb.IOSId);
                        iOSLb.Info.Title = lb.id;
                        IOSNativeSettings.Instance.Leaderboards.Add(iOSLb);
                    }
                    EditorGUILayout.Space();
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space();
                }

                settings.IsAchievementsOpen = EditorGUILayout.Foldout(settings.IsAchievementsOpen, "Achievements");
                if(settings.IsAchievementsOpen) {
                    if(settings.Achievements.Count == 0) {
                        EditorGUILayout.HelpBox("No Achievements Added", MessageType.Warning);
                    }

                    foreach(UM_Achievement achievement in settings.Achievements) {
                        GPAchievement gpAch = GetAndroidAchievement(achievement.AndroidId);
                        GK_AchievementTemplate gkAch = GetIOSAchievement(achievement.IOSId);

                        EditorGUILayout.BeginVertical (GUI.skin.box);

                        EditorGUILayout.BeginHorizontal();

                        GUIStyle s =  new GUIStyle();
                        s.padding =  new RectOffset();
                        s.margin =  new RectOffset();
                        s.border =  new RectOffset();

                        if(achievement.Texture != null) {
                            GUILayout.Box(achievement.Texture, s, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(18)});
                        }

                        achievement.IsOpen = EditorGUILayout.Foldout(achievement.IsOpen, achievement.id);
                        bool ItemWasRemoved = DrawSortingButtons((object) achievement, settings.Achievements,
                                                                 (object) gpAch, AndroidNativeSettings.Instance.Achievements,
                                                                 (object) gkAch, IOSNativeSettings.Instance.Achievements);
                        if(ItemWasRemoved) {
                            return;
                        }
                        EditorGUILayout.EndHorizontal();

                        if(achievement.IsOpen) {
                            EditorGUI.indentLevel++; {

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(AID);
                                achievement.id	 	= EditorGUILayout.TextField(achievement.id);
                                if(achievement.id.Length > 0) {
                                    achievement.id 		= achievement.id.Trim();
                                }
                                gkAch.Title = achievement.id;
                                gpAch.Name = achievement.id;
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(ALID);
                                achievement.IOSId	 	= EditorGUILayout.TextField(achievement.IOSId);
                                if(achievement.IOSId.Length > 0) {
                                    achievement.IOSId 		= achievement.IOSId.Trim();
                                }
                                gkAch.Id = achievement.IOSId;
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(ANDROIDAID);

                                EditorGUI.BeginChangeCheck();

                                bool doesntMatch = false;
                                bool fileDoesntExists = false;

                                string name = string.Empty;
                                string[] names = new string[resources.Keys.Count + 1];
                                names[0] = "[None]";
                                resources.Keys.CopyTo(names, 1);
                                List<string> listNames = new List<string>(names);
                                if (achievement.AndroidId.Equals(string.Empty)) {
                                    name = names[EditorGUILayout.Popup(0, names)];
                                } else {
                                    if (FileStaticAPI.IsFileExists ("Plugins/Android/AN_Res/res/values/ids.xml")) {
                                        if (resources.ContainsValue(achievement.AndroidId)) {
                                            name = names[EditorGUILayout.Popup(listNames.IndexOf(GetKeyForValue(resources, achievement.AndroidId)), names)];
                                        } else {
                                            doesntMatch = true;
                                            name = names[EditorGUILayout.Popup(0, names)];
                                        }
                                    } else {
                                        fileDoesntExists = true;
                                    }
                                }

                                if (EditorGUI.EndChangeCheck()){
                                    if (!name.Equals("[None]")) {
                                        achievement.AndroidId = resources[name];
                                    }
                                }

                                if(achievement.AndroidId.Length > 0) {
                                    achievement.AndroidId 		= achievement.AndroidId.Trim();
                                }
                                gpAch.Id = achievement.AndroidId;
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                if (fileDoesntExists) {
                                    EditorGUILayout.HelpBox("XML file with PlayService ID's DOESN'T exist", MessageType.Warning);
                                }
                                if (doesntMatch) {
                                    EditorGUILayout.HelpBox("Achievement ID doesn't match any PlayService ID of ids.xml file", MessageType.Warning);
                                }
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.Space();
                                EditorGUILayout.Space();

                                EditorGUILayout.BeginHorizontal();
                                EditorGUILayout.LabelField(AchievementDescriptionLabel);
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                achievement.Description	 = EditorGUILayout.TextArea(achievement.Description,  new GUILayoutOption[]{GUILayout.Height(60), GUILayout.Width(200)} );
                                gkAch.Description = achievement.Description;
                                gpAch.Description = achievement.Description;
                                achievement.Texture = (Texture2D) EditorGUILayout.ObjectField("", achievement.Texture, typeof (Texture2D), false);
                                gkAch.Texture = achievement.Texture;
                                gpAch.Texture = achievement.Texture;
                                EditorGUILayout.EndHorizontal();
                                EditorGUILayout.Space();

                            } EditorGUI.indentLevel--;
                        }
                        EditorGUILayout.EndVertical();
                    }

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.Space();
                    if(GUILayout.Button("Add new",  GUILayout.Width(80))) {
                        UM_Achievement ac = new UM_Achievement();

                        int index = 0;
                        do {
                            index++;
                        } while (IsAchievementExists(ac.id + index.ToString()));
                        ac.id = ac.id + index.ToString();
                        ac.AndroidId = ac.id;
                        ac.IOSId = ac.id;

                        settings.AddAchievement(ac);
                        AndroidNativeSettings.Instance.Achievements.Add(new GPAchievement(ac.AndroidId, ac.id));
                        IOSNativeSettings.Instance.Achievements.Add(new GK_AchievementTemplate(){Id = ac.IOSId, Title = ac.id});
                    }
                    EditorGUILayout.Space();
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space();
                }
            } EditorGUI.indentLevel--;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(AutoLoadBigmagesLoadTitle);
            UltimateMobileSettings.Instance.AutoLoadUsersBigImages = EditorGUILayout.Toggle(UltimateMobileSettings.Instance.AutoLoadUsersBigImages);

            IOSNativeSettings.Instance.AutoLoadUsersBigImages = UltimateMobileSettings.Instance.AutoLoadUsersBigImages;
            AndroidNativeSettings.Instance.LoadProfileImages = UltimateMobileSettings.Instance.AutoLoadUsersBigImages;

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(AutoLoadSmallImagesLoadTitle);
            UltimateMobileSettings.Instance.AutoLoadUsersSmallImages = EditorGUILayout.Toggle(UltimateMobileSettings.Instance.AutoLoadUsersSmallImages);

            IOSNativeSettings.Instance.AutoLoadUsersSmallImages = UltimateMobileSettings.Instance.AutoLoadUsersSmallImages;
            AndroidNativeSettings.Instance.LoadProfileIcons = UltimateMobileSettings.Instance.AutoLoadUsersSmallImages;

            EditorGUILayout.EndHorizontal();
        }
    }
	private void OnLeaderboardMaxRangeUpdate(string array) {
		string[] data = array.Split("|" [0]);

		string identifier = data[0];
		int MaxRange = System.Convert.ToInt32(data[1]);

		GK_Leaderboard board;
		if(_leaderboards.ContainsKey(identifier)) {
			board = _leaderboards[identifier];
		} else {
			board =  new GK_Leaderboard(identifier);
		}

		board.UpdateMaxRange(MaxRange);
	}
예제 #20
0
	public void Setup(GK_Leaderboard gkLeaderboard) {
		gk_Leaderboard = gkLeaderboard;
	}
예제 #21
0
	public GK_LeaderboardResult(GK_Leaderboard leaderboard, string errorData):base(errorData) {
		Setinfo(leaderboard);
	}
예제 #22
0
	private void Setinfo(GK_Leaderboard leaderboard) {
		_Leaderboard = leaderboard;
	}
예제 #23
0
	public GK_LeaderboardResult(GK_Leaderboard leaderboard):base(true) {
		Setinfo(leaderboard);
	}
예제 #24
0
 public GK_LeaderboardResult(GK_Leaderboard leaderboard, SA.Common.Models.Error error) : base(error)
 {
     Setinfo(leaderboard);
 }
    private void MoreActions()
    {
        IOSNativeSettings.Instance.ShowOtherParams = EditorGUILayout.Foldout(IOSNativeSettings.Instance.ShowOtherParams, "More Actions");
        if (IOSNativeSettings.Instance.ShowOtherParams)
        {
            EditorGUI.BeginChangeCheck();


            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(DisablePluginLogsNote);
            IOSNativeSettings.Instance.DisablePluginLogs = EditorGUILayout.Toggle(IOSNativeSettings.Instance.DisablePluginLogs);
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Load Example Settings", GUILayout.Width(140)))
            {
                PlayerSettings.applicationIdentifier = "com.stansassets.iosnative.dev";
                IOSNativeSettings.Instance.InAppProducts.Clear();

                IOSProductTemplate SmallPack = new IOSProductTemplate();
                SmallPack.IsOpen      = false;
                SmallPack.Id          = "your.product.id1.here";
                SmallPack.PriceTier   = ISN_InAppPriceTier.Tier1;
                SmallPack.DisplayName = "Small Pack";
                SmallPack.ProductType = ISN_InAppType.Consumable;


                IOSProductTemplate NonConsumablePack = new IOSProductTemplate();
                NonConsumablePack.IsOpen      = false;
                NonConsumablePack.Id          = "your.product.id2.here";
                NonConsumablePack.PriceTier   = ISN_InAppPriceTier.Tier2;
                NonConsumablePack.DisplayName = "Non Consumable Pack";
                NonConsumablePack.ProductType = ISN_InAppType.Consumable;

                IOSNativeSettings.Instance.InAppProducts.Add(SmallPack);
                IOSNativeSettings.Instance.InAppProducts.Add(NonConsumablePack);



                IOSNativeSettings.Instance.Leaderboards.Clear();
                GK_Leaderboard Leaderboard1 = new GK_Leaderboard("your.ios.leaderbord1.id");
                Leaderboard1.IsOpen     = false;
                Leaderboard1.Info.Title = "Leaderboard 1";

                IOSNativeSettings.Instance.Leaderboards.Clear();
                GK_Leaderboard Leaderboard2 = new GK_Leaderboard("your.ios.leaderbord2.id");
                Leaderboard2.IsOpen     = false;
                Leaderboard2.Info.Title = "Leaderboard 2";

                IOSNativeSettings.Instance.Leaderboards.Add(Leaderboard1);
                IOSNativeSettings.Instance.Leaderboards.Add(Leaderboard2);


                IOSNativeSettings.Instance.Achievements.Clear();
                GK_AchievementTemplate Achievement1 = new GK_AchievementTemplate();
                Achievement1.Id     = "your.achievement.id1.here";
                Achievement1.IsOpen = false;
                Achievement1.Title  = "Achievement 1";


                GK_AchievementTemplate Achievement2 = new GK_AchievementTemplate();
                Achievement2.Id     = "your.achievement.id2.here";
                Achievement2.IsOpen = false;
                Achievement2.Title  = "Achievement 2";

                GK_AchievementTemplate Achievement3 = new GK_AchievementTemplate();
                Achievement3.Id     = "your.achievement.id3.here";
                Achievement3.IsOpen = false;
                Achievement3.Title  = "Achievement 3";

                IOSNativeSettings.Instance.Achievements.Add(Achievement1);
                IOSNativeSettings.Instance.Achievements.Add(Achievement2);
                IOSNativeSettings.Instance.Achievements.Add(Achievement3);

                IOSNativeSettings.Instance.SoomlaEnvKey  = "3c3df370-ad80-4577-8fe5-ca2c49b2c1b4";
                IOSNativeSettings.Instance.SoomlaGameKey = "db24ba61-3aa7-4653-a3f7-9c613cb2c0f3";
            }


            if (GUILayout.Button("Remove IOS Native", GUILayout.Width(140)))
            {
                SA_RemoveTool.RemovePlugins();
            }



            EditorGUILayout.EndHorizontal();
        }
    }
예제 #26
0
	private void GameCenterSettings() {
		EditorGUILayout.Space();
		EditorGUILayout.HelpBox("Leaderboards Info", MessageType.None);


		EditorGUI.indentLevel++; {
			
			EditorGUILayout.BeginVertical (GUI.skin.box);

			EditorGUILayout.BeginHorizontal();
			IOSNativeSettings.Instance.ShowLeaderboards = EditorGUILayout.Foldout(IOSNativeSettings.Instance.ShowLeaderboards, "Leaderboards");
			
			
			
			EditorGUILayout.EndHorizontal();

			
			if(IOSNativeSettings.Instance.ShowLeaderboards) {
				EditorGUILayout.Space();
				
				foreach(GK_Leaderboard leaderboard in IOSNativeSettings.Instance.Leaderboards) {
					
					
					EditorGUILayout.BeginVertical (GUI.skin.box);
					
					EditorGUILayout.BeginHorizontal();
					
					
					
					if(leaderboard.Info.Texture != null) {
						GUILayout.Box(leaderboard.Info.Texture, ImageBoxStyle, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(18)});
					}
					
					leaderboard.IsOpen 	= EditorGUILayout.Foldout(leaderboard.IsOpen, leaderboard.Info.Title);
					
					

					bool ItemWasRemoved = DrawSrotingButtons((object) leaderboard, IOSNativeSettings.Instance.Leaderboards);
					if(ItemWasRemoved) {
						return;
					}
					
					
					EditorGUILayout.EndHorizontal();
					
					if(leaderboard.IsOpen) {
						EditorGUILayout.BeginHorizontal();
						EditorGUILayout.LabelField(L_IdDLabel);
						leaderboard.Info.Identifier	 	= EditorGUILayout.TextField(leaderboard.Info.Identifier);
						if(leaderboard.Info.Identifier.Length > 0) {
							leaderboard.Info.Identifier 		= leaderboard.Info.Identifier.Trim();
						}
						EditorGUILayout.EndHorizontal();
						
						
						EditorGUILayout.BeginHorizontal();
						EditorGUILayout.LabelField(L_DisplayNameLabel);
						leaderboard.Info.Title	 	= EditorGUILayout.TextField(leaderboard.Info.Title);
						EditorGUILayout.EndHorizontal();
		

						EditorGUILayout.Space();
						EditorGUILayout.Space();

						
						EditorGUILayout.BeginHorizontal();
						EditorGUILayout.LabelField(L_DescriptionLabel);
						EditorGUILayout.EndHorizontal();
						
						EditorGUILayout.BeginHorizontal();
						leaderboard.Info.Description	 = EditorGUILayout.TextArea(leaderboard.Info.Description,  new GUILayoutOption[]{GUILayout.Height(60), GUILayout.Width(200)} );
						leaderboard.Info.Texture = (Texture2D) EditorGUILayout.ObjectField("", leaderboard.Info.Texture, typeof (Texture2D), false);
						EditorGUILayout.EndHorizontal();
						
					}
					
					EditorGUILayout.EndVertical();
					
				}
				
				EditorGUILayout.BeginHorizontal();
				EditorGUILayout.Space();
				if(GUILayout.Button("Add new", EditorStyles.miniButton, GUILayout.Width(250))) {
					GK_Leaderboard leaderbaord =  new GK_Leaderboard("");
					IOSNativeSettings.Instance.Leaderboards.Add(leaderbaord);
				}
				
				EditorGUILayout.Space();
				EditorGUILayout.EndHorizontal();
				EditorGUILayout.Space();
			}

			EditorGUILayout.EndVertical();

		}EditorGUI.indentLevel--;



		EditorGUILayout.Space();
		EditorGUILayout.HelpBox("Achievements Info", MessageType.None);

		EditorGUI.indentLevel++; {

			EditorGUILayout.BeginVertical (GUI.skin.box);
			
			EditorGUILayout.BeginHorizontal();
			IOSNativeSettings.Instance.ShowAchievementsParams = EditorGUILayout.Foldout(IOSNativeSettings.Instance.ShowAchievementsParams, "Achievements");
			
			
			
			EditorGUILayout.EndHorizontal();
			
			
			if(IOSNativeSettings.Instance.ShowAchievementsParams) {
				EditorGUILayout.Space();
				
				foreach(GK_AchievementTemplate achievement in IOSNativeSettings.Instance.Achievements) {
					
					
					EditorGUILayout.BeginVertical (GUI.skin.box);
					
					EditorGUILayout.BeginHorizontal();
					
					
					
					if(achievement.Texture != null) {
						GUILayout.Box(achievement.Texture, ImageBoxStyle, new GUILayoutOption[]{GUILayout.Width(18), GUILayout.Height(18)});
					}
					
					achievement.IsOpen 	= EditorGUILayout.Foldout(achievement.IsOpen, achievement.Title);
					
					
					
					bool ItemWasRemoved = DrawSrotingButtons((object) achievement, IOSNativeSettings.Instance.Achievements);
					if(ItemWasRemoved) {
						return;
					}
					
					
					EditorGUILayout.EndHorizontal();
					
					if(achievement.IsOpen) {
						EditorGUILayout.BeginHorizontal();
						EditorGUILayout.LabelField(A_IdDLabel);
						achievement.Id	 	= EditorGUILayout.TextField(achievement.Id);
						if(achievement.Id.Length > 0) {
							achievement.Id 		= achievement.Id.Trim();
						}
						EditorGUILayout.EndHorizontal();
						
						
						EditorGUILayout.BeginHorizontal();
						EditorGUILayout.LabelField(A_DisplayNameLabel);
						achievement.Title	 	= EditorGUILayout.TextField(achievement.Title);
						EditorGUILayout.EndHorizontal();
						
						
						EditorGUILayout.Space();
						EditorGUILayout.Space();
						
						
						EditorGUILayout.BeginHorizontal();
						EditorGUILayout.LabelField(A_DescriptionLabel);
						EditorGUILayout.EndHorizontal();
						
						EditorGUILayout.BeginHorizontal();
						achievement.Description	 = EditorGUILayout.TextArea(achievement.Description,  new GUILayoutOption[]{GUILayout.Height(60), GUILayout.Width(200)} );
						achievement.Texture = (Texture2D) EditorGUILayout.ObjectField("", achievement.Texture, typeof (Texture2D), false);
						EditorGUILayout.EndHorizontal();
						
					}
					
					EditorGUILayout.EndVertical();
					
				}
				
				EditorGUILayout.BeginHorizontal();
				EditorGUILayout.Space();
				if(GUILayout.Button("Add new", EditorStyles.miniButton, GUILayout.Width(250))) {
					GK_AchievementTemplate achievement =  new GK_AchievementTemplate();
					IOSNativeSettings.Instance.Achievements.Add(achievement);
				}
				
				EditorGUILayout.Space();
				EditorGUILayout.EndHorizontal();
				EditorGUILayout.Space();
			}
			
			EditorGUILayout.EndVertical();




		}EditorGUI.indentLevel--;

		EditorGUILayout.Space();
		EditorGUILayout.HelpBox("Game Center API Settings", MessageType.None);



		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.LabelField(AutoLoadBigmagesLoadTitle);
		IOSNativeSettings.Instance.AutoLoadUsersBigImages = EditorGUILayout.Toggle(IOSNativeSettings.Instance.AutoLoadUsersBigImages);
		EditorGUILayout.EndHorizontal();
		
		
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.LabelField(AutoLoadSmallImagesLoadTitle);
		IOSNativeSettings.Instance.AutoLoadUsersSmallImages = EditorGUILayout.Toggle(IOSNativeSettings.Instance.AutoLoadUsersSmallImages);
		EditorGUILayout.EndHorizontal();


		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.LabelField(UseGCCaching);
		IOSNativeSettings.Instance.UseGCRequestCaching = EditorGUILayout.Toggle(IOSNativeSettings.Instance.UseGCRequestCaching);
		EditorGUILayout.EndHorizontal();
		
		
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.LabelField("Store Achievements Progress in PlayerPrefs[?]");
		IOSNativeSettings.Instance.UsePPForAchievements = EditorGUILayout.Toggle(IOSNativeSettings.Instance.UsePPForAchievements);
		EditorGUILayout.EndHorizontal();
			
			



	}
    private void GameCenterSettings()
    {
        EditorGUILayout.Space();
        EditorGUILayout.HelpBox("Leaderboards Info", MessageType.None);


        EditorGUI.indentLevel++; {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.BeginHorizontal();
            IOSNativeSettings.Instance.ShowLeaderboards = EditorGUILayout.Foldout(IOSNativeSettings.Instance.ShowLeaderboards, "Leaderboards");



            EditorGUILayout.EndHorizontal();


            if (IOSNativeSettings.Instance.ShowLeaderboards)
            {
                EditorGUILayout.Space();

                foreach (GK_Leaderboard leaderboard in IOSNativeSettings.Instance.Leaderboards)
                {
                    EditorGUILayout.BeginVertical(GUI.skin.box);

                    EditorGUILayout.BeginHorizontal();



                    if (leaderboard.Info.Texture != null)
                    {
                        GUILayout.Box(leaderboard.Info.Texture, ImageBoxStyle, new GUILayoutOption[] { GUILayout.Width(18), GUILayout.Height(18) });
                    }

                    leaderboard.IsOpen = EditorGUILayout.Foldout(leaderboard.IsOpen, leaderboard.Info.Title);



                    bool ItemWasRemoved = DrawSrotingButtons((object)leaderboard, IOSNativeSettings.Instance.Leaderboards);
                    if (ItemWasRemoved)
                    {
                        return;
                    }


                    EditorGUILayout.EndHorizontal();

                    if (leaderboard.IsOpen)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(L_IdDLabel);
                        leaderboard.Info.Identifier = EditorGUILayout.TextField(leaderboard.Info.Identifier);
                        if (leaderboard.Info.Identifier.Length > 0)
                        {
                            leaderboard.Info.Identifier = leaderboard.Info.Identifier.Trim();
                        }
                        EditorGUILayout.EndHorizontal();


                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(L_DisplayNameLabel);
                        leaderboard.Info.Title = EditorGUILayout.TextField(leaderboard.Info.Title);
                        EditorGUILayout.EndHorizontal();


                        EditorGUILayout.Space();
                        EditorGUILayout.Space();


                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(L_DescriptionLabel);
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginHorizontal();
                        leaderboard.Info.Description = EditorGUILayout.TextArea(leaderboard.Info.Description, new GUILayoutOption[] { GUILayout.Height(60), GUILayout.Width(200) });
                        leaderboard.Info.Texture     = (Texture2D)EditorGUILayout.ObjectField("", leaderboard.Info.Texture, typeof(Texture2D), false);
                        EditorGUILayout.EndHorizontal();
                    }

                    EditorGUILayout.EndVertical();
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.Space();
                if (GUILayout.Button("Add new", EditorStyles.miniButton, GUILayout.Width(250)))
                {
                    GK_Leaderboard leaderbaord = new GK_Leaderboard("");
                    IOSNativeSettings.Instance.Leaderboards.Add(leaderbaord);
                }

                EditorGUILayout.Space();
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();
            }

            EditorGUILayout.EndVertical();
        } EditorGUI.indentLevel--;



        EditorGUILayout.Space();
        EditorGUILayout.HelpBox("Achievements Info", MessageType.None);

        EditorGUI.indentLevel++; {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.BeginHorizontal();
            IOSNativeSettings.Instance.ShowAchievementsParams = EditorGUILayout.Foldout(IOSNativeSettings.Instance.ShowAchievementsParams, "Achievements");



            EditorGUILayout.EndHorizontal();


            if (IOSNativeSettings.Instance.ShowAchievementsParams)
            {
                EditorGUILayout.Space();

                foreach (GK_AchievementTemplate achievement in IOSNativeSettings.Instance.Achievements)
                {
                    EditorGUILayout.BeginVertical(GUI.skin.box);

                    EditorGUILayout.BeginHorizontal();



                    if (achievement.Texture != null)
                    {
                        GUILayout.Box(achievement.Texture, ImageBoxStyle, new GUILayoutOption[] { GUILayout.Width(18), GUILayout.Height(18) });
                    }

                    achievement.IsOpen = EditorGUILayout.Foldout(achievement.IsOpen, achievement.Title);



                    bool ItemWasRemoved = DrawSrotingButtons((object)achievement, IOSNativeSettings.Instance.Achievements);
                    if (ItemWasRemoved)
                    {
                        return;
                    }


                    EditorGUILayout.EndHorizontal();

                    if (achievement.IsOpen)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(A_IdDLabel);
                        achievement.Id = EditorGUILayout.TextField(achievement.Id);
                        if (achievement.Id.Length > 0)
                        {
                            achievement.Id = achievement.Id.Trim();
                        }
                        EditorGUILayout.EndHorizontal();


                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(A_DisplayNameLabel);
                        achievement.Title = EditorGUILayout.TextField(achievement.Title);
                        EditorGUILayout.EndHorizontal();


                        EditorGUILayout.Space();
                        EditorGUILayout.Space();


                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(A_DescriptionLabel);
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginHorizontal();
                        achievement.Description = EditorGUILayout.TextArea(achievement.Description, new GUILayoutOption[] { GUILayout.Height(60), GUILayout.Width(200) });
                        achievement.Texture     = (Texture2D)EditorGUILayout.ObjectField("", achievement.Texture, typeof(Texture2D), false);
                        EditorGUILayout.EndHorizontal();
                    }

                    EditorGUILayout.EndVertical();
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.Space();
                if (GUILayout.Button("Add new", EditorStyles.miniButton, GUILayout.Width(250)))
                {
                    GK_AchievementTemplate achievement = new GK_AchievementTemplate();
                    IOSNativeSettings.Instance.Achievements.Add(achievement);
                }

                EditorGUILayout.Space();
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();
            }

            EditorGUILayout.EndVertical();
        } EditorGUI.indentLevel--;

        EditorGUILayout.Space();
        EditorGUILayout.HelpBox("Game Center API Settings", MessageType.None);



        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(AutoLoadBigmagesLoadTitle);
        IOSNativeSettings.Instance.AutoLoadUsersBigImages = EditorGUILayout.Toggle(IOSNativeSettings.Instance.AutoLoadUsersBigImages);
        EditorGUILayout.EndHorizontal();


        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(AutoLoadSmallImagesLoadTitle);
        IOSNativeSettings.Instance.AutoLoadUsersSmallImages = EditorGUILayout.Toggle(IOSNativeSettings.Instance.AutoLoadUsersSmallImages);
        EditorGUILayout.EndHorizontal();


        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(UseGCCaching);
        IOSNativeSettings.Instance.UseGCRequestCaching = EditorGUILayout.Toggle(IOSNativeSettings.Instance.UseGCRequestCaching);
        EditorGUILayout.EndHorizontal();


        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Store Achievements Progress in PlayerPrefs[?]");
        IOSNativeSettings.Instance.UsePPForAchievements = EditorGUILayout.Toggle(IOSNativeSettings.Instance.UsePPForAchievements);
        EditorGUILayout.EndHorizontal();
    }
예제 #28
0
	private void MoreActions() {


		
		IOSNativeSettings.Instance.ShowOtherParams = EditorGUILayout.Foldout(IOSNativeSettings.Instance.ShowOtherParams, "More Actions");
		if (IOSNativeSettings.Instance.ShowOtherParams) {




			EditorGUI.BeginChangeCheck();


			EditorGUILayout.BeginHorizontal();
			EditorGUILayout.LabelField(DisablePluginLogsNote);
			IOSNativeSettings.Instance.DisablePluginLogs = EditorGUILayout.Toggle(IOSNativeSettings.Instance.DisablePluginLogs);
			EditorGUILayout.EndHorizontal();


			EditorGUILayout.Space();

			EditorGUILayout.BeginHorizontal();
			if(GUILayout.Button("Load Example Settings",  GUILayout.Width(140))) {
				PlayerSettings.bundleIdentifier = "com.stansassets.iosnative.dev";
				IOSNativeSettings.Instance.InAppProducts.Clear();

				IOSProductTemplate SmallPack =  new IOSProductTemplate();
				SmallPack.IsOpen = false;
				SmallPack.Id = "your.product.id1.here";
				SmallPack.PriceTier = ISN_InAppPriceTier.Tier1;
				SmallPack.DisplayName = "Small Pack";
				SmallPack.ProductType = ISN_InAppType.Consumable;


				IOSProductTemplate NonConsumablePack =  new IOSProductTemplate();
				NonConsumablePack.IsOpen = false;
				NonConsumablePack.Id = "your.product.id2.here";
				NonConsumablePack.PriceTier = ISN_InAppPriceTier.Tier2;
				NonConsumablePack.DisplayName = "Non Consumable Pack";
				NonConsumablePack.ProductType = ISN_InAppType.Consumable;

				IOSNativeSettings.Instance.InAppProducts.Add(SmallPack);
				IOSNativeSettings.Instance.InAppProducts.Add(NonConsumablePack);



				IOSNativeSettings.Instance.Leaderboards.Clear();
				GK_Leaderboard Leaderboard1 =  new GK_Leaderboard("your.ios.leaderbord1.id");
				Leaderboard1.IsOpen = false;
				Leaderboard1.Info.Title = "Leaderboard 1";

				IOSNativeSettings.Instance.Leaderboards.Clear();
				GK_Leaderboard Leaderboard2 =  new GK_Leaderboard("your.ios.leaderbord2.id");
				Leaderboard2.IsOpen = false;
				Leaderboard2.Info.Title = "Leaderboard 2";

				IOSNativeSettings.Instance.Leaderboards.Add(Leaderboard1);
				IOSNativeSettings.Instance.Leaderboards.Add(Leaderboard2);


				IOSNativeSettings.Instance.Achievements.Clear();
				GK_AchievementTemplate Achievement1 =  new GK_AchievementTemplate();
				Achievement1.Id = "your.achievement.id1.here";
				Achievement1.IsOpen = false;
				Achievement1.Title = "Achievement 1";
				
	
				GK_AchievementTemplate Achievement2 =  new GK_AchievementTemplate();
				Achievement2.Id = "your.achievement.id2.here";
				Achievement2.IsOpen = false;
				Achievement2.Title = "Achievement 2";

				GK_AchievementTemplate Achievement3 =  new GK_AchievementTemplate();
				Achievement3.Id = "your.achievement.id3.here";
				Achievement3.IsOpen = false;
				Achievement3.Title = "Achievement 3";
				
				IOSNativeSettings.Instance.Achievements.Add(Achievement1);
				IOSNativeSettings.Instance.Achievements.Add(Achievement2);
				IOSNativeSettings.Instance.Achievements.Add(Achievement3);

				IOSNativeSettings.Instance.SoomlaEnvKey = "3c3df370-ad80-4577-8fe5-ca2c49b2c1b4";
				IOSNativeSettings.Instance.SoomlaGameKey = "db24ba61-3aa7-4653-a3f7-9c613cb2c0f3";

			}


			if(GUILayout.Button("Remove IOS Native",  GUILayout.Width(140))) {
				SA_RemoveTool.RemovePlugins();
			}



			EditorGUILayout.EndHorizontal();



		

		}
	}
	private void onLeaderboardScoreListLoaded(string array) {


		
		string[] data;
		data = array.Split("," [0]);

		string lbId = data[0];
		GK_TimeSpan timeSpan = (GK_TimeSpan) System.Convert.ToInt32(data[1]);
		GK_CollectionType collection = (GK_CollectionType) System.Convert.ToInt32(data[2]);

		GK_Leaderboard board;
		if(_leaderboards.ContainsKey(lbId)) {
			board = _leaderboards[lbId];
		} else {
			board =  new GK_Leaderboard(lbId);
			_leaderboards.Add(lbId, board);
		}


	
		
		
		for(int i = 3; i < data.Length; i+=3) {
			string playerId = data[i];
			string scoreVal = data[i + 1];
			int rank = System.Convert.ToInt32(data[i + 2]);

			GK_Score score =  new GK_Score(scoreVal, rank, timeSpan, collection, lbId, playerId);
			board.UpdateScore(score);
			if(Player != null) {
				if(Player.Id.Equals(playerId)) {
					board.UpdateCurrentPlayerRank(rank, timeSpan, collection);
				}
			}
		}
		


		ISN_Result result = new ISN_Result (true);
		OnScoresListLoaded (result);


	}
예제 #30
0
 public void Setup(GK_Leaderboard gkLeaderboard)
 {
     gk_Leaderboard = gkLeaderboard;
 }
예제 #31
0
 private void Setinfo(GK_Leaderboard leaderboard)
 {
     _Leaderboard = leaderboard;
 }
	private void OnScoresListLoaded (ISN_Result res) {
		if(res.IsSucceeded) {
			Debug.Log("Scores loaded");
			loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId);
		} else  {
			Debug.Log("Failed to load scores");
		}
	}
예제 #33
0
 public GK_LeaderboardResult(GK_Leaderboard leaderboard, string errorData) : base(errorData)
 {
     Setinfo(leaderboard);
 }
예제 #34
0
 private GK_Leaderboard GetIOSLeaderboard(string id)
 {
     foreach (GK_Leaderboard lb in IOSNativeSettings.Instance.Leaderboards) {
         if (lb.Id.Equals(id)) {
             return lb;
         }
     }
     GK_Leaderboard l = new GK_Leaderboard(id);
     IOSNativeSettings.Instance.Leaderboards.Add(l);
     return l;
 }
예제 #35
0
 public GK_LeaderboardResult(GK_Leaderboard leaderboard) : base(true)
 {
     Setinfo(leaderboard);
 }
	private void OnScoresListLoaded (ISN_Result res) {
		if(res.IsSucceeded) {

			loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId_1);
			IOSMessage.Create("Success", "Scores loaded");
		} else  {
			IOSMessage.Create("Fail", "Failed to load scores");
		}
	}
예제 #37
0
	public static GK_Leaderboard GetLeaderboard(string id) {

		foreach(GK_Leaderboard leaderboard in Leaderboards) {
			if(leaderboard.Id.Equals(id)) {
				return leaderboard;
			}
		}

		GK_Leaderboard new_leaderboard = new GK_Leaderboard(id);
		Leaderboards.Add(new_leaderboard);

		return new_leaderboard;
	}
	private void onLeaderboardScore(string array) {

		string[] data;
		data = array.Split("," [0]);

		string lbId = data[0];
		string scoreVal = data[1];
		int rank = System.Convert.ToInt32(data[2]);


		GK_TimeSpan timeSpan = (GK_TimeSpan) System.Convert.ToInt32(data[3]);
		GK_CollectionType collection = (GK_CollectionType) System.Convert.ToInt32(data[4]);

		GK_Leaderboard board;
		if(_leaderboards.ContainsKey(lbId)) {
			board = _leaderboards[lbId];
		} else {
			board =  new GK_Leaderboard(lbId);
			_leaderboards.Add(lbId, board);
		}


		GK_Score score =  new GK_Score(scoreVal, rank, timeSpan, collection, lbId, Player.Id);

		board.UpdateScore(score);
		board.UpdateCurrentPlayerRank(rank, timeSpan, collection);
	

		GK_PlayerScoreLoadedResult result = new GK_PlayerScoreLoadedResult (score);
		OnPlayerScoreLoaded (result);
	}