Example #1
0
    private IEnumerator LoadMainSceneWithDelay()
    {
        yield return(new WaitForSeconds(1f));

        PlayerData.Instance.WelcomebackTimeStamp.Value = ServerTimeService.NowTicks();
        SceneLoadHelper.LoadMainScene();
    }
Example #2
0
 public void ApplyCloudSaveAndRestart()
 {
     BindingManager.Instance.SystemPopup.SetActive(value: true);
     PlayerDataLoader.Instance().FillBaseData(m_cloudSave, PlayerData.Instance);
     UploadSaveToCloud(PlayerData.Instance, "cloud_save", delegate
     {
         SceneLoadHelper.LoadInitScene();
     }, null);
 }
Example #3
0
    public void ChangeLanguage()
    {
        List <string> list = PersistentSingleton <LocalizationService> .Instance.SupportedLanguages();

        PlayerData.Instance.Language = list[m_languageSelection];
        PersistentSingleton <LocalizationService> .Instance.ParseLocalization();

        SceneLoadHelper.LoadMainScene();
    }
Example #4
0
    public GameLogic(GameSettings gameSettings)
    {
        GameSettings = gameSettings;
        SceneLoader  = new SceneLoadHelper(GameSettings.SceneName, new LoadSceneParameters(LoadSceneMode.Additive, LocalPhysicsMode.Physics3D));

        // Init scene loading
        SceneLoader.LoadSimulationScene(OnSceneLoaded);

        // Prepare AI
        CurrentPlayer = 0;
        PlayerTypes   = gameSettings.PlayerTypes;
        AIs           = new IGameAI[NumberOfPlayers];
    }
Example #5
0
 protected void Awake()
 {
     Instance = this;
     m_loaded = (m_loaded || SceneManager.GetActiveScene().name == "Initialize");
     if (!m_loaded)
     {
         InitialScene = SceneManager.GetActiveScene().name;
         SceneLoadHelper.LoadInitSceneNow();
         return;
     }
     if (SceneManager.GetActiveScene().name == "Main")
     {
         MainInstaller.ReleaseAll();
         MainInstaller.DoAwake();
     }
     if (SceneManager.GetActiveScene().name == "TimeMachine")
     {
         GamblingInstaller.ReleaseAll();
         GamblingInstaller.DoAwake();
     }
 }
 private void OnPlayBtnClick(BaseEventData baseData)
 {
     MessageBoxController.OpenOKCancelCountDownBox("Go Doteen Test Scene?", "NOTICE", 5.0f,
     delegate
     {
         SceneLoadHelper.LoadTargetScene(GameGlobeVar.LOADING_TESTSCENE_NAME, delegate
         {
             MessageBoxController.OpenWaitBox("Notice", "Dotween Test", 3.0f, 1.0f, delegate
             {
                 LogModule.Log("Wait over!");
             });
         });
     },
     delegate
     {
         UIManager.CloseUI(UIInfos.MessageBoxUI);
     },
     delegate
     {
         UIManager.CloseUI(UIInfos.MessageBoxUI);
     });
 }
 private void OnDestroy()
 {
     _instance = null;
 }
 private void Awake()
 {
     _instance = this;
     DontDestroyOnLoad(this.gameObject);
 }
Example #9
0
    private IEnumerator LoadGamblingSceneWithDelay()
    {
        yield return(new WaitForSeconds(1f));

        SceneLoadHelper.LoadGamblingScene();
    }
Example #10
0
    private IEnumerator LoadSimpleEditorSceneWithDelay()
    {
        yield return(new WaitForSeconds(1f));

        SceneLoadHelper.LoadSimpleEditorScene();
    }
