Exemple #1
0
        public override void Update(GameTime gameTime)
        {
            float time = (float)gameTime.ElapsedGameTime.Ticks / 100000;

            switch (state)
            {
            case LogoState.One:
                if (allTime > 100)
                {
                    state = LogoState.Two;
                }
                break;
            }
            EngineLogo(time);
            for (int particle = 0; particle < particles.Count; particle++)
            {
                particles[particle].Update(gameTime);
                if (particles[particle].Size <= 0 ||
                    particles[particle].TTL <= 0)
                {
                    particles.RemoveAt(particle);
                    particle--;
                }
            }
        }
 public override void Initialize()
 {
     mCamera    = new Camera();
     State      = LogoState.GA_FadeIn;
     Visibility = new SteppingProgress(1.5f);
     IdleTimer  = new SteppingProgress(4f);
 }
    void Awake()
    {
        logoState = LogoState.WaitFade;

        #if UNITY_EDITOR
            timerLength = 0f;
        #elif UNITY_ANDROID
            timerLength = 0f;
        #elif UNITY_IPHONE
            timerLength = 3.5f;
        #endif

        timer = 0;

        backgroundImage = GameObject.Find("Background").GetComponent<RawImage>();
        backgroundColor = backgroundImage.color;

        //backgroundImage.color = new Color(ba)

        logoImage = GameObject.Find("Logo").GetComponent<RawImage>();
        logoColor = logoImage.color;

        logoImage.color = new Color(logoColor.r, logoColor.g, logoColor.b, 0f);

        GameObject.Find("AdColonyAdManager").GetComponent<AdColonyManager>().Initialize();
    }
    public void PalyLogoTexture(CallbackEnvet logoAllIn, CallbackEnvet logoAllOut)
    {
        gameObject.SetActive(true);
        mBlackTexture.enabled = true;
        mProcessUI.SetActive(false);
        e_LogoAllIn              = logoAllIn;
        e_LogoAllOut             = logoAllOut;
        mLogoTexture.mainTexture = Resources.Load("Texture2d/Tex/leibang_intro_logo") as Texture2D;
        tempTime = 0;
//		mBlackTexture.enabled =false;
        mMaskUI.gameObject.SetActive(true);
        mLogoState = LogoState.LogoIn;
    }
        public override void Update()
        {
            switch (State)
            {
            case LogoState.GA_FadeIn:
                Visibility.StepForward();
                if (Visibility.Complete)
                {
                    State = LogoState.GA_Idle;
                }
                break;

            case LogoState.GA_Idle:
                IdleTimer.StepForward();
                IdleTimer.StepForward();
                if (IdleTimer.Complete)
                {
                    IdleTimer.Reset();
                    State = LogoState.GA_FadeOut;
                }
                break;

            case LogoState.GA_FadeOut:
                Visibility.StepBackward();
                if (Visibility.Progress <= 0f)
                {
                    State = LogoState.Fables_FadeIn;
                }
                break;

            case LogoState.Fables_FadeIn:
                Visibility.StepForward();
                if (Visibility.Complete)
                {
                    State = LogoState.Fables_Idle;
                }
                break;

            case LogoState.Fables_Idle:
                IdleTimer.StepForward();
                if (IdleTimer.Complete)
                {
                    IdleTimer.Reset();
                    State = LogoState.Fables_FadeOut;
                }
                break;

            case LogoState.Fables_FadeOut:
                Visibility.StepBackward();
                if (Visibility.Progress <= 0f)
                {
                    SceneManager.Instance.SetCurrentSceneTo("Menu");
                }
                break;
            }
            if (InputHelper.Player1.InputJustPressed(InputHelper.mDebug))
            {
                Visibility.Reset();
                IdleTimer.Reset(true);
                SceneManager.Instance.SetCurrentSceneTo("Menu");
            }
        }
    void Update()
    {
        if (async == null)
        {
            LoadAsync(1);
        }

        switch (logoState)
        {
            //----------------------------------------
            case LogoState.WaitFade:

                timer += Time.deltaTime;

                if (timer >= timerLength)
                {
                    timer = 1.5f;
                    timerLength = 1.5f;
                    logoState = LogoState.FadeBackgroundOut;
                }
                break;
            case LogoState.FadeBackgroundOut:

                timer -= Time.deltaTime;

                float imgAlpha = (timer / timerLength);

                if (imgAlpha <= 0)
                {
                    imgAlpha = 0;
                }

                backgroundImage.color = new Color(backgroundColor.r, backgroundColor.g, backgroundColor.b, imgAlpha);

                if (timer <= 0)
                {
                    timer = 0;
                    timerLength = .75f;
                    logoState = LogoState.WaitFadeIn;
                }

                break;
            case LogoState.WaitFadeIn:
                timer += Time.deltaTime;

                if (timer >= timerLength)
                {
                    timer = 0;
                    timerLength = .75f;
                    logoState = LogoState.FadeIn;
                }
                break;
            case LogoState.FadeIn:

                timer += Time.deltaTime;

                imgAlpha = (timer / timerLength);
                if (imgAlpha >= 1)
                {
                    imgAlpha = 1;
                }

                logoImage.color = new Color(logoColor.r, logoColor.g, logoColor.b, imgAlpha);

                if (timer >= timerLength)
                {
                    timer = 0;
                    timerLength = 1.5f;
                    logoState = LogoState.Hold;
                }
                break;
            case LogoState.Hold:
                timer += Time.deltaTime;

                if (async != null)
                {
                    if (async.progress >= .9f && timer >= timerLength)
                    {
                        timer = .75f;
                        timerLength = .75f;
                        logoState = LogoState.FadeOut;
                    }
                }
                break;
            case LogoState.FadeOut:
                timer -= Time.deltaTime;

                imgAlpha = (timer / timerLength);
                if (imgAlpha <= 0)
                {
                    imgAlpha = 0;
                }

                logoImage.color = new Color(logoColor.r, logoColor.g, logoColor.b, imgAlpha);

                if (timer <= 0)
                {
                    async.allowSceneActivation = true;
                    logoState = LogoState.WaitFade;
                }
                break;
        }
    }
