Пример #1
0
        protected override void OnStarting()
        {
            base.OnStarting();
            var startState = new LoadingState(GameStateManager, this);

            GameStateManager.Load(startState);
        }
Пример #2
0
    IEnumerator Loading(AsyncOperation progress, LoadingScreenBehaviour ls)
    {
        ls.Begin();
        LoadingState state = ls.state;

        while (!progress.isDone)
        {
            state.Callback("LoadingScene", progress.progress);
            yield return(null);
        }

        List <Action> doneListeners = new List <Action>();

        var initializer = GetInitializer();

        if (initializer != null)
        {
            state.Callback("InitializingScene", 0);
            yield return(null);

            AsyncProcessor processor = new AsyncProcessor(this);
            yield return(initializer.Initialize(processor, doneListeners.Add, state));

            yield return(new WaitUntil(processor.allDone));
        }

        ls.End();
        Done();
        foreach (var dl in doneListeners)
        {
            dl.Invoke();
        }
    }
Пример #3
0
    private IEnumerator Load(Func <AsyncOperation> onLoad, float fadeTime)
    {
        while (!_loadingDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        _loadingState = LoadingState.LOADING;
        StartCoroutine(AnimateLoadingText());

        Time.timeScale = 0.0f;
        _fadeTime      = fadeTime;

        _fadeTween = _loadingScreenContainer.DOFade(1.0f, fadeTime).SetUpdate(true);

        _fadeTween.onComplete = () =>
        {
            if (onLoad != null)
            {
                _asyncOp = onLoad();
            }

            if (_asyncOp == null)
            {
                _loadingState = LoadingState.DONE;
                _startTime    = Time.realtimeSinceStartup;
            }
        };

        yield break;
    }
Пример #4
0
	protected /*virtual*/ void Awake()
	{
		foreach(AGameState each in GetComponents<AGameState>())
		{
			if(states.ContainsKey(each.ID))
			{
				Debug.LogError("States ID found twice : " + each.ID.ToString());
			}
			else
			{
				states.Add(each.ID, each);
			}
			
			if(each is ExitState)
			{
				exit = each as ExitState;
			}
			
			if(each is LoadingState)
			{
				loading = each as LoadingState;
			}
			
			each.SetGameMode(this);
		}
		
		Enter();
	}
Пример #5
0
 /// <summary>
 /// Loads the given level from the storage device
 /// </summary>
 /// <param name="serviceProvider">Provides the content reference</param>
 /// <param name="levelIndex">The level index to load</param>
 public ContentLoader(Game game, AsyncCallback callback, String filename)
     : base(game)
 {
     content = game.Content;
     this.filename = filename;
     loadingState = LoadingState.ReadyToSelectStorageDevice;
 }
		public TickStateController Create(ITAlertPhotonClient photonClient)
		{
		    var simulationSummary = new SimulationSummary.SimulationSummary();

			// Loading
			var loadingState = new LoadingState(new LoadingStateInput());
			loadingState.AddTransitions(new OnCompletedTransition(loadingState, LoginState.StateName));

			// Login
			var loginState = new LoginState();
			loginState.AddTransitions(new OnCompletedTransition(loginState, MenuState.StateName));

			// Menu
			var menuState = new MenuState(photonClient);

			// Room
			var roomStateInput = new RoomStateInput(photonClient);
			var roomState = new RoomState(roomStateInput, photonClient, simulationSummary);


			// Test Simulation Summary
			var simulationSummaryStateInput = new SimulationSummaryStateInput(simulationSummary);
			var simulationSummaryState = new SimulationSummaryState(simulationSummaryStateInput, simulationSummary);

			// Add states to controller
			var stateController = new TickStateController(loadingState, loginState, menuState, roomState, simulationSummaryState);
		    stateController.SetParent(ParentStateController);


		    roomState.SetSubstateParentController(stateController);
		    menuState.SetSubstateParentController(stateController);

            return stateController;
		}
Пример #7
0
    void Update()
    {
        if (mState == LoadingState.Loading)
        {
            UICenter.Instance.SetProgress(req.progress);
            if (req.isDone)
            {
                curPrefab = req.asset as GameObject;
                GameObject building_obj = GameObject.Instantiate(curPrefab, Vector3.zero, Quaternion.identity, transform);
                Building   building     = building_obj.GetComponent <Building> ();
                building.Initialize();
                curObject = building_obj;
                mState    = LoadingState.Idle;
                UICenter.Instance.MaskDisappear();
                StopCoroutine(loadCoroutine);

                onLoadComplete();
                onLoadComplete = null;
                req            = null;
                loadCoroutine  = null;
            }
            else
            {
                UICenter.Instance.SetProgress(req.progress);
            }
        }
    }
Пример #8
0
 public LoadingProceedCommandHandler(GameStateMachine gameStateMachine,
                                     LoadingState loadingState, MainMenuState mainMenuState)
 {
     _gameStateMachine = gameStateMachine;
     _mainMenuState    = mainMenuState;
     _loadingState     = loadingState;
 }
Пример #9
0
        private async void LoadNewAssets()
        {
            loadingState = LoadingState.LoadingNewAssets;
            await requestedState.Load();

            CollectGarbage();
        }
Пример #10
0
 private void bgwProcess_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (state == LoadingState.Load)
     {
         if (MoneyDataKeeper.Instance.FileIsEncrypted())
         {
             showPasswordControls();
         }
         else
         {
             state = LoadingState.Activate;
             bgwProcess.RunWorkerAsync();
         }
     }
     else if (state == LoadingState.Decrypt)
     {
         state = LoadingState.Activate;
         bgwProcess.RunWorkerAsync();
     }
     else if (state == LoadingState.Redecrypt)
     {
         showPasswordControls();
         lblPleaseEnterPassword.ForeColor = Color.Red;
         lblPleaseEnterPassword.Text      = Resources.Labels.PasswordIncorrect;
     }
     else if (state == LoadingState.Activate)
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Пример #11
0
        public async Task <ActionResult> LoadSessionAsync()
        {
            var user      = _userManager.Users.First();
            var loginUser = new LoadingState()
            {
                User = new RegisterUserDTO()
                {
                    Email = user.Email, Name = user.UserName
                },
                Token = await GerarJWT(user.Email),
            };

            return(Ok(loginUser));

            //var user = new IdentityUser { UserName = loginUserDTO.Email };

            //var result = await _singnInManeger.PasswordSignInAsync(loginUserDTO.Email, loginUserDTO.Password, false, true);

            //if (result.Succeeded)
            //{
            //    var loginUser = new AccessManager()
            //    {
            //        User = loginUserDTO,
            //        Token = await GerarJWT(loginUserDTO.Email)
            //    };
            //    return Ok(loginUser);

            //}
        }
        public override void Update(GameTime gameTime)
        {
            switch (loadingState)
            {
            case LoadingState.Fonts:
                LoadFonts();
                loadingState = LoadingState.Textures;
                break;

            case LoadingState.Textures:
                LoadTextures();
                loadingState = LoadingState.Sounds;
                break;

            case LoadingState.Sounds:
                LoadSounds();
                loadingState = LoadingState.Completed;
                break;

            case LoadingState.Completed:
                NewMessenger.Default.Send <ViewStateChangedMessage>(new ViewStateChangedMessage {
                    ViewState = ViewState.Menu
                });
                break;
            }
        }
Пример #13
0
        public async Task CheckForNewEventsAsync()
        {
            // var searchPage = (Application.Current as App)?.HomePage.GenSearchPage;
            var dontShowFurtherToasts = false;

            if (GlobalVars.isSyncNeeded && _loadingState == LoadingState.NotLoading)
            {
                _loadingState = LoadingState.LoadingEvents;

                GlobalVars.DoToast("Now checking for updated events...", GlobalVars.ToastType.Yellow);
                var events = await App.GenEventManager.GetEventsAsync(await GlobalVars.serverLastSyncTime());

                var toastText = "";

                if (events.Count > 0)
                {
                    toastText = await GlobalVars.db.SaveItemsAsync(events);
                }

                GlobalVars.lastSyncTime = DateTime.Now;

                if (!string.IsNullOrEmpty(toastText))
                {
                    GlobalVars.DoToast(toastText, GlobalVars.ToastType.Yellow, 10000);
                    dontShowFurtherToasts = true;
                }
                else
                {
                    GlobalVars.DoToast("All events are now up-to-date.", GlobalVars.ToastType.Green);
                }

                GlobalVars.View_GenSearchView?.UpdateEventInfo();
                await CheckForNewGlobalVarsAsync(dontShowFurtherToasts);
            }
        }
Пример #14
0
    public void Initialize()
    {
        _states = new Dictionary <EGameState, AGameState>();

        InitializeState initializeState = new InitializeState();

        initializeState.Initialize(EGameState.INITIALIZE);
        _states.Add(EGameState.INITIALIZE, initializeState);

        LoadingState loadingState = new LoadingState();

        loadingState.Initialize(EGameState.LOADING);
        _states.Add(EGameState.LOADING, loadingState);

        MainMenuState mainMenuState = new MainMenuState();

        mainMenuState.Initialize(EGameState.MAINMENU);
        _states.Add(EGameState.MAINMENU, mainMenuState);

        GameState gameState = new GameState();

        gameState.Initialize(EGameState.GAME);
        _states.Add(EGameState.GAME, gameState);

        _currentStateType = EGameState.INITIALIZE;
        CurrentState.EnterState();
    }
Пример #15
0
    public override bool MoveNext()
    {
        if (IsMainLoader && _State == LoadingState.Pre && (int)f_PC.GetValue(Inner) == 3)
        {
            _State = LoadingState.Loading;
        }

        if (_State == LoadingState.Loading)
        {
            Current = null;
            if (MultiSceneLoader.Instance != null && !MultiSceneLoader.Instance.HasFinishedLoading)
            {
                return(true); // Wait until loading finished.
            }
            _State = LoadingState.Post;
            // Return control to the inner or any further wrapper.
            Current = OnLoadFinished?.InvokePassing(Inner, SceneManager.GetSceneByName(SceneName)) ?? Inner;
            return(true);
        }

        if (_State == LoadingState.Post)
        {
            Current = null;
            return(false);
        }

        if (_State != LoadingState.Loading)
        {
            bool move = Inner.MoveNext();
            Current = Inner.Current;
            return(move);
        }

        return(true);
    }
Пример #16
0
        public void Initialize()
        {
            LoadingState = LoadingState.Loading;

            Debug.Log("Initialize SaveService");
            _lifeCycleService.ApplicationPause.Subscribe(val =>
            {
                if (val)
                {
                    Save();
                }
            });

            _lifeCycleService.ApplicationQuitStream.Subscribe(val => { Save(); });

            _saveList.AddRange(_diContainer.ResolveAll <IAutoPersistent>());

            Load();

            foreach (var element in _saveList)
            {
                element.OnLoaded();
            }

            LoadingState = LoadingState.Loaded;
        }
Пример #17
0
    public static IGameState GetState(int index)
    {
        IGameState state;

        switch (index)
        {
        case 0:
            state = new LoadingState();
            break;

        case 1:
            state = new MenuState();
            break;

        case 2:
            state = new OverworldState();
            break;

        case 3:
            state = new CutsceneState();
            break;

        default:
            state = new LoadingState();
            break;
        }
        return(state);
    }
Пример #18
0
    private void StartLoad()
    {
        _Action = null;

        //_Isloading = true;
        _Action = delegate
        {
            C_MonoSingleton <C_SceneMgr> .GetInstance().LoadScene(m_SceneQueue.Dequeue(), "StageLoading", () =>
            {
                NextStep();
            });
        };
        if (!string.IsNullOrEmpty(_PreLoadFile))
        {
            //  _StartPreloadRes = true;
            _LoadingState = LoadingState.load_ab;
            C_MonoSingleton <PreLoadResMgr> .Instance.StartLoadRes(_PreLoadFile);
        }
        else
        {
            //_StartPreloadRes = false;
            _LoadingState = LoadingState.load_scene;

            _Action();
        }
    }
Пример #19
0
    protected /*virtual*/ void Awake()
    {
        foreach (AGameState each in GetComponents <AGameState>())
        {
            if (states.ContainsKey(each.ID))
            {
                Debug.LogError("States ID found twice : " + each.ID.ToString());
            }
            else
            {
                states.Add(each.ID, each);
            }

            if (each is ExitState)
            {
                exit = each as ExitState;
            }

            if (each is LoadingState)
            {
                loading = each as LoadingState;
            }

            each.SetGameMode(this);
        }

        Enter();
    }
    public void OnLevelLoaded(SceneSerializationType type)
    {
//		Debug.Log("On level loaded delegate firing");
        loadingDialogue.SetActive(false);
//		WebGLComm.inst.Debug("UTY.levelloader.onlevel loaded (deleagte)");
        GameManager.inst.RestartLevelTimer();

        if (onLevelLoadedDelegate != null)
        {
//			WebGLComm.inst.Debug("UTY.levelloader delegate:"+onLevelLoadedDelegate.ToString());
            onLevelLoadedDelegate();
        }
        if (LevelBuilder.inst.levelBuilderIsShowing && LevelBuilder.inst.firstTimeOpened)
        {
            LevelBuilder.inst.ActionCenterOnPlayer();
        }

        GameManager.inst.NewLevelWasLoaded();


        if (LevelBuilder.inst.levelBuilderIsShowing)
        {
            GameManager.inst.SetGameState(GameState.Editing);
        }
        else
        {
            GameManager.inst.SetGameState(GameState.Playing);
        }

        state = LoadingState.Ready;

//		StartCoroutine(GameStartedAfterSeconds(.2f)); // can't do this same frame because old stuff will get touched and new instantiated stuff isnt there yet.
//		Player.inst.SetPlayerLocationForGameStarted();
    }
Пример #21
0
        public void InitializeVideoImage()
        {
            if (_videoImage != null)
            {
                return;
            }

            if (HasThumbnail || HasMoviePicture)
            {
                _videosImageLoadingState = LoadingState.Loaded;

                Task.Run(async() =>
                {
                    await DispatchHelper.InvokeInUIThreadHighPriority(async() =>
                    {
                        VideoImage = await GetBitmap();
                    });
                });
            }
            else if (_videosImageLoadingState == LoadingState.NotLoaded)
            {
                _videosImageLoadingState = LoadingState.Loading;
                Locator.MediaLibrary.GenerateVideoThumbnailAsync(this);
            }
        }
Пример #22
0
        public void UpdateProgress(LoadingState state, int percentage, string substring = null)
        {
            switch (state)
            {
            case LoadingState.ConnectingToServer:
                // Text = "Connecting to server...";
                _textDisplay.TranslationKey = "connect.connecting";
                break;

            case LoadingState.LoadingChunks:
                //  Text = $"Loading chunks...";
                _textDisplay.TranslationKey = _connectingToServer ? "multiplayer.downloadingTerrain" : "menu.loadingLevel";
                break;

            case LoadingState.GeneratingVertices:
                //  Text = $"Building world...";
                _textDisplay.TranslationKey = "menu.generatingTerrain";
                break;

            case LoadingState.Spawning:
                //  Text = $"Getting ready...";
                _textDisplay.TranslationKey = "connect.joining";
                break;
            }

            UpdateProgress(percentage);
            CurrentState = state;
            Percentage   = percentage;
            SubText      = substring;
        }
Пример #23
0
        //Folder/Open
        private void OpenToolStripMenuItem1_Click(Object sender, EventArgs e)
        {
            var openFileDialog = new VistaFolderBrowserDialog();
            var bLaunch        = false;

            openFileDialog.Description = "Select a folder to convert";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                //check if we are inside a GameData folder
                if (FolderLoader.ValidDirectory(openFileDialog.SelectedPath))
                {
                    bLaunch = true;
                }
                else
                {
                    if (MessageBox.Show("This folder does not seems to be inside a GameData folder. Proceed anyway?", "Invalid Directory?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        bLaunch = true;
                    }
                }
            }
            if (bLaunch)
            {
                //switch the loading state to "folder"
                currentLoadingState = LoadingState.Folder;
                //refresh the "folder" container
                loadedFolder = openFileDialog.SelectedPath;
                //show informations about folder
                FolderLoader.RefreshInfo(openFileDialog.SelectedPath, true, true);
            }
            CheckToolStripItems();
            CheckGroupBoxItems();
        }
Пример #24
0
    private void StartUnLoad()
    {
        // _Isloading = true;
        _Action = null;

        _Action = delegate
        {
            C_MonoSingleton <C_SceneMgr> .GetInstance().UnloadSceneAsync(m_UnloadSceneQueue.Dequeue(), "StageLoading", () =>
            {
                UnLoadNextStep();
            });
        };
        // _Action();
        // _StartPreloadRes = false;
        if (!string.IsNullOrEmpty(_UnloadResFile))
        {
            //  _StartPreloadRes = true;
            C_MonoSingleton <PreLoadResMgr> .Instance.ForceUnloadABRes(_UnloadResFile);

            _LoadingState = LoadingState.unload_ab;
        }
        else
        {
            //_StartPreloadRes = false;
            _LoadingState = LoadingState.unload_scene;

            _Action();
        }
    }
        private void UpdateState(LoadingState state)
        {
            Debug("New State: " + state.ToString());

            if (_state != state)
            {
                _state = state;
                switch (state)
                {
                case LoadingState.Constructed:
                    break;

                case LoadingState.StartingLoad:
                    if (!HasContentLoaded)
                    {
                        if (LoadingDisplayOffset.TotalSeconds == 0.0 && _state != LoadingState.Failed)
                        {
                            Debug("Offset seconds of 0, going to loading state");
                            UpdateCover(CoverState.Loading);
                        }
                        else
                        {
                            // UpdateCover(CoverState.Blank); // ? is this necessary ?
                            IntervalDispatcher.BeginInvoke(LoadingDisplayOffset, StartingLoadDelayExpired);
                        }
                    }
                    break;

                case LoadingState.TemplateApplied:
                    UpdateCover(CoverState.Blank);
                    System.Diagnostics.Debug.Assert(IsCovered == true);

                    break;

                case LoadingState.Unknown:
                    break;

                case LoadingState.ContentUncovered:
                    UpdateCover(CoverState.Blank);
                    break;

                case LoadingState.ContentPresenterLoaded:
                case LoadingState.ContentPresenterUnloaded:
                case LoadingState.Failed:
                case LoadingState.ReadyToUncover:
                    break;

                case LoadingState.TimedOut:
                    UpdateCover(CoverState.Timeout);
                    break;

                default:
//#if DEBUG
//                        throw new InvalidOperationException();
//#endif
                    break;
                }
            }
        }
    public override void Initialize()
    {
        LoadingState   loadingState   = new LoadingState();
        StartMenuState startMenuState = new StartMenuState();

        AddState(loadingState);
        AddState(startMenuState);
    }
Пример #27
0
    private void PostCSLoadingState(LoadingState state, float progress = 0f)
    {
        userInf.Clear();
        userInf["state"]    = state;
        userInf["progress"] = progress;

        NotificationCenter.Instance.PostNotification(GameConst.NOTIFY_HANDLE_UI_LOAD_PROCESS, null, userInf);
    }
Пример #28
0
 /// <summary>
 /// Constructor. MUST use graphics device for creating extra textures, and
 ///              using the viewport
 /// </summary>
 /// <param name="theGraphicsDevice"></param>
 public Level(GraphicsDevice theGraphicsDevice, string levelId)
 {
     myGraphicsDevice = theGraphicsDevice;
     loadedState = LoadingState.uninitialized;
     runningState = CompletionState.running;
     myLevelId = levelId;
     deathStrings = new List<string> {"humiliated", "pwned", "destroyed", "demolished", "embarrassed", "O.J. Simpson'ed", "gutted", "fatalatied", "slapped" };
 }
 public SceneController(
     ISceneTransition transition,
     ISceneReference startScene)
 {
     _transition   = transition;
     _currentScene = startScene;
     _loadingState = LoadingState.Idle;
 }
    public override void Initialize() 
    {
        LoadingState loadingState = new LoadingState();
        StartMenuState startMenuState = new StartMenuState();

        AddState(loadingState);
        AddState(startMenuState);
    }
Пример #31
0
    private IState GetStateMachineSwitchState()
    {
        IStateMachine playerControlStateMachine = player.GetComponent <PlayerControlStateMachine>();
        IStateMachine playerStateMachine        = player.GetComponent <PlayerStateMachine>();
        IState        loadingState = new LoadingState(player);

        return(new SwitchStateMachineState(playerControlStateMachine, playerStateMachine, loadingState));
    }
Пример #32
0
 protected virtual string GetPlaceholderText(LoadingState state, KTreeNodes children)
 {
     if (PlaceholderText == null)
     {
         return(null);
     }
     return(PlaceholderText(Children.Parent, state, children));
 }
Пример #33
0
 void DataLoader_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
 {
     if (loadingState != LoadingState.InProgress && e.LoadingState == LoadingState.InProgress)
     {
         GLib.Timeout.Add(ShowProgressbarDelay, new GLib.TimeoutHandler(StartLoadProgress));
     }
     loadingState = e.LoadingState;
 }
Пример #34
0
    public override void _Ready()
    {
        VisualServer.SetDefaultClearColor(Color.Color8(0, 0, 0, 255));

        AddChild(ARVROrigin            = new ARVROrigin());
        ARVROrigin.AddChild(ARVRCamera = new ARVRCamera()
        {
            Current = true,
        });
        ARVROrigin.AddChild(LeftController = new ARVRController()
        {
            ControllerId = 1,
        });
        LeftController.AddChild(GD.Load <PackedScene>("res://OQ_Toolkit/OQ_ARVRController/models3d/OculusQuestTouchController_Left.gltf").Instance());
        ARVROrigin.AddChild(RightController = new ARVRController()
        {
            ControllerId = 2,
        });
        RightController.AddChild(GD.Load <PackedScene>("res://OQ_Toolkit/OQ_ARVRController/models3d/OculusQuestTouchController_Right.gltf").Instance());

        AddChild(new WorldEnvironment()
        {
            Environment = new Godot.Environment()
            {
                BackgroundColor = Color.Color8(0, 0, 0, 255),
                BackgroundMode  = Godot.Environment.BGMode.Color,
            },
        });

        AddChild(DosScreen = new DosScreen()
        {
            GlobalTransform = new Transform(Basis.Identity, new Vector3(0, 0, -2)),
        });

        DosScreen.Screen.WriteLine("Platform detected: " + OS.GetName());

        switch (OS.GetName())
        {
        case "Android":
            Path          = "/storage/emulated/0/";
            ARVRInterface = ARVRServer.FindInterface("OVRMobile");
            State         = PermissionsGranted ? LoadingState.DOWNLOAD_SHAREWARE : LoadingState.ASK_PERMISSION;
            break;

        default:
            ARVRInterface = ARVRServer.FindInterface("OpenVR");
            State         = LoadingState.DOWNLOAD_SHAREWARE;
            break;
        }

        if (ARVRInterface != null && ARVRInterface.Initialize())
        {
            GetViewport().Arvr = true;
        }

        LeftController.Connect("button_pressed", this, nameof(ButtonPressed));
        RightController.Connect("button_pressed", this, nameof(ButtonPressed));
    }
Пример #35
0
 private void bgwProcess_DoWork(object sender, DoWorkEventArgs e)
 {
     LocalizationHelper.SetThreadLocale();
     if (state == LoadingState.Load)
     {
         MoneyDataKeeper.Instance.FilePreLoad();
     }
     else if (state == LoadingState.Activate)
     {
         MoneyDataKeeper.Instance.FileActivate();
     }
     else if (state == LoadingState.Decrypt)
     {
         if (!MoneyDataKeeper.Instance.FileTryDecrypt())
         {
             state = LoadingState.Redecrypt;
         }
     }
 }
Пример #36
0
    void ChangeStates(LoadingState ls)
    {
        m_curState = ls;

        switch(ls)
        {
            case LoadingState.Idle:
                LockPlayer(false);
                break;
            case LoadingState.FadeIn:
                LockPlayer(true);
                break;
            case LoadingState.LoadScene:
                LockPlayer(true);
                break;
            case LoadingState.FadeOut:
                LockPlayer(true);
                break;
        }
    }
Пример #37
0
        void LoadingThread()
        {
            // Border
            myBlankTexture = new Texture2D(myGraphicsDevice, 1, 1);
            myBlankTexture.SetData(new[] { Color.White });

            // load level by parsing XML
            lock (locker)
            {
                myLevelSprites.Clear();
                LevelData levelData = myContent.Load<LevelData>("levels/" + myLevelId);
                foreach (SpriteData curSprite in levelData.sprites)
                {
                    // Loads the sprite
                    MovingSprite dummySprite = new MovingSprite(curSprite.textureName, myGraphicsDevice.Viewport.Width, (collisionTypes)curSprite.obstacleType);
                    dummySprite.LoadContent(myContent);

                    // Set the sprite properties
                    dummySprite.scale = curSprite.scale;
                    dummySprite.color = curSprite.color;
                    dummySprite.position = curSprite.position;
                    dummySprite.repeat = curSprite.repeat;
                    dummySprite.setSpeed(curSprite.gameSpeed);
                    dummySprite.rotation = curSprite.rotation;
                    dummySprite.rotationSpeed = curSprite.rotationSpeed;
                    dummySprite.rotationDirection = curSprite.rotationDirection;
                    dummySprite.Changed += new ChangedEventHandler(catchCollisionPhase);

                    // ****** TEMPORARY!!! Until proper collision detection is implemented ******* /
                    if (myCollidedSprite == null && dummySprite.getCollisionType() == collisionTypes.OBSTACLE)
                        myCollidedSprite = dummySprite;

                    myLevelSprites.Add(dummySprite);
                }

                // Load players
                myPlayer.LoadContent(myContent);
                myPlayer.Changed += new ChangedEventHandler(catchPlayerState);
                if (!playerList.list().Contains(myPlayer))
                    playerList.list().Add(myPlayer);

                loadedState = LoadingState.complete;
            }
        }
Пример #38
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if ((state == LoadingState.Load) || (state == LoadingState.Redecrypt))
     {
         MoneyDataKeeper.Instance.Password = tbPassword.Text;
         state = LoadingState.Decrypt;
         hidePasswordControls();
         bgwProcess.RunWorkerAsync();
     }
 }