Example #11
0
    public FacebookRunner()
    {
        SceneLoader root = SceneLoader.Instance;

        Singleton <PropertyManager> .Instance.AddRootContext(this);

        IsLoggedToFacebook = PersistentSingleton <FacebookAPIService> .Instance.IsLoggedToFB.ToReactiveProperty();

        FacebookEvents = m_fbEventsInternal.AsObservable();
        FacebookEvents.Subscribe(delegate(UniRx.Tuple <FacebookEvent, object> e)
        {
            switch (e.Item1)
            {
            case FacebookEvent.LOGIN_CANCELLED:
            case FacebookEvent.LOGIN_FAILED:
                break;

            case FacebookEvent.NEW_FRIENDS_FETCHED:
                break;

            case FacebookEvent.ADD_FRIEND_REQUEST_ERROR:
                break;

            case FacebookEvent.LOGIN_ATTEMPT:
                HandleLoginAttempt((ILoginResult)e.Item2);
                break;

            case FacebookEvent.LOGIN:
                RequestFBData();
                break;

            case FacebookEvent.MY_DATA:
                HandleMyFBData((MyFacebookData)e.Item2);
                GetAllRequests();
                break;

            case FacebookEvent.FRIEND_DATA:
                HandleFriendFBData((FBPlayer)e.Item2);
                GiftsFetched.OnNext(value: true);
                break;

            case FacebookEvent.ALL_REQUESTS:
                HandleAllRequests((IGraphResult)e.Item2);
                break;

            case FacebookEvent.APP_REQUEST_RESULT:
                HandleAppRequestResult((IAppRequestResult)e.Item2);
                break;

            case FacebookEvent.FRIEND_REQUEST_RESULT:
                HandleFBFriendAppRequest((FBPlayer)e.Item2);
                GiftsFetched.OnNext(value: true);
                break;
            }
        }).AddTo(root);
        GiftConsuming.Subscribe(delegate
        {
            GiftOpenInProgress.Value++;
        }).AddTo(root);
        GiftConsumeFailed.Subscribe(delegate
        {
            GiftOpenInProgress.Value--;
        }).AddTo(root);
        GiftConsumeSuccess.Subscribe(delegate
        {
            GiftOpenInProgress.Value--;
        }).AddTo(root);
        GiftSending.Subscribe(delegate
        {
            GiftSendInProgress.Value++;
        }).AddTo(root);
        GiftSendingFailed.Subscribe(delegate
        {
            GiftSendInProgress.Value--;
        }).AddTo(root);
        GiftSendingSuccess.Subscribe(delegate
        {
            GiftSendInProgress.Value--;
        }).AddTo(root);
        GiftOpenBlocked = (from count in GiftOpenInProgress
                           select count != 0).TakeUntilDestroy(root).ToReadOnlyReactiveProperty();
        GiftSendBlocked = (from count in GiftSendInProgress
                           select count != 0).TakeUntilDestroy(root).ToReadOnlyReactiveProperty();
        GiftOpenAvailable = (from _ in (from _ in GiftOpenInProgress
                                        select true).Merge(GiftsFetched)
                             select UniqueGifts().Count > 0).TakeUntilDestroy(root).ToReadOnlyReactiveProperty();
        GiftSendAvailable = (from _ in (from _ in GiftSendInProgress
                                        select true).Merge(GiftsFetched)
                             select !AreAllPlayersGifted()).TakeUntilDestroy(root).ToReadOnlyReactiveProperty();
        GiftConsumeSuccess.Subscribe(delegate(FacebookGift gift)
        {
            MaybeSendBackGift(m_consumedFrom, gift.FromId);
        }).AddTo(root);
        (from pause in Observable.EveryApplicationPause().StartWith(value: false)
         where !pause && IsLoggedToFacebook.Value
         select pause).Subscribe(delegate
        {
            GetAllRequests();
        }).AddTo(root);
        (from tuple in PlayerData.Instance.LifetimeChunk.CombineLatest(PlayerData.Instance.FBId, (int highscore, string player) => new
        {
            highscore,
            player
        })
         where tuple.player != string.Empty && PersistentSingleton <FacebookAPIService> .Instance.FBPlayers.ContainsKey(tuple.player)
         where tuple.highscore > PersistentSingleton <FacebookAPIService> .Instance.FBPlayers[tuple.player].Highscore
         select tuple).Subscribe(tuple =>
        {
            PersistentSingleton <FacebookAPIService> .Instance.FBPlayers[tuple.player].Highscore = tuple.highscore;
        }).AddTo(root);
        (from e in FacebookEvents
         where e.Item1 == FacebookEvent.LOGIN
         select(AccessToken) e.Item2).Subscribe(delegate(AccessToken access)
        {
            PersistentSingleton <PlayFabService> .Instance.LoggedOnPlayerId.Take(1).Subscribe(delegate
            {
                JSONObject customInfo = PersistentSingleton <PlayFabService> .Instance.GetCustomInfo();
                SyncToFacebook(access, customInfo, delegate(JSONObject json)
                {
                    string a = json.asString("PlayFabId", () => string.Empty);
                    if (a != PersistentSingleton <PlayFabService> .Instance.LoggedOnPlayerId.Value)
                    {
                        PersistentSingleton <PlayFabService> .Instance.ClearCmdQueue();
                        PlayerData.Instance.LastSavedToCloud.Value = 0L;
                        PersistentSingleton <PlayFabService> .Instance.LoggedOnPlayerId.UnpublishValue();
                        PersistentSingleton <PlayFabService> .Instance.ShouldLoginImmediately = true;
                        SceneLoadHelper.LoadInitScene();
                    }
                }, null);
            }).AddTo(root);
        }).AddTo(root);
        (from e in FacebookEvents
         where e.Item1 == FacebookEvent.MY_DATA
         select(from f in ((MyFacebookData)e.Item2).Friends
                where ((Dictionary <string, object>) f).ContainsKey("id")
                select(string)((Dictionary <string, object>) f)["id"]).ToList()).Subscribe(delegate(List <string> list)
        {
            PersistentSingleton <PlayFabService> .Instance.GetPlayFabToFacebookIdMapping(list, delegate(Dictionary <string, string> fbToPf)
            {
                PlayerData.Instance.PlayFabToFBIds.Value = fbToPf;
                UpdateLeaderboards.SetValueAndForceNotify(value: true);
            }, null);
        }).AddTo(root);
        (from logged in IsLoggedToFacebook
         where logged
         select logged).Subscribe(delegate
        {
            OnLoggedIn();
        }).AddTo(root);
    }