Exemple #7
0
        public void EngineLogo(float time)
        {
            for (int a = 0; a < 1; a++)
            {
                Vector4 color    = new Vector4(1f, 1f, (float)random.NextDouble(), 1);
                float   size     = (float)TestGame.Width / 1600;
                Vector2 velocity = Vector2.Zero;
                float   angleVel = 0;
                float   angle    = 0;
                int     ttl      = 2;
                float   sizeVel  = 0;
                float   alphaVel = 0;
                if (allTime < 100)
                {
                    size = (float)Math.Pow(allTime / 100, 2) * TestGame.Width / 1600;
                }
                Vector2 position = new Vector2(TestGame.Width / 2, TestGame.Height / 5);

                GenerateNewParticle(particleTexture, position, velocity, angle, angleVel, color, size, ttl, sizeVel, alphaVel, Particle.Type.Effect, BlendState.Additive);
            }
            switch (state)
            {
            case LogoState.One:
                allTime += time;
                break;

            case LogoState.Two:
            {
                state = LogoState.Three;
                for (int a = 1; a < 6; a++)
                {
                    float   size     = (float)TestGame.Width / 1600;
                    Vector2 velocity = Vector2.Zero;
                    float   ttl      = 500f / time;
                    float   sizeVel  = time / 300 * a;
                    float   alphaVel = time / 300 * (7 - a);
                    Vector4 color    = new Vector4(1f, 1f, 1f, 1f);
                    Vector2 position = new Vector2(TestGame.Width / 2, TestGame.Height / 5);

                    GenerateNewParticle(particleTexture, position, velocity, 0, 0, color, size, ttl, sizeVel, alphaVel, Particle.Type.Effect, BlendState.Additive);
                }
                allTime += time;
                break;
            }

            case LogoState.Three:
            {
                int t = (int)(allTime / 10);
                allTime += time;
                if ((int)(allTime / 10) > t)
                {
                    for (int a = 0; a < 5; a++)
                    {
                        Vector2 velocity = AngleToV2((float)-Math.PI / 2, (float)random.NextDouble() * 9 * time);
                        float   size     = (float)TestGame.Width / (float)sparkTexture.Width / 100;
                        Vector4 color    = new Vector4(1f, 1f, 1f, 1f);
                        float   ttl      = 50f / time;
                        float   sizeVel  = 0;
                        float   alphaVel = 0;
                        float   k        = (float)TestGame.Width / 1600 * particleTexture.Width * 0.95f;
                        Vector2 position = new Vector2((float)((TestGame.Width - k) / 2 + random.NextDouble() * k), TestGame.Height * 0.2f);

                        GenerateNewParticle(sparkTexture, position, velocity, 0, 0, color, size, ttl, sizeVel, alphaVel, Particle.Type.Effect, BlendState.Additive);
                    }
                }
                break;
            }
            }
        }
