//--------------------------------------
    //  PRIVATE METHODS
    //--------------------------------------

    private void SaveLocalProgress(GK_AchievementTemplate tpl)
    {
        if (IOSNativeSettings.Instance.UsePPForAchievements)
        {
            SaveAchievementProgress(tpl.Id, tpl.Progress);
        }
    }
    public static void RegisterAchievement(GK_AchievementTemplate achievement)
    {
        bool isContains = false;

        int replaceIndex = 0;

        foreach (GK_AchievementTemplate tpl in Achievements)
        {
            if (tpl.Id.Equals(achievement.Id))
            {
                isContains   = true;
                replaceIndex = Achievements.IndexOf(tpl);
                break;
            }
        }

        if (isContains)
        {
            Achievements[replaceIndex] = achievement;
        }
        else
        {
            Achievements.Add(achievement);
        }
    }
Esempio n. 3
0
    private void onAchievementsLoaded(string array)
    {
        ISN_Result result = new ISN_Result(true);

        if (array.Equals(string.Empty))
        {
            OnAchievementsLoaded(result);
            return;
        }

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


        for (int i = 0; i < data.Length; i += 3)
        {
            GK_AchievementTemplate tpl = new GK_AchievementTemplate();
            tpl.Id          = data[i];
            tpl.Description = data[i + 1];
            tpl.Progress    = System.Convert.ToSingle(data[i + 2]);
            submitAchievement(tpl);
        }

        _IsAchievementsInfoLoaded = true;
        OnAchievementsLoaded(result);
    }
    public static void RegisterAchievement(string achievementId)
    {
        GK_AchievementTemplate tpl = new GK_AchievementTemplate();

        tpl.Id = achievementId;

        RegisterAchievement(tpl);
    }
Esempio n. 5
0
 private void HandleOnAchievementsProgress(GK_AchievementProgressResult result)
 {
     if (result.IsSucceeded)
     {
         GK_AchievementTemplate tpl = result.Achievement;
         Debug.Log(tpl.Id + ":  " + tpl.Progress.ToString());
     }
 }
Esempio n. 6
0
    private void OnAchievementProgress(CEvent e)
    {
        Debug.Log("OnAchievementProgress");

        GK_AchievementTemplate tpl = e.data as GK_AchievementTemplate;

        Debug.Log(tpl.Id + ":  " + tpl.Progress.ToString());
    }
Esempio n. 7
0
    void HandleOnAchievementsProgress(GK_AchievementProgressResult progress)
    {
        Debug.Log("OnAchievementProgress");

        GK_AchievementTemplate tpl = progress.Achievement;

        Debug.Log(tpl.Id + ":  " + tpl.Progress.ToString());
    }
Esempio n. 8
0
    private void OnAchievementProgress(CEvent e)
    {
        Debug.Log("OnAchievementProgress");

        GK_AchievementProgressResult result = e.data as GK_AchievementProgressResult;

        if (result.IsSucceeded)
        {
            GK_AchievementTemplate tpl = result.info;
            Debug.Log(tpl.Id + ":  " + tpl.Progress.ToString());
        }
    }
    public static float GetAchievementProgress(string id)
    {
        float progress = 0f;

        if (IOSNativeSettings.Instance.UsePPForAchievements)
        {
            progress = GetStoredAchievementProgress(id);
        }
        else
        {
            GK_AchievementTemplate achievement = GetAchievement(id);
            progress = achievement.Progress;
        }

        return(progress);
    }
    private void onAchievementProgressChanged(string array)
    {
        string[] data = array.Split(SA.Common.Data.Converter.DATA_SPLITTER);



        GK_AchievementTemplate tpl = GetAchievement(data[0]);

        tpl.Progress = System.Convert.ToSingle(data [1]);

        GK_AchievementProgressResult result = new GK_AchievementProgressResult(tpl);

        SaveLocalProgress(tpl);

        OnAchievementsProgress(result);
    }
