Ejemplo n.º 1
0
    void OnGUI()
    {
        // Make a background box
        GUI.Box(new Rect(10, 10, 100, 90), "Loader Menu");

        // Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
        if (GUI.Button(new Rect(20, 40, 80, 20), "Level 1"))
        {
            Amplitude amplitude = Amplitude.Instance;
            amplitude.logEvent("tapped");
            Dictionary <string, object> userProperties = new Dictionary <string, object>()
            {
                { "float_gprop", 1.0 }
            };
            amplitude.setUserProperties(userProperties);

            Dictionary <string, object> demoOptions = new Dictionary <string, object>()
            {
                { "Bucket", "A" },
                { "Credits", 9001 }
            };
            amplitude.logEvent("unity event 2", demoOptions);
            amplitude.logRevenue(0.03);
            amplitude.logRevenue("sku", 1, 1.99);
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                amplitude.logRevenue("sku", 1, 1.99, "cmVjZWlwdA==", null);
            }
            else if (Application.platform == RuntimePlatform.Android)
            {
                amplitude.logRevenue("sku", 1, 1.99, "receipt", "receiptSignature");
            }
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        Amplitude amplitude = Amplitude.Instance;

        amplitude.logRevenue(0.03);
        amplitude.setOnceUserProperty("bool", true);
        amplitude.setOnceUserProperty("boolArray", new bool[] { true, false, false });
        amplitude.setOnceUserProperty("stringArray", new string[] { "this", "is", "a", "test" });
        amplitude.unsetUserProperty("bool");
        amplitude.setUserProperty("string", "this is a test");
        amplitude.setUserProperty("stringArray", new string[] { "replace", "existing", "strings" });
        amplitude.appendUserProperty("stringArray", new string[] { "append", "more", "strings" });
        amplitude.setUserProperty("floatArray", new float[] { 123.45f, 678.9f });
        amplitude.setUserProperty("doubleArray", new double[] { 123.45, 678.9 });

        Dictionary <string, object> dictValue = new Dictionary <string, object>()
        {
            { "key3", "value3" },
            { "key4", "value4" },
            { "keyFloat", (float)1.23 },
            { "keyDouble", 2.34 }
        };

        amplitude.setOnceUserProperty("dictValue", dictValue);

        List <int> intList = new List <int> ();

        intList.Add(4);
        intList.Add(5);
        intList.Add(6);
        amplitude.setOnceUserProperty("intList", intList);

        List <string> stringList = new List <string> ();

        stringList.Add("string2");
        stringList.Add("list2");
        amplitude.setUserProperty("stringList", stringList);

        amplitude.addUserProperty("floatValue", 10.0f);
        amplitude.addUserProperty("intValue", -1);

        amplitude.appendUserProperty("newIntValue", 15);
        amplitude.appendUserProperty("intValue", false);

        amplitude.appendUserProperty("intList", new int[] { 7, 8, 9 });
        amplitude.appendUserProperty("stringList", stringList);

        amplitude.logEvent("this is a test");
        Debug.Log(amplitude.getDeviceId());
        amplitude.uploadEvents();
    }