private void Awake() { context = this; modEnabled = Config.Bind <bool>("General", "Enabled", true, "Enable this mod"); isDebug = Config.Bind <bool>("General", "IsDebug", true, "Enable debug logs"); nexusID = Config.Bind <int>("General", "NexusID", 1113, "Nexus mod ID for updates"); hotKeyRadius = Config.Bind <float>("Config", "HotKeyRadius", 150f, "Reset radius for hotkey command"); toolRadius = Config.Bind <float>("Config", "ToolRadius", 2f, "Reset radius for tool"); hotKey = Config.Bind <string>("Config", "HotKey", "", "Hotkey to reset terrain. Use https://docs.unity3d.com/Manual/class-InputManager.html"); modKey = Config.Bind <string>("Config", "ModKey", "left alt", "Modifer key to reset terrain when using the level ground hoe tool. Use https://docs.unity3d.com/Manual/class-InputManager.html"); consoleCommand = Config.Bind <string>("Config", "ConsoleCommand", "resetterrain", "Console command to reset terrain. Usage: <command> <radius>"); resetMessage = Config.Bind <string>("Config", "ResetMessage", "{0} edits reset.", "Reset message. {0} is replaced by the number of edits. Set to empty to disable message"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null); }
private void Awake() { context = this; modEnabled = Config.Bind <bool>("General", "Enabled", true, "Enable this mod"); isDebug = Config.Bind <bool>("General", "IsDebug", true, "Enable debug logs"); //nexusID = Config.Bind<int>("General", "NexusID", 1113, "Nexus mod ID for updates"); openUIKey = Config.Bind <string>("Config", "OpenUIKey", "f10", "Key to open currency UI"); updateInterval = Config.Bind <int>("Config", "UpdateInterval", 60, "Update interval in seconds (server only)"); updateIntervalReward = Config.Bind <int>("Currency", "UpdateIntervalReward", 1, "Currency awarded every update interval."); staticLoginReward = Config.Bind <int>("Currency", "StaticLoginReward", 100, "Currency awarded for logging in."); consecutiveLoginReward = Config.Bind <string>("Currency", "ConsecutiveLoginReward", "100,200,300,400,500,600,700", "Login rewards for logging in a consecutive number of days."); consecutiveLoginRewardOnce = Config.Bind <bool>("Currency", "ConsecutiveLoginRewardOnce", true, "Consecutive login reward only applies once, otherwise repeats from start."); windowWidth = Config.Bind <float>("UI", "WindowWidth", Screen.width / 3, "Width of the store window"); windowHeight = Config.Bind <float>("UI", "WindowHeight", Screen.height / 3, "Height of the store window"); windowPosition = Config.Bind <Vector2>("UI", "WindowPosition", new Vector2(Screen.width / 3, Screen.height / 3), "Position of the store window"); packagesPerRow = Config.Bind <int>("UI", "PackagesPerRow", 4, "Packages per row"); titleFontSize = Config.Bind <int>("UI", "TitleFontSize", 24, "Size of the store window title"); currencyFontSize = Config.Bind <int>("UI", "CurrencyFontSize", 20, "Size of the currency info"); labelFontSize = Config.Bind <int>("UI", "LabelFontSize", 24, "Size of the package labels"); //titleFontColor = Config.Bind<Color>("UI", "TitleFontColor", new Color(1, 1, 0.7f, 1), "Color of the store window title"); storeTitle = Config.Bind <string>("UI", "StoreTitle", "<b><color=#9999FFFF>Server Store</color></b>", "Store window title"); currencyString = Config.Bind <string>("UI", "CurrencyString", "${1}", "Currency string."); myCurrencyString = Config.Bind <string>("UI", "MyCurrencyString", "<b><color=#FFFFFFFF>My Balance:</color> <color=#FFFF00FF>{0}</color></b>", "My currency string"); packageString = Config.Bind <string>("UI", "PackageString", "<b><color=#FFFFFFFF>{0}</color> <color=#FFFF00FF>{1}</color></b>", "Package string"); string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ServerRewards"); if (!Directory.Exists(path)) { Dbgl("Creating mod folder"); Directory.CreateDirectory(path); } string AssetsPath = Path.Combine(path, "Assets"); if (!Directory.Exists(AssetsPath)) { Directory.CreateDirectory(AssetsPath); } foreach (string file in Directory.GetFiles(AssetsPath, "*.png")) { Texture2D texture = new Texture2D(2, 2, TextureFormat.RGBA32, true, false); byte[] data = File.ReadAllBytes(file); texture.LoadImage(data); textureDict.Add(Path.GetFileNameWithoutExtension(file), texture); } string infoPath = Path.Combine(path, "PlayerInfo"); if (!Directory.Exists(infoPath)) { Directory.CreateDirectory(infoPath); } string storePath = Path.Combine(path, "StoreInfo"); if (!Directory.Exists(storePath)) { Directory.CreateDirectory(storePath); PackageInfo package = new PackageInfo() { name = "Shields", id = "Shields", type = "Common", price = 50, items = new List <string>() { "ShieldWood,1,70,choice", "ShieldBronze,1,30,choice" } }; File.WriteAllText(Path.Combine(storePath, package.id + ".json"), JsonUtility.ToJson(package)); } windowTitleText = storeTitle.Value; ApplyConfig(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null); }
private void Awake() { context = this; modEnabled = Config.Bind <bool>("General", "Enabled", true, "Enable this mod"); isDebug = Config.Bind <bool>("General", "IsDebug", true, "Enable debug logs"); testing = Config.Bind <bool>("General", "Testing", false, "Enable mod testing mode (populates store locally)"); nexusID = Config.Bind <int>("General", "NexusID", 1131, "Nexus mod ID for updates"); openUIKey = Config.Bind <string>("Config", "OpenUIKey", "f10", "Key to open currency UI"); updateInterval = Config.Bind <int>("Config", "UpdateInterval", 60, "Update interval in seconds (server only)"); useTombstone = Config.Bind <bool>("General", "UseTombstone", false, "Place items in a tombstone instead of dropping on ground."); updateIntervalReward = Config.Bind <int>("Currency", "UpdateIntervalReward", 1, "Currency awarded every update interval"); staticLoginReward = Config.Bind <int>("Currency", "StaticLoginReward", 100, "Currency awarded for logging in"); consecutiveLoginReward = Config.Bind <string>("Currency", "ConsecutiveLoginReward", "100,200,300,400,500,600,700", "Login rewards for logging in a consecutive number of days"); consecutiveLoginRewardOnce = Config.Bind <bool>("Currency", "ConsecutiveLoginRewardOnce", true, "Consecutive login reward only applies once, otherwise repeats from start"); playerStartCurrency = Config.Bind <int>("Currency", "PlayerStartCurrency", 0, "Players start with this amount of currency."); windowWidth = Config.Bind <float>("UI", "WindowWidth", Screen.width / 3, "Width of the store window"); windowHeight = Config.Bind <float>("UI", "WindowHeight", Screen.height / 3, "Height of the store window"); windowPosition = Config.Bind <Vector2>("UI", "WindowPosition", new Vector2(Screen.width / 3, Screen.height / 3), "Position of the store window"); packagesPerRow = Config.Bind <int>("UI", "PackagesPerRow", 4, "Packages per row"); titleFontSize = Config.Bind <int>("UI", "TitleFontSize", 24, "Size of the store window title"); currencyFontSize = Config.Bind <int>("UI", "CurrencyFontSize", 20, "Size of the currency info"); labelFontSize = Config.Bind <int>("UI", "LabelFontSize", 20, "Size of the package labels"); coinBeforeAmount = Config.Bind <bool>("UI", "CoinBeforeAmount", true, "Display the currency icon before the amount? Otherwise after"); storeTitleString = Config.Bind <string>("Text", "StoreTitle", "<b><color=#FFFFFFFF>Server Store</color></b>", "Store window title"); currencyString = Config.Bind <string>("Text", "CurrencyString", "<b><color=#FFFF00FF>{0}</color></b>", "Currency string"); myCurrencyString = Config.Bind <string>("Text", "MyCurrencyString", "<b><color=#FFFFFFFF>My Balance:</color></b>", "My currency string"); packageString = Config.Bind <string>("Text", "PackageString", "<b><color=#FFFFFFFF>{0}</color></b>", "Package string"); packageInfoString = Config.Bind <string>("Text", "PackageInfoString", "{0} chest purchased by {1}", "Reward string to show on the tombstone. {0} is replaced by the package name, {1} is replaced by the player name."); rewardString = Config.Bind <string>("Text", "RewardString", "You received a {0}!", "Reward string to show when dropping items in world."); string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ServerRewards"); if (!Directory.Exists(path)) { Dbgl("Creating mod folder"); Directory.CreateDirectory(path); } string AssetsPath = Path.Combine(path, "Assets"); if (!Directory.Exists(AssetsPath)) { Directory.CreateDirectory(AssetsPath); } foreach (string file in Directory.GetFiles(AssetsPath, "*.png")) { Texture2D texture = new Texture2D(2, 2, TextureFormat.RGBA32, true, false); byte[] data = File.ReadAllBytes(file); texture.LoadImage(data); textureDict.Add(Path.GetFileNameWithoutExtension(file), texture); } string infoPath = Path.Combine(path, "PlayerInfo"); if (!Directory.Exists(infoPath)) { Directory.CreateDirectory(infoPath); } string storePath = Path.Combine(path, "StoreInfo"); if (!Directory.Exists(storePath)) { Directory.CreateDirectory(storePath); PackageInfo package = new PackageInfo() { name = "Shields", id = "Shields", type = "Common", price = 50, items = new List <string>() { "ShieldWood,1,70,choice", "ShieldBronzeBuckler,1,30,choice" } }; File.WriteAllText(Path.Combine(storePath, package.id + ".json"), JsonUtility.ToJson(package)); } if (testing.Value) { storePackages = GetAllPackages(); myCurrency = 805; } windowTitleText = storeTitleString.Value; ApplyConfig(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null); }