コード例 #1
0
 public static void showChartBoostMoreGamesAd()
 {
     if (SSAdInitializer.ChartBoostActiveStaticFlag)
     {
         ChartBoostBinding.showMoreApps();
     }
 }
コード例 #2
0
    void Update()
    {
        // Raycast checking for where to route information and what events / SendMessages to use.
        if (Input.GetMouseButtonDown(0))
        {
            if (instance.menuState != MenuState.InTransition)
            {
                Ray        ray = Camera.mainCamera.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                //Debug.DrawRay(ray.origin, ray.direction * 10, Color.yellow, 3f);
                if (Physics.Raycast(ray, out hit, 100f))
                {
                    if (hit.collider.tag == "MainUI")
                    {
                        hit.collider.gameObject.SendMessage("onMenuClick", instance, SendMessageOptions.DontRequireReceiver);
                    }
                    else if (hit.collider.gameObject.layer == 11 && instance.menuState == MainMenuController.MenuState.Character)
                    {
                        DBAccess.instance.userPrefs.enemyName = findTaggedParent(hit.collider.transform).tag;
                        DBAccess.instance.enemyStats          = findTaggedParent(hit.collider.transform).GetComponent <EnemySelectStats>().stats;

                        if (DBAccess.instance.userPrefs.playCount == 0)
                        {
                            StartCoroutine(loadNextLevel(1));                                           //Tutorial Scene
                        }
                        else
                        {
                            StartCoroutine(loadNextLevel(2));                                   //Demo Scene
                        }
                    }

                    else if (hit.collider.tag == "StoreUI")
                    {
                        onStoreClick(hit.collider.GetComponent <SuppliesUIObject>(), instance.menuState, hit.collider.gameObject);
                    }
                    else if (hit.collider.tag == "BuyButton")
                    {
                        onPurchasableClick(hit.collider.gameObject);

                        if (Application.platform == RuntimePlatform.IPhonePlayer)
                        {
                            ChartBoostBinding.trackEvent("Buy Item Attempt");
                        }
                    }
                    else if (hit.collider.tag == "GoldButton")
                    {
                        onPurchasableClick(hit.collider.gameObject);
                    }
                    else if (hit.collider.tag == "StashUI")
                    {
                        onStashClick(hit.collider.GetComponent <SuppliesUIObject>(), instance.menuState, hit.collider.gameObject);
                    }
                    else if (hit.collider.tag == "OptionsUI")
                    {
                        GameObject clicked = hit.collider.gameObject;

                        if (clicked.name.Contains("Sound"))
                        {
                            clicked.SendMessage("hitByRayCast", SendMessageOptions.DontRequireReceiver);
                        }
                        else if (clicked.name.Contains("Music"))
                        {
                            clicked.SendMessage("hitByRayCast", SendMessageOptions.DontRequireReceiver);
                        }
                        else if (clicked.name.Contains("Control"))
                        {
                            clicked.SendMessage("hitByRayCast", SendMessageOptions.DontRequireReceiver);
                        }
                        else if (clicked.name.Contains("GameCenter"))
                        {
                            clicked.SendMessage("hitByRayCast", SendMessageOptions.DontRequireReceiver);
                        }
                        else if (clicked.name.Contains("Play"))
                        {
                            StartCoroutine(loadNextLevel(1));
                        }
                        else if (clicked.name.Contains("Background More Apps"))
                        {
                            Debug.Log("Options More Apps");
                            if (Application.platform == RuntimePlatform.IPhonePlayer)
                            {
                                ChartBoostBinding.showMoreApps();
                                ChartBoostBinding.trackEvent("Options More Apps Click");
                            }
                        }
                    }
                    else if (hit.collider.tag == "CharacterUI")
                    {
                        EnemySelectPopulator e = GameObject.Find("EnemyGroupingParent").GetComponent <EnemySelectPopulator>();

                        if (hit.collider.name == "Arrow Right" && e.characterIndex < 4)
                        {
                            instance.menuState = MainMenuController.MenuState.InTransition;

                            hit.collider.SendMessage("hitByRayCast", hit.collider.gameObject, SendMessageOptions.DontRequireReceiver);

                            if (onCharacterArrow != null)
                            {
                                onCharacterArrow(true);
                            }
                        }
                        if (hit.collider.name == "Arrow Left" && e.characterIndex > 0)
                        {
                            instance.menuState = MainMenuController.MenuState.InTransition;

                            hit.collider.SendMessage("hitByRayCast", hit.collider.gameObject, SendMessageOptions.DontRequireReceiver);

                            if (onCharacterArrow != null)
                            {
                                onCharacterArrow(false);
                            }
                        }
                        if (hit.collider.name.Contains("Background More Apps"))
                        {
                            Debug.Log("Character More Apps");

                            if (Application.platform == RuntimePlatform.IPhonePlayer)
                            {
                                ChartBoostBinding.showMoreApps();
                                ChartBoostBinding.trackEvent("Character Select More Apps Click");
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #3
0
    void OnGUI()
    {
        float yPos       = 5.0f;
        float xPos       = 5.0f;
        float width      = (Screen.width >= 960 || Screen.height >= 960) ? 320 : 160;
        float height     = (Screen.width >= 960 || Screen.height >= 960) ? 80 : 40;
        float heightPlus = height + 10.0f;


        if (GUI.Button(new Rect(xPos, yPos, width, height), "Init"))
        {
            ChartBoostBinding.init("YOUR_APP_ID", "YOUR_APP_SIGNATURE");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Cache Interstitial"))
        {
            ChartBoostBinding.cacheInterstitial("default");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Is Interstitial Cached?"))
        {
            Debug.Log("is cached: " + ChartBoostBinding.hasCachedInterstitial("default"));
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Show Interstitial"))
        {
            ChartBoostBinding.showInterstitial("default");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Cache More Apps"))
        {
            ChartBoostBinding.cacheMoreApps();
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Show More Apps"))
        {
            ChartBoostBinding.showMoreApps();
        }


        xPos = Screen.width - width - 5.0f;
        yPos = 5.0f;

        if (GUI.Button(new Rect(xPos, yPos, width, height), "Track Event"))
        {
            ChartBoostBinding.trackEvent("some_event");
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Track Event with Metadata"))
        {
            var dict = new Dictionary <string, string>();
            dict.Add("key", "theValue");
            ChartBoostBinding.trackEventWithMetadata("some_event_with_data", dict);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Track Event with Value"))
        {
            ChartBoostBinding.trackEventWithValue("event_with_value", 123);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Track Event with Value and Metadata"))
        {
            var dict = new Dictionary <string, string>();
            dict.Add("key", "theValue");
            ChartBoostBinding.trackEventWithValueAndMetadata("event_with_value_and_data", 9809823, dict);
        }
    }