Пример #39
0
	void LoginCallback(ILoginResult result)
	{
		Debug.Log("LoginCallback access token: " + Facebook.Unity.AccessToken.CurrentAccessToken.TokenString);		
		if (FB.IsLoggedIn)
		{
			isLogin = true;
			OnLoggedIn();
			loadingState = LoadingState.WAITING_FOR_INITIAL_PLAYER_DATA;
			getFriendLevels();
		}
	}
Пример #40
0
 private void SetInit()
 {
     Util.Log("SetInit");
     enabled = true; // "enabled" is a property inherited from MonoBehaviour
     if (FB.IsLoggedIn)
     {
         Util.Log("Already logged in");
         OnLoggedIn();
         loadingState = LoadingState.WAITING_FOR_INITIAL_PLAYER_DATA;
     }
     else
     {
         loadingState = LoadingState.DONE;
     }
 }
Пример #41
0
 void checkIfUserDataReady()
 {
     Util.Log("checkIfUserDataReady");
     if (loadingState == LoadingState.WAITING_FOR_INITIAL_PLAYER_DATA && haveUserPicture && !string.IsNullOrEmpty(GameStateManager.Username))
     {
       Util.Log("user data ready");
       loadingState = LoadingState.DONE;
     }
 }
Пример #42
0
 private void SetState(LoadingState state, string message) {
     State = state;
     Message = message;
 }
