public static void InitializeReskins() { MonoMain.loadMessage = "loading new reskins"; List <string> files = new List <string>(GetFiles(Directory.GetCurrentDirectory(), "*.rsk")); foreach (string dir in ModLoader.accessibleMods.Select(x => x?.configuration?.contentDirectory?.Replace('/', '\\')).Where(x => x != null)) { files.AddRange(GetFiles(dir, "*.rsk", false)); } foreach (Team team in files.Select(x => Team.Deserialize(x))) { if (team == null || !team.hasHat || team.hat.texture.height <= ReskinFile.HatHeight || team.hat.texture.width != 64) { continue; } DevConsole.Log("trying to load skin: " + team.name, Color.Green); ReskinFile reskin = tryLoadReskin(team.hat.texture); if (reskin == null) { continue; } string dir = CreateReskinFiles(reskin); ReskinFile file = new ReskinFile(reskin.Hat); file.OtherData.Add(new TextChunk("MD5", reskin.UID)); if (!IsValid(GetReskin(reskinMod.ReskinPath + reskin.UID))) { continue; } if (!hatData.ContainsKey(reskin.UID)) { hatData.Add(reskin.UID, team.customData); } team.customData = file.getHat(team.name + "md5");; file.Hat.Dispose(); reskin.Hat.Dispose(); DevConsole.Log("successfully loaded: " + reskin.UID + "/" + team.name + ", with customdatasize: " + team.customData.Length, Color.Green); Teams.AddExtraTeam(team); } DuckEvents.OnDuckQuack += OnDuckQuack; DuckEvents.OnDuckSpawn += OnDuckSpawned; MonoMain.loadMessage = "loading mods"; }
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(); }