Exemplo n.º 1
0
    void OnGUI()
    {
        GUI.Label(new Rect(centerX - 200, 20, 400, 35), "SDK Demo", labelStyle);

        if (GUI.Button(new Rect(centerX - 75, 80, 150, 35), "DoStuff"))
        {
            // Display banner.
            int bannerId = MobFox.createBanner(this.gameObject, "fe96717d9875b9da4339ea5367eff1ec", new Rect(0, 0, 320, 50));
            MobFox.showBanner(bannerId);

            // Display interstitial.
            MobFox.createInterstitial(this.gameObject, "267d72ac3f77a3f447b32cf7ebf20673");
        }
    }
Exemplo n.º 2
0
    void OnGUI()
    {
        float yPos       = 5.0f;
        float xPos       = 5.0f;
        float width      = (Screen.width >= 800 || Screen.height >= 800) ? 320 : 160;
        float height     = (Screen.width >= 800 || Screen.height >= 800) ? 80 : 40;
        float heightPlus = height + 10.0f;


        if (GUI.Button(new Rect(xPos, yPos, width, height), "Create default Banner ad"))
        {
            // will create banner with default 320x50 size.
            MobFox.createBanner(_bannerAdUnitId, MobFox.BannerAlignment.BottomCenter);
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Create Banner ad with size: 300x250"))
        {
            MobFox.createBanner(_bannerAdUnitId, MobFox.BannerAlignment.BottomLeft, 300, 250);
        }

        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Destroy Banner"))
        {
            MobFox.destroyBanner();
        }

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

        if (GUI.Button(new Rect(xPos, yPos, width, height), "Request Interstitial"))
        {
            MobFox.requestInterstitalAd(_interstitialAdUnitId);
        }


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


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Show Banner"))
        {
            MobFox.setBannerVisibility(true);
        }


        if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Hide Banner"))
        {
            MobFox.setBannerVisibility(false);
        }

        float labelWidth  = Screen.width - 2.5F * width;
        float labelHeight = Screen.height / 2;

        if (labelWidth < width)           //not enough space between buttons for log
        {
            labelWidth  = width;
            yPos       += heightPlus;
            labelHeight = Screen.height - yPos - 60;             //leave some place for banner and buttons
        }
        else
        {
            xPos = Screen.width / 2 - labelWidth / 2;
            yPos = 5.0f;
        }

        scrollPosition = new Vector2(scrollPosition.x, Mathf.Infinity);
        GUILayout.BeginArea(new Rect(xPos, yPos, labelWidth, labelHeight));
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(labelWidth), GUILayout.Height(labelHeight));
        GUILayout.Label(_labelText);
        GUILayout.EndScrollView();
        GUILayout.EndArea();
    }