public override void Initialize()
 {
     if (this._testMode)
     {
         this._endOfHighlights  = true;
         Options.Data.sfxVolume = 0.0f;
         DuckStory duckStory = new DuckStory();
         duckStory.text          = "|SUAVE||RED|John Mallard|WHITE| here dancing|CALM| for you |EXCITED|and wearing ties!";
         HighlightLevel._stories = new List <DuckStory>();
         for (int index = 0; index < 9999; ++index)
         {
             HighlightLevel._stories.Add(duckStory);
         }
     }
     HighlightLevel._cancelSkip = false;
     this._tv       = new Sprite("bigTV");
     this._duck     = new SpriteMap("newsDuck", 140, 100);
     this._duckBeak = new SpriteMap("newsDuckBeak", 140, 100);
     this._tie      = new SpriteMap("ties", 12, 21);
     this._pumpkin  = new Sprite("pump");
     this._pumpkin.CenterOrigin();
     this._newsTable = new Sprite("newsTable");
     this._logo      = new Sprite("duckGameTitle");
     this._logo.CenterOrigin();
     this._background = new Sprite("duckChannelBackground");
     this._blurLayer  = new Layer("BLUR", Layer.HUD.depth + 5, Layer.HUD.camera);
     Layer.Add(this._blurLayer);
     this._blurLayer.effect = Content.Load <Effect>("Shaders/blur");
     this._transition       = new DuckChannelLogo();
     Level.Add((Thing)this._transition);
     this._tl            = new Vec2(30f, 32f);
     this._size          = new Vec2(207f, 141f);
     this._rockImage2    = new Sprite(RockScoreboard.finalImage, 0.0f, 0.0f);
     this._talker        = new Teleprompter(0.0f, 0.0f, this._duck);
     this._talker.active = this._talker.visible = false;
     Level.Add((Thing)this._talker);
     if (HighlightLevel.didSkip)
     {
         this._skip = true;
     }
     if (this._endOfHighlights)
     {
         this._state        = TVState.ShowNewscaster;
         this._desiredState = this._state;
     }
     else
     {
         HighlightLevel._image     = (Sprite)null;
         HighlightLevel.currentTie = Rando.Int(15);
         Music.Play("SportsCap");
         HighlightLevel._stories = DuckNews.CalculateStories();
     }
     this._hotness   = new HotnessAnimation();
     this._tie.frame = HighlightLevel.currentTie;
     for (int index = 0; index < HighlightLevel._stories.Count; index = index - 1 + 1)
     {
         bool flag = HighlightLevel._stories[index].text == "%CUEHIGHLIGHTS%";
         if (HighlightLevel._stories[index].text == "CUE%HOTNESSIMAGE%")
         {
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnHotnessImage);
         }
         if (HighlightLevel._stories[index].text == "CUE%CUEHOTNESS%")
         {
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnHotnessStory);
         }
         if (HighlightLevel._stories[index].text == "CUE%ENDHOTNESS%")
         {
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnHotnessEnd);
         }
         if (HighlightLevel._stories[index].text == "CUE%INTERVIEWIMAGE%")
         {
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnInterviewImage);
         }
         if (HighlightLevel._stories[index].text == "CUE%CUEINTERVIEW%")
         {
             this._interviewIndex = index;
             HighlightLevel._stories[index].OnStoryBegin += new DuckStory.OnStoryBeginDelegate(this.OnInterview);
         }
         if (!flag)
         {
             this._talker.ReadLine(HighlightLevel._stories[index]);
         }
         HighlightLevel._stories.RemoveAt(index);
         if (flag)
         {
             break;
         }
     }
     Vote.OpenVoting("SKIP", "START");
 }
 public override void Initialize()
 {
     this._tv = new Sprite("bigTV");
     Vote.OpenVoting("SKIP", "START");
 }
 public override void Update()
 {
     if (this._testMode)
     {
         this._wait += Maths.IncFrameTimer();
         if (Keyboard.Pressed(Keys.F5) || (double)this._wait > 0.1)
         {
             this._wait = 0.0f;
             try
             {
                 this._tie        = new SpriteMap((Tex2D)ContentPack.LoadTexture2D("tieTest.png"), 64, 64);
                 this._tie.center = new Vec2(26f, 27f);
             }
             catch (Exception ex)
             {
             }
         }
     }
     DuckGame.Graphics.fadeAdd = Lerp.Float(DuckGame.Graphics.fadeAdd, 0.0f, 0.01f);
     if (Main.isDemo && this._skip && !this._firedSkipLogic)
     {
         this._firedSkipLogic = true;
         Vote.CloseVoting();
         HUD.CloseAllCorners();
         this.DoSkip();
     }
     if ((double)DuckGame.Graphics.fade > 0.990000009536743 && !this._skip && Vote.Passed(VoteType.Skip))
     {
         this._skip = true;
     }
     if (this._talker.finished || !HighlightLevel._cancelSkip && this._skip && !Main.isDemo)
     {
         this._done -= 0.04f;
     }
     DuckGame.Graphics.fade = Lerp.Float(DuckGame.Graphics.fade, (double)this._done < 0.0 ? 0.0f : 1f, 0.02f);
     if ((double)DuckGame.Graphics.fade < 0.00999999977648258 && (this._talker.finished || this._skip))
     {
         if (this._endOfHighlights || this._skip)
         {
             Vote.CloseVoting();
             Level.current = (Level) new RockScoreboard(RockScoreboard.returnLevel, ScoreBoardMode.ShowWinner, true);
         }
         else
         {
             Level.current = (Level) new HighlightPlayback(4);
         }
     }
     if (this._state == TVState.ShowPedestals)
     {
         this._waitZoom -= 0.008f;
         if ((double)this._waitZoom < 0.00999999977648258)
         {
             this._waitZoom     = 0.0f;
             this._desiredState = TVState.ShowNewscaster;
         }
     }
     if (this._state == TVState.ShowHotness && this._hotness.ready)
     {
         this._talker.Resume();
     }
     if (this._state == TVState.ShowInterview)
     {
         this._interviewWait -= 0.02f;
         if ((double)this._interviewWait < 0.0 && !this._askedQuestion)
         {
             this._talker.InsertLine(Script.winner() + "! To what do you attribute your success?", this._interviewIndex);
             this._talker.Resume();
             this._askedQuestion = true;
         }
     }
     this._cameraOffset.x = Lerp.Float(this._cameraOffset.x, HighlightLevel._image != null ? 20f : 0.0f, 2f);
     this._talker.active  = this._talker.visible = this._state != TVState.ShowPedestals;
     if (this._state == this._desiredState)
     {
         return;
     }
     this._talker.active = false;
     this._transition.PlaySwipe();
     if (!this._transition.doTransition)
     {
         return;
     }
     this._state = this._desiredState;
 }
