Example #1
0
 private void OnTick(object sender, EventArgs e)
 {
     if (status == SplashState.Opening)
     {
         if (Opacity < 1)
         {
             Opacity += fadeOpacityStep;
         }
         else
         {
             status = SplashState.Opened;
         }
     }
     else if (status == SplashState.Closing)
     {
         if (Opacity > .10)
         {
             Opacity -= fadeOpacityStep;
         }
         else
         {
             status = SplashState.Closed;
         }
     }
     else if (status == SplashState.Closed)
     {
         Ticker.Enabled = false;
         Ticker.Dispose();
         Close();
     }
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     m_activeHitboxes      = new List <Hitbox_Render>();
     m_previousMatchState  = new MatchState();
     m_previousSplashState = new SplashState();
     InitSprites();
 }
Example #3
0
 void Update()
 {
     AudioListener.volume = Mathf.Min(1.0f * Preferences.master_volume, AudioListener.volume + Time.deltaTime * 2.0f * Preferences.master_volume);
     if (state == SplashState.FADE_IN)
     {
         fade_in = Mathf.Min(1.0f, fade_in + Time.deltaTime * 2.0f);
         if (fade_in == 1.0)
         {
             state = SplashState.WAIT;
         }
     }
     if (state == SplashState.FADE_OUT)
     {
         fade_out = Mathf.Min(1.0f, fade_out + Time.deltaTime * 2.0f);
         if (fade_out == 1.0)
         {
             ++cur_slide;
             if (cur_slide == slides.Length)
             {
                 Application.Quit();
                 UnityEngine.SceneManagement.SceneManager.LoadScene("splashscreen");
             }
             state    = SplashState.FADE_IN;
             fade_out = 0.0f;
             fade_in  = 0.0f;
         }
     }
 }
Example #4
0
 private void ENTER_Copyright()
 {
     mCopyrightScreen.SetActive(true);
     mState = SplashState.SCOPYRIGHT;
     sfx_copyright.Play();
     mTime = Time.time;
 }
Example #5
0
        private State GetState(States state)
        {
            State result;

            switch (state)
            {
            case States.SPLASH:
                result = new SplashState(this);
                break;

            case States.GAME:
                result = new GameState(this);
                break;

            case States.PAUSE:
                result = new PauseState(this, CurrentState.StateIdentifier);
                break;

            case States.MAINMENU:
                result = new MainMenuState(this);
                break;

            case States.CREDIT:
                result = new CreditState(this);
                break;

            default:
                result = new FailState(this);
                break;
            }
            return(result);
        }
Example #6
0
 protected GameplayState(Match.SetData _setData) : base()
 {
     m_previousStates       = new List <GameState>();
     m_statesPreviousRounds = new List <List <GameState> >();
     m_setData          = _setData;
     Match              = new MatchState();
     CurrentSplashState = new SplashState();
     m_previousStates.Add(new GameState(_setData.InitData, 0));
     m_previousStates.Add(SetRoundStart());
 }
Example #7
0
    public void RenderSplashSprites(GameState _gameState, MatchState _matchState, SplashState _splashState)
    {
        //check if there is a change
        if (m_previousSplashState.CurrentState != _splashState.CurrentState)
        {
            //1. deactivate previous sprites
            foreach (SpriteRenderPair pair in m_spriteList.SplashSprites)
            {
                pair.Active = false;
                pair.SpriteRenderer.sprite = null;
            }

            //2. activate required sprites
            switch (_splashState.CurrentState)
            {
            case SplashState.State.RoundOver_ShowResult:
                RenderMatchResult(_matchState);
                break;

            case SplashState.State.RoundStart_1:
                m_spriteList.TXT_1.Active = true;
                break;

            case SplashState.State.RoundStart_2:
                m_spriteList.TXT_2.Active = true;
                break;

            case SplashState.State.RoundStart_3:
                m_spriteList.TXT_3.Active = true;
                break;

            case SplashState.State.RoundStart_F:
                m_spriteList.TXT_Foozies.Active = true;
                break;

            case SplashState.State.GameOver:
                m_spriteList.TXT_GameOver.Active  = true;
                m_spriteList.TXT_AnyButton.Active = true;
                break;
            }
            //render what has to be rendered
            foreach (SpriteRenderPair pair in m_spriteList.SplashSprites)
            {
                if (pair.Active)
                {
                    pair.SpriteRenderer.sprite = pair.Sprite;
                }
            }
        }


        m_previousSplashState = new SplashState(_splashState);
    }