Esempio n. 11
0
    private void onAchievementProgressChanged(string array)
    {
        string[] data;
        data = array.Split("," [0]);



        GK_AchievementTemplate tpl = new GK_AchievementTemplate();

        tpl.Id       = data [0];
        tpl.Progress = System.Convert.ToSingle(data [1]);
        GK_AchievementProgressResult result = new GK_AchievementProgressResult(tpl);

        submitAchievement(tpl);

        OnAchievementsProgress(result);
    }
    public static GK_AchievementTemplate GetAchievement(string achievementId)
    {
        foreach (GK_AchievementTemplate achievement in Achievements)
        {
            if (achievement.Id.Equals(achievementId))
            {
                return(achievement);
            }
        }

        GK_AchievementTemplate new_achievement = new GK_AchievementTemplate();

        new_achievement.Id = achievementId;
        Achievements.Add(new_achievement);

        return(new_achievement);
    }
Esempio n. 13
0
    private void onAchievementProgressChanged(string array)
    {
        string[] data;
        data = array.Split("," [0]);



        GK_AchievementTemplate tpl = new GK_AchievementTemplate();

        tpl.Id       = data [0];
        tpl.Progress = System.Convert.ToSingle(data [1]);
        GK_AchievementProgressResult result = new GK_AchievementProgressResult(tpl);

        submitAchievement(tpl);

        OnAchievementsProgress(result);
        Dispatcher.dispatch(GAME_CENTER_ACHIEVEMENT_PROGRESS, result);
    }
Esempio n. 14
0
    public static void RegisterAchievement(string achievementId)
    {
        bool isContains = false;

        foreach (GK_AchievementTemplate t in _achievements)
        {
            if (t.Id.Equals(achievementId))
            {
                isContains = true;
            }
        }


        if (!isContains)
        {
            GK_AchievementTemplate tpl = new GK_AchievementTemplate();
            tpl.Id       = achievementId;
            tpl.Progress = 0;
            _achievements.Add(tpl);
        }
    }
    private void onAchievementsLoaded(string array)
    {
        SA.Common.Models.Result result = new SA.Common.Models.Result();
        if (array.Equals(string.Empty))
        {
            OnAchievementsLoaded(result);
            return;
        }

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


        for (int i = 0; i < data.Length; i += 3)
        {
            GK_AchievementTemplate tpl = GetAchievement(data[i]);
            tpl.Description = data[i + 1];
            tpl.Progress    = System.Convert.ToSingle(data[i + 2]);
            SaveLocalProgress(tpl);
        }

        _IsAchievementsInfoLoaded = true;
        OnAchievementsLoaded(result);
    }
Esempio n. 16
0
    //--------------------------------------
    //  PRIVATE METHODS
    //--------------------------------------

    private void submitAchievement(GK_AchievementTemplate tpl)
    {
        bool isContains = false;

        foreach (GK_AchievementTemplate t in _achievements)
        {
            if (t.Id.Equals(tpl.Id))
            {
                isContains = true;
                t.Progress = tpl.Progress;
            }
        }

        if (IOSNativeSettings.Instance.UsePPForAchievements)
        {
            SaveAchievementProgress(tpl.Id, tpl.Progress);
        }

        if (!isContains)
        {
            _achievements.Add(tpl);
        }
    }
	private void onAchievementsLoaded(string array) {

		ISN_Result result = new ISN_Result (true);
		if(array.Equals(string.Empty)) {
			OnAchievementsLoaded (result);
			return;
		}

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


		for(int i = 0; i < data.Length; i+=3) {
			GK_AchievementTemplate tpl =  new GK_AchievementTemplate();
			tpl.Id 				= data[i];
			tpl.Description 	= data[i + 1];
			tpl.Progress 		= System.Convert.ToSingle(data[i + 2]);
			submitAchievement (tpl);
		}

		_IsAchievementsInfoLoaded = true;
		OnAchievementsLoaded (result);
	}
	//--------------------------------------
	//  PRIVATE METHODS
	//--------------------------------------

	private void submitAchievement(GK_AchievementTemplate tpl) {
		bool isContains = false;
		foreach(GK_AchievementTemplate t in _achievements) {
			if (t.Id.Equals (tpl.Id)) {
				isContains = true;
				t.Progress = tpl.Progress;
			}
		}

		if(IOSNativeSettings.Instance.UsePPForAchievements) {
			SaveAchievementProgress(tpl.Id, tpl.Progress);
		}

		if(!isContains) {
			_achievements.Add (tpl);
		}
	}
	public GK_AchievementProgressResult(GK_AchievementTemplate tpl):base(true) {
		_tpl = tpl;
	}
