Пример #1
0
 void GotSettings(Dictionary <string, object> settings, int group)
 {
     // apply settings to your game, eg:
     // SettingsManager.maxParticles = settings['max_particles']
     Debug.Log("got new settings");
     FirebaseConnection.GetInstance().PushGetSettings();
 }
Пример #2
0
        public void Update()
        {
            if (_updateNeeded == true && _callback != null)
            {
                var segmentConfig = _cachedSegmentConfig;
                var deviceInfo    = _deviceInfo;
                try
                {
                    var roundtripTime = Time.time - _startTime;
                    Debug.LogFormat("autotune roundtrip: {0}", roundtripTime);
                    _callback(segmentConfig.settings, segmentConfig.group_id);

                    // should not happen but do not want to write null checks in code below this
                    if (deviceInfo == null)
                    {
                        deviceInfo = new DeviceInfo(_sheetId, _buildVersion);
                    }

                    // device information data should reuse the same naming convention as DeviceInfo event
                    var status = Analytics.CustomEvent("autotune.SegmentRequestInfo", new Dictionary <string, object>()
                    {
                        { "segment_id", segmentConfig.segment_id },
                        { "group_id", segmentConfig.group_id },
                        { "error", _isError },
                        { "player_override", _isPlayerOverride },
                        { "request_latency", roundtripTime },
                        { "model", deviceInfo.model },
                        { "ram", deviceInfo.ram },
                        { "cpu", deviceInfo.cpu },
                        { "cpu_count", deviceInfo.cpu_count },
                        { "gfx_name", deviceInfo.gfx_name },
                        { "gfx_vendor", deviceInfo.gfx_vendor },
                        { "screen", deviceInfo.screen },
                        { "dpi", deviceInfo.dpi },
                        { "gfx_ver", deviceInfo.gfx_ver },
                        { "gfx_shader", deviceInfo.gfx_shader },
                        { "max_texture_size", deviceInfo.max_texture_size },
                        { "os_ver", deviceInfo.os_ver },
                        { "platformid", deviceInfo.platformid },
                        { "app_build_version", _buildVersion },
                        { "plugin_version", AutoTuneMeta.version },
                        { "sheet_id", deviceInfo.sheet_id }
                    });

                    Debug.Log("autotune.SegmentRequestInfo event status: " + status);
                    FirebaseConnection.GetInstance().PushEventStatus(status);

                    var dic = new Dictionary <string, object>()
                    {
                        { "segment_id", segmentConfig.segment_id },
                        { "group_id", segmentConfig.group_id },
                        { "error", _isError },
                        { "player_override", _isPlayerOverride },
                        { "request_latency", roundtripTime },
                        { "model", deviceInfo.model },
                        { "ram", deviceInfo.ram },
                        { "cpu", deviceInfo.cpu },
                        { "cpu_count", deviceInfo.cpu_count },
                        { "gfx_name", deviceInfo.gfx_name },
                        { "gfx_vendor", deviceInfo.gfx_vendor },
                        { "screen", deviceInfo.screen },
                        { "dpi", deviceInfo.dpi },
                        { "gfx_ver", deviceInfo.gfx_ver },
                        { "gfx_shader", deviceInfo.gfx_shader },
                        { "max_texture_size", deviceInfo.max_texture_size },
                        { "os_ver", deviceInfo.os_ver },
                        { "platformid", deviceInfo.platformid },
                        { "app_build_version", _buildVersion },
                        { "plugin_version", AutoTuneMeta.version },
                        { "sheet_id", deviceInfo.sheet_id }
                    };

                    FirebaseConnection.GetInstance().PushAutotuneDic(dic);
                }
                catch (System.Exception e)
                {
                    Debug.LogError(e);
                }
                finally
                {
                    _isError      = false;
                    _updateNeeded = false;
                }
            }
        }