Example #8
0
 private void OnFormClosing(object sender, FormClosingEventArgs e)
 {
     if (status == SplashState.Opened)
     {
         if (fadeClose)
         {
             status = SplashState.Closing;
         }
         else
         {
             status = SplashState.Closed;
         }
     }
 }
Example #9
0
    public void RenderScene(GameState _gameState, MatchState _matchState, SplashState _splashState)
    {
        //1. Render Hitboxes
        RenderHitboxes(_gameState);

        //2. Render Effects (hit sparks)

        //3. Render Score, Time, Gauges
        GaugeRenderer.UpdateGaugeTransforms(_gameState);

        //4. Splash situations (match end, round end)
        RenderSplashSprites(_gameState, _matchState, _splashState);

        //5. Labels
        RenderLabels(_gameState, _matchState, _splashState);
    }
Example #10
0
        // Start is called before the first frame update
        private void Start()
        {
            m_gameStateMachine = new GameStateMachine();

            var splash   = new SplashState(this, UIController.Instance.SplashPanel);
            var mainMenu = new MainMenuState(this, UIController.Instance.MainMenuPanel,
                                             UIController.Instance.MainMenuPlayButton);
            var tutorial = new TutorialState(this, UIController.Instance.TutorialPanel,
                                             UIController.Instance.TutorialDoneButton);
            var gameplay = new GamePlayState(this, UIController.Instance.GamePlayPanel);
            var win      = new WinState(this, UIController.Instance.LevelCompletePanel,
                                        UIController.Instance.WinContinueButton);
            var fail = new FailState(this, UIController.Instance.LevelFailPanel,
                                     UIController.Instance.FailContinueButton);

            //Adding Transitions
            At(splash, mainMenu, CanShowMainMenu());
            At(mainMenu, tutorial, CanPlayTutorial());
            At(mainMenu, gameplay, CanPlayGame());
            At(tutorial, gameplay, () => tutorial.HasTutorialFinished);
            At(gameplay, win, GameToWin());
            At(gameplay, fail, GameToFail());
            At(win, mainMenu, WinToMainMenu());



            void At(IState from, IState to, Func <bool> condition) =>
            m_gameStateMachine.AddTransition(from, to, condition);


            //Adding Conditions for Transitions
            Func <bool> CanShowMainMenu() => () =>
            splash.HasSplashEnded;
            Func <bool> CanPlayGame() => () =>
            mainMenu.HasPressedPlay && PlayerPrefs.GetInt(GameConstants.TutorialCompleted, 0) == 1;
            Func <bool> CanPlayTutorial() => () =>
            mainMenu.HasPressedPlay && PlayerPrefs.GetInt(GameConstants.TutorialCompleted, 0) == 0;
            Func <bool> GameToWin() => () => gameplay.HasWon;
            Func <bool> GameToFail() => () => gameplay.HasLost;
            Func <bool> WinToMainMenu() => () => win.HasPressedContinue;


            //SetDefaultState
            m_gameStateMachine.SetState(splash);
        }
Example #11
0
    private void OnGUI()
    {
        Color color = new Color(fade_in, fade_in, fade_in, 1);

        color.r  *= 1.0f - fade_out;
        color.g  *= 1.0f - fade_out;
        color.b  *= 1.0f - fade_out;
        GUI.color = color;
        //GUI.DrawTexture(Rect(0,0,Screen.width, Screen.height),splash_back, ScaleMode.ScaleAndCrop, false);
        float scale = 1.0f + (Mathf.Sin(Time.time * 0.5f) + 1.0f) * 0.1f;

        GUI.DrawTexture(new Rect(Screen.width * (1 - scale) * 0.5f, Screen.height * (1 - scale) * 0.5f, Screen.width * scale, Screen.height * scale), splash_back, ScaleMode.ScaleAndCrop, true);
        GUI.DrawTexture(new Rect(Screen.width * 0.125f, Screen.height * 0.3f - splash_text.height * 0.5f, Screen.width * 0.75f, splash_text.height), splash_text, ScaleMode.ScaleToFit, true);
        color.a   = color.a * (fade_in - 1.6f) * 4.0f;
        GUI.color = color;
        GUI.DrawTexture(new Rect(Screen.width * 0.5f - splash_play.width,
                                 Screen.height * 0.7f - splash_play.height * 0.5f,
                                 splash_play.width * 2.0f,
                                 splash_play.height),
                        splash_play, ScaleMode.ScaleToFit, true);
        GUI.color = new Color(color.r, color.g, color.b, 0.35f * (fade_in - 3.6f) * 4.0f);
        GUI.DrawTexture(new Rect(Screen.width * 0.125f, Screen.height * 0.9f - splash_credits.height * 0.5f, Screen.width * 0.75f, splash_credits.height), splash_credits, ScaleMode.ScaleToFit, true);

        if (state == SplashState.FADE_IN || state == SplashState.WAIT)
        {
            if (Event.current.type == EventType.KeyDown ||
                Event.current.type == EventType.MouseDown)
            {
                state = SplashState.FADE_OUT;
                audiosource_effect.PlayOneShot(stop_sound, Preferences.sound_volume);
                audiosource_music_a.Stop();
                audiosource_music_b.Stop();
            }
        }
        if (fade_out_delay >= 0.2 && state == SplashState.FADE_OUT)
        {
            //UnityEngine.SceneManagement.SceneManager.LoadScene("scene");
            //UnityEngine.SceneManagement.SceneManager.sceneLoaded += SceneLoaded;
            //UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("scene",LoadSceneMode.Additive);
            UnityEngine.SceneManagement.SceneManager.LoadScene("scene");
            state = SplashState.LOADING;
        }
    }
