public static void OnPostProcessBuild(BuildTarget target, string path) { EveryplaySettings settings = (EveryplaySettings)Resources.Load(EveryplaySettingsEditor.settingsFile); if (settings != null) { if (settings.IsEnabled) { if (settings.IsValid) { if (target == BuildTarget.iPhone) { PostProcessBuild_iOS(path, settings.clientId); } else if (target == BuildTarget.Android) { PostProcessBuild_Android(path, settings.clientId); } } else { Debug.LogError("Everyplay will be disabled because client id, client secret or redirect URI was not valid."); if (target == BuildTarget.iPhone) { SetEveryplayEnabledForTarget(BuildTargetGroup.iPhone, false); } else if (target == BuildTarget.Android) { SetEveryplayEnabledForTarget(BuildTargetGroup.Android, false); } } } } }
public static void ValidateEveryplayState(EveryplaySettings settings) { bool isValid = false; if (settings != null && settings.IsValid) { isValid = true; } foreach (BuildTargetGroup target in System.Enum.GetValues(typeof(BuildTargetGroup))) { if (target == kBuildTargetGroup_iOS) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(kBuildTargetGroup_iOS, isValid ? settings.iosSupportEnabled : false); } else if (target == kBuildTargetGroup_tvOS) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(kBuildTargetGroup_tvOS, isValid ? settings.tvosSupportEnabled : false); } else if (target == BuildTargetGroup.Android) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Android, isValid ? settings.androidSupportEnabled : false); } else if (target == BuildTargetGroup.Standalone) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Standalone, isValid ? settings.standaloneSupportEnabled : false); } } }
public static void OnPostProcessBuild(BuildTarget target, string path) { path = UnityPathBugFix(path); EveryplaySettings settings = EveryplaySettingsEditor.LoadEveryplaySettings(); if (settings != null) { if (settings.IsBuildTargetEnabled) { if (settings.IsValid) { if (target == kBuildTarget_iOS) { PostProcessBuild_iOS(path); } else if (target == kBuildTarget_tvOS) { PostProcessBuild_iOS(path); } else if (target == BuildTarget.Android) { PostProcessBuild_Android(path); } } else { Debug.LogError("Everyplay will be disabled because client id, client secret or redirect URI was not valid."); } } } ValidateEveryplayState(settings); }
public static void ValidateEveryplayState(EveryplaySettings settings) { bool isValid = false; if (settings != null && settings.IsValid) { isValid = true; } foreach (BuildTargetGroup target in System.Enum.GetValues(typeof(BuildTargetGroup))) { if (target == kBuildTargetGroup_iOS) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(kBuildTargetGroup_iOS, isValid ? settings.iosSupportEnabled : false); } else if (target == kBuildTargetGroup_tvOS) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(kBuildTargetGroup_tvOS, isValid ? settings.tvosSupportEnabled : false); } else if (target == BuildTargetGroup.Android) { bool androidEnabled = isValid ? settings.androidSupportEnabled : false; EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Android, androidEnabled); #if UNITY_5_5_OR_NEWER FixAndroidDynamicLibraryCopyWithGradle(androidEnabled); #endif } else if (target == BuildTargetGroup.Standalone) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Standalone, isValid ? settings.standaloneSupportEnabled : false); } } }
void OnDisable() { if (currentSettings != null) { EditorUtility.SetDirty(currentSettings); currentSettings = null; } }
void Start() { EveryplaySettings settings = (EveryplaySettings)Resources.Load("EveryplaySettings"); if (settings != null) { if (settings.earlyInitializerEnabled && settings.IsEnabled && settings.IsValid) { StartCoroutine(InitializeEveryplay()); } } }
static void InitializeEveryplayOnStartup() { EveryplaySettings settings = (EveryplaySettings)Resources.Load("EveryplaySettings"); if (settings != null) { if (settings.earlyInitializerEnabled && settings.IsEnabled && settings.IsValid) { Everyplay.Initialize(); } } }
public static void OnPostprocessScene() { EveryplaySettings settings = EveryplaySettingsEditor.LoadEveryplaySettings(); if (settings != null) { if (settings.earlyInitializerEnabled && settings.IsValid && settings.IsEnabled) { GameObject everyplayEarlyInitializer = new GameObject("EveryplayEarlyInitializer"); everyplayEarlyInitializer.AddComponent <EveryplayEarlyInitializer>(); } } }
public static void ShowSettings() { EveryplaySettings settingsInstance = LoadEveryplaySettings(); if (settingsInstance == null) { settingsInstance = CreateEveryplaySettings(); } if (settingsInstance != null) { EveryplayPostprocessor.ValidateAndUpdateFacebook(); EveryplayLegacyCleanup.Clean(false); Selection.activeObject = settingsInstance; } }
public static void ValidateEveryplayState(EveryplaySettings settings) { if (settings != null && settings.IsValid) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(kBuildTargetGroupIOS, settings.iosSupportEnabled); EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Android, settings.androidSupportEnabled); } else { EveryplayPostprocessor.SetEveryplayEnabledForTarget(kBuildTargetGroupIOS, false); EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Android, false); } // Disable PluginImporter on iOS and use xCode editor instead SetPluginImportEnabled(kBuildTargetIOS, false); }
private static EveryplaySettings CreateEveryplaySettings() { EveryplaySettings everyplaySettings = (EveryplaySettings)ScriptableObject.CreateInstance(typeof(EveryplaySettings)); if (everyplaySettings != null) { if (!Directory.Exists(System.IO.Path.Combine(Application.dataPath, "Resources"))) { AssetDatabase.CreateFolder("Assets/", "Resources"); } AssetDatabase.CreateAsset(everyplaySettings, "Assets/Resources/" + settingsFile + settingsFileExtension); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); return(everyplaySettings); } return(null); }
public static void OnPostProcessBuild(BuildTarget target, string path) { if (path.StartsWith("./")) // Fix two erroneous path cases on Unity 5.4f03 { path = Path.Combine(Application.dataPath.Replace("Assets", ""), path.Replace("./", "")); } else if (path.Contains("./")) { path = path.Replace("./", ""); } EveryplaySettings settings = EveryplaySettingsEditor.LoadEveryplaySettings(); if (settings != null) { if (settings.IsBuildTargetEnabled) { if (settings.IsValid) { if (target == kBuildTarget_iOS) { PostProcessBuild_iOS(path, settings.clientId); } else if (target == kBuildTarget_tvOS) { PostProcessBuild_iOS(path, settings.clientId); } else if (target == BuildTarget.Android) { PostProcessBuild_Android(path, settings.clientId); } } else { Debug.LogError("Everyplay will be disabled because client id, client secret or redirect URI was not valid."); } } } ValidateEveryplayState(settings); }
public override void OnInspectorGUI() { try { // Might be null when this gui is open and this file is being reimported if(target == null) { Selection.activeObject = null; return; } currentSettings = (EveryplaySettings)target; bool showAndroidSettings = CheckForAndroidSDK(); if(currentSettings != null) { EditorGUILayout.HelpBox("1) Enter your game credentials", MessageType.None); if(!currentSettings.IsValid) { EditorGUILayout.HelpBox("Invalid or missing game credentials, Everyplay disabled. Check your game credentials at https://developers.everyplay.com/", MessageType.Error); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelClientId, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.clientId = TrimmedText(EditorGUILayout.TextField(currentSettings.clientId)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelClientSecret, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.clientSecret = TrimmedText(EditorGUILayout.TextField(currentSettings.clientSecret)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelRedirectURI, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.redirectURI = TrimmedText(EditorGUILayout.TextField(currentSettings.redirectURI)); EditorGUILayout.EndHorizontal(); EditorGUILayout.HelpBox("2) Enable recording on these platforms", MessageType.None); EditorGUILayout.BeginVertical(); iosSupportEnabled = EditorGUILayout.Toggle(labelIOsSupport, currentSettings.iosSupportEnabled); if(iosSupportEnabled != currentSettings.iosSupportEnabled) { currentSettings.iosSupportEnabled = iosSupportEnabled; EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.iPhone, currentSettings.iosSupportEnabled); EditorUtility.SetDirty(currentSettings); } if(showAndroidSettings) { androidSupportEnabled = EditorGUILayout.Toggle(labelAndroidSupport, currentSettings.androidSupportEnabled); if(androidSupportEnabled != currentSettings.androidSupportEnabled) { currentSettings.androidSupportEnabled = androidSupportEnabled; EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Android, currentSettings.androidSupportEnabled); EditorUtility.SetDirty(currentSettings); } } EditorGUILayout.EndVertical(); EditorGUILayout.HelpBox("3) Try out Everyplay", MessageType.None); EditorGUILayout.BeginVertical(); testButtonsEnabled = EditorGUILayout.Toggle(labelTestButtons, currentSettings.testButtonsEnabled); if(testButtonsEnabled != currentSettings.testButtonsEnabled) { currentSettings.testButtonsEnabled = testButtonsEnabled; EditorUtility.SetDirty(currentSettings); EnableTestButtons(testButtonsEnabled); } EditorGUILayout.EndVertical(); } } catch(Exception e) { if(e != null) { } } }
public override void OnInspectorGUI() { try { // Might be null when this gui is open and this file is being reimported if (target == null) { Selection.activeObject = null; return; } currentSettings = (EveryplaySettings) target; if (currentSettings != null) { bool settingsValid = currentSettings.IsValid; EditorGUILayout.HelpBox("1) Enter your game credentials", MessageType.None); if (!currentSettings.IsValid) { EditorGUILayout.HelpBox("Invalid or missing game credentials, Everyplay disabled. Check your game credentials at https://developers.everyplay.com/", MessageType.Error); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelClientId, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.clientId = TrimmedText(EditorGUILayout.TextField(currentSettings.clientId)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelClientSecret, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.clientSecret = TrimmedText(EditorGUILayout.TextField(currentSettings.clientSecret)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelRedirectURI, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.redirectURI = TrimmedText(EditorGUILayout.TextField(currentSettings.redirectURI)); EditorGUILayout.EndHorizontal(); EditorGUILayout.HelpBox("2) Enable recording on these platforms", MessageType.None); EditorGUILayout.BeginVertical(); bool validityChanged = currentSettings.IsValid != settingsValid; bool selectedPlatformsChanged = false; iosSupportEnabled = EditorGUILayout.Toggle(labelSupport_iOS, currentSettings.iosSupportEnabled); if (iosSupportEnabled != currentSettings.iosSupportEnabled) { selectedPlatformsChanged = true; currentSettings.iosSupportEnabled = iosSupportEnabled; EditorUtility.SetDirty(currentSettings); } if (CheckForSDK_tvOS()) { tvosSupportEnabled = EditorGUILayout.Toggle(labelSupport_tvOS, currentSettings.tvosSupportEnabled); if (tvosSupportEnabled != currentSettings.tvosSupportEnabled) { selectedPlatformsChanged = true; currentSettings.tvosSupportEnabled = tvosSupportEnabled; EditorUtility.SetDirty(currentSettings); } } if (CheckForSDK_Android()) { androidSupportEnabled = EditorGUILayout.Toggle(labelSupport_Android, currentSettings.androidSupportEnabled); if (androidSupportEnabled != currentSettings.androidSupportEnabled) { selectedPlatformsChanged = true; currentSettings.androidSupportEnabled = androidSupportEnabled; EditorUtility.SetDirty(currentSettings); } } if (CheckForSDK_Mac()) { standaloneSupportEnabled = EditorGUILayout.Toggle(labelSupport_Standalone, currentSettings.standaloneSupportEnabled); if (standaloneSupportEnabled != currentSettings.standaloneSupportEnabled) { selectedPlatformsChanged = true; currentSettings.standaloneSupportEnabled = standaloneSupportEnabled; EditorUtility.SetDirty(currentSettings); } } if (validityChanged || selectedPlatformsChanged) { EveryplayPostprocessor.ValidateEveryplayState(currentSettings); } EditorGUILayout.EndVertical(); EditorGUILayout.HelpBox("3) Try out Everyplay", MessageType.None); EditorGUILayout.BeginVertical(); testButtonsEnabled = EditorGUILayout.Toggle(labelTestButtons, currentSettings.testButtonsEnabled); if (testButtonsEnabled != currentSettings.testButtonsEnabled) { currentSettings.testButtonsEnabled = testButtonsEnabled; EditorUtility.SetDirty(currentSettings); EnableTestButtons(testButtonsEnabled); } EditorGUILayout.EndVertical(); } } catch (Exception e) { if (e != null) { } } }
public override void OnInspectorGUI() { try { // Might be null when this gui is open and this file is being reimported if (target == null) { Selection.activeObject = null; return; } currentSettings = (EveryplaySettings)target; if (currentSettings != null) { bool settingsValid = currentSettings.IsValid; EditorGUILayout.HelpBox("1) Enter your game credentials", MessageType.None); if (!currentSettings.IsValid) { EditorGUILayout.HelpBox("Invalid or missing game credentials, Everyplay disabled. Check your game credentials at https://developers.everyplay.com/", MessageType.Error); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelClientId, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.clientId = TrimmedText(EditorGUILayout.TextField(currentSettings.clientId)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelClientSecret, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.clientSecret = TrimmedText(EditorGUILayout.TextField(currentSettings.clientSecret)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelRedirectURI, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.redirectURI = TrimmedText(EditorGUILayout.TextField(currentSettings.redirectURI)); EditorGUILayout.EndHorizontal(); EditorGUILayout.HelpBox("2) Enable recording on these platforms", MessageType.None); EditorGUILayout.BeginVertical(); bool validityChanged = currentSettings.IsValid != settingsValid; bool selectedPlatformsChanged = false; iosSupportEnabled = EditorGUILayout.Toggle(labelSupport_iOS, currentSettings.iosSupportEnabled); if (iosSupportEnabled != currentSettings.iosSupportEnabled) { selectedPlatformsChanged = true; currentSettings.iosSupportEnabled = iosSupportEnabled; EditorUtility.SetDirty(currentSettings); } if (CheckForSDK_tvOS()) { tvosSupportEnabled = EditorGUILayout.Toggle(labelSupport_tvOS, currentSettings.tvosSupportEnabled); if (tvosSupportEnabled != currentSettings.tvosSupportEnabled) { selectedPlatformsChanged = true; currentSettings.tvosSupportEnabled = tvosSupportEnabled; EditorUtility.SetDirty(currentSettings); } } if (CheckForSDK_Android()) { androidSupportEnabled = EditorGUILayout.Toggle(labelSupport_Android, currentSettings.androidSupportEnabled); if (androidSupportEnabled != currentSettings.androidSupportEnabled) { selectedPlatformsChanged = true; currentSettings.androidSupportEnabled = androidSupportEnabled; EditorUtility.SetDirty(currentSettings); } } if (CheckForSDK_Mac()) { standaloneSupportEnabled = EditorGUILayout.Toggle(labelSupport_Standalone, currentSettings.standaloneSupportEnabled); if (standaloneSupportEnabled != currentSettings.standaloneSupportEnabled) { selectedPlatformsChanged = true; currentSettings.standaloneSupportEnabled = standaloneSupportEnabled; EditorUtility.SetDirty(currentSettings); } } if (validityChanged || selectedPlatformsChanged) { EveryplayPostprocessor.ValidateEveryplayState(currentSettings); } EditorGUILayout.EndVertical(); EditorGUILayout.HelpBox("3) Try out Everyplay", MessageType.None); EditorGUILayout.BeginVertical(); earlyInitializerEnabled = EditorGUILayout.Toggle(labelEarlyInitializer, currentSettings.earlyInitializerEnabled); if (earlyInitializerEnabled != currentSettings.earlyInitializerEnabled) { currentSettings.earlyInitializerEnabled = earlyInitializerEnabled; EditorUtility.SetDirty(currentSettings); } testButtonsEnabled = EditorGUILayout.Toggle(labelTestButtons, currentSettings.testButtonsEnabled); if (testButtonsEnabled != currentSettings.testButtonsEnabled) { currentSettings.testButtonsEnabled = testButtonsEnabled; EditorUtility.SetDirty(currentSettings); EnableTestButtons(testButtonsEnabled); } EditorGUILayout.EndVertical(); } } catch (Exception e) { if (e != null) { } } }
public static void ValidateEveryplayState(EveryplaySettings settings) { if(settings != null && settings.IsValid) { EveryplayPostprocessor.SetEveryplayEnabledForTarget(kBuildTargetGroupIOS, settings.iosSupportEnabled); EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Android, settings.androidSupportEnabled); } else { EveryplayPostprocessor.SetEveryplayEnabledForTarget(kBuildTargetGroupIOS, false); EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Android, false); } // Disable PluginImporter on iOS and use xCode editor instead SetPluginImportEnabled(kBuildTargetIOS, false); }
public override void OnInspectorGUI() { try { // Might be null when this gui is open and this file is being reimported if (target == null) { Selection.activeObject = null; return; } currentSettings = (EveryplaySettings)target; bool showAndroidSettings = CheckForAndroidSDK(); if (currentSettings != null) { EditorGUILayout.HelpBox("1) Enter your game credentials", MessageType.None); if (!currentSettings.IsValid) { EditorGUILayout.HelpBox("Invalid or missing game credentials, Everyplay disabled. Check your game credentials at https://developers.everyplay.com/", MessageType.Error); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelClientId, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.clientId = TrimmedText(EditorGUILayout.TextField(currentSettings.clientId)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelClientSecret, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.clientSecret = TrimmedText(EditorGUILayout.TextField(currentSettings.clientSecret)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(labelRedirectURI, GUILayout.Width(108), GUILayout.Height(18)); currentSettings.redirectURI = TrimmedText(EditorGUILayout.TextField(currentSettings.redirectURI)); EditorGUILayout.EndHorizontal(); EditorGUILayout.HelpBox("2) Enable recording on these platforms", MessageType.None); EditorGUILayout.BeginVertical(); iosSupportEnabled = EditorGUILayout.Toggle(labelIOsSupport, currentSettings.iosSupportEnabled); if (iosSupportEnabled != currentSettings.iosSupportEnabled) { currentSettings.iosSupportEnabled = iosSupportEnabled; EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.iOS, currentSettings.iosSupportEnabled); EditorUtility.SetDirty(currentSettings); } if (showAndroidSettings) { androidSupportEnabled = EditorGUILayout.Toggle(labelAndroidSupport, currentSettings.androidSupportEnabled); if (androidSupportEnabled != currentSettings.androidSupportEnabled) { currentSettings.androidSupportEnabled = androidSupportEnabled; EveryplayPostprocessor.SetEveryplayEnabledForTarget(BuildTargetGroup.Android, currentSettings.androidSupportEnabled); EditorUtility.SetDirty(currentSettings); } } EditorGUILayout.EndVertical(); EditorGUILayout.HelpBox("3) Try out Everyplay", MessageType.None); EditorGUILayout.BeginVertical(); testButtonsEnabled = EditorGUILayout.Toggle(labelTestButtons, currentSettings.testButtonsEnabled); if (testButtonsEnabled != currentSettings.testButtonsEnabled) { currentSettings.testButtonsEnabled = testButtonsEnabled; EditorUtility.SetDirty(currentSettings); EnableTestButtons(testButtonsEnabled); } EditorGUILayout.EndVertical(); } } catch (Exception e) { if (e != null) { } } }