Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        serializedConfiguration.Update();

        addWarning("Remember to click \"Save changes\" below to persist any changes");

        if (!string.IsNullOrEmpty(serializedAppConfigAndroid.stringValue) && IsVulkanEnabled())
        {
            addWarning(vulkanEnabledWarning);
        }

        addHeader("Core config");
        addProperty(serializedAppIdentifier, "App identifier");
        addHelpBox("Required field. This is the identifier you picked for your app when creating it on the " +
                   "dashboard.");

        addProperty(serializedAppConfigAndroid, "Android key");
        addProperty(serializedAppConfigIos, "iOS key");
        addHelpBox("The keys above are required for the platforms you develop for. You can find " +
                   "them on your dashboard at https://dashboard.megacool.co");

        addHeader("Linking");
        addProperty(serializedBaseUrl, "Custom base url");
        addLabel("Scheme");
        addProperty(serializedSchemeIOS, "    iOS");
        addProperty(serializedSchemeAndroid, "    Android");
        addProperty(serializedAndroidReferrals, "Android referrals");
        addLabel("Universal linking");
        addProperty(serializedUniversalLinksIOS, "    iOS");
        addProperty(serializedUniversalLinksAndroid, "    Android");

        addHelpBox("The properties below can also be set programmatically, see the documentation " +
                   "for details");
        addHeader("Recording");
        addProperty(serializedLastFrameDelay, "Last frame delay (ms)");
        addProperty(serializedLastFrameOverlay, "Last frame overlay");
        addProperty(serializedRecordingFrameRate, "Recording frame rate");
        addProperty(serializedPlaybackFrameRate, "Playback frame rate");
        addProperty(serializedMaxFrames, "Max frames");
        addProperty(serializedPeakLocation, "Peak location");

        addHeader("Shares");
        addProperty(serializedShareMessage, "Message");
        addProperty(serializedSharingStrategy, "Strategy");
        addProperty(serializedSharingFallback, "Fallback media");
        addProperty(serializedShareModalTitle, "Modal title");

        addHeader("Advanced");
        addHelpBox("If you've customized the Android launch activity elsewhere, set the name of " +
                   "the new activity here so that the manifests get merged correctly. This is " +
                   "necessary if you're for example using Firebase Cloud Messaging, in which " +
                   "case you should set this to " +
                   "\"com.google.firebase.MessagingUnityPlayerActivity\".");
        addProperty(serializedCustomAndroidActivity, "Custom Android activity");

        if (MegacoolAndroidManifestEditor.IsDefaultApplicationIdentifer())
        {
            // Fail hard if this is unset since otherwise it'll build successfully but only fail once a share is
            // attempted, making it easy to ship something broken.
            addWarning(unsetBundleIdentifierWarning);
        }

        if (GUILayout.Button("Save changes"))
        {
            serializedConfiguration.ApplyModifiedProperties();

            if (MegacoolAndroidManifestEditor.IsDefaultApplicationIdentifer())
            {
                // Fail hard if this is unset since otherwise it'll build successfully but only fail once a share is
                // attempted, making it easy to ship something broken.
                Debug.LogError(unsetBundleIdentifierWarning);
                return;
            }

            MegacoolAndroidManifestEditor.WriteAndroidManifest();

            MegacoolAndroidManifestEditor.WriteStringsDotXML(
                serializedUniversalLinksAndroid.boolValue,
                serializedSchemeAndroid.stringValue,
                MegacoolConfiguration.Instance.CustomBaseUrlOrDefault()
                );

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            Debug.Log("Megacool configuration saved! Remember to commit the resulting AndroidManifest.xml, " +
                      "strings.xml and the MegacoolConfiguration.asset!");
        }

        if (GUI.changed)
        {
            serializedConfiguration.ApplyModifiedProperties();
        }
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        serializedConfiguration.Update();

        addHeader("Core config");
        addProperty(serializedAppIdentifier, "App identifier");
        addProperty(serializedAppConfigAndroid, "Android key");
        addProperty(serializedAppConfigIos, "iOS key");
        addHelpBox("The properties above are required, you can find them on your dashboard at " +
                   "https://dashboard.megacool.co");

        addHeader("Linking");
        addLabel("Scheme");
        addProperty(serializedSchemeIOS, "    iOS");
        addProperty(serializedSchemeAndroid, "    Android");
        addProperty(serializedAndroidReferrals, "Android referrals");
        addLabel("Universal linking");
        addProperty(serializedUniversalLinksIOS, "    iOS");
        addProperty(serializedUniversalLinksAndroid, "    Android");

        addHelpBox("The properties below can also be set programmatically, see the documentation for details");
        addHeader("Recording");
        addProperty(serializedLastFrameDelay, "Last frame delay (ms)");
        addProperty(serializedRecordingFrameRate, "Recording frame rate");
        addProperty(serializedPlaybackFrameRate, "Playback frame rate");
        addProperty(serializedMaxFrames, "Max frames");
        addProperty(serializedPeakLocation, "Peak location");
        addProperty(serializedGifColorTable, "GIF color table");

        addHeader("Shares");
        addProperty(serializedSharingText, "Default share text");

        if (GUILayout.Button("Save changes"))
        {
            serializedConfiguration.ApplyModifiedProperties();

            if (MegacoolAndroidManifestEditor.IsDefaultApplicationIdentifer())
            {
                // Fail hard if this is unset since otherwise it'll build successfully but only fail once a share is
                // attempted, making it easy to ship something broken.
                Debug.LogError("The Android Bundle Identifier seems to be unset, ensure it's set in the " +
                               "Android Player Settings. This is necessary for GIF sharing to work.");
                return;
            }

            MegacoolAndroidManifestEditor.ReplaceMegacoolManifestApplicationId();

            MegacoolAndroidManifestEditor.WriteStringsDotXML(
                serializedAppIdentifier.stringValue,
                serializedUniversalLinksAndroid.boolValue,
                serializedSchemeAndroid.stringValue
                );

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            Debug.Log("Megacool configuration saved! Remember to commit the resulting AndroidManifest.xml, " +
                      "strings.xml and the MegacoolConfiguration.asset!");
        }

        if (GUI.changed)
        {
            serializedConfiguration.ApplyModifiedProperties();
        }
    }