Пример #43
0
 public void ResetGo()
 {
     _animator.SetBool("Start", false);
     _animator.SetBool("Restart", false);
     _animator.SetInteger("Target", 0);
     BroadcastLoadingAnimDone();
     _loadingState = LoadingState.Playing;
     _goScreen = false;
     if (!_isGameplayScene) GameManager.instance.SetGameState(_IntendedGameStateAfterLoading);
 }
Пример #44
0
 public void SetStateMiddle()
 {
     _loadingState = LoadingState.Middle;
 }
Пример #45
0
 private void EnterScreens()
 {
     SetDisplay();
     _loadingState = LoadingState.Enter;
     _animator.SetInteger("Target", UnityEngine.Random.Range(1, 4));
     _delayManager.AddDelay(_minimumLoadTime);
     _displayLoading = true;
     StartCoroutine(ChangeLoadingText());
 }
Пример #46
0
        /// <summary>
        /// Transitions the SavingState through the saving process. 
        /// Handles selecting the storage device, opening the storage container, and executing the save function
        /// </summary>
        private void UpdateLoading()
        {
            switch (loadingState)
            {
                case LoadingState.ReadyToSelectStorageDevice:
            #if XBOX
                    if (!Guide.IsVisible)
            #endif
                    {
                        asyncResult = StorageDevice.BeginShowSelector(playerIndex, null, null);
                        loadingState = LoadingState.SelectingStorageDevice;
                    }
                    break;

                case LoadingState.SelectingStorageDevice:
                    if (asyncResult.IsCompleted)
                    {
                        storageDevice = StorageDevice.EndShowSelector(asyncResult);
                        loadingState = LoadingState.ReadyToOpenStorageContainer;
                    }
                    break;

                case LoadingState.ReadyToOpenStorageContainer:
                    if (storageDevice == null || !storageDevice.IsConnected)
                    {
                        loadingState = LoadingState.ReadyToSelectStorageDevice;
                    }
                    else
                    {
                        asyncResult = storageDevice.BeginOpenContainer("EditorStorageContainer", null, null);
                        loadingState = LoadingState.OpeningStorageContainer;
                    }
                    break;

                case LoadingState.OpeningStorageContainer:
                    if (asyncResult.IsCompleted)
                    {
                        storageContainer = storageDevice.EndOpenContainer(asyncResult);
                        loadingState = LoadingState.ReadyToLoad;
                    }
                    break;

                case LoadingState.ReadyToLoad:
                    if (storageContainer == null)
                    {
                        loadingState = LoadingState.ReadyToOpenStorageContainer;
                    }
                    else
                    {
                        try
                        {
                            Load(filename);
                        }
                        catch (IOException e)
                        {
                            // Replace with in game dialog notifying user of error
                            Console.Out.WriteLine(e.Message);
                        }
                        finally
                        {
                            storageContainer.Dispose();
                            storageContainer = null;
                            loadingState = LoadingState.NotLoading;
                        }
                    }
                    break;
            }
        }
