示例#1
0
 public static void Initialize()
 {
     foreach (string file in Content.GetFiles("Content/titles"))
     {
         IEnumerable <XElement> source = XDocument.Load(TitleContainer.OpenStream(file)).Elements((XName)"Title");
         if (source != null)
         {
             XAttribute xattribute1 = source.Attributes((XName)"name").FirstOrDefault <XAttribute>();
             if (xattribute1 != null)
             {
                 DuckTitle duckTitle = new DuckTitle();
                 duckTitle._name = xattribute1.Value;
                 bool flag = false;
                 foreach (XElement element in source.Elements <XElement>())
                 {
                     if (element.Name == (XName)"StatRequirement")
                     {
                         XAttribute statNameAttrib = element.Attributes((XName)"name").FirstOrDefault <XAttribute>();
                         XAttribute xattribute2    = element.Attributes((XName)"value").FirstOrDefault <XAttribute>();
                         if (statNameAttrib != null && xattribute2 != null)
                         {
                             PropertyInfo key = ((IEnumerable <PropertyInfo>) typeof(ProfileStats).GetProperties()).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(x => x.Name == statNameAttrib.Value));
                             if (key != (PropertyInfo)null)
                             {
                                 if (key.GetType() == typeof(float))
                                 {
                                     duckTitle._requirementsFloat.Add(key, Change.ToSingle((object)xattribute2.Value));
                                 }
                                 else if (key.GetType() == typeof(int))
                                 {
                                     duckTitle._requirementsFloat.Add(key, (float)Convert.ToInt32(xattribute2.Value));
                                 }
                                 else
                                 {
                                     duckTitle._requirementsString.Add(key, xattribute2.Value);
                                 }
                             }
                             else
                             {
                                 flag = true;
                                 break;
                             }
                         }
                         else
                         {
                             flag = true;
                             break;
                         }
                     }
                 }
                 if (!flag)
                 {
                     DuckTitle._titles.Add(duckTitle);
                 }
             }
         }
     }
 }
示例#2
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();
 }