Esempio n. 1
0
 protected override void OnStart()
 {
     Options.Initialize();
     Global.Initialize();
     Teams.Initialize();
     DuckRig.Initialize();
     Unlocks.Initialize();
     ConnectionStatusUI.Initialize();
     Unlocks.CalculateTreeValues();
     Profiles.Initialize();
     Dialogue.Initialize();
     DuckTitle.Initialize();
     News.Initialize();
     Script.Initialize();
     DuckNews.Initialize();
     VirtualBackground.InitializeBack();
     AmmoType.InitializeTypes();
     DestroyType.InitializeTypes();
     VirtualTransition.Initialize();
     Unlockables.Initialize();
     UIInviteMenu.Initialize();
     LevelGenerator.Initialize();
     DuckFile.CompleteSteamCloudInitializate();
     Main.ResetMatchStuff();
     foreach (Profile profile in Profiles.active)
     {
         profile.RecordPreviousStats();
     }
     Main.editor = new DuckGameEditor();
     foreach (string file in DuckFile.GetFiles(Directory.GetCurrentDirectory(), "*.hat"))
     {
         Team t = Team.Deserialize(file);
         if (t != null)
         {
             Teams.AddExtraTeam(t);
         }
     }
     Main.SetPurchaseDetails(9.99f, "USD");
     if (Main.connectID != 0UL)
     {
         NCSteam.inviteLobbyID = Main.connectID;
         Level.current         = (Level) new JoinServer(Main.connectID);
     }
     else
     {
         Level.current = !MonoMain.noIntro ? (Level) new BIOSScreen() : (!MonoMain.startInEditor ? (Level) new TitleScreen() : (Level)Main.editor);
     }
     this._font = new BitmapFont("biosFont", 8);
     Highlights.StartRound();
 }
Esempio n. 2
0
 public static void Initialize()
 {
     foreach (string file in Content.GetFiles("Content/news"))
     {
         IEnumerable <XElement> source1 = XDocument.Load(TitleContainer.OpenStream(file)).Elements((XName)"NewsStory");
         if (source1 != null)
         {
             if (DG.isHalloween)
             {
                 IEnumerable <XElement> source2 = source1.Elements <XElement>((XName)"NewsStoryHalloween");
                 if (source2 != null && source2.Count <XElement>() > 0)
                 {
                     source1 = source2;
                 }
             }
             DuckNews duckNews = DuckNews.Parse(source1.ElementAt <XElement>(0));
             if (duckNews != null)
             {
                 DuckNews._stories.Add(duckNews);
             }
         }
     }
     DuckNews._stories = DuckNews._stories.OrderBy <DuckNews, int>((Func <DuckNews, int>)(x => (int)x._section)).ToList <DuckNews>();
 }
 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");
 }
Esempio n. 4
0
        public static DuckNews Parse(XElement rootElement)
        {
            DuckNews   duckNews1   = new DuckNews();
            XAttribute xattribute1 = rootElement.Attributes((XName)"name").FirstOrDefault <XAttribute>();

            if (xattribute1 != null)
            {
                duckNews1._name = xattribute1.Value;
            }
            foreach (XElement element in rootElement.Elements())
            {
                if (element.Name == (XName)"Section")
                {
                    XAttribute xattribute2 = element.Attributes((XName)"name").FirstOrDefault <XAttribute>();
                    if (xattribute2 != null)
                    {
                        try
                        {
                            duckNews1._section = (NewsSection)Enum.Parse(typeof(NewsSection), xattribute2.Value);
                        }
                        catch
                        {
                            return((DuckNews)null);
                        }
                    }
                }
                else if (element.Name == (XName)"Requirement")
                {
                    Script.activeProfile = Profiles.DefaultPlayer1;
                    duckNews1._requirements.Add(ScriptStatement.Parse(element.Value + " "));
                }
                else if (element.Name == (XName)"Dialogue")
                {
                    XAttribute xattribute2 = element.Attributes((XName)"value").FirstOrDefault <XAttribute>();
                    if (xattribute2 != null)
                    {
                        duckNews1._dialogue.Add(xattribute2.Value);
                    }
                }
                else if (element.Name == (XName)"VALUE")
                {
                    Script.activeProfile        = Profiles.DefaultPlayer1;
                    duckNews1._valueCalculation = ScriptStatement.Parse(element.Value + " ");
                }
                else if (element.Name == (XName)"VALUE2")
                {
                    Script.activeProfile         = Profiles.DefaultPlayer1;
                    duckNews1._valueCalculation2 = ScriptStatement.Parse(element.Value + " ");
                }
                else if (element.Name == (XName)"Cycle")
                {
                    XAttribute xattribute2 = element.Attributes((XName)"value").FirstOrDefault <XAttribute>();
                    if (xattribute2 != null)
                    {
                        duckNews1._cycle = (CycleMode)Enum.Parse(typeof(CycleMode), xattribute2.Value);
                    }
                }
                else if (element.Name == (XName)"SubStory")
                {
                    DuckNews duckNews2 = DuckNews.Parse(element);
                    duckNews1._subStories.Add(duckNews2);
                }
            }
            return(duckNews1);
        }