using Amanotes.TripleSDK.Core; using Amanotes.TripleSDK.Core.Analytics; using Amanotes.TripleSDK.Core.Configuration; using Newtonsoft.Json; using Plugins.Countly; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Amanotes.TripleSDK.Countly { public abstract class CountlyServiceBase : MonoBehaviour, ICountlyService { public ServiceStatus serviceStatus { get; protected set; } public ICountly CountlyWrapper { get; protected set; } public abstract void Init(); private CountlyConfiguration configuration; private void Start() { configuration = Bootstrap.Instance.GetRequiredService(). GetConfiguration(); if (configuration == null) { serviceStatus = ServiceStatus.Unvailable; Debug.LogError("CountlyService initializing is failed. Configuration not found."); return; } } public void LogEvent(string eventName) { if (configuration.EnableSendEvent == false) return; Debug.Log($"[Countly EVENT] EventName: {eventName}"); StartCoroutine(LazyLogEvent(eventName)); } protected abstract IEnumerator LazyLogEvent(string eventName, Dictionary param = null); public void LogEvent(string eventName, Dictionary param) { if (configuration.EnableSendEvent == false) return; Debug.Log($"[Countly EVENT] EventName: {eventName} , Param: {JsonConvert.SerializeObject(param)}"); StartCoroutine(LazyLogEvent(eventName, param)); } public ServiceStatus GetStatus() { return serviceStatus; } } }