示例#1
0
        public List <DuckStory> CalculateStory(List <Profile> p)
        {
            List <DuckStory> duckStoryList = new List <DuckStory>();

            Script.activeNewsStory = this;
            if (p == null || p.Count > 0)
            {
                Script.activeProfile = p[0];
            }
            foreach (ScriptStatement requirement in this._requirements)
            {
                if (requirement.result is bool result && !result)
                {
                    return(duckStoryList);
                }
            }
            if (this._dialogue.Count > 0)
            {
                DuckStory duckStory = new DuckStory()
                {
                    section = this._section,
                    text    = this._dialogue[Rando.Int(this._dialogue.Count - 1)]
                };
                duckStory.text = this.FillString(duckStory.text, p);
                duckStoryList.Add(duckStory);
            }
            foreach (DuckNews subStorey in this._subStories)
            {
                if (subStorey._valueCalculation == null)
                {
                    subStorey._valueCalculation = this._valueCalculation;
                }
                if (subStorey._valueCalculation2 == null)
                {
                    subStorey._valueCalculation2 = this._valueCalculation2;
                }
                if (subStorey._section == NewsSection.None)
                {
                    subStorey._section = this._section;
                }
                if (subStorey._cycle == CycleMode.None)
                {
                    duckStoryList.AddRange((IEnumerable <DuckStory>)subStorey.CalculateStory(p));
                }
                else
                {
                    duckStoryList.AddRange((IEnumerable <DuckStory>)subStorey.CalculateStory());
                }
            }
            return(duckStoryList);
        }
 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 void OnInterview(DuckStory story)
 {
     story.OnStoryBegin -= new DuckStory.OnStoryBeginDelegate(this.OnHotnessStory);
     this._desiredState  = TVState.ShowInterview;
     this._talker.Pause();
 }
 public void OnHotnessEnd(DuckStory story)
 {
     story.OnStoryBegin   -= new DuckStory.OnStoryBeginDelegate(this.OnHotnessEnd);
     this._desiredState    = TVState.ShowNewscaster;
     HighlightLevel._image = (Sprite)null;
 }
 public void OnInterviewImage(DuckStory story)
 {
     story.OnStoryBegin   -= new DuckStory.OnStoryBeginDelegate(this.OnInterviewImage);
     HighlightLevel._image = (Sprite) new SpriteMap("interviewBox", 63, 47);
 }
 public void OnHotnessImage(DuckStory story)
 {
     story.OnStoryBegin   -= new DuckStory.OnStoryBeginDelegate(this.OnHotnessImage);
     HighlightLevel._image = new Sprite("newscast/hotnessImage");
 }