void OnEnable() { m_Launcher = (GameGrowthLauncher)target; m_Configuration = m_Launcher.configuration; m_GameGrowthEnvironmentWarning = GameGrowthEnvironmentValidator.GetVerboseWarning(m_Configuration.environment); m_DefaultConfiguration = serializedObject.FindProperty("m_DefaultConfiguration"); m_StartAdjustManually = serializedObject.FindProperty("m_StartAdjustManually"); m_AdjustEventBuffering = serializedObject.FindProperty("m_AdjustEventBuffering"); m_AdjustSendInBackground = serializedObject.FindProperty("m_AdjustSendInBackground"); m_AdjustLaunchDeferredDeeplink = serializedObject.FindProperty("m_AdjustLaunchDeferredDeeplink"); m_AdjustAndroidAppToken = serializedObject.FindProperty("m_AdjustAndroidAppToken"); m_AdjustAndroidPurchaseEventToken = serializedObject.FindProperty("m_AdjustAndroidPurchaseEventToken"); m_AdjustIosAppToken = serializedObject.FindProperty("m_AdjustIosAppToken"); m_AdjustIosPurchaseEventToken = serializedObject.FindProperty("m_AdjustIosPurchaseEventToken"); m_AdjustOverrideTokens = serializedObject.FindProperty("m_AdjustOverrideTokens"); m_AdjustUseSameToken = serializedObject.FindProperty("m_AdjustUseSameToken"); m_AdjustAppToken = serializedObject.FindProperty("m_AdjustAppToken"); m_AdjustPurchaseEventToken = serializedObject.FindProperty("m_AdjustPurchaseEventToken"); m_AdjustLogLevel = serializedObject.FindProperty("m_AdjustLogLevel"); m_AttributionChangedCallbackHandler = serializedObject.FindProperty("m_AttributionChangedCallbackHandler"); m_AdImpressionHandler = serializedObject.FindProperty("m_AdImpressionHandler"); m_TransactionHandler = serializedObject.FindProperty("m_TransactionHandler"); m_StartDeltaDnaManually = serializedObject.FindProperty("m_StartDeltaDnaManually"); m_AdjustFold = true; m_DdnaFold = true; #if GAMEGROWTH_UNITY_MEDIATION || GAMEGROWTH_MOPUB m_MediationFold = true; m_UseDefaultImpressionTrackedHandler = serializedObject.FindProperty("m_UseDefaultImpressionTrackedHandler"); #endif #if GAMEGROWTH_ADMOB m_AdMobFold = true; m_AdMobConfiguration = AdMobConfiguration.LoadMainAsset(); #endif #if GAMEGROWTH_FACEBOOK_SDK m_FacebookSdkFold = true; m_StartFacebookSdkManually = serializedObject.FindProperty("m_StartFacebookSdkManually"); #endif // Synchronize the object and verify if the actual app token or purchase token are different (may be indicating an upgrade from older version) serializedObject.Update(); if (IsAppTokenDifferent() || IsPurchaseEventTokenDifferent()) { m_AdjustUseSameToken.boolValue = false; serializedObject.ApplyModifiedProperties(); } }
public override void OnInspectorGUI() { // Make sure the serialized Object is up-to-date before using it. serializedObject.Update(); EditorGUILayout.PropertyField(m_DefaultConfiguration, m_DefaultConfigurationContent); EditorGUILayout.Separator(); if (!string.IsNullOrEmpty(m_GameGrowthEnvironmentWarning)) { EditorGUILayout.HelpBox(m_GameGrowthEnvironmentWarning, MessageType.Info); } if (m_StartAdjustManually.boolValue || m_StartDeltaDnaManually.boolValue) { EditorGUILayout.HelpBox(k_CollectIdsMsg, MessageType.Info); } EditorGUI.BeginChangeCheck(); m_Configuration.environment = (GameGrowthEnvironment)EditorGUILayout.EnumPopup(m_EnvironmentLabel, m_Configuration.environment); if (EditorGUI.EndChangeCheck()) { var isSandbox = m_Configuration.environment == GameGrowthEnvironment.Sandbox; DeltaDNAConfigurationHelper.UpdateEnvironment(isSandbox); m_GameGrowthEnvironmentWarning = GameGrowthEnvironmentValidator.GetVerboseWarning(m_Configuration.environment); } m_AdjustFold = EditorGUILayout.Foldout(m_AdjustFold, m_AdjustLabel); if (m_AdjustFold) { EditorGUILayout.PropertyField(m_StartAdjustManually, m_StartAdjustManuallyLabel); EditorGUILayout.PropertyField(m_AdjustEventBuffering, m_AdjustEventBufferingLabel); EditorGUILayout.PropertyField(m_AdjustSendInBackground, m_AdjustSendInBackgroundLabel); EditorGUILayout.PropertyField(m_AdjustLaunchDeferredDeeplink, m_AdjustLaunchDeferredDeeplinkLabel); GUILayout.Space(2f); EditorGUILayout.PropertyField(m_AdjustOverrideTokens, m_AdjustOverrideTokensLabel); if (m_AdjustOverrideTokens.boolValue) { EditorGUILayout.PropertyField(m_AdjustUseSameToken, m_AdjustUseSameTokenLabel); if (m_AdjustUseSameToken.boolValue) { EditorGUILayout.PropertyField(m_AdjustAppToken, m_AdjustAppTokenLabel); EditorGUILayout.PropertyField(m_AdjustPurchaseEventToken, m_AdjustPurchaseEventTokenLabel); var appToken = m_AdjustAppToken.stringValue; if (appToken != GameGrowthLauncher.appTokenDefaultText) { m_AdjustAndroidAppToken.stringValue = appToken; m_AdjustIosAppToken.stringValue = appToken; } else { m_AdjustAndroidAppToken.stringValue = GameGrowthLauncher.androidAppTokenDefaultText; m_AdjustIosAppToken.stringValue = GameGrowthLauncher.iosAppTokenDefaultText; } var purchaseEventToken = m_AdjustPurchaseEventToken.stringValue; if (purchaseEventToken != GameGrowthLauncher.purchaseEventTokenDefaultText) { m_AdjustAndroidPurchaseEventToken.stringValue = purchaseEventToken; m_AdjustIosPurchaseEventToken.stringValue = purchaseEventToken; } else { m_AdjustAndroidPurchaseEventToken.stringValue = GameGrowthLauncher.androidPurchaseEventTokenDefaultText; m_AdjustIosPurchaseEventToken.stringValue = GameGrowthLauncher.iosPurchaseEventTokenDefaultText; } } else { EditorGUILayout.PropertyField(m_AdjustAndroidAppToken, m_AdjustAndroidAppTokenLabel); EditorGUILayout.PropertyField(m_AdjustAndroidPurchaseEventToken, m_AdjustAndroidPurchaseEventTokenLabel); EditorGUILayout.PropertyField(m_AdjustIosAppToken, m_AdjustIosAppTokenLabel); EditorGUILayout.PropertyField(m_AdjustIosPurchaseEventToken, m_AdjustIosPurchaseEventTokenLabel); } } EditorGUILayout.PropertyField(m_AdjustLogLevel, m_AdjustLogLevelLabel); } EditorGUILayout.Separator(); m_DdnaFold = EditorGUILayout.Foldout(m_DdnaFold, m_DdnaLabel); if (m_DdnaFold) { EditorGUILayout.PropertyField(m_StartDeltaDnaManually, m_StartDeltaDnaManuallyLabel); EditorGUILayout.PropertyField(m_AttributionChangedCallbackHandler, m_AttributionChangedCallbackHandlerLabel, true); EditorGUILayout.PropertyField(m_AdImpressionHandler, m_AdImpressionHandlerLabel, true); EditorGUILayout.PropertyField(m_TransactionHandler, m_TransactionHandlerLabel, true); if (GUILayout.Button(m_ConfigureDeltaDnaButtonLabel)) { var window = EditorWindow.GetWindow <ConfigurationWindow>(); window.Show(); } } #if GAMEGROWTH_FACEBOOK_SDK m_FacebookSdkFold = EditorGUILayout.Foldout(m_FacebookSdkFold, m_FacebookSdkLabel); if (m_FacebookSdkFold) { EditorGUILayout.PropertyField(m_StartFacebookSdkManually, m_StartFacebookSdkManuallyLabel); } #endif #if GAMEGROWTH_UNITY_MEDIATION || GAMEGROWTH_MOPUB m_MediationFold = EditorGUILayout.Foldout(m_MediationFold, m_MediationLabel); if (m_MediationFold) { EditorGUILayout.PropertyField(m_UseDefaultImpressionTrackedHandler, m_UseDefaultImpressionTrackedHandlerLabel); } #endif #if GAMEGROWTH_ADMOB m_AdMobFold = EditorGUILayout.Foldout(m_AdMobFold, m_AdMobLabel); if (m_AdMobFold) { if (m_AdMobConfiguration != null) { CreateCachedEditor(m_AdMobConfiguration, null, ref m_AdMobConfigurationEditor); m_AdMobConfigurationEditor.OnInspectorGUI(); } else { Debug.LogWarning("Could not find AdMobConfigurationAsset."); } } #endif EditorGUILayout.BeginVertical(); try { GUILayout.Space(5f); if (m_Launcher.DefaultConfiguration != null && m_Launcher.DefaultConfiguration.projectSummary != null && !string.IsNullOrEmpty(m_Launcher.DefaultConfiguration.projectSummary.projectId)) { m_Launcher.DefaultConfiguration.DrawInspector(); } else { EditorGUILayout.HelpBox(m_NoDefaultConfigurationMessage, MessageType.Warning); } } finally { EditorGUILayout.EndVertical(); } serializedObject.ApplyModifiedProperties(); }