Beispiel #1
0
        public void OnPostGenerateGradleAndroidProject(string path)
        {
            var manifest = new AndroidXmlDocument(GetManifestPath(path));

            manifest.AddMeta("com.google.android.gms.games.APP_ID", "@string/app_id");
            manifest.AddMeta("com.google.android.gms.games.unityVersion", "0.10.12");
            manifest.AddMeta("com.google.games.bridge.NativeBridgeActivity", "@android:style/Theme.Translucent.NoTitleBar.Fullscreen");
            manifest.Save();

            var pathBuilder = new StringBuilder(path);

            pathBuilder.Append(Path.DirectorySeparatorChar).Append("src");
            pathBuilder.Append(Path.DirectorySeparatorChar).Append("main");
            pathBuilder.Append(Path.DirectorySeparatorChar).Append("res");
            pathBuilder.Append(Path.DirectorySeparatorChar).Append("values");
            pathBuilder.Append(Path.DirectorySeparatorChar).Append("strings.xml");

            var appId = GooglePlayGamesSettings.GetOrCreateSettings().AppId;

            if (appId.Length < 3)
            {
                throw new Exception("Please set GooglePlayGames APP_ID in " + GooglePlayGamesSettingsProvider.PATH);
            }

            var content = new StringBuilder();

            content.Append("<resources>\n");
            content.Append("<string name=\"app_id\">" + appId + "</string>\n");
            content.Append("</resources>");
            File.WriteAllText(pathBuilder.ToString(), content.ToString());
        }
Beispiel #2
0
 public override void OnActivate(string searchContext, VisualElement rootElement)
 {
     settings = GooglePlayGamesSettings.GetOrCreateSettings();
 }