コード例 #1
0
 void Start()
 {
     if (loadOnStart)
     {
         CoreServiceManager.AddInitializationCallback(Load);
     }
 }
コード例 #2
0
 static void StaticReset()
 {
     s_onAllInitComplete         = new InitEvent();
     s_initializationCallbackMap = new Dictionary <Type, InitEvent>();
     InitializationComplete      = false;
     Instance = null;
 }
コード例 #3
0
    public CoreServiceManager()
    {
        Debug.Assert(Instance == null);
        Instance = this;

        CoreServiceBank bank = CoreServiceBank.LoadBank();

        // Spawn core services
        List <ICoreService> unofficialServiceList = bank.GetCoreServices();

        foreach (ICoreService service in unofficialServiceList)
        {
            ICoreService officialInstance = service.ProvideOfficialInstance();
            _services.Add(officialInstance.GetType(), officialInstance);
        }

        // Initialize them all
        ServiceInitJoin join = new ServiceInitJoin(this, OnInitializationComplete);

        foreach (KeyValuePair <Type, ICoreService> servicePair in _services)
        {
            servicePair.Value.Initialize(join.RegisterOperation());
        }
        join.MarkEnd();
    }
コード例 #4
0
 void Awake()
 {
     // Fred - maybe this is not necessary
     if (SceneService.TotalSceneLoadCount == 0)
     {
         CoreServiceManager.AddInitializationCallback(OnServicesReady);
     }
 }
コード例 #5
0
        // If the object is disabled, check to see if the developer also wants to turn off our service
        private void OnDisable()
        {
            CoreServiceManager.WidgetAppsChangedAction -= OnUpdateWidgetApps;

            if (YURSettings.TurnOffYURServiceOnDisable)
            {
                CoreServiceManager.StopServices();
            }
        }
コード例 #6
0
 public static void Start(QuickStartSettings settings)
 {
     HasEverQuickStarted = true;
     CoreServiceManager.AddInitializationCallback(() =>
     {
         Log.Info("QuickStart: " + settings.ToString());
         StopRoutine();
         s_currentRoutine = CoroutineLauncherService.Instance.StartCoroutine(StartRoutine(settings));
     });
 }
コード例 #7
0
 /// <summary>
 /// Logs out of the current user
 /// </summary>
 public void Logout()
 {
     try
     {
         CoreServiceManager.Logout();
     } catch (UnityException e)
     {
         Instance.Log("YUR could not log out. Here's why: " + e.Message);
     }
 }
コード例 #8
0
 public static void StartFromScratch(int playerProfileLocalId)
 {
     HasEverQuickStarted = true;
     CoreServiceManager.AddInitializationCallback(() =>
     {
         Log.Info("QuickStart: from scratch - profile:" + playerProfileLocalId);
         StopRoutine();
         PlayerProfileService.Instance.SetPlayerProfile(playerProfileLocalId);
         GameStateManager.TransitionToState(Assets.rootMenu);
     });
 }
コード例 #9
0
        // Create instance of YUR_Manager and begin the service
        private void OnEnable()
        {
            CoreServiceManager.WidgetAppsChangedAction += OnUpdateWidgetApps;
            bool initCore = false;

            TurnOnDebugLogging = YURSettings.DebugLogging;

            try
            {
                if (_instance == null)
                {
                    _instance = this;
                    DontDestroyOnLoad(gameObject);

                    initCore = true;
                }
                else if (_instance != this)
                {
                    Destroy(gameObject);
                }
                else
                {
                    if (!CoreServiceManager.Initialized)
                    {
                        initCore = true;
                    }
                }
            } catch (UnityException e)
            {
                Instance.Log("Could not create instance. Here's why: " + e);
            }

            if (initCore)
            {
                try
                {
                    LatestOSU = null;

                    // Magic line that makes the YUR service run
                    CoreServiceManager.RunServices
                    (
                        OnOverlayUpdate: OnStatusUpdate /* Fires action every second */,
                        OnServiceShutdown: OnServiceShutdown,
                        OnUserPreferencesChanged: OnUserPreferencesChanged
                    );

                    Instance.Log("YUR Services Started!");
                }
                catch (UnityException e)
                {
                    Instance.Log("YUR Could Not Start. Here's Why: " + e.Message);
                }
            }
        }
コード例 #10
0
 /// <summary>
 /// Sends a request to get a PIN to authenticate logins
 /// </summary>
 public void Login()
 {
     try
     {
         CoreServiceManager.ShortcodeLogin(OnLoginRequest, OnLoginResponseSuccess, OnLoginResponseFailure);
     }
     catch (UnityException e)
     {
         Instance.Log("YUR Could Not Log In. Here's Why: " + e);
     }
 }
コード例 #11
0
 void RegisterButWaitForCamerService()
 {
     if (CameraService.Instance == null) // we can't register if the camera service is not up and running
     {
         onCoreServiceInitComplete = OnCoreServiceManagerInitComplete;
         CoreServiceManager.AddInitializationCallback <CameraService>(onCoreServiceInitComplete);
     }
     else
     {
         Register();
     }
 }
コード例 #12
0
    void UnregisterAndCancelCallbackIfNecessary()
    {
        if (onCoreServiceInitComplete != null)
        {
            CoreServiceManager.RemoveInitializationCallback <CameraService>(onCoreServiceInitComplete);
        }

        if (CameraService.Instance != null)
        {
            Unregister();
        }
    }
コード例 #13
0
 public void Logout()
 {
     if (CoreServiceManager.IsLoggedIn)
     {
         CoreServiceManager.Logout();
     }
     else
     {
         if (triggerSleeveState is object)
         {
             triggerSleeveState.SendTransitionStateToController();
         }
     }
 }
コード例 #14
0
 private void OnEnable()
 {
     OnShutdown.Invoke();
     CoreServiceManager.Logout();
 }
コード例 #15
0
 void Awake()
 {
     CoreServiceManager.AddInitializationCallback(OnCoreServicesReady);
 }
コード例 #16
0
 public ServiceInitJoin(CoreServiceManager owner, Action onJoin) : base(onJoin)
 {
     this._owner = owner;
 }