コード例 #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");
            }
        }
    }
コード例 #2
0
    void UpdateUserProperties()
    {
        UserProperties.Clear();

        try
        {
            FillCustomProperties(UserProperties);
        }
        catch (Exception e)
        {
            Debug.LogException(e);
        }

        amplitude.setUserProperties(UserProperties);
    }