예제 #1
0
 public void SessionEnd()
 {
     if (this.initialized)
     {
         MATBinding.MeasureSession();
     }
 }
예제 #2
0
        public override void Init()
        {
            if (!build.MAT)
            {
                return;
            }

            try
            {
                if (platform == Platform.AppStore)
                {
                    MATBinding.Init(iOS.id, iOS / key);
                }
                else if (platform == Platform.GooglePlay)
                {
                    MATBinding.Init(android.id, android.key);
                }

                MATBinding.SetDebugMode(isDebug);
                MATBinding.MeasureSession();
            }
            catch (Exception e)
            {
                LogError("Analytic - MAT Init Exception - " + e.Message);
                build.MAT = false;
                return;
            }

            Analytic.onEventRevenue.Add(EventRevenue);
            Analytic.onEventUserLogin.Add(UserLogin);
        }
예제 #3
0
 void UserLogin()
 {
     // MATBinding.SetAge(34);
     if (!string.IsNullOrEmpty(user.facebookId))
     {
         MATBinding.SetFacebookUserId(user.facebookId);
     }
     if (user.gender != "Unknown")
     {
         MATBinding.SetGender(user.gender == "Male" ? 1 : 0);
     }
     if (!string.IsNullOrEmpty(user.googleId))
     {
         MATBinding.SetGoogleUserId(user.googleId);
     }
     // MATBinding.SetLocation(111, 222, 333);
     // MATBinding.SetPayingUser(true);
     // MATBinding.SetPhoneNumber("111-222-3456");
     // MATBinding.SetTwitterUserId("twitter_user_id");
     if (!string.IsNullOrEmpty(user.id))
     {
         MATBinding.SetUserId(user.id);
     }
     // if (!string.IsNullOrEmpty(user.name)) MATBinding.SetUserName(user.name);
     if (!string.IsNullOrEmpty(user.email))
     {
         MATBinding.SetUserEmail(user.email);
     }
 }
예제 #4
0
 public void MeasureEvent(string _EventName)
 {
     if (this.m_goMATDelegate == null)
     {
         return;
     }
     MATBinding.MeasureEvent(_EventName);
 }
예제 #5
0
 public void Set_UserID(string _strUserId)
 {
     if (this.m_goMATDelegate == null)
     {
         return;
     }
     MATBinding.SetUserId(_strUserId);
 }
예제 #6
0
 public void TutorialComplete()
 {
     if (this.m_goMATDelegate == null)
     {
         return;
     }
     MATBinding.MeasureEvent("tutorial complete");
 }
예제 #7
0
        void EventRevenue(PurchaseData data)
        {
            var matEvent = new MATEvent("purchase");

            matEvent.revenue      = data.iap.revenue;
            matEvent.currencyCode = data.iap.currencyCode;
            matEvent.eventItems   = new MATItem[] { new MATItem(data.iap.sku) };
            MATBinding.MeasureEvent(matEvent);
        }
예제 #8
0
 public void Event(ESdkEvent eventName, object param)
 {
     if (this.initialized)
     {
         if (eventName == ESdkEvent.Tuturial)
         {
             MATEvent tuneEvent = new MATEvent("tutorial_complete");
             MATBinding.MeasureEvent(tuneEvent);
         }
     }
 }
예제 #9
0
 public void Purchase(PremiumProduct product)
 {
     if (this.initialized)
     {
         MATEvent tuneEvent = new MATEvent();
         tuneEvent.name         = "purchase";
         tuneEvent.revenue      = new double?((double)product.price);
         tuneEvent.currencyCode = product.currencyCode;
         MATBinding.MeasureEvent(tuneEvent);
     }
 }
예제 #10
0
 public void Init(string _strAdID, string _strConversionKey, string _strPackageName)
 {
     if (this.m_goMATDelegate == null)
     {
         return;
     }
     MATBinding.Init(_strAdID, _strConversionKey);
     MATBinding.SetPackageName(_strPackageName);
     MATBinding.SetFacebookEventLogging(true, false);
     MATBinding.AutomateIapEventMeasurement(false);
     MATBinding.MeasureSession();
 }