Esempio n. 20
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();



		

		}
	}
Esempio n. 21
0
 public GK_AchievementProgressResult(GK_AchievementTemplate tpl) : base(true)
 {
     _tpl = tpl;
 }
    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();
        }
    }
    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 onAchievementProgressChanged(string array) {
		string[] data;
		data = array.Split("," [0]);



		GK_AchievementTemplate tpl =  new GK_AchievementTemplate();
		tpl.Id = data [0];
		tpl.Progress = System.Convert.ToSingle(data [1]) ;
		GK_AchievementProgressResult result = new GK_AchievementProgressResult(tpl);

		submitAchievement (tpl);

		OnAchievementsProgress(result);

	}
Esempio n. 25
0
	public static GK_AchievementTemplate GetAchievement(string achievementId) {
		foreach(GK_AchievementTemplate achievement in Achievements) {
			if(achievement.Id.Equals(achievementId)) {
				return achievement;
			}
		}

		GK_AchievementTemplate new_achievement =  new GK_AchievementTemplate();
		new_achievement.Id = achievementId;
		Achievements.Add(new_achievement);

		return new_achievement;
	}
Esempio n. 26
0
	public static void RegisterAchievement(string achievementId) {

		GK_AchievementTemplate tpl = new GK_AchievementTemplate ();
		tpl.Id = achievementId;

		RegisterAchievement(tpl);
	}
Esempio n. 27
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();
			
			



	}
Esempio n. 28
0
	public static void RegisterAchievement(GK_AchievementTemplate achievement) {
		bool isContains = false;
	
		int replaceIndex = 0;
		foreach(GK_AchievementTemplate tpl in Achievements) {
			if(tpl.Id.Equals(achievement.Id)) {
				isContains = true;
				replaceIndex = Achievements.IndexOf(tpl);
				break;
			}
		}
		
		if(isContains) {
			Achievements[replaceIndex] = achievement;
		} else {
			Achievements.Add(achievement);
		}
	}
Esempio n. 29
0
 private GK_AchievementTemplate GetIOSAchievement(string id)
 {
     foreach (GK_AchievementTemplate ach in IOSNativeSettings.Instance.Achievements) {
         if (ach.Id.Equals(id)) {
             return ach;
         }
     }
     GK_AchievementTemplate a = new GK_AchievementTemplate(){Id = id};
     IOSNativeSettings.Instance.Achievements.Add(a);
     return a;
 }
Esempio n. 30
0
	//--------------------------------------
	//  PRIVATE METHODS
	//--------------------------------------

	private void SaveLocalProgress(GK_AchievementTemplate tpl) {
		if(IOSNativeSettings.Instance.UsePPForAchievements) {
			SaveAchievementProgress(tpl.Id, tpl.Progress);
		}
	}
	public static void RegisterAchievement(string achievementId) {


		bool isContains = false;

		foreach(GK_AchievementTemplate t in _achievements) {
			if (t.Id.Equals (achievementId)) {
				isContains = true;
			}
		}


		if(!isContains) {
			GK_AchievementTemplate tpl = new GK_AchievementTemplate ();
			tpl.Id = achievementId;
			tpl.Progress = 0;
			_achievements.Add (tpl);
		}
	}