using LeanCloud.Storage.Internal; using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace LeanCloud { public class AVCoreExtensions : MonoBehaviour { [RuntimeInitializeOnLoadMethod] static void OnRuntimeMethodLoad() { var go = new GameObject { name = "AVCoreExtensions" }; DontDestroyOnLoad(go); var avce = go.AddComponent(); Dispatcher.Instance.GameObject = go; // Kick off the dispatcher. avce.StartCoroutine(Dispatcher.Instance.DispatcherCoroutine); AVInitializeBehaviour.IsWebPlayer = Application.platform == RuntimePlatform.WebGLPlayer; } } /// /// Mandatory MonoBehaviour for scenes that use LeanCloud. Set the application ID and .NET key /// in the editor. /// // TODO (hallucinogen): somehow because of Push, we need this class to be added in a GameObject // called `AVInitializeBehaviour`. We might want to fix this. public class AVInitializeBehaviour : MonoBehaviour { [SerializeField] /// /// The LeanCloud applicationId used in this app. You can get this value from the LeanCloud website. /// public string applicationID; [SerializeField] /// /// The LeanCloud applicationKey used in this app. You can get this value from the LeanCloud website. /// public string applicationKey; [SerializeField] /// /// The service region. /// public AVClient.Configuration.AVRegion region; [SerializeField] /// /// Use this uri as cloud function server host. This is used for local development. /// public string engineServer; [SerializeField] /// /// Whether use production stage to process request or not. /// public bool useProduction = true; /// /// Gets or sets a value indicating whether this is web player. /// /// true if is web player; otherwise, false. public static bool IsWebPlayer { get; set; } } }