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(); } }
public void RemoveLeaderboard(UM_Leaderboard l) { Leaderboards.Remove(l); }
private void Actions() { settings.IsMoreActionsOpen = EditorGUILayout.Foldout(settings.IsMoreActionsOpen, "More Actions"); if(settings.IsMoreActionsOpen) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if(GUILayout.Button("Open Manifest ", GUILayout.Width(140))) { UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal("Assets" + AN_ManifestManager.MANIFEST_FILE_PATH, 1); } if(GUILayout.Button("Reinstall ", GUILayout.Width(140))) { InstallUltimateMobile(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if(GUILayout.Button("Load Example Settings", GUILayout.Width(140))) { UltimateMobileSettings.Instance.Leaderboards.Clear(); UM_Leaderboard lb = new UM_Leaderboard(); lb.id = "LeaderBoardSample_1"; lb.AndroidId = "CgkIipfs2qcGEAIQAA"; UltimateMobileSettings.Instance.Leaderboards.Add(lb); lb = new UM_Leaderboard(); lb.id = "LeaderBoardSample_2"; lb.AndroidId = "CgkIipfs2qcGEAIQFQ"; UltimateMobileSettings.Instance.Leaderboards.Add(lb); settings.InAppProducts.Clear(); UM_InAppProduct p; p = new UM_InAppProduct(); p.id = "coins_bonus"; p.IOSId = "purchase.example.coins_bonus"; p.AndroidId = "coins_bonus"; p.IsConsumable = false; settings.AddProduct(p); p = new UM_InAppProduct(); p.id = "coins_pack"; p.IOSId = "purchase.example.small_coins_bag"; p.AndroidId = "pm_coins"; p.IsConsumable = true; settings.AddProduct(p); #if UNITY_IOS || UNITY_IPHONE PlayerSettings.bundleIdentifier = "com.iosnative.preview"; #endif #if UNITY_ANDROID PlayerSettings.bundleIdentifier = "com.unionassets.android.plugin.preview"; #endif AndroidNativeSettingsEditor.LoadExampleSettings(); } if(GUILayout.Button("Remove", GUILayout.Width(140))) { SA_RemoveTool.RemovePlugins(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } }
private void Actions() { EditorGUILayout.Space(); settings.IsMoreSettingsOpen = EditorGUILayout.Foldout(settings.IsMoreSettingsOpen, "More Settings"); if(settings.IsMoreSettingsOpen) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if(GUILayout.Button("Android Native Settings ", GUILayout.Width(140))) { Selection.activeObject = AndroidNativeSettings.Instance; } if(GUILayout.Button("IOS Native Settings ", GUILayout.Width(140))) { Selection.activeObject = IOSNativeSettings.Instance; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if(GUILayout.Button("Analytics Settings ", GUILayout.Width(140))) { Selection.activeObject = GoogleAnalyticsSettings.Instance; } if(GUILayout.Button("Google Ad Settings ", GUILayout.Width(140))) { Selection.activeObject = GoogleMobileAdSettings.Instance; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } settings.IsMoreActionsOpen = EditorGUILayout.Foldout(settings.IsMoreActionsOpen, "More Actions"); if(settings.IsMoreActionsOpen) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if(GUILayout.Button("Open Manifest ", GUILayout.Width(140))) { UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal("Assets" + AN_ManifestManager.MANIFEST_FILE_PATH, 1); } if(GUILayout.Button("Reinstall ", GUILayout.Width(140))) { UpdatePluginVersion(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if(GUILayout.Button("Load Example Settings", GUILayout.Width(140))) { UltimateMobileSettings.Instance.Leaderboards.Clear(); UM_Leaderboard lb = new UM_Leaderboard(); lb.id = "LeaderBoardSample_1"; lb.AndroidId = "CgkIipfs2qcGEAIQAA"; UltimateMobileSettings.Instance.Leaderboards.Add(lb); lb = new UM_Leaderboard(); lb.id = "LeaderBoardSample_2"; lb.AndroidId = "CgkIipfs2qcGEAIQFQ"; UltimateMobileSettings.Instance.Leaderboards.Add(lb); PlayerSettings.bundleIdentifier = "com.unionassets.android.plugin.preview"; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } }
//-------------------------------------- // Leaderboards //-------------------------------------- public void AddLeaderboard(UM_Leaderboard l) { Leaderboards.Add(l); }
public UM_LeaderboardResult(UM_Leaderboard leaderboard, ISN_Result result):base(result) { Setinfo(leaderboard); }
private void Setinfo(UM_Leaderboard leaderboard) { _Leaderboard = leaderboard; }
public UM_LeaderboardResult(UM_Leaderboard leaderboard, GooglePlayResult result):base(result) { Setinfo(leaderboard); }