Exemple #8
0
 public Logo(Texture2D texture, Texture2D sparkTexture)
 {
     this.sparkTexture    = sparkTexture;
     this.particleTexture = texture;
     this.state           = LogoState.One;
 }
    // Update is called once per frame
    void Update()
    {
        if (isStarLoad)
        {
            tempTime += Time.deltaTime;
            mLoadSpr.transform.rotation = Quaternion.Euler(0, 0, (int)(tempTime / 0.025f) * -14.4f);
        }
        else if (isBeginScence)
        {
//			tempTime += Time.deltaTime;
            mBlackTexture.alpha = Mathf.Clamp01(1 - tempTime / mWaitTime);

            if (tempTime >= mWaitTime)
            {
                isBeginScence = false;
                mMaskUI.SetActive(false);
                gameObject.SetActive(false);

                //lz-2016.06.23 场景加载完成恢复声音
                AudioListener.pause = false;
                if (e_BeginScenceOK != null)
                {
                    e_BeginScenceOK();
                    e_BeginScenceOK = null;
                }
            }

            tempTime += Time.deltaTime;
        }

        else if (isEndScence)
        {
            tempTime           += Time.deltaTime;
            mBlackTexture.alpha = Mathf.Clamp01(tempTime / mWaitTime);


            if (tempTime >= mWaitTime)
            {
                isEndScence = false;
                if (e_EndScenceOK != null)
                {
                    e_EndScenceOK();
                    e_EndScenceOK = null;
                }
            }
        }
        else
        {
            switch (mLogoState)
            {
            case LogoState.LogoIn:
                if (!mMaskUI.gameObject.activeSelf)
                {
                    mMaskUI.gameObject.SetActive(true);
                }
                mBlackTexture.alpha = 1f;
                mLogoTexture.alpha  = tempTime / mLogoFadeTime;
                tempTime           += Time.deltaTime;
                if (tempTime > mLogoFadeTime)
                {
                    if (e_LogoAllIn != null)
                    {
                        e_LogoAllIn();
                        e_LogoAllIn = null;
                    }
                    mLogoState = LogoState.Logo;
                    tempTime   = Time.realtimeSinceStartup;
                }
                break;

            case LogoState.Logo:
                mBlackTexture.alpha = 1f;
                mLogoTexture.alpha  = 1f;
                if (Time.realtimeSinceStartup - tempTime > mLogoShowTime)
                {
                    mLogoState = LogoState.LogoOut;
                    tempTime   = 0;
                }
                break;

            case LogoState.LogoOut:
                mBlackTexture.alpha = 1f;
                mLogoTexture.alpha  = 1f - tempTime / mLogoFadeTime;
                tempTime           += Time.deltaTime;
                if (tempTime > mLogoFadeTime)
                {
                    if (e_LogoAllOut != null)
                    {
                        e_LogoAllOut();
                        e_LogoAllOut = null;
                    }
                    mMaskUI.gameObject.SetActive(false);
                    tempTime = 0;
                    mLogoTexture.mainTexture = null;
                    mLogoState = LogoState.Null;
                }
                break;

            default:
                break;
            }
        }
    }
 void  Awake()
 {
     mInstance  = this;
     mLogoState = LogoState.Null;
     GameObject.DontDestroyOnLoad(gameObject);
 }