StansAssets / com.stansassets.android-native

Android Native Plugin Wiki
https://api.stansassets.com/android-native/
10 stars 1 forks source link

Auto generate a class file with constants for Achievements and Leaderboards ids #26

Closed stan-osipov closed 4 years ago

stan-osipov commented 4 years ago

Hello, there is a small issue with Android google play game services setting window. After I setup the game resources, subsequent updates do not get reflected on the configuration section. I managed to get the updated settings by restarting the Unity editor. To reproduce this simply setup a configuration, then press the Update Game Resource and remove or add an Achievement. The message will say that the games-ids.xml has been updated, but the Configuration UI remains the same.

Also as a side note here, it would be really nice for the plugin to auto generate a class file with constants for Achievements and Leaderboards ids, so that we can easily use the correct codes. The 'official' google play services for unity plugin has this feature. https://github.com/playgameservices/play-games-plugin-for-unity

stan-osipov commented 4 years ago

Done! https://github.com/StansAssets/com.stansassets.android-native/wiki/Getting-Started#an_gamesids-code-generation

When you set the Resources you can see what values do you have inside using plugin UI:

GC_Sample_-_NativePluginsUnityProject_-_Android_-_Unity_2019_4_11f1__Metal_

You can also press the Generate AN_GamesIds.cs file which will generate the AN_GamesIds.cs file in your project that would look similar to:

namespace SA.Android.GMS.CodeGen
{
    public static class AN_GamesIds
    {
        public const string AppId = "721571874513";

        public static class Achievements
        {
            public const string GrandPlayer = "CgkI0Y2kiIAVEAIQAg";
            public const string ProApiUser = "CgkI0Y2kiIAVEAIQAw";
            public const string GameMaster = "CgkI0Y2kiIAVEAIQBA";
            public const string GreenDroid = "CgkI0Y2kiIAVEAIQBQ";
            public const string Achievement5 = "CgkI0Y2kiIAVEAIQBg";
            public const string SuperLongIncemental = "CgkI0Y2kiIAVEAIQCQ";
            public const string DraftAchieve = "CgkI0Y2kiIAVEAIQDQ";
        }

        public static class Leaderboards
        {
            public const string BestApiUsers = "CgkI0Y2kiIAVEAIQBw";
            public const string BestTime = "CgkI0Y2kiIAVEAIQCA";
        }
    }
}