Example #12
0
    private IEnumerator MainLoader()
    {
        InitializeEnvironmentVariables();
        yield return(null);

        LoadGameSettings();
        if (ClearCacheIfOld())
        {
            SceneLoadHelper.LoadInitScene();
            yield break;
        }
        StartCoroutine(FetchConfigsRoutine());
        ConnectivityService.StartUp();
        ServerTimeService.StartUp();
        PersistentSingleton <SaveLoad> .Instance.Load(PlayerData.Instance);

        PersistentSingleton <SessionService> .Instance.StartUp();

        PersistentSingleton <MainSaver> .Instance.StartUp();

        while (!ConfigLoader.Fetched)
        {
            yield return(null);
        }
        if (ConfigLoader.OverrideCacheWithFirebaseConfigs())
        {
            UnityEngine.Debug.LogWarning("Override configs and restart game");
            SceneLoadHelper.LoadInitScene();
            yield break;
        }
        PersistentSingleton <LocalizationService> .Instance.ParseLocalization();

        if (IsTooOld())
        {
            Debug.LogError("Show Force Update");
            // ForceUpdateService.ShowForceUpdateDialog();
            yield break;
        }
        if (HaventAcceptedYet())
        {
            AcceptOurTermsService.ShowTOSAndPPPopup();
        }
        PersistentSingleton <Economies> .Instance.LoadConfigs();

        InitializeGraphicsQuality();
        yield return(null);

        PersistentSingleton <FlooredProvidersFactory> .Instance.Init();

        yield return(null);

        PersistentSingleton <AdService> .Instance.Init();

        yield return(null);

        PersistentSingleton <ARService> .Instance.InitializeCustomLevels();

        yield return(null);

        PersistentSingleton <IAPService> .Instance.InitializePurchasing();

        yield return(null);

        PersistentSingleton <AppsFlyerService> .Instance.InitializeAppsFlyer();

        yield return(null);

        PersistentSingleton <AnalyticsService> .Instance.InitializeAnalytics();

        yield return(null);

        PersistentSingleton <FacebookAPIService> .Instance.InitializeFB();

        yield return(null);

        PersistentSingleton <GlobalAnalyticsParameters> .Instance.InitializeGlobalAnalyticsParameters();

        PersistentSingleton <GameAnalytics> .Instance.InitializeGameAnalytics();

        yield return(null);

        PersistentSingleton <NotificationRunner> .Instance.InitializeNotifications();

        yield return(null);

        while (HaventAcceptedYet())
        {
            yield return(null);
        }
        if (SceneLoader.InitialScene == string.Empty)
        {
            m_asynLoading = SceneManager.LoadSceneAsync("Main");
        }
        else
        {
            m_asynLoading = SceneManager.LoadSceneAsync(SceneLoader.InitialScene);
        }
        yield return(m_asynLoading);
    }