Example #12
0
    // Once the jingle is done, we switch to the next screen.
    private void ENTER_Logo()
    {
        mDebugText.text = "ENTER_Logo has been called";

        mState = SplashState.SLOGO;
        sfx_logo.Play();
        mTime = Time.time;

        // Now is as good a time as any to try to execute the program.
        Process p = new Process();

        p.StartInfo.UseShellExecute = false;
        string path = Application.dataPath + "/PLAYART_CREATION/PlayArtCreator.exe";

        p.StartInfo.FileName       = path;
        p.StartInfo.CreateNoWindow = true;
        p.EnableRaisingEvents      = true;
        p.Exited       += new System.EventHandler(PROC_PlayArtExited);
        mDebugText.text = "About to start the process";
        p.Start();
    }
Example #13
0
    void Start()
    {
        IO_DefPlays.FLOAD_PLAYS();
        IO_PlayList.FLOAD_PLAYS();
        IO_RouteList.FLOAD_ROUTES();
        IO_Settings.FLOAD_SETTINGS();
        IO_ZoneList.FLOAD_ZONES();

        mDebugText.text = "Loading in stuffs";

        // IO_RouteList.FWRITE_ALL_ROUTES_AS_TEXT();
        DeleteOldFilesFromPlayArtDirectories();
        TransferCurrentFormationsAndPlaysIntoPlayArtDirectories();

        mDebugText.text = "Should have transfered text files with formation and plays";

        mState = SplashState.SLOGO;
        mAudioMixer.SetFloat("MASTER_VOLUME", IO_Settings.mSet.lMasterVolume);

        ENTER_Logo();
    }
Example #14
0
    void OnGUI()
    {
        if (cur_slide >= slides.Length)
        {
            return;
        }
        Color color = new Color(1.0f, 1.0f, 1.0f, fade_in * (1.0f - fade_out));

        GUI.color = color;
        Texture tex     = slides[cur_slide];
        float   max_fit = Mathf.Min(Screen.width / (tex.width + 0.0f), Screen.height / (tex.height + 0.0f));

        Debug.Log(max_fit);
        float scale = 1.0f + (Mathf.Sin(Time.time * 0.5f) + 1.0f) * 0.1f;

        scale = max_fit;
        GUI.DrawTexture(new Rect(Screen.width * 0.5f - tex.width * scale * 0.5f,
                                 Screen.height * 0.5f - tex.height * scale * 0.5f,
                                 tex.width * scale,
                                 tex.height * scale),
                        slides[cur_slide], ScaleMode.ScaleToFit, true);

        if (state == SplashState.WAIT)
        {
            if (Event.current.type == EventType.KeyDown ||
                Event.current.type == EventType.MouseDown)
            {
                state = SplashState.FADE_OUT;
                audiosource_effect.PlayOneShot(stop_sound, Preferences.sound_volume);
                //audiosource_music_a.Stop();
                //audiosource_music_b.Stop();
            }
        }

        /*if(fade_out == 1.0){
         *  Application.LoadLevel("splash");
         * }*/
    }