Пример #4
0
 public override void Initialize()
 {
     Vote.ClearVotes();
     if (this.level == "RANDOM")
     {
         this._randomLevel = LevelGenerator.MakeLevel(seed: this.seed);
         this.seed         = this._randomLevel.seed;
     }
     base.Initialize();
     if (Network.isActive)
     {
         Level.core.gameInProgress = true;
     }
     if (this._randomLevel != null)
     {
         this._randomLevel.LoadParts(0.0f, 0.0f, (Level)this, this.seed);
         List <SpawnPoint> source1 = new List <SpawnPoint>();
         foreach (SpawnPoint spawnPoint in this.things[typeof(SpawnPoint)])
         {
             source1.Add(spawnPoint);
         }
         if (source1.Count == 0)
         {
             Level.current = (Level) new GameLevel("RANDOM");
             return;
         }
         List <SpawnPoint> chosenSpawns = new List <SpawnPoint>();
         for (int index = 0; index < 4; ++index)
         {
             if (chosenSpawns.Count == 0)
             {
                 chosenSpawns.Add(source1.ElementAt <SpawnPoint>(Rando.Int(source1.Count - 1)));
             }
             else
             {
                 IOrderedEnumerable <SpawnPoint> source2 = source1.OrderByDescending <SpawnPoint, int>((Func <SpawnPoint, int>)(x =>
                 {
                     int num = 9999999;
                     foreach (Transform transform in chosenSpawns)
                     {
                         num = (int)Math.Min((transform.position - x.position).length, (float)num);
                     }
                     return(num);
                 }));
                 chosenSpawns.Add(source2.First <SpawnPoint>());
             }
         }
         foreach (SpawnPoint spawnPoint in source1)
         {
             if (!chosenSpawns.Contains(spawnPoint))
             {
                 Level.Remove((Thing)spawnPoint);
             }
         }
         foreach (Thing thing in this.things)
         {
             if (Network.isActive && thing.isStateObject)
             {
                 GhostManager.context.MakeGhost(thing, initLevel: true);
                 thing.ghostType = Editor.IDToType[thing.GetType()];
             }
         }
         PyramidBackground pyramidBackground = new PyramidBackground(0.0f, 0.0f);
         pyramidBackground.visible = false;
         Level.Add((Thing)pyramidBackground);
         base.Initialize();
     }
     this.things.RefreshState();
     if (this._mode == null)
     {
         this._mode = (GameMode) new DM(this._validityTest, this._editorTestMode);
     }
     this._mode.DoInitialize();
     if (!Network.isServer)
     {
         return;
     }
     foreach (Duck prepareSpawn in this._mode.PrepareSpawns())
     {
         prepareSpawn.localSpawnVisible = false;
         prepareSpawn.immobilized       = true;
         Level.Add((Thing)prepareSpawn);
     }
 }