Exemplo n.º 1
0
    public void InitSDK_OnClick()
    {
        // Here we initialize the SDK manually, instead of using the InitializeOnAwake flag on the SDK Object.
        // By default InitializeOnAwake is true, which will automatically initialize the SDK when the scene loads.
        SingularSDK.InitializeSingularSDK();

        // Registering the class as the Singular Link handler.
        SingularSDK.SetSingularLinkHandler(this);

        ShowToast("SDK initialized");
    }
Exemplo n.º 2
0
    public void OnDebugCmd(string cmd)
    {
        string[] result = cmd.Split(' ');
        if (result.Length == 0 || result.GetLength(0) < 2)
        {
            return;
        }

        if (result[0].Equals("dn"))
        {
            int cmdid = int.Parse(result[1]);
            if (cmdid == 9)
            {
                ChangeWeather(WeatherType.Rain);
            }
            else if (cmdid == 10)
            {
                ChangeWeather(WeatherType.Snow);
            }
            else if (cmdid == 11)
            {
                ChangeWeather(WeatherType.None);
            }
            else if (cmdid == 1)
            {
                DynamicEffectManager.Instance.OnDebugCmd(DynamicEffectType.Morning);
            }
            else if (cmdid == 2)
            {
                DynamicEffectManager.Instance.OnDebugCmd(DynamicEffectType.Day);
            }
            else if (cmdid == 3)
            {
                DynamicEffectManager.Instance.OnDebugCmd(DynamicEffectType.Dusk);
            }
            else if (cmdid == 4)
            {
                DynamicEffectManager.Instance.OnDebugCmd(DynamicEffectType.Night);
            }
            else if (cmdid == 801)
            {
                HobaDebuger.LogError("InitializeSingularSDK");
                SingularSDK.InitializeSingularSDK();
            }
            else if (cmdid == 802)
            {
                // An example login event with no arguments
                HobaDebuger.LogError("SingularSDK.Event");
                SingularSDK.Event("Login");
            }
            else if (cmdid == 803)
            {
                // An example login event passing two key value pairs
                SingularSDK.Event("Login", "Key1", "Value1", "Key2", 1234);
            }
            else if (cmdid == 804)
            {
                // An example JSONEvent passing a dictionary
                SingularSDK.Event(new Dictionary <string, object>()
                {
                    { "Key1", "Value1" },
                    { "Key2", new Dictionary <string, object>()
                      {
                          { "SubKey1", "SubValue1" },
                          { "SubKey2", "SubValue2" }
                      } }
                }, "JSONEvent");
            }
            else if (cmdid == 805)
            {
                // Revenue with no product details
                SingularSDK.Revenue("USD", 9.99);
            }
            else if (cmdid == 806)
            {
                // Revenue with product details
                SingularSDK.Revenue("USD", 50.50, "abc123", "myProductName", "myProductCategory", 2, 25.50);
            }
            else if (cmdid == 807)
            {
                // Set a Custom User ID
                SingularSDK.SetCustomUserId("custom_user_id");

                // Unset a Custom User ID
                SingularSDK.UnsetCustomUserId();
            }
            else if (cmdid == 700)
            {
                //SendDebugData();
            }
            else if (cmdid == 808)
            {
                _BlocksManager.OnDebugCmd(true);
                _ColliderManager.OnDebugCmd(false);
            }
            else if (cmdid == 809)
            {
                _BlocksManager.OnDebugCmd(false);
                _ColliderManager.OnDebugCmd(true);
            }
        }
    }