Example #15
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            switch (splashState)
            {
            case SplashState.FadingIn:
                this.Opacity += .05;
                if (this.Opacity == 1.0)
                {
                    splashState     = SplashState.Showing;
                    timer1.Interval = 1000;
                }
                break;

            case SplashState.Showing:
                timer1.Interval = 200;
                progressCount++;

                if (progressCount > 950)
                {
                    progressCount = 100;
                }
                progressBar1.Value = progressCount / 10;
                if (Earth3d.Initialized || Earth3d.HideSplash)
                {
                    splashState     = SplashState.FadingOut;
                    timer1.Interval = 50;
                }
                break;

            case SplashState.FadingOut:
                this.Opacity -= .05;
                if (this.Opacity == 0.0)
                {
                    this.Close();
                }
                break;
            }
        }
Example #16
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            switch(splashState)
            {
                case SplashState.FadingIn:
                    this.Opacity += .05;
                    if (this.Opacity == 1.0)
                    {
                        splashState = SplashState.Showing;
                        timer1.Interval = 1000;
                    }
                    break;
                case SplashState.Showing:
                    timer1.Interval = 200;
                    progressCount++;

                    if (progressCount > 950)
                    {
                        progressCount = 100;
                    }
                    progressBar1.Value = progressCount / 10;
                    if (Earth3d.Initialized || Earth3d.HideSplash)
                    {
                        splashState = SplashState.FadingOut;
                        timer1.Interval = 50;
                    }
                    break;
                case SplashState.FadingOut:
                    this.Opacity -= .05;
                    if (this.Opacity == 0.0)
                    {
                        this.Close();
                    }
                    break;
            }
        }
Example #17
0
        protected override void InitState()
        {
            //**
            SplashState m_SplashState = new SplashState(this);

            m_SplashState.AddTransition("FirstGame", "WelcomeState");
            m_SplashState.AddTransition("SecondGame", "SettingHint");
            AddState(m_SplashState);

            //**
            WelcomeState m_WelcomeState = new WelcomeState(this);

            m_WelcomeState.AddTransition("Enter", "SettingHint");
            m_WelcomeState.AddTransition("Back", "ExitFlowState");
            m_WelcomeState.AddTransition("Buy", "ByState");
            AddState(m_WelcomeState);

            //**
            ExitFlowState m_ExitFlowState = new ExitFlowState(this);

            AddState(m_ExitFlowState);

            //**
            SettingHint m_SettingHint = new SettingHint(this);

            m_SettingHint.AddTransition("HintDown", "DownApp");
            m_SettingHint.AddTransition("SettingEnd", "StateGame");
            m_SettingHint.AddTransition("Ctr", "ControllState");
            m_SettingHint.AddTransition("Usb", "UsbState");
            m_SettingHint.AddTransition("Beacon", "BeaconState");
            m_SettingHint.AddTransition("Back", "ExitFlowState");
            AddState(m_SettingHint);

            //**
            DownApp m_DownApp = new DownApp(this);

            AddState(m_DownApp);

            //**
            StateGame m_StateGame = new StateGame(this);

            m_StateGame.AddTransition("Start", "InPhone");
            AddState(m_StateGame);

            //**
            ControllState m_ControllState = new ControllState(this);

            m_ControllState.AddTransition("Usb", "UsbState");
            m_ControllState.AddTransition("Beacon", "BeaconState");
            m_ControllState.AddTransition("Back", "SettingHint");
            AddState(m_ControllState);

            //**
            UsbState m_UsbState = new UsbState(this);

            m_UsbState.AddTransition("Back", "SettingHint");
            m_UsbState.AddTransition("Ctr", "ControllState");
            m_UsbState.AddTransition("Beacon", "BeaconState");
            AddState(m_UsbState);

            //**
            BeaconState m_BeaconState = new BeaconState(this);

            m_BeaconState.AddTransition("Back", "SettingHint");
            m_BeaconState.AddTransition("Ctr", "ControllState");
            m_BeaconState.AddTransition("Usb", "UsbState");
            AddState(m_BeaconState);

            //**
            InPhone m_InPhone = new InPhone(this);

            AddState(m_InPhone);

            //**
            ByState m_ByState = new ByState(this);

            AddState(m_ByState);
            //**
        }
Example #18
0
 public SplashState(SplashState _other)
 {
     CurrentState    = _other.CurrentState;
     FramesRemaining = _other.FramesRemaining;
 }