예제 #11
0
 private void Initialize(string trUserId)
 {
     if (!this.initialized)
     {
         MATBinding.Init(ConfigSdk.MAT_ADVERTISER_ID, ConfigSdk.MAT_CONVERSION_KEY);
         MATBinding.SetPackageName(ConfigSdk.ANDROID_PACKAGE_NAME);
         MATBinding.SetUserId(trUserId);
         MATBinding.AutomateIapEventMeasurement(true);
         MATBinding.SetDebugMode(ConfigSdk.SDK_DEBUG);
         this.initialized = true;
     }
 }
예제 #12
0
    public void Measure_Purchase(long _MallIndex)
    {
        if (this.m_goMATDelegate == null)
        {
            return;
        }
        ITEM_MALL_ITEM item = NrTSingleton <ItemMallItemManager> .Instance.GetItem(_MallIndex);

        if (item == null)
        {
            return;
        }
        string textFromItem = NrTSingleton <NrTextMgr> .Instance.GetTextFromItem(item.m_strTextKey);

        string        currencyCode       = string.Empty;
        eSERVICE_AREA currentServiceArea = NrTSingleton <NrGlobalReference> .Instance.GetCurrentServiceArea();

        if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_KORGOOGLE || currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_KORKAKAO)
        {
            if (item.m_nMoneyType == 1)
            {
                currencyCode = "KRW";
                MATItem[] eventItems = new MATItem[]
                {
                    new MATItem(textFromItem)
                    {
                        quantity  = new int?(1),
                        unitPrice = new double?((double)item.m_nPrice),
                        revenue   = new double?((double)item.m_nPrice)
                    }
                };
                MATBinding.MeasureEvent(new MATEvent("Purchase")
                {
                    currencyCode     = currencyCode,
                    eventItems       = eventItems,
                    receiptSignature = PlayerPrefs.GetString(NrPrefsKey.SHOP_RECEIPT, string.Empty),
                    revenue          = new double?((double)item.m_nPrice),
                    advertiserRefId  = "186576"
                });
            }
        }
        else if (item.m_nMoneyType == 1)
        {
            currencyCode = "USD";
            MATBinding.MeasureEvent(new MATEvent("Purchase")
            {
                revenue         = new double?((double)item.m_fPrice),
                currencyCode    = currencyCode,
                advertiserRefId = textFromItem
            });
        }
    }
예제 #13
0
 public void Set_MAT()
 {
     this.m_goMATDelegate = GameObject.Find("MobileAppTracker");
     if (this.m_goMATDelegate == null)
     {
         this.m_goMATDelegate = new GameObject("MobileAppTracker");
     }
     if (this.m_goMATDelegate != null)
     {
         UnityEngine.Object.DontDestroyOnLoad(this.m_goMATDelegate);
         MATDelegate x = this.m_goMATDelegate.GetComponent <MATDelegate>();
         if (x == null)
         {
             x = this.m_goMATDelegate.AddComponent <MATDelegate>();
         }
         MATBinding x2 = this.m_goMATDelegate.GetComponent <MATBinding>();
         if (x2 == null)
         {
             x2 = this.m_goMATDelegate.AddComponent <MATBinding>();
         }
     }
 }
