public override void UpdateWhenCurrentLocation(GameTime time)
        {
            base.UpdateWhenCurrentLocation(time);
            if (this.restoreAreaTimer > 0)
            {
                int restoreAreaTimer = this.restoreAreaTimer;
                this.restoreAreaTimer = this.restoreAreaTimer - time.ElapsedGameTime.Milliseconds;
                switch (this.restoreAreaPhase)
                {
                case 0:
                    if (this.restoreAreaTimer > 0)
                    {
                        break;
                    }
                    this.restoreAreaTimer = 3000;
                    this.restoreAreaPhase = 1;
                    Game1.player.faceDirection(2);
                    Game1.player.jump();
                    Game1.player.jitterStrength = 1f;
                    Game1.player.showFrame(94, false);
                    break;

                case 1:
                    if (Game1.random.NextDouble() < 0.4)
                    {
                        Vector2 positionInThisRectangle = Utility.getRandomPositionInThisRectangle(this.getAreaBounds(this.restoreAreaIndex), Game1.random);
                        Junimo  junimo = new Junimo(positionInThisRectangle * (float)Game1.tileSize, this.restoreAreaIndex, true);
                        if (!this.isCollidingPosition(junimo.GetBoundingBox(), Game1.viewport, (Character)junimo))
                        {
                            this.characters.Add((NPC)junimo);
                            this.temporarySprites.Add(new TemporaryAnimatedSprite(Game1.random.NextDouble() < 0.5 ? 5 : 46, positionInThisRectangle * (float)Game1.tileSize + new Vector2((float)(Game1.tileSize / 4), (float)(Game1.tileSize / 4)), Color.White, 8, false, 100f, 0, -1, -1f, -1, 0)
                            {
                                layerDepth = 1f
                            });
                            Game1.playSound("tinyWhip");
                        }
                    }
                    if (this.restoreAreaTimer <= 0)
                    {
                        this.restoreAreaTimer = 999999;
                        this.restoreAreaPhase = 2;
                        Game1.screenGlowOnce(Color.White, true, 0.005f, 1f);
                        if (Game1.soundBank != null)
                        {
                            this.buildUpSound = Game1.soundBank.GetCue("wind");
                            this.buildUpSound.SetVariable("Volume", 0.0f);
                            this.buildUpSound.SetVariable("Frequency", 0.0f);
                            this.buildUpSound.Play();
                        }
                        Game1.player.jitterStrength = 2f;
                        Game1.player.stopShowingFrame();
                    }
                    Game1.drawLighting = false;
                    break;

                case 2:
                    if (this.buildUpSound != null)
                    {
                        this.buildUpSound.SetVariable("Volume", Game1.screenGlowAlpha * 150f);
                        this.buildUpSound.SetVariable("Frequency", Game1.screenGlowAlpha * 150f);
                    }
                    if ((double)Game1.screenGlowAlpha >= (double)Game1.screenGlowMax)
                    {
                        this.messageAlpha = this.messageAlpha + 0.008f;
                        this.messageAlpha = Math.Min(this.messageAlpha, 1f);
                    }
                    if ((double)Game1.screenGlowAlpha == (double)Game1.screenGlowMax && this.restoreAreaTimer > 5200)
                    {
                        this.restoreAreaTimer = 5200;
                    }
                    if (this.restoreAreaTimer < 5200 && Game1.random.NextDouble() < (double)(5200 - this.restoreAreaTimer) / 10000.0)
                    {
                        Game1.playSound(Game1.random.NextDouble() < 0.5 ? "dustMeep" : "junimoMeep1");
                    }
                    if (this.restoreAreaTimer > 0)
                    {
                        break;
                    }
                    this.restoreAreaTimer = 2000;
                    this.restoreAreaPhase = 3;
                    Game1.screenGlowHold  = false;
                    this.loadArea(this.restoreAreaIndex, true);
                    if (this.buildUpSound != null)
                    {
                        this.buildUpSound.Stop(AudioStopOptions.Immediate);
                    }
                    Game1.playSound("wand");
                    Game1.changeMusicTrack("junimoStarSong");
                    Game1.playSound("woodyHit");
                    this.messageAlpha = 0.0f;
                    Game1.flashAlpha  = 1f;
                    Game1.player.stopJittering();
                    for (int index = this.characters.Count - 1; index >= 0; --index)
                    {
                        if (this.characters[index] is Junimo && (this.characters[index] as Junimo).temporaryJunimo)
                        {
                            this.characters.RemoveAt(index);
                        }
                    }
                    Game1.drawLighting = true;
                    break;

                case 3:
                    if (restoreAreaTimer > 1000 && this.restoreAreaTimer <= 1000)
                    {
                        Junimo junimoForArea = this.getJunimoForArea(this.restoreAreaIndex);
                        if (junimoForArea != null)
                        {
                            junimoForArea.position = Utility.getRandomAdjacentOpenTile(Game1.player.getTileLocation()) * (float)Game1.tileSize;
                            int num;
                            for (num = 0; this.isCollidingPosition(junimoForArea.GetBoundingBox(), Game1.viewport, (Character)junimoForArea) && num < 20; ++num)
                            {
                                junimoForArea.position = Utility.getRandomPositionInThisRectangle(this.getAreaBounds(this.restoreAreaIndex), Game1.random);
                            }
                            if (num < 20)
                            {
                                junimoForArea.fadeBack();
                                junimoForArea.returnToJunimoHutToFetchStar((GameLocation)this);
                            }
                        }
                    }
                    if (this.restoreAreaTimer > 0)
                    {
                        break;
                    }
                    Game1.freezeControls = false;
                    break;
                }
            }
            else
            {
                if (Game1.activeClickableMenu != null || this.junimoNotesViewportTargets == null || (this.junimoNotesViewportTargets.Count <= 0 || Game1.isViewportOnCustomPath()))
                {
                    return;
                }
                this.setViewportToNextJunimoNoteTarget();
            }
        }
