IEnumerator WaitForOnlineServiceInit() { // wait for authenticating, // always wait 1 frame do { yield return(null); } while (!OnlineService.IsAuthenicated); OnSignIn?.Invoke(OnlineService); // authenticated, now load inventory OnlineService.Load(); // wait for load do { yield return(null); } while (!OnlineService.IsLoaded); // load data to inventory DataSystem.LoadInventory(CurrentPlayer.Inventory, OnlineService.LoadedData, out lastLoadedInventoryData); OnGameInit?.Invoke(this); }
void Start() { mainMenuBackground.SetActive(true); Background.CreateCutsceneBackground(Vector3.zero); if (OnlineService == null) { // load data to inventory from file DataSystem.LoadInventory(CurrentPlayer.Inventory, out lastLoadedInventoryData); // if there is no service, everything is initialized OnGameInit?.Invoke(this); } Shop.OnAmmoBuy += Shop_OnAmmoBuy; Shop.OnWeaponBuy += Shop_OnWeaponBuy; Shop.OnWeaponRepair += Shop_OnWeaponRepair; }