Example #19
0
        private IEnumerator Initialize()
        {
            yield return(LauncherConnection.InitializeConnection());

            if (!ApplicationStarter.InitializeAssetManager())
            {
                Log.Error("InitializeAssetManager: misssing AssetReferenceMap", 100, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Main.cs");
                Quit();
            }
            if (!ApplicationStarter.InitializeRuntimeData())
            {
                Log.Error("InitializeAssetManager: missing LocalizedTextData or BootTextCollection", 107, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Main.cs");
                Quit();
            }
            SplashState splashState = new SplashState();

            StateManager.GetDefaultLayer().SetChildState(splashState, 0);
            yield return(ApplicationStarter.ReadBootConfig());

            if (!BootConfig.initialized)
            {
                yield return(GoToCatastrophicFailureState(InitializationFailure.BootConfigInitialisation));

                yield break;
            }
            if (ApplicationConfig.showServerSelection)
            {
                ApplicationConfig.versionCheckResult = VersionChecker.Result.Success;
            }
            else
            {
                string text = ApplicationConfig.configUrl;
                if (string.IsNullOrEmpty(text))
                {
                    text = BootConfig.remoteConfigUrl;
                }
                Log.Info("configUrl=" + text, 136, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Main.cs");
                yield return(ApplicationStarter.ReadRemoteConfig(text));

                if (!ApplicationConfig.initialized)
                {
                    yield return(GoToInitializationFailedState(InitializationFailure.ApplicationConfigInitialisation));

                    yield break;
                }
            }
            ApplicationConfig.PrintConfig();
            if (ApplicationConfig.versionCheckResult == VersionChecker.Result.None)
            {
                yield return(ApplicationStarter.ReadVersion(ApplicationConfig.versionFileUrl));
            }
            if (!ApplicationConfig.IsVersionValid())
            {
                yield return(GoToInitializationFailedState(InitializationFailure.UnvalidVersion));

                yield break;
            }
            this.StartCoroutine(CheckServerStatus());
            if (ApplicationConfig.haapiAllowed)
            {
                HaapiManager.Initialize();
            }
            string bundlesUrl     = ApplicationConfig.bundlesUrl;
            bool   patchAvailable = ApplicationConfig.versionCheckResult == VersionChecker.Result.PatchAvailable;

            yield return(ApplicationStarter.ConfigureAssetManager(bundlesUrl, patchAvailable));

            if (!AssetManager.get_isReady())
            {
                yield return(GoToInitializationFailedState(InitializationFailure.AssetManagerInitialisation));

                yield break;
            }
            if (patchAvailable)
            {
                yield return(ApplicationStarter.CheckPatch());
            }
            yield return(AudioManager.Load());

            PlayerPreferences.InitializeAudioPreference();
            yield return(RuntimeData.Load());

            if (!RuntimeData.isReady)
            {
                yield return(GoToInitializationFailedState(InitializationFailure.RuntimeDataInitialisation));

                yield break;
            }
            ConnectionHandler.Initialize();
            while (!m_serverStatusChecked)
            {
                yield return(null);
            }
            StatesUtility.GotoLoginState();
        }
Example #20
0
        /// <summary>
        /// Allows the splash screen to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // If there is any touch or gesture on the screen, complete the splash screen
            foreach (GestureSample gs in InputHandler.Instance.Taps())
            {
                InputHandler.Instance.Clear();
                Complete = true;
            }

            // Update the splash screen for alpha fading
            switch (state)
            {
                // Fade in the screen
                case SplashState.FadeIn:
                    alpha += 0.05f;
                    if (alpha >= 1)
                        state = SplashState.Display;
                    break;
                // Display normally
                case SplashState.Display:
                    // Create and update timer
                    if (timer == null)
                        timer = new Timer(game, totalTime);
                    timer.Update(gameTime);

                    // Time to fade out?
                    if (timer.IsDone())
                        state = SplashState.FadeOut;
                    break;
                // Fade out screen
                case SplashState.FadeOut:
                    alpha -= 0.05f;
                    if (alpha <= 0)
                        Complete = true;
                    break;
            }

            base.Update(gameTime);
        }
Example #21
0
 public void RenderLabels(GameState _gameState, MatchState _matchState, SplashState _splashState)
 {
     P1_CharName.text = _gameState.P1_CState.GetCharacterName() + " - " + _matchState.P1_Score.ToString();
     P2_CharName.text = _gameState.P2_CState.GetCharacterName() + " - " + _matchState.P2_Score.ToString();
     Timer.text       = (_gameState.RemainingTime / 60).ToString();
 }
Example #22
0
 void SetState(SplashState _state)
 {
     state             = _state;
     m_fStateTimeStart = Time.time;
 }
Example #23
0
 void SetState(SplashState _state)
 {
     state = _state;
     m_fStateTimeStart = Time.time;
 }