예제 #14
0
    void OnGUI()
    {
        GUIStyle headingLabelStyle = new GUIStyle();

        headingLabelStyle.fontStyle        = FontStyle.Bold;
        headingLabelStyle.fontSize         = 50;
        headingLabelStyle.alignment        = TextAnchor.MiddleCenter;
        headingLabelStyle.normal.textColor = Color.white;

        float titleHeight = Screen.height / 10;

        GUI.Label(new Rect(10, topMargin, Screen.width - 20, titleHeight), "MAT Unity Test App", headingLabelStyle);

        GUI.skin.button.fontSize = 40;

        GUI.skin.verticalScrollbar.fixedWidth      = Screen.width * 0.05f;
        GUI.skin.verticalScrollbarThumb.fixedWidth = Screen.width * 0.05f;

        float scrollViewContentHeight = (float)(numButtons * 0.125) * Screen.height;

        scrollPosition = GUI.BeginScrollView(
            new Rect(0.1f * Screen.width, 0.15f * Screen.height, Screen.width - 0.1f * Screen.width, Screen.height - 0.15f * Screen.height - topMargin - bottomMargin),
            scrollPosition,
            new Rect(0.1f * Screen.width, 0.15f * Screen.height, Screen.width - 0.1f * Screen.width, scrollViewContentHeight));

        int   buttonIndex = 0;
        float yPos        = (float)(0.15f + buttonIndex * 0.125) * Screen.height;
        Rect  rect        = new Rect(0.1f * Screen.width, yPos,
                                     0.8f * Screen.width, 0.1f * Screen.height);

        if (GUI.Button(rect, "Start MAT SDK"))
        {
            print("Start MAT SDK clicked");
            MATBinding.Init(MAT_ADVERTISER_ID, MAT_CONVERSION_KEY);
            MATBinding.SetPackageName(MAT_PACKAGE_NAME);
        }

        ++buttonIndex;
        yPos = (float)(0.15f + buttonIndex * 0.125) * Screen.height;
        rect = new Rect(0.1f * Screen.width, yPos,
                        0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(rect, "Set Delegate"))
        {
            print("Set Delegate clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE)
            MATBinding.SetDelegate(true);
            #endif
            #if UNITY_METRO
            MATBinding.SetMATResponse(new SampleWinMATResponse());
            #endif
        }

        ++buttonIndex;
        yPos = (float)(0.15f + buttonIndex * 0.125) * Screen.height;
        rect = new Rect(0.1f * Screen.width, yPos,
                        0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(rect, "Show Banner"))
        {
            print("Show Banner");
            MATBinding.ShowBanner("place1");
        }

        ++buttonIndex;
        yPos = (float)(0.15f + buttonIndex * 0.125) * Screen.height;
        rect = new Rect(0.1f * Screen.width, yPos,
                        0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(rect, "Hide Banner"))
        {
            print("Hide Banner");
            MATBinding.HideBanner();
        }

        ++buttonIndex;
        yPos = (float)(0.15f + buttonIndex * 0.125) * Screen.height;
        rect = new Rect(0.1f * Screen.width, yPos,
                        0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(rect, "Destroy Banner"))
        {
            print("Destroy Banner");
            MATBinding.DestroyBanner();
        }

        ++buttonIndex;
        yPos = (float)(0.15f + buttonIndex * 0.125) * Screen.height;
        rect = new Rect(0.1f * Screen.width, yPos,
                        0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(rect, "Cache Interstitial"))
        {
            MATAdMetadata metadata = new MATAdMetadata();
            metadata.setBirthDate(DateTime.Today.AddYears(-45));
            metadata.setGender(MATAdGender.FEMALE);
            metadata.setLocation(120.8f, 234.5f, 579.6f);
            metadata.setDebugMode(true);

            HashSet <string> keywords = new HashSet <string>();
            keywords.Add("pro");
            keywords.Add("evening");
            metadata.setKeywords(keywords);

            Dictionary <string, string> customTargets = new Dictionary <string, string>();
            customTargets.Add("type", "game");
            customTargets.Add("subtype1", "adventure");
            customTargets.Add("subtype2", "action");
            metadata.setCustomTargets(customTargets);

            MATBinding.CacheInterstitial("place1", metadata);
        }

        ++buttonIndex;
        yPos = (float)(0.15f + buttonIndex * 0.125) * Screen.height;
        rect = new Rect(0.1f * Screen.width, yPos,
                        0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(rect, "Show Interstitial"))
        {
            print("Show Interstitial");
            MATBinding.ShowInterstitial("place1");
        }

        ++buttonIndex;
        yPos = (float)(0.15f + buttonIndex * 0.125) * Screen.height;
        rect = new Rect(0.1f * Screen.width, yPos,
                        0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(rect, "Destroy Interstitial"))
        {
            print("Destroy Interstitial");
            MATBinding.DestroyInterstitial();
        }

        GUI.EndScrollView();

        numButtons = buttonIndex + 1;

        // resize banner ad for current orientation
        MATBinding.LayoutBanner();
    }
예제 #15
0
 public void SessionStart(string trUserId)
 {
     this.Initialize(trUserId);
     MATBinding.MeasureSession();
 }
예제 #16
0
    void OnGUI ()
    {
        GUIStyle headingLabelStyle = new GUIStyle();
        headingLabelStyle.fontStyle = FontStyle.Bold;
        headingLabelStyle.fontSize = 50;
        headingLabelStyle.alignment = TextAnchor.MiddleCenter;
        headingLabelStyle.normal.textColor = Color.white;
        
        GUI.Label(new Rect(10, 5, Screen.width - 20, Screen.height/10), "MAT Unity Test App", headingLabelStyle);
        
        GUI.skin.button.fontSize = 40;
        
        if (GUI.Button (new Rect (10, Screen.height/10, Screen.width - 20, Screen.height/10), "Start MAT"))
        {
            print ("Start MAT clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8 || UNITY_METRO)
                MATBinding.Init(MAT_ADVERTISER_ID, MAT_CONVERSION_KEY);
                MATBinding.SetPackageName(MAT_PACKAGE_NAME);
                MATBinding.SetFacebookEventLogging(true, false);
            #endif
            #if (UNITY_ANDROID || UNITY_IPHONE)
                MATBinding.CheckForDeferredDeeplinkWithTimeout(750); // 750 ms
                MATBinding.AutomateIapEventMeasurement(true);
            #endif
        }

        else if (GUI.Button (new Rect (10, 2*Screen.height/10, Screen.width - 20, Screen.height/10), "Set Delegate"))
        {
            print ("Set Delegate clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE)
            MATBinding.SetDelegate(true);

            #endif
            #if UNITY_WP8
            MATBinding.SetMATResponse(new SampleWP8MATResponse());
            #endif
            #if UNITY_METRO
            MATBinding.SetMATResponse(new SampleWinStoreMATResponse());
            #endif
        }

        else if (GUI.Button (new Rect (10, 3*Screen.height/10, Screen.width - 20, Screen.height/10), "Enable Debug Mode"))
        {
            print ("Enable Debug Mode clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8 || UNITY_METRO)
            // NOTE: !!! ONLY FOR DEBUG !!!
            // !!! Make sure you set to false
            //     OR
            //     remove the setDebugMode and setAllowDuplicates calls for Production builds !!!
            MATBinding.SetDebugMode(true);
            #endif
        }

        else if (GUI.Button (new Rect (10, 4*Screen.height/10, Screen.width - 20, Screen.height/10), "Allow Duplicates"))
        {
            print ("Allow Duplicates clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8 || UNITY_METRO)
            // NOTE: !!! ONLY FOR DEBUG !!!
            // !!! Make sure you set to false
            //     OR
            //     remove the setDebugMode and setAllowDuplicates calls for Production builds !!!
            MATBinding.SetAllowDuplicates(true);
            #endif
        }

        else if (GUI.Button (new Rect (10, 5*Screen.height/10, Screen.width - 20, Screen.height/10), "Measure Session"))
        {
            print ("Measure Session clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8 || UNITY_METRO)
            MATBinding.MeasureSession();
            #endif
        }

        else if (GUI.Button (new Rect (10, 6*Screen.height/10, Screen.width - 20, Screen.height/10), "Measure Event"))
        {
            print ("Measure Event clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8 || UNITY_METRO)
            MATBinding.MeasureEvent("evt11");
            #endif
        }

        else if (GUI.Button (new Rect (10, 7*Screen.height/10, Screen.width - 20, Screen.height/10), "Measure Event With Event Items"))
        {
            print ("Measure Event With Event Items clicked");
            
            #if (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8 || UNITY_METRO)
            MATItem item1 = new MATItem();
            item1.name = "subitem1";
            item1.unitPrice = 5;
            item1.quantity = 5;
            item1.revenue = 3;
            item1.attribute2 = "attrValue2";
            item1.attribute3 = "attrValue3";
            item1.attribute4 = "attrValue4";
            item1.attribute5 = "attrValue5";
            
            MATItem item2 = new MATItem();
            item2.name = "subitem2";
            item2.unitPrice = 1;
            item2.quantity = 3;
            item2.revenue = 1.5;
            item2.attribute1 = "attrValue1";
            item2.attribute3 = "attrValue3";
            
            MATItem[] eventItems = { item1, item2 };

            MATEvent matEvent = new MATEvent("purchase");
            matEvent.revenue = 10;
            matEvent.currencyCode = "AUD";
            matEvent.advertiserRefId = "ref222";
            matEvent.attribute1 = "test_attribute1";
            matEvent.attribute2 = "test_attribute2";
            matEvent.attribute3 = "test_attribute3";
            matEvent.attribute4 = "test_attribute4";
            matEvent.attribute5 = "test_attribute5";
            matEvent.contentType = "test_contentType";
            matEvent.contentId = "test_contentId";
            matEvent.date1 = DateTime.UtcNow;
            matEvent.date2 = DateTime.UtcNow.Add(new TimeSpan((new DateTime(2,1,1)).Ticks));
            matEvent.level = 3;
            matEvent.quantity = 2;
            matEvent.rating = 4.5;
            matEvent.searchString = "test_searchString";
            matEvent.eventItems = eventItems;
            // transaction state may be set to the value received from the iOS/Android app store.
            matEvent.transactionState = 1;
            
            #if UNITY_IPHONE
            matEvent.receipt = getSampleiTunesIAPReceipt();
            #endif

            MATBinding.MeasureEvent(matEvent);

            #endif
        }

        else if (GUI.Button (new Rect (10, 8*Screen.height/10, Screen.width - 20, Screen.height/10), "Test Setter Methods"))
        {
            print ("Test Setter Methods clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8 || UNITY_METRO)
            MATBinding.SetAge(34);
            MATBinding.SetAllowDuplicates(true);
            MATBinding.SetAppAdTracking(true);
            MATBinding.SetDebugMode(true);
            MATBinding.SetExistingUser(false);
            MATBinding.SetFacebookUserId("temp_facebook_user_id");
            MATBinding.SetGender(0);
            MATBinding.SetGoogleUserId("temp_google_user_id");
            MATBinding.SetLocation(111,222,333);
            //MATBinding.SetPackageName(MAT_PACKAGE_NAME);
            MATBinding.SetPayingUser(true);
            MATBinding.SetPhoneNumber("111-222-3456");
            MATBinding.SetTwitterUserId("twitter_user_id");
            MATBinding.SetUserId("temp_user_id");
            MATBinding.SetUserName("temp_user_name");
            MATBinding.SetUserEmail("*****@*****.**");
            //iOS-specific Features
            #if UNITY_IPHONE
            #if UNITY_5_0
            MATBinding.SetAppleAdvertisingIdentifier(UnityEngine.iOS.Device.advertisingIdentifier, UnityEngine.iOS.Device.advertisingTrackingEnabled);
            #else
            MATBinding.SetAppleAdvertisingIdentifier(UnityEngine.iPhone.advertisingIdentifier, UnityEngine.iPhone.advertisingTrackingEnabled);
            #endif
            MATBinding.SetAppleVendorIdentifier(UnityEngine.iPhone.vendorIdentifier);
            MATBinding.SetDelegate(true);
            MATBinding.SetJailbroken(false);
            MATBinding.SetShouldAutoDetectJailbroken(true);
            MATBinding.SetShouldAutoGenerateVendorIdentifier(true);
            MATBinding.SetUseCookieTracking(false);
            #endif
            //Android-specific Features
            #if UNITY_ANDROID
            MATBinding.SetAndroidId("111111111111");
            MATBinding.SetDeviceId("123456789123456");
            MATBinding.SetGoogleAdvertisingId("12345678-1234-1234-1234-123456789012", true);
            MATBinding.SetMacAddress("AA:BB:CC:DD:EE:FF");
            #endif
            //Windows Phone 8 Specific Features
            #if UNITY_WP8
            MATBinding.SetAppName("testWP8_AppName");
            MATBinding.SetAppVersion("testWP8_AppVersion");
            MATBinding.SetLastOpenLogId("testWP8_LastOpenLogId");
            MATBinding.SetOSVersion("testWP8_OS");
            #endif
            //Android and iOS-specific Features
            #if (UNITY_ANDROID || UNITY_IPHONE)
            MATBinding.SetCurrencyCode("CAD");
            MATBinding.SetTRUSTeId("1234567890");

            MATPreloadData pd = new MATPreloadData("1122334455");
            pd.advertiserSubAd = "some_adv_sub_ad_id";
            pd.publisherSub3 = "some_pub_sub3";
            MATBinding.SetPreloadedApp(pd);
            #endif

            #endif
        }

        else if (GUI.Button (new Rect (10, 9*Screen.height/10, Screen.width - 20, Screen.height/10), "Test Getter Methods"))
        {
            print ("Test Getter Methods clicked");
            #if (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8 || UNITY_METRO)
            print ("isPayingUser = "******"matId     = " + MATBinding.GetMATId());
            print ("openLogId = " + MATBinding.GetOpenLogId());
            #endif
        }
    }
예제 #17
0
    private void OnGUI()
    {
        GUIStyle gUIStyle = new GUIStyle();

        gUIStyle.fontStyle        = FontStyle.Bold;
        gUIStyle.fontSize         = 50;
        gUIStyle.alignment        = TextAnchor.MiddleCenter;
        gUIStyle.normal.textColor = Color.white;
        GUI.Label(new Rect(10f, 5f, (float)(Screen.width - 20), (float)(Screen.height / 10)), "MAT Unity Test App", gUIStyle);
        GUI.skin.button.fontSize = 40;
        if (GUI.Button(new Rect(10f, (float)(Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Start MAT"))
        {
            MonoBehaviour.print("Start MAT clicked");
            MATBinding.Init(this.MAT_ADVERTISER_ID, this.MAT_CONVERSION_KEY);
            MATBinding.SetPackageName(this.MAT_PACKAGE_NAME);
            MATBinding.SetFacebookEventLogging(true, false);
            MATBinding.CheckForDeferredDeeplinkWithTimeout(750.0);
            MATBinding.AutomateIapEventMeasurement(true);
        }
        else if (GUI.Button(new Rect(10f, (float)(2 * Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Set Delegate"))
        {
            MonoBehaviour.print("Set Delegate clicked");
            MATBinding.SetDelegate(true);
        }
        else if (GUI.Button(new Rect(10f, (float)(3 * Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Enable Debug Mode"))
        {
            MonoBehaviour.print("Enable Debug Mode clicked");
            MATBinding.SetDebugMode(true);
        }
        else if (GUI.Button(new Rect(10f, (float)(4 * Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Allow Duplicates"))
        {
            MonoBehaviour.print("Allow Duplicates clicked");
            MATBinding.SetAllowDuplicates(true);
        }
        else if (GUI.Button(new Rect(10f, (float)(5 * Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Measure Session"))
        {
            MonoBehaviour.print("Measure Session clicked");
            MATBinding.MeasureSession();
        }
        else if (GUI.Button(new Rect(10f, (float)(6 * Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Measure Event"))
        {
            MonoBehaviour.print("Measure Event clicked");
            MATBinding.MeasureEvent("evt11");
        }
        else if (GUI.Button(new Rect(10f, (float)(7 * Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Measure Event With Event Items"))
        {
            MonoBehaviour.print("Measure Event With Event Items clicked");
            MATItem mATItem = default(MATItem);
            mATItem.name       = "subitem1";
            mATItem.unitPrice  = new double?(5.0);
            mATItem.quantity   = new int?(5);
            mATItem.revenue    = new double?(3.0);
            mATItem.attribute2 = "attrValue2";
            mATItem.attribute3 = "attrValue3";
            mATItem.attribute4 = "attrValue4";
            mATItem.attribute5 = "attrValue5";
            MATItem mATItem2 = default(MATItem);
            mATItem2.name       = "subitem2";
            mATItem2.unitPrice  = new double?(1.0);
            mATItem2.quantity   = new int?(3);
            mATItem2.revenue    = new double?(1.5);
            mATItem2.attribute1 = "attrValue1";
            mATItem2.attribute3 = "attrValue3";
            MATItem[] eventItems = new MATItem[]
            {
                mATItem,
                mATItem2
            };
            MATEvent matEvent = new MATEvent("purchase");
            matEvent.revenue         = new double?(10.0);
            matEvent.currencyCode    = "AUD";
            matEvent.advertiserRefId = "ref222";
            matEvent.attribute1      = "test_attribute1";
            matEvent.attribute2      = "test_attribute2";
            matEvent.attribute3      = "test_attribute3";
            matEvent.attribute4      = "test_attribute4";
            matEvent.attribute5      = "test_attribute5";
            matEvent.contentType     = "test_contentType";
            matEvent.contentId       = "test_contentId";
            matEvent.date1           = new DateTime?(DateTime.UtcNow);
            DateTime utcNow   = DateTime.UtcNow;
            DateTime dateTime = new DateTime(2, 1, 1);
            matEvent.date2            = new DateTime?(utcNow.Add(new TimeSpan(dateTime.Ticks)));
            matEvent.level            = new int?(3);
            matEvent.quantity         = new int?(2);
            matEvent.rating           = new double?(4.5);
            matEvent.searchString     = "test_searchString";
            matEvent.eventItems       = eventItems;
            matEvent.transactionState = new int?(1);
            MATBinding.MeasureEvent(matEvent);
        }
        else if (GUI.Button(new Rect(10f, (float)(8 * Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Test Setter Methods"))
        {
            MonoBehaviour.print("Test Setter Methods clicked");
            MATBinding.SetAge(34);
            MATBinding.SetAllowDuplicates(true);
            MATBinding.SetAppAdTracking(true);
            MATBinding.SetDebugMode(true);
            MATBinding.SetExistingUser(false);
            MATBinding.SetFacebookUserId("temp_facebook_user_id");
            MATBinding.SetGender(0);
            MATBinding.SetGoogleUserId("temp_google_user_id");
            MATBinding.SetLocation(111.0, 222.0, 333.0);
            MATBinding.SetPayingUser(true);
            MATBinding.SetPhoneNumber("111-222-3456");
            MATBinding.SetTwitterUserId("twitter_user_id");
            MATBinding.SetUserId("temp_user_id");
            MATBinding.SetUserName("temp_user_name");
            MATBinding.SetUserEmail("*****@*****.**");
            MATBinding.SetAndroidId("111111111111");
            MATBinding.SetDeviceId("123456789123456");
            MATBinding.SetGoogleAdvertisingId("12345678-1234-1234-1234-123456789012", true);
            MATBinding.SetMacAddress("AA:BB:CC:DD:EE:FF");
            MATBinding.SetCurrencyCode("CAD");
            MATBinding.SetTRUSTeId("1234567890");
            MATBinding.SetPreloadedApp(new MATPreloadData("1122334455")
            {
                advertiserSubAd = "some_adv_sub_ad_id",
                publisherSub3   = "some_pub_sub3"
            });
        }
        else if (GUI.Button(new Rect(10f, (float)(9 * Screen.height / 10), (float)(Screen.width - 20), (float)(Screen.height / 10)), "Test Getter Methods"))
        {
            MonoBehaviour.print("Test Getter Methods clicked");
            MonoBehaviour.print("isPayingUser = "******"matId     = " + MATBinding.GetMATId());
            MonoBehaviour.print("openLogId = " + MATBinding.GetOpenLogId());
        }
    }
예제 #18
0
    private void OnGUI()
    {
        GUIStyle style = new GUIStyle();

        style.fontStyle        = FontStyle.Bold;
        style.fontSize         = 50;
        style.alignment        = TextAnchor.MiddleCenter;
        style.normal.textColor = Color.white;
        float height = Screen.height / 10;

        GUI.Label(new Rect(10f, (float)this.topMargin, (float)(Screen.width - 20), height), "MAT Unity Test App", style);
        GUI.skin.button.fontSize = 40;
        GUI.skin.verticalScrollbar.fixedWidth      = Screen.width * 0.05f;
        GUI.skin.verticalScrollbarThumb.fixedWidth = Screen.width * 0.05f;
        float num2 = ((float)(this.numButtons * 0.125)) * Screen.height;

        this.scrollPosition = GUI.BeginScrollView(new Rect(0.1f * Screen.width, 0.15f * Screen.height, Screen.width - (0.1f * Screen.width), ((Screen.height - (0.15f * Screen.height)) - this.topMargin) - this.bottomMargin), this.scrollPosition, new Rect(0.1f * Screen.width, 0.15f * Screen.height, Screen.width - (0.1f * Screen.width), num2));
        int   num3     = 0;
        float top      = ((float)(0.15000000596046448 + (num3 * 0.125))) * Screen.height;
        Rect  position = new Rect(0.1f * Screen.width, top, 0.8f * Screen.width, 0.1f * Screen.height);

        if (GUI.Button(position, "Start MAT SDK"))
        {
            MonoBehaviour.print("Start MAT SDK clicked");
            MATBinding.Init(this.MAT_ADVERTISER_ID, this.MAT_CONVERSION_KEY);
            MATBinding.SetPackageName(this.MAT_PACKAGE_NAME);
        }
        num3++;
        top      = ((float)(0.15000000596046448 + (num3 * 0.125))) * Screen.height;
        position = new Rect(0.1f * Screen.width, top, 0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(position, "Set Delegate"))
        {
            MonoBehaviour.print("Set Delegate clicked");
            MATBinding.SetDelegate(true);
        }
        num3++;
        top      = ((float)(0.15000000596046448 + (num3 * 0.125))) * Screen.height;
        position = new Rect(0.1f * Screen.width, top, 0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(position, "Show Banner"))
        {
            MonoBehaviour.print("Show Banner");
            MATBinding.ShowBanner("place1");
        }
        num3++;
        top      = ((float)(0.15000000596046448 + (num3 * 0.125))) * Screen.height;
        position = new Rect(0.1f * Screen.width, top, 0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(position, "Hide Banner"))
        {
            MonoBehaviour.print("Hide Banner");
            MATBinding.HideBanner();
        }
        num3++;
        top      = ((float)(0.15000000596046448 + (num3 * 0.125))) * Screen.height;
        position = new Rect(0.1f * Screen.width, top, 0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(position, "Destroy Banner"))
        {
            MonoBehaviour.print("Destroy Banner");
            MATBinding.DestroyBanner();
        }
        num3++;
        top      = ((float)(0.15000000596046448 + (num3 * 0.125))) * Screen.height;
        position = new Rect(0.1f * Screen.width, top, 0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(position, "Cache Interstitial"))
        {
            MATAdMetadata metadata = new MATAdMetadata();
            metadata.setBirthDate(new DateTime?(DateTime.Today.AddYears(-45)));
            metadata.setGender(MATAdGender.FEMALE);
            metadata.setLocation(120.8f, 234.5f, 579.6f);
            metadata.setDebugMode(true);
            HashSet <string> keywords = new HashSet <string>();
            keywords.Add("pro");
            keywords.Add("evening");
            metadata.setKeywords(keywords);
            Dictionary <string, string> customTargets = new Dictionary <string, string>();
            customTargets.Add("type", "game");
            customTargets.Add("subtype1", "adventure");
            customTargets.Add("subtype2", "action");
            metadata.setCustomTargets(customTargets);
            MATBinding.CacheInterstitial("place1", metadata);
        }
        num3++;
        top      = ((float)(0.15000000596046448 + (num3 * 0.125))) * Screen.height;
        position = new Rect(0.1f * Screen.width, top, 0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(position, "Show Interstitial"))
        {
            MonoBehaviour.print("Show Interstitial");
            MATBinding.ShowInterstitial("place1");
        }
        num3++;
        top      = ((float)(0.15000000596046448 + (num3 * 0.125))) * Screen.height;
        position = new Rect(0.1f * Screen.width, top, 0.8f * Screen.width, 0.1f * Screen.height);
        if (GUI.Button(position, "Destroy Interstitial"))
        {
            MonoBehaviour.print("Destroy Interstitial");
            MATBinding.DestroyInterstitial();
        }
        GUI.EndScrollView();
        this.numButtons = num3 + 1;
        MATBinding.LayoutBanner();
    }