Пример #47
0
 private void bgwProcess_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (state == LoadingState.Load)
     {
         if (MoneyDataKeeper.Instance.FileIsEncrypted())
         {
             showPasswordControls();
         }
         else
         {
             state = LoadingState.Activate;
             bgwProcess.RunWorkerAsync();
         }
     }
     else if (state == LoadingState.Decrypt)
     {
         state = LoadingState.Activate;
         bgwProcess.RunWorkerAsync();
     }
     else if (state == LoadingState.Redecrypt)
     {
         showPasswordControls();
         lblPleaseEnterPassword.ForeColor = Color.Red;
         lblPleaseEnterPassword.Text = Resources.Labels.PasswordIncorrect;
     }
     else if (state == LoadingState.Activate)
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
 public FileLoadingEventArgs(string file, LoadingState state)
 {
     FileName = file;
     State = state;
 }
Пример #49
0
	void checkIfUserDataReady()
	{
		Debug.Log("checkIfUserDataReady");
		if (loadingState == LoadingState.WAITING_FOR_INITIAL_PLAYER_DATA)
		{
			Debug.Log("user data ready");
			loadingState = LoadingState.DONE;
		}
	}
        private void UpdateState(LoadingState state)
        {
            Debug("New State: " + state.ToString());

            if (_state != state)
            {
                _state = state;
                switch (state)
                {
                    case LoadingState.Constructed:
                        break;

                    case LoadingState.StartingLoad:
                        if (!HasContentLoaded)
                        {
                            if (LoadingDisplayOffset.TotalSeconds == 0.0 && _state != LoadingState.Failed)
                            {
                                Debug("Offset seconds of 0, going to loading state");
                                UpdateCover(CoverState.Loading);
                            }
                            else
                            {
                                // UpdateCover(CoverState.Blank); // ? is this necessary ?
                                IntervalDispatcher.BeginInvoke(LoadingDisplayOffset, StartingLoadDelayExpired);
                            }
                        }
                        break;

                    case LoadingState.TemplateApplied:
                        UpdateCover(CoverState.Blank);
                        System.Diagnostics.Debug.Assert(IsCovered == true);

                        break;

                    case LoadingState.Unknown:
                        break;

                    case LoadingState.ContentUncovered:
                        UpdateCover(CoverState.Blank);
                        break;

                    case LoadingState.ContentPresenterLoaded:
                    case LoadingState.ContentPresenterUnloaded:
                    case LoadingState.Failed:
                    case LoadingState.ReadyToUncover:
                        break;

                    case LoadingState.TimedOut:
                        UpdateCover(CoverState.Timeout);
                        break;

                    default:
//#if DEBUG
//                        throw new InvalidOperationException();
//#endif
                        break;
                }
            }
        }
Пример #51
0
 private void PleaseWaitForm_Load(object sender, EventArgs e)
 {
     state = LoadingState.Load;
     bgwProcess.RunWorkerAsync();
 }
Пример #52
0
        private void LoadLevel(ContentManager theContent)
        {
            // Start level loading thread
            loadedState = LoadingState.loading;
            myContent = theContent;
            GameOverTextLarge = myContent.Load<SpriteFont>("Fixedsys_large");
            GameOverTextSmall = myContent.Load<SpriteFont>("Fixedsys_small");

            // Emit signal to let the game know to start loading video
            if (loadingSignal != null)
                loadingSignal(this, true);
            Thread loadLevelThread = new Thread(LoadingThread);
            loadLevelThread.Start();
        }
Пример #53
0
 private bool GoScreen()
 {
     _loadingState = LoadingState.Exit;
     _animator.SetBool("Start", true);
     return true;
 }
 /// <summary>
 /// Sets up a Loadng event with a given starting state
 /// </summary>
 /// <param name="state"></param>
 public LoadingEvent(LoadingState state)
 {
     State = state;
 }