using System; using System.IO; using System.Text; using Godot; using Environment = System.Environment; namespace ColdMint.scripts; public static class Config { /// /// ID of the behavior tree /// 行为树的ID /// public static class BehaviorTreeId { /// /// 巡逻 /// Patrol /// public const string Patrol = "Patrol"; } /// /// Loot table ID /// 战利品表ID /// public static class LootListId { /// /// A trophy table for testing /// 测试用的战利品表 /// public const string Test = "Test"; } /// /// BehaviorTreeResult /// 行为树的结果 /// public static class BehaviorTreeResult { /// /// Running /// 运行中 /// public const int Running = 0; /// /// Success /// 成功 /// public const int Success = 1; /// /// Failure /// 失败 /// public const int Failure = 2; } /// /// Camp ID /// 阵营ID /// public static class CampId { /// /// Default camp /// 表示默认阵营 /// public const string Default = "Default"; /// /// Demon camp /// 魔族阵营 /// public const string Mazoku = "Mazoku"; /// /// Aborigines /// 原住民 /// public const string Aborigines = "Aborigines"; } /// /// The percentage of speed reduced after a thrown item hits an enemy /// 抛出的物品击中敌人后减少的速度百分比 /// public const float ThrownItemsHitEnemiesReduceSpeedByPercentage = 0.5f; /// /// How much blood does a heart represent /// 一颗心代表多少血量 /// public const int HeartRepresentsHealthValue = 4; /// /// The maximum number of stacked items in a single inventory /// 单个物品栏最大堆叠的物品数量 /// public const int MaxStackQuantity = 99; /// /// Text change buffering Time How long does it take to execute the actual event after an event with a text change listener is triggered? (Anti-shake processing time), unit: milliseconds /// 当添加了文本改变监听器的事件被触发后,多长时间后执行实际事件?(防抖处理时长),单位:毫秒 /// public const long TextChangesBuffetingDuration = 300; /// /// Operation prompts, function key text color /// 操作提示内,功能键文本颜色 /// public const string OperationTipActionColor = "#2b8a3e"; /// /// Company/Creator name /// 公司/创作者名字 /// public const string CompanyName = "ColdMint"; /// /// How many item slots are there on the shortcut bar /// 快捷栏上有多少个物品槽 /// public const int HotBarSize = 9; /// /// UserID /// 用户ID /// public const string UserId = "DefaultUser"; /// /// Whether version isolation is enabled /// 是否启用版本隔离 /// public const bool EnableVersionIsolation = true; /// /// Default version name /// 默认的版本名称 /// /// ///Used when version isolation is disabled ///在禁用版本隔离时用的 /// public const string DefaultVersionName = "Default"; /// /// IsDebug /// 是否为Debug模式 /// /// public static bool IsDebug() { return OS.HasFeature("debug"); } /// /// Whether to run on the editor /// 是否在编辑器上运行 /// /// public static bool IsEditor() { return OS.HasFeature("editor"); } /// /// Room Injector ID /// 房间注入器ID /// public static class RoomInjectionProcessorId { /// /// Chance /// 概率的 /// public const string Chance = "Chance"; /// /// TimeInterval /// 时间范围的 /// public const string TimeInterval = "TimeInterval"; } public enum OsEnum { //unknown //未知 Unknown, //Runs on Android (non-web browser) //在 Android 上运行(非 Web 浏览器) Android, //Runs on Linux (non-web browser) //在 Linux 上运行(非 Web 浏览器) Linux, //Runs on macOS (non-Web browser) //在 macOS 上运行(非 Web 浏览器) Macos, //Runs on iOS (non-Web browser) //在 iOS 上运行(非 Web 浏览器) Ios, //Runs on Windows //在 Windows 上运行 Windows, //The host operating system is a web browser //宿主操作系统是网页浏览器 Web } /// /// Get what platform is currently running on /// 获取当前在什么平台上运行 /// /// public static OsEnum GetOs() { if (OS.HasFeature("windows")) { return OsEnum.Windows; } if (OS.HasFeature("android")) { return OsEnum.Android; } if (OS.HasFeature("linux")) { return OsEnum.Linux; } if (OS.HasFeature("web")) { return OsEnum.Web; } if (OS.HasFeature("macos")) { return OsEnum.Macos; } if (OS.HasFeature("ios")) { return OsEnum.Ios; } return OsEnum.Unknown; } /// /// Get the game version /// 获取游戏版本 /// /// public static string GetVersion() { var stringBuilder = new StringBuilder(); stringBuilder.Append(ProjectSettings.GetSetting("application/config/version").AsString()); stringBuilder.Append(IsDebug() ? "_debug" : "_release"); return stringBuilder.ToString(); } /// /// GetGameDataDirectory /// 获取游戏数据目录 /// /// public static string GetGameDataDirectory() { if (EnableVersionIsolation) { return Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), CompanyName, ProjectSettings.GetSetting("application/config/name").AsString(), UserId, ProjectSettings.GetSetting("application/config/version").AsString()); } else { return Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), CompanyName, ProjectSettings.GetSetting("application/config/name").AsString(), UserId, DefaultVersionName); } } /// /// Get the export directory for the level graph /// 获取关卡图的导出目录 /// /// public static string GetLevelGraphExportDirectory() { return Path.Join(GetGameDataDirectory(), "LevelGraphs"); } /// /// The initial year of creating this game /// 创建此游戏的初始年份 /// public const int CreationYear = 2024; /// /// Tile map, dimensions of individual tiles /// 瓦片地图,单个瓦片的尺寸 /// public const int CellSize = 32; /// /// The maximum health of the default creature /// 默认生物的最大血量 /// public const int DefaultMaxHp = 100; /// /// When a creature takes damage, how long to hide the bloodline again /// 生物受到伤害时,要在多长时间后再次隐藏血条 /// public static TimeSpan HealthBarDisplaysTime = TimeSpan.FromSeconds(2); /// /// Text size of critical hit damage /// 暴击伤害的文本大小 /// public const int CritDamageTextSize = 33; /// /// Crit damage multiplier /// 暴击伤害乘数 /// /// ///How much damage to increase after a critical strike ///造成暴击后要将伤害提升到原有的多少倍 /// public const float CriticalHitMultiplier = 2f; /// /// Text size of normal damage /// 普通伤害的文本大小 /// public const int NormalDamageTextSize = 22; /// /// Horizontal speed of damage numbers /// 伤害数字的水平速度 /// public const int HorizontalSpeedOfDamageNumbers = 3; /// /// VerticalVelocityOfDamageNumbers /// 伤害数字的垂直速度 /// public const int VerticalVelocityOfDamageNumbers = 5; /// /// Physical collision layer number /// 物理碰撞层 序号 /// public static class LayerNumber { public const int RoomArea = 1; public const int Ground = 2; public const int Player = 3; public const int PickAbleItem = 4; public const int Projectile = 5; public const int Platform = 6; public const int Mob = 7; } public static class RoomDataTag { /// /// Mark the starting room /// 起点房间的标记 /// public const string StartingRoom = "StartingRoom"; } /// /// Specify the type of damage used in the game /// 指定游戏内使用的伤害类型 /// public static class DamageType { /// /// physical injury /// 物理伤害 /// public const int Physical = 1; /// /// Magic damage /// 魔法伤害 /// public const int Magic = 2; } }