protected override void OnEnable() { base.OnEnable(); requester = new SerializedObject(target); whenToRequest = requester.FindProperty("whenToRequest"); placement = requester.FindProperty("placement"); showsOverlayImmediately = requester.FindProperty("showsOverlayImmediately"); rewardMayBeDelivered = requester.FindProperty("rewardMayBeDelivered"); rewardMessageType = requester.FindProperty("rewardMessageType"); requestDelay = requester.FindProperty("requestDelay"); limitedUse = requester.FindProperty("limitedUse"); maxUses = requester.FindProperty("maxUses"); exhaustAction = requester.FindProperty("exhaustAction"); useDefaultTestReward = requester.FindProperty("useDefaultTestReward"); defaultTestRewardName = requester.FindProperty("defaultTestRewardName"); defaultTestRewardQuantity = requester.FindProperty("defaultTestRewardQuantity"); prefetch = requester.FindProperty("prefetch"); refetchWhenUsed = requester.FindProperty("refetchWhenUsed"); connectionForPrefetch = requester.FindProperty("connectionForPrefetch"); //pauseGameWhenDisplayed = serializedObject.FindProperty("pauseGameWhenDisplayed"); originalBackgroundColor = GUI.backgroundColor; delayRequest = requestDelay.floatValue >= DELAY_MIN; // settings settings = PlayHavenSettings.Get(); RefreshPlacementList(); RefreshRewardsList(); }
void OnGameSelectionCleared() { secretsAreFrozen = false; if (Selection.activeObject != null && Selection.activeObject is GameObject && ((GameObject)Selection.activeObject).GetComponent <PlayHavenManager>() != null) { #if UNITY_ANDROID || UNITY_IPHONE serializedObject.Update(); token.stringValue = string.Empty; lockToken.boolValue = false; secret.stringValue = string.Empty; lockSecret.boolValue = false; serializedObject.ApplyModifiedProperties(); #endif Repaint(); } else { settings = PlayHavenSettings.Get(); if (settings != null) { // locate the PlayHavenManager in the scene and update it this way instead PlayHavenManager phm = GameObject.FindObjectOfType(typeof(PlayHavenManager)) as PlayHavenManager; if (phm != null) { #if UNITY_ANDROID if (!settings.HasGameAndroid) { phm.tokenAndroid = string.Empty; phm.secretAndroid = string.Empty; } #elif UNITY_IPHONE if (!settings.HasGameIOS) { phm.token = string.Empty; phm.secret = string.Empty; } #endif EditorUtility.SetDirty(phm); } else { string warning = "Unable to locate PlayHavenManager in this scene. In order for the token and secret to properly update, please open the scene(s) that have one and select the game object with the PlayHavenManager and resave the scene."; if (EditorUtility.DisplayDialog("Cannot find PlayHavenManager", warning, "OK")) { } Debug.LogWarning(warning); } } } }
void Initialize() { windowObject = new SerializedObject(this); placementProperty = windowObject.FindProperty("placement"); triggerTypeProperty = windowObject.FindProperty("triggerType"); rewardableProperty = windowObject.FindProperty("rewardable"); customScriptTypeProperty = windowObject.FindProperty("customScriptType"); newScriptNameProperty = windowObject.FindProperty("newScriptName"); existingScriptProperty = windowObject.FindProperty("existingScript"); // settings settings = PlayHavenSettings.Get(); RefreshPlacementList(); }