Exemple #2
0
        // Token: 0x060010CA RID: 4298 RVA: 0x00157770 File Offset: 0x00155970
        public override void UpdateWhenCurrentLocation(GameTime time)
        {
            base.UpdateWhenCurrentLocation(time);
            if (this.restoreAreaTimer > 0)
            {
                int old = this.restoreAreaTimer;
                this.restoreAreaTimer -= time.ElapsedGameTime.Milliseconds;
                switch (this.restoreAreaPhase)
                {
                case 0:
                    if (this.restoreAreaTimer <= 0)
                    {
                        this.restoreAreaTimer = 3000;
                        this.restoreAreaPhase = 1;
                        Game1.player.faceDirection(2);
                        Game1.player.jump();
                        Game1.player.jitterStrength = 1f;
                        Game1.player.showFrame(94, false);
                        return;
                    }
                    break;

                case 1:
                    if (Game1.random.NextDouble() < 0.4)
                    {
                        Vector2 v = Utility.getRandomPositionInThisRectangle(this.getAreaBounds(this.restoreAreaIndex), Game1.random);
                        Junimo  i = new Junimo(v * (float)Game1.tileSize, this.restoreAreaIndex, true);
                        if (!base.isCollidingPosition(i.GetBoundingBox(), Game1.viewport, i))
                        {
                            this.characters.Add(i);
                            this.temporarySprites.Add(new TemporaryAnimatedSprite((Game1.random.NextDouble() < 0.5) ? 5 : 46, v * (float)Game1.tileSize + new Vector2((float)(Game1.tileSize / 4), (float)(Game1.tileSize / 4)), Color.White, 8, false, 100f, 0, -1, -1f, -1, 0)
                            {
                                layerDepth = 1f
                            });
                            Game1.playSound("tinyWhip");
                        }
                    }
                    if (this.restoreAreaTimer <= 0)
                    {
                        this.restoreAreaTimer = 999999;
                        this.restoreAreaPhase = 2;
                        Game1.screenGlowOnce(Color.White, true, 0.005f, 1f);
                        if (Game1.soundBank != null)
                        {
                            this.buildUpSound = Game1.soundBank.GetCue("wind");
                            this.buildUpSound.SetVariable("Volume", 0f);
                            this.buildUpSound.SetVariable("Frequency", 0f);
                            this.buildUpSound.Play();
                        }
                        Game1.player.jitterStrength = 2f;
                        Game1.player.stopShowingFrame();
                    }
                    Game1.drawLighting = false;
                    return;

                case 2:
                    if (this.buildUpSound != null)
                    {
                        this.buildUpSound.SetVariable("Volume", Game1.screenGlowAlpha * 150f);
                        this.buildUpSound.SetVariable("Frequency", Game1.screenGlowAlpha * 150f);
                    }
                    if (Game1.screenGlowAlpha >= Game1.screenGlowMax)
                    {
                        this.messageAlpha += 0.008f;
                        this.messageAlpha  = Math.Min(this.messageAlpha, 1f);
                    }
                    if (Game1.screenGlowAlpha == Game1.screenGlowMax && this.restoreAreaTimer > 5200)
                    {
                        this.restoreAreaTimer = 5200;
                    }
                    if (this.restoreAreaTimer < 5200 && Game1.random.NextDouble() < (double)((float)(5200 - this.restoreAreaTimer) / 10000f))
                    {
                        Game1.playSound((Game1.random.NextDouble() < 0.5) ? "dustMeep" : "junimoMeep1");
                    }
                    if (this.restoreAreaTimer <= 0)
                    {
                        this.restoreAreaTimer = 2000;
                        this.restoreAreaPhase = 3;
                        Game1.screenGlowHold  = false;
                        this.loadArea(this.restoreAreaIndex, true);
                        if (this.buildUpSound != null)
                        {
                            this.buildUpSound.Stop(AudioStopOptions.Immediate);
                        }
                        Game1.playSound("wand");
                        Game1.changeMusicTrack("junimoStarSong");
                        Game1.playSound("woodyHit");
                        this.messageAlpha = 0f;
                        Game1.flashAlpha  = 1f;
                        Game1.player.stopJittering();
                        for (int j = this.characters.Count - 1; j >= 0; j--)
                        {
                            if (this.characters[j] is Junimo && (this.characters[j] as Junimo).temporaryJunimo)
                            {
                                this.characters.RemoveAt(j);
                            }
                        }
                        Game1.drawLighting = true;
                        return;
                    }
                    break;

                case 3:
                    if (old > 1000 && this.restoreAreaTimer <= 1000)
                    {
                        Junimo k = this.getJunimoForArea(this.restoreAreaIndex);
                        if (k != null)
                        {
                            k.position = Utility.getRandomAdjacentOpenTile(Game1.player.getTileLocation()) * (float)Game1.tileSize;
                            int iter = 0;
                            while (base.isCollidingPosition(k.GetBoundingBox(), Game1.viewport, k) && iter < 20)
                            {
                                k.position = Utility.getRandomPositionInThisRectangle(this.getAreaBounds(this.restoreAreaIndex), Game1.random);
                                iter++;
                            }
                            if (iter < 20)
                            {
                                k.fadeBack();
                                k.returnToJunimoHutToFetchStar(this);
                            }
                        }
                    }
                    if (this.restoreAreaTimer <= 0)
                    {
                        Game1.freezeControls = false;
                        return;
                    }
                    break;

                default:
                    return;
                }
            }
            else if (Game1.activeClickableMenu == null && this.junimoNotesViewportTargets != null && this.junimoNotesViewportTargets.Count > 0 && !Game1.isViewportOnCustomPath())
            {
                this.setViewportToNextJunimoNoteTarget();
            }
        }