2018-12-30 18:00:05 +08:00
|
|
|
using System.Collections.Generic;
|
2018-12-30 13:01:20 +08:00
|
|
|
using System.IO;
|
2017-09-13 02:20:18 +08:00
|
|
|
using StardewModdingAPI;
|
2019-12-07 05:31:10 +08:00
|
|
|
using StardewValley;
|
2018-06-13 14:25:36 +08:00
|
|
|
using StardustCore.UIUtilities;
|
2018-03-30 20:46:24 +08:00
|
|
|
using StardustCore.UIUtilities.SpriteFonts;
|
2017-07-14 11:27:48 +08:00
|
|
|
|
2017-09-05 19:13:42 +08:00
|
|
|
namespace StardustCore
|
2017-07-14 11:27:48 +08:00
|
|
|
{
|
2017-09-05 19:13:42 +08:00
|
|
|
public class ModCore : Mod
|
2017-07-14 11:27:48 +08:00
|
|
|
{
|
2017-09-12 09:35:31 +08:00
|
|
|
public static IModHelper ModHelper;
|
|
|
|
public static IMonitor ModMonitor;
|
2018-08-09 04:18:51 +08:00
|
|
|
public static IManifest Manifest;
|
2018-12-30 13:01:20 +08:00
|
|
|
public static TextureManager TextureManager;
|
2018-08-09 04:18:51 +08:00
|
|
|
public static Dictionary<string, TextureManager> TextureManagers;
|
|
|
|
|
2018-08-21 04:53:56 +08:00
|
|
|
public ModConfig config;
|
|
|
|
|
2018-02-06 17:27:28 +08:00
|
|
|
public static string ContentDirectory;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>The mod entry point, called after the mod is first loaded.</summary>
|
|
|
|
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
2017-09-12 09:35:31 +08:00
|
|
|
public override void Entry(IModHelper helper)
|
|
|
|
{
|
2018-12-30 13:01:20 +08:00
|
|
|
ModHelper = this.Helper;
|
|
|
|
ModMonitor = this.Monitor;
|
|
|
|
Manifest = this.ModManifest;
|
2018-12-16 12:54:58 +08:00
|
|
|
|
2017-11-17 15:07:30 +08:00
|
|
|
IlluminateFramework.Colors.initializeColors();
|
2018-08-14 03:41:11 +08:00
|
|
|
ContentDirectory = "Content";
|
|
|
|
if (!Directory.Exists(ContentDirectory)) Directory.CreateDirectory(Path.Combine(ModHelper.DirectoryPath, "Content"));
|
2018-03-30 20:46:24 +08:00
|
|
|
SpriteFonts.initialize();
|
2018-06-13 09:42:31 +08:00
|
|
|
|
2018-08-09 04:18:51 +08:00
|
|
|
TextureManagers = new Dictionary<string, TextureManager>();
|
2019-07-16 17:09:42 +08:00
|
|
|
TextureManager = new TextureManager("StardustCore");
|
|
|
|
TextureManager.addTexture("Test1", new Texture2DExtended(ModCore.ModHelper,Manifest,Path.Combine("Content", "Graphics", "MultiTest", "Test1.png")));
|
|
|
|
TextureManager.addTexture("Test2", new Texture2DExtended(ModCore.ModHelper,Manifest, Path.Combine("Content", "Graphics", "MultiTest", "Test2.png")));
|
|
|
|
TextureManager.addTexture("Test3", new Texture2DExtended(ModCore.ModHelper, Manifest,Path.Combine("Content", "Graphics", "MultiTest", "Test3.png")));
|
2018-12-30 13:01:20 +08:00
|
|
|
TextureManagers.Add(this.ModManifest.UniqueID, TextureManager);
|
2018-12-16 12:54:58 +08:00
|
|
|
|
2019-12-07 05:31:10 +08:00
|
|
|
this.Helper.Events.GameLoop.GameLaunched += this.GameLoop_GameLaunched;
|
|
|
|
|
2018-12-30 13:01:20 +08:00
|
|
|
this.config = ModHelper.ReadConfig<ModConfig>();
|
2017-09-12 09:35:31 +08:00
|
|
|
}
|
2019-07-16 17:09:42 +08:00
|
|
|
|
2019-12-07 05:31:10 +08:00
|
|
|
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
|
|
|
|
{
|
|
|
|
string soundbankPath=Path.Combine(Game1.content.RootDirectory, "XACT", "Sound Bank.xsb");
|
|
|
|
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "ProcessedGameFiles"));
|
|
|
|
//this.Monitor.Log(Utilities.HexDumper.HexDumpString(soundbankPath), LogLevel.Info);
|
|
|
|
Utilities.HexDumper.StripSoundCuesToFile(Path.Combine(this.Helper.DirectoryPath, "ProcessedGameFiles", "SoundCues.json"),Utilities.HexDumper.StripSoundCuesFromHex(Utilities.HexDumper.HexDumpString(soundbankPath)));
|
|
|
|
//Utilities.HexDumper.HexDumpFile(soundbankPath, Path.Combine(this.Helper.DirectoryPath, "ProcessedGameFiles", "SoundCuesRaw.json"));
|
|
|
|
}
|
|
|
|
|
2019-07-16 17:09:42 +08:00
|
|
|
public static void log(string message)
|
|
|
|
{
|
|
|
|
ModMonitor.Log(message);
|
|
|
|
}
|
2017-07-14 11:27:48 +08:00
|
|
|
}
|
|
|
|
}
|