Exemple #1
0
        public void FillBaseData(long sessionID)
        {
            this.bundle         = Application.identifier;
            this.idfa           = ElephantCore.Instance.idfa;
            this.idfv           = ElephantCore.Instance.idfv;
            this.app_version    = Application.version;
            this.lang           = Utils.GetISOCODE(Application.systemLanguage);
            this.user_tag       = RemoteConfig.GetInstance().GetTag();
            this.os_version     = SystemInfo.operatingSystem;
            this.sdk_version    = ElephantVersion.SDK_VERSION;
            this.ad_sdk_version = VersionCheckUtils.GetInstance().AdSdkVersion;
            this.device_model   = SystemInfo.deviceModel;
            this.create_date    = Utils.Timestamp();
            this.session_id     = sessionID;

            try
            {
                TimeZone localZone     = TimeZone.CurrentTimeZone;
                DateTime currentDate   = DateTime.Now;
                TimeSpan currentOffset =
                    localZone.GetUtcOffset(currentDate);
                this.timezone_offset = currentOffset.ToString();
            }
            catch (Exception e)
            {
                Debug.Log(e);
            }
        }
Exemple #2
0
        void ExampleSDKUsage()
        {
            int currentLevel = 1;

            // make sure you send this  at the start of the each level
            Elephant.LevelStarted(currentLevel);

            // basic SDK event
            Elephant.Event("user_clicked_something", currentLevel);


            // SDK event with parameter
            Elephant.Event("custom_reward_event", currentLevel, Params.New().Set("gold", 1000));


            // SDK transaction for currencies (consumable user properties)
            Elephant.Transaction("gem", currentLevel, -10, 90, "skin_unlock");


            // SDK event with some parameters
            Params param2 = Params.New()
                            .Set("gems", 10)
                            .Set("source", "level_reward")
                            .Set("some_double", 3.141592).CustomString("{\"t\": 1}");


            Elephant.Event("custom_reward_event2", currentLevel, param2);


            // send level completed or failed event
            if (LevelPassed())
            {
                Elephant.LevelCompleted(currentLevel);
            }
            else
            {
                Elephant.LevelFailed(currentLevel);
            }


            // use some remote config parameters to change the game remotely ( useful for A\B testing )
            string someString = RemoteConfig.GetInstance().Get("test_string", "default");
            int    someInt    = RemoteConfig.GetInstance().GetInt("test_int", 0);
            long   someLong   = RemoteConfig.GetInstance().GetLong("test_long", 1L);
        }