using System; using System.Collections.Generic; using System.Linq; using HC.MiniJSON; namespace HC.Plugins { public class HCAnalytics : HCSingleton, HCIBaseAnalytics { private Dictionary config; protected override void OnInstanceCreate() { base.OnInstanceCreate(); config = new Dictionary(); } public void InitializeSdk() { HCServer.Instance.AppConfig((code, msg, appConfig) => { if (code != 0) return; var appConfigContent = appConfig.content; if (string.IsNullOrEmpty(appConfigContent)) return; var contentData = (Dictionary)Json.Deserialize(appConfigContent); config = contentData; HCAnalyticsManager.Instance.RemoteConfigListen?.Invoke(TrackEventPlatform.HC, config); }); } public TrackEventPlatform GetTrackEventPlatform() { return TrackEventPlatform.HC; } public bool ContainsRemoteConfigKey(string key) { return config.Keys.Contains(key); } public string GetRemoteConfigStr(string key, string defaultValue) { return config.TryGetValue(key, out var value) ? Convert.ToString(value) : defaultValue; } public int GetRemoteConfigInt(string key, int defaultValue) { return config.TryGetValue(key, out var value) ? Convert.ToInt32(value) : defaultValue; } public bool GetRemoteConfigBool(string key, bool defaultValue) { return config.TryGetValue(key, out var value) ? Convert.ToBoolean(value) : defaultValue; } public void SetUserId(string userId) { } public void TrackEvent(string eventName, Dictionary eventDic = null) { } public void TrackAdRevenue(string eventName, Dictionary dictionary) { } public void SetSuperProperties(Dictionary mPoperties) { } public void UserSet(Dictionary mPoperties) { } public void Login(string userId) { } public void UserSetOnce(Dictionary properties) { } public void SetLogEnable(bool enable) { } } }