Beispiel #1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (this.gameObject.tag == "Store")
            {
                script.CloseStore();
            }


            if (this.gameObject.tag == "Game End")
            {
                requester.Request();
            }

            if (this.gameObject.tag != "Game Pause")
            {
                if (Application.loadedLevel == 3 || Application.loadedLevel == 4)
                {
                    requester.Request();
                }
                Application.LoadLevel("AAMainMenu");
            }
        }
    }
Beispiel #2
0
    void OnClick()
    {
        Debug.Log("Store Button Pressed");

        storeActive = !storeActive;
        MainMenuAudio.isObjectActive = storeActive;

        switch (Application.loadedLevel)
        {
        case 3:
            requester.Request();
            Application.LoadLevel("AAStore");
            break;

        case 4:
            requester.Request();
            Application.LoadLevel("AAStore");
            break;

        default:
            Application.LoadLevel("AAStore");
            break;
        }
    }
Beispiel #3
0
 public void DisplayAd()
 {
     requester.Request();
 }
Beispiel #4
0
        public override void CustomInspectorGUI()
        {
            guiDisabledOrig = GUI.enabled;

            //DrawDefaultInspector();
            requester.Update();

            // placement
            if (placement.stringValue.Length == 0)
            {
                GUI.backgroundColor = Color.red;
            }
            if (placement.stringValue.Length > 0 && !placementTagsList.Contains(placement.stringValue))
            {
                EditorGUILayout.PropertyField(placement, new GUIContent("Placement"));
            }
            else
            {
                selectedPlacement     = EditorGUILayout.Popup("Placement", selectedPlacement, placementTagsList.ToArray());
                placement.stringValue = (selectedPlacement >= 0) ? placementTagsList[selectedPlacement] : string.Empty;
            }
            GUI.backgroundColor = originalBackgroundColor;
            EditorGUILayout.BeginHorizontal();
            if (placement.stringValue.Length > 0 && placementTagsList.Contains(placement.stringValue))
            {
                if (GUILayout.Button("Edit..."))
                {
                    Placement placementObj = null;
                                        #if UNITY_ANDROID
                    placementObj = settings.GetPlacementByTag(placement.stringValue, Game.OperatingSystem.android);
                                        #else
                    placementObj = settings.GetPlacementByTag(placement.stringValue, Game.OperatingSystem.ios);
                                        #endif
                    if (placementObj != null)
                    {
                        PlayHavenWindow.CreateWindow(PlayHavenWindow.TOOLBAR_PLACEMENTS);
                        PlayHavenWindow w = PlayHavenWindow.Get();
                        w.SetPlacementToEdit(placementObj);
                    }
                }
            }
            if (settings.HasGameAndroid || settings.HasGameIOS)
            {
                if (GUILayout.Button("New..."))
                {
                    PlayHavenWindow.CreateWindow(PlayHavenWindow.TOOLBAR_PLACEMENTS);
                }
            }
            if (placement.stringValue.Length > 0 && placementTagsList.Contains(placement.stringValue))
            {
                if (GUILayout.Button("Refresh"))
                {
                    RefreshPlacementList();
                }
            }
            EditorGUILayout.EndHorizontal();
            Comment("Placements define the locations in your game where content may appear to your players.");

            // whenToRequest
            EditorGUILayout.PropertyField(whenToRequest);
            if (whenToRequest.enumValueIndex != 3)              // !OnDisable
            {
                delayRequest = EditorGUILayout.Toggle("Delay Request", delayRequest);
                GUI.enabled  = guiDisabledOrig && delayRequest;
                GUILayout.BeginHorizontal();
                requestDelay.floatValue = EditorGUILayout.Slider("Seconds", requestDelay.floatValue, DELAY_MIN, DELAY_MAX);
                GUI.enabled             = guiDisabledOrig;
                GUILayout.EndHorizontal();
                if (!delayRequest)
                {
                    requestDelay.floatValue = 0f;
                }
            }
            Comment("Specify when to make the request. If set to manual, you will need to call the Request() method on this component yourself in your code.");

            // prefetching
            EditorGUILayout.PropertyField(prefetch);
            EditorGUILayout.PropertyField(connectionForPrefetch);
            EditorGUILayout.PropertyField(refetchWhenUsed);
            Comment("Automatic pre-fetching characteristics.");

            // pauseGameWhenDisplayed

            /*
             * EditorGUILayout.PropertyField(pauseGameWhenDisplayed, new GUIContent("Pause When Displayed"));
             * Comment("If set, the timescale will be set to 0 when the content unit is displayed and returned to the previous timescale when dismissed.");
             */

            // showsOverlayImmediately
            EditorGUILayout.PropertyField(showsOverlayImmediately, new GUIContent("Loading Overlay"));
            Comment("If \"Loading Overlay\" is set, an overlay will be shown so that the user cannot interact with the game while the content is being fetched.");

            EditorGUILayout.PropertyField(rewardMayBeDelivered, new GUIContent("Rewardable"));
            {
                // rewardMessageType
                if (rewardMayBeDelivered.boolValue)
                {
                    //EditorGUI.indentLevel = 1;
                    EditorGUILayout.PropertyField(rewardMessageType, new GUIContent("Message Type"));

                    // default test reward
                    EditorGUILayout.PropertyField(useDefaultTestReward, new GUIContent("Test Def. Reward"));
                    if (useDefaultTestReward.boolValue)
                    {
                        EditorGUI.indentLevel = 0;
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(6);
                        GUILayout.Label("Test Default Reward");
                        GUILayout.EndHorizontal();
                        EditorGUI.indentLevel = 1;
                        EditorGUILayout.PropertyField(defaultTestRewardName, new GUIContent("Name"));
                        EditorGUILayout.PropertyField(defaultTestRewardQuantity, new GUIContent("Quantity"));
                        EditorGUI.indentLevel = 0;
                        GUI.enabled           = guiDisabledOrig;
                        //GUILayout.Space(8);
                    }

                    // manual test capability
                    if (Application.isPlaying)
                    {
                        EditorGUI.indentLevel = 0;
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(6);
                        GUILayout.Label("Test Reward Now");
                        GUILayout.EndHorizontal();
                        EditorGUI.indentLevel = 1;
                        if (testRewardKey.Length > 0 && !rewardTagsList.Contains(testRewardKey))
                        {
                            testRewardKey = EditorGUILayout.TextField("Name", testRewardKey);
                        }
                        else
                        {
                            selectedReward = EditorGUILayout.Popup("Name", selectedReward, rewardTagsList.ToArray());
                            testRewardKey  = (selectedReward > -1) ? rewardTagsList[selectedReward] : string.Empty;
                        }
                        testRewardQuantity    = EditorGUILayout.IntField("Quantity", testRewardQuantity);
                        EditorGUI.indentLevel = 0;
                        GUI.enabled           = guiDisabledOrig && testRewardKey.Length > 0;
                        if (GUILayout.Button("Give Reward"))
                        {
                            PlayHaven.Reward reward = new PlayHaven.Reward();
                            reward.name     = testRewardKey;
                            reward.quantity = testRewardQuantity;
                            ((PlayHavenContentRequester)target).HandlePlayHavenManagerOnRewardGiven(0, reward);
                        }
                        GUI.enabled = guiDisabledOrig;
                        //GUILayout.Space(8);
                    }

                    EditorGUI.indentLevel = 0;
                }
            }
            Comment("If \"Rewardable\" is set, this game object is automatically wired to receive reward notifications when this placement is reported. If a reward is delivered, a message OnPlayHavenRewardGiven(PlayHaven.Reward) will be broadcast to this game object.");

            // usage
            EditorGUILayout.PropertyField(limitedUse, new GUIContent("Limited Use"));
            GUI.enabled = guiDisabledOrig && limitedUse.boolValue;
            EditorGUILayout.PropertyField(maxUses, new GUIContent("Max Uses"));
            EditorGUILayout.PropertyField(exhaustAction, new GUIContent("Exhaust Action"));
            GUI.enabled = guiDisabledOrig;
            if (maxUses.intValue < 1)
            {
                maxUses.intValue = 1;
            }
            Comment("You can limit how many times a content requester can be used with the above settings.");

            requester.ApplyModifiedProperties();

            if (Application.isPlaying)
            {
                PlayHavenContentRequester playHavenContentRequester = (PlayHavenContentRequester)target;
                if (playHavenContentRequester != null)
                {
                    GUILayout.Space(8);
                    if (GUILayout.Button("Test this Request"))
                    {
                        playHavenContentRequester.Request();
                    }
                }
            }
        }