2024-04-28 13:55:19 +00:00
using System ;
using System.IO ;
2024-05-02 08:28:22 +00:00
using System.Text ;
2024-04-28 13:55:19 +00:00
using Godot ;
using Environment = System . Environment ;
namespace ColdMint.scripts ;
public static class Config
{
2024-06-10 13:05:18 +00:00
/// <summary>
/// <para>Loot table ID</para>
/// <para>战利品表ID</para>
/// </summary>
public static class LootListId
{
/// <summary>
/// <para>A trophy table for testing</para>
/// <para>测试用的战利品表</para>
/// </summary>
2024-06-16 08:56:45 +00:00
public const string Test = "test" ;
2024-04-28 13:55:19 +00:00
}
2024-09-08 13:17:05 +00:00
2024-08-03 16:32:49 +00:00
/// <summary>
/// <para>Difficulty</para>
/// <para>游戏难度</para>
/// </summary>
public static class Difficulty
{
/// <summary>
/// <para>Simple mode</para>
/// <para>简单模式</para>
/// </summary>
public const int Easy = 0 ;
2024-09-08 13:17:05 +00:00
2024-08-03 16:32:49 +00:00
/// <summary>
/// <para>Normal mode</para>
/// <para>正常模式</para>
/// </summary>
public const int Normal = 1 ;
2024-09-08 13:17:05 +00:00
2024-08-03 16:32:49 +00:00
/// <summary>
/// <para>Hard mode</para>
/// <para>困难模式</para>
/// </summary>
public const int Hard = 2 ;
}
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>Camp ID</para>
/// <para>阵营ID</para>
/// </summary>
public static class CampId
{
/// <summary>
/// <para>Default camp</para>
/// <para>表示默认阵营</para>
/// </summary>
public const string Default = "Default" ;
/// <summary>
/// <para>Demon camp</para>
/// <para>魔族阵营</para>
/// </summary>
public const string Mazoku = "Mazoku" ;
/// <summary>
/// <para>Aborigines</para>
/// <para>原住民</para>
/// </summary>
public const string Aborigines = "Aborigines" ;
}
2024-07-15 14:36:48 +00:00
/// <summary>
/// <para>Path of the App configuration file</para>
/// <para>App配置文件路径</para>
/// </summary>
public const string AppConfigPath = "res://AppConfig.yaml" ;
2024-07-21 15:18:44 +00:00
2024-06-11 14:16:10 +00:00
/// <summary>
/// <para>The percentage of speed reduced after a thrown item hits an enemy</para>
/// <para>抛出的物品击中敌人后减少的速度百分比</para>
/// </summary>
public const float ThrownItemsHitEnemiesReduceSpeedByPercentage = 0.5f ;
2024-06-25 14:11:19 +00:00
2024-09-05 03:50:05 +00:00
/// <summary>
/// <para>Scale of the room preview view</para>
/// <para>房间预览图的缩放</para>
/// </summary>
2024-09-08 01:45:14 +00:00
public const float RoomPreviewScale = 3f ;
2024-09-05 03:50:05 +00:00
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>How much blood does a heart represent</para>
/// <para>一颗心代表多少血量</para>
/// </summary>
public const int HeartRepresentsHealthValue = 4 ;
2024-07-22 15:47:01 +00:00
/// <summary>
/// <para>The name of the mod manifest file</para>
/// <para>模组清单文件的名字</para>
/// </summary>
public const string ModManifestFileName = "ModManifest.yaml" ;
2024-05-17 14:08:19 +00:00
/// <summary>
/// <para>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</para>
/// <para>当添加了文本改变监听器的事件被触发后,多长时间后执行实际事件?(防抖处理时长),单位:毫秒</para>
/// </summary>
public const long TextChangesBuffetingDuration = 300 ;
2024-05-09 13:07:14 +00:00
/// <summary>
/// <para>Operation prompts, function key text color</para>
/// <para>操作提示内,功能键文本颜色</para>
/// </summary>
public const string OperationTipActionColor = "#2b8a3e" ;
2024-05-15 13:52:07 +00:00
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>Company/Creator name</para>
/// <para>公司/创作者名字</para>
/// </summary>
public const string CompanyName = "ColdMint" ;
2024-07-26 14:38:18 +00:00
2024-07-24 15:29:22 +00:00
/// <summary>
/// <para>Module life handler name</para>
/// <para>模组生命周期处理器名称</para>
/// </summary>
public const string ModLifecycleHandlerName = "ModLifecycleHandler" ;
2024-07-23 15:03:03 +00:00
2024-07-21 15:18:44 +00:00
/// <summary>
/// <para>Solution Name</para>
/// <para>解决方案名称</para>
/// </summary>
2024-07-24 15:29:22 +00:00
public const string SolutionName = "ColdMint.Traveler" ;
2024-05-03 14:35:54 +00:00
/// <summary>
/// <para>How many item slots are there on the shortcut bar</para>
/// <para>快捷栏上有多少个物品槽</para>
/// </summary>
2024-05-04 14:59:46 +00:00
public const int HotBarSize = 9 ;
2024-09-08 13:17:05 +00:00
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>Whether version isolation is enabled</para>
/// <para>是否启用版本隔离</para>
/// </summary>
2024-07-23 15:03:03 +00:00
public static bool EnableVersionIsolation ( )
{
//By default, we enable version isolation, but special feature identifiers can be set to disable version isolation.
//默认情况,我们启用版本隔离,但是可以设置特殊的功能标识来禁用版本隔离。
return ! OS . HasFeature ( "disableVersionIsolation" ) ;
}
2024-04-28 13:55:19 +00:00
2024-07-28 02:09:44 +00:00
/// <summary>
/// <para>Whether to enable Mod</para>
/// <para>是否启用Mod</para>
/// </summary>
/// <returns></returns>
public static bool EnableMod ( )
{
return OS . HasFeature ( "enableMod" ) ;
}
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>Default version name</para>
/// <para>默认的版本名称</para>
/// </summary>
/// <remarks>
///<para>Used when version isolation is disabled</para>
///<para>在禁用版本隔离时用的</para>
/// </remarks>
public const string DefaultVersionName = "Default" ;
2024-09-28 14:59:25 +00:00
2024-09-27 15:24:22 +00:00
/// <summary>
/// <para>EmptyVariant</para>
/// <para>空变量</para>
/// </summary>
2024-09-28 14:59:25 +00:00
public static readonly Variant EmptyVariant = new ( ) ;
2024-04-28 13:55:19 +00:00
2024-05-02 08:28:22 +00:00
/// <summary>
/// <para>IsDebug</para>
/// <para>是否为Debug模式</para>
/// </summary>
/// <returns></returns>
public static bool IsDebug ( )
{
return OS . HasFeature ( "debug" ) ;
}
2024-05-26 11:09:43 +00:00
/// <summary>
/// <para>Whether to run on the editor</para>
/// <para>是否在编辑器上运行</para>
/// </summary>
/// <returns></returns>
public static bool IsEditor ( )
{
return OS . HasFeature ( "editor" ) ;
}
2024-06-05 13:38:45 +00:00
/// <summary>
/// <para>Room Injector ID</para>
/// <para>房间注入器ID</para>
/// </summary>
public static class RoomInjectionProcessorId
2024-05-30 14:49:54 +00:00
{
/// <summary>
/// <para>Chance</para>
/// <para>概率的</para>
/// </summary>
public const string Chance = "Chance" ;
2024-06-05 13:38:45 +00:00
2024-05-30 14:49:54 +00:00
/// <summary>
/// <para>TimeInterval</para>
/// <para>时间范围的</para>
/// </summary>
public const string TimeInterval = "TimeInterval" ;
}
2024-09-28 14:59:25 +00:00
2024-09-23 13:03:39 +00:00
/// <summary>
/// <para>Item data changes the event type</para>
/// <para>物品数据改变事件类型</para>
/// </summary>
public enum ItemDataChangeEventType
{
/// <summary>
/// <para>add</para>
/// <para>添加</para>
/// </summary>
Add ,
/// <summary>
/// <para>Quantity Added</para>
/// <para>物品数量增加</para>
/// </summary>
QuantityAdded ,
/// <summary>
/// <para>remove</para>
/// <para>移除</para>
/// </summary>
2024-09-27 15:24:22 +00:00
Remove ,
2024-09-28 14:59:25 +00:00
2024-09-27 15:24:22 +00:00
/// <summary>
/// <para>Replace</para>
/// <para>被替换</para>
/// </summary>
2024-09-28 14:59:25 +00:00
Replace ,
/// <summary>
/// <para>Clear</para>
/// <para>被清空</para>
/// </summary>
Clear
2024-09-23 13:03:39 +00:00
}
2024-06-05 13:38:45 +00:00
2024-05-15 13:52:07 +00:00
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
//宿主操作系统是网页浏览器
2024-07-21 15:18:44 +00:00
Web ,
//Running on editor
//在编辑器内运行
Editor
2024-05-15 13:52:07 +00:00
}
/// <summary>
/// <para>Get what platform is currently running on</para>
/// <para>获取当前在什么平台上运行</para>
/// </summary>
2024-07-23 15:03:03 +00:00
/// <param name="containEditor">
///<para>Whether to include an editor environment</para>
///<para>是否包含编辑器环境</para>
/// </param>
2024-05-15 13:52:07 +00:00
/// <returns></returns>
2024-07-23 15:03:03 +00:00
public static OsEnum GetOs ( bool containEditor = false )
2024-05-15 13:52:07 +00:00
{
2024-07-23 15:03:03 +00:00
if ( containEditor & & OS . HasFeature ( "editor" ) )
2024-07-21 15:18:44 +00:00
{
return OsEnum . Editor ;
}
2024-05-15 13:52:07 +00:00
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 ;
}
2024-06-05 13:38:45 +00:00
2024-05-15 13:52:07 +00:00
return OsEnum . Unknown ;
}
2024-06-05 13:38:45 +00:00
/// <summary>
/// <para>Get the game version</para>
/// <para>获取游戏版本</para>
/// </summary>
/// <returns></returns>
2024-05-02 08:28:22 +00:00
public static string GetVersion ( )
{
var stringBuilder = new StringBuilder ( ) ;
stringBuilder . Append ( ProjectSettings . GetSetting ( "application/config/version" ) . AsString ( ) ) ;
stringBuilder . Append ( IsDebug ( ) ? "_debug" : "_release" ) ;
return stringBuilder . ToString ( ) ;
}
2024-05-03 14:35:54 +00:00
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>GetGameDataDirectory</para>
/// <para>获取游戏数据目录</para>
/// </summary>
/// <returns></returns>
public static string GetGameDataDirectory ( )
{
2024-07-23 15:03:03 +00:00
if ( EnableVersionIsolation ( ) )
2024-04-28 13:55:19 +00:00
{
return Path . Join ( Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) , CompanyName ,
2024-08-05 16:27:51 +00:00
ProjectSettings . GetSetting ( "application/config/name" ) . AsString ( ) ,
2024-04-28 13:55:19 +00:00
ProjectSettings . GetSetting ( "application/config/version" ) . AsString ( ) ) ;
}
else
{
return Path . Join ( Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) , CompanyName ,
2024-08-05 16:27:51 +00:00
ProjectSettings . GetSetting ( "application/config/name" ) . AsString ( ) ,
2024-04-28 13:55:19 +00:00
DefaultVersionName ) ;
}
}
2024-08-05 16:27:51 +00:00
/// <summary>
/// <para>GetDataBaseDirectory</para>
/// <para>获取数据库文件夹</para>
/// </summary>
/// <returns></returns>
public static string GetDataBaseDirectory ( )
{
return Path . Join ( GetGameDataDirectory ( ) , "Databases" ) ;
}
2024-07-23 15:03:03 +00:00
/// <summary>
/// <para>GetModDataDirectory</para>
/// <para>获取模组文件夹</para>
/// </summary>
/// <returns></returns>
public static string GetModDataDirectory ( )
{
return Path . Join ( GetGameDataDirectory ( ) , "Mods" ) ;
}
2024-05-15 13:52:07 +00:00
/// <summary>
/// <para>Get the export directory for the level graph</para>
/// <para>获取关卡图的导出目录</para>
/// </summary>
/// <returns></returns>
public static string GetLevelGraphExportDirectory ( )
{
return Path . Join ( GetGameDataDirectory ( ) , "LevelGraphs" ) ;
}
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>The initial year of creating this game</para>
/// <para>创建此游戏的初始年份</para>
/// </summary>
public const int CreationYear = 2024 ;
/// <summary>
/// <para>Tile map, dimensions of individual tiles</para>
/// <para>瓦片地图,单个瓦片的尺寸</para>
/// </summary>
public const int CellSize = 32 ;
/// <summary>
/// <para>The maximum health of the default creature</para>
/// <para>默认生物的最大血量</para>
/// </summary>
public const int DefaultMaxHp = 100 ;
2024-09-13 15:04:39 +00:00
/// <summary>
/// <para>The default durability of furniture</para>
/// <para>家具的默认耐久度</para>
/// </summary>
public const int DefaultMaxDurability = 50 ;
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>When a creature takes damage, how long to hide the bloodline again</para>
/// <para>生物受到伤害时,要在多长时间后再次隐藏血条</para>
/// </summary>
public static TimeSpan HealthBarDisplaysTime = TimeSpan . FromSeconds ( 2 ) ;
/// <summary>
/// <para>Text size of critical hit damage</para>
/// <para>暴击伤害的文本大小</para>
/// </summary>
public const int CritDamageTextSize = 33 ;
/// <summary>
/// <para>Crit damage multiplier</para>
/// <para>暴击伤害乘数</para>
/// </summary>
/// <remarks>
///<para>How much damage to increase after a critical strike</para>
///<para>造成暴击后要将伤害提升到原有的多少倍</para>
/// </remarks>
public const float CriticalHitMultiplier = 2f ;
/// <summary>
/// <para>Text size of normal damage</para>
/// <para>普通伤害的文本大小</para>
/// </summary>
public const int NormalDamageTextSize = 22 ;
/// <summary>
/// <para>Horizontal speed of damage numbers</para>
/// <para>伤害数字的水平速度</para>
/// </summary>
public const int HorizontalSpeedOfDamageNumbers = 3 ;
/// <summary>
/// <para>VerticalVelocityOfDamageNumbers</para>
/// <para>伤害数字的垂直速度</para>
/// </summary>
public const int VerticalVelocityOfDamageNumbers = 5 ;
2024-08-14 15:08:07 +00:00
public static class OffsetAngleMode
{
/// <summary>
/// <para>Random(Default)</para>
/// <para>随机的(默认)</para>
/// </summary>
public const int Random = 0 ;
2024-09-08 13:17:05 +00:00
2024-08-14 15:08:07 +00:00
/// <summary>
/// <para>AlwaysSame</para>
/// <para>永远不变的偏移角度</para>
/// </summary>
public const int AlwaysSame = 1 ;
2024-09-08 13:17:05 +00:00
2024-08-14 15:08:07 +00:00
/// <summary>
/// <para>Cross</para>
/// <para>交叉变换</para>
/// </summary>
public const int Cross = 2 ;
}
2024-09-08 13:17:05 +00:00
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>Physical collision layer number</para>
/// <para>物理碰撞层 序号</para>
/// </summary>
2024-06-05 13:38:45 +00:00
public static class LayerNumber
2024-04-28 13:55:19 +00:00
{
public const int RoomArea = 1 ;
2024-09-13 15:04:39 +00:00
/// <summary>
/// <para>Floor</para>
/// <para>地板</para>
/// </summary>
2024-08-12 14:30:13 +00:00
public const int Floor = 2 ;
2024-04-28 13:55:19 +00:00
public const int Player = 3 ;
2024-06-16 07:28:16 +00:00
public const int PickAbleItem = 4 ;
2024-04-28 13:55:19 +00:00
public const int Projectile = 5 ;
2024-09-13 15:04:39 +00:00
/// <summary>
/// <para>Platform</para>
/// <para>平台</para>
/// </summary>
2024-04-28 13:55:19 +00:00
public const int Platform = 6 ;
public const int Mob = 7 ;
2024-09-13 15:04:39 +00:00
/// <summary>
/// <para>Wall</para>
/// <para>墙壁</para>
/// </summary>
2024-08-12 14:30:13 +00:00
public const int Wall = 8 ;
2024-09-13 15:04:39 +00:00
/// <summary>
/// <para>Furniture</para>
/// <para>家具</para>
/// </summary>
public const int Furniture = 9 ;
2024-04-28 13:55:19 +00:00
}
2024-06-05 13:38:45 +00:00
2024-07-26 14:38:18 +00:00
/// <summary>
/// <para>TileMapLayerName</para>
/// <para>瓦片节点名称</para>
/// </summary>
public static class TileMapLayerName
{
/// <summary>
/// <para>Ground Layer</para>
/// <para>地面层</para>
/// </summary>
/// <remarks>
///<para>There are collision nodes on which players and creatures can stand.</para>
///<para>拥有碰撞节点,玩家和生物可以站在上面。</para>
/// </remarks>
public const string Ground = "Ground" ;
2024-09-08 13:17:05 +00:00
/// <summary>
/// <para>Barrier</para>
/// <para>屏障</para>
/// </summary>
public const string Barrier = "Barrier" ;
2024-07-26 14:38:18 +00:00
/// <summary>
/// <para>Background decorative layer</para>
/// <para>背景装饰层</para>
/// </summary>
public const string BackgroundDecoration = "BackgroundDecoration" ;
/// <summary>
/// <para>Background wall layer</para>
/// <para>背景墙</para>
/// </summary>
public const string BackgroundWall = "BackgroundWall" ;
}
2024-06-05 13:38:45 +00:00
public static class RoomDataTag
2024-05-18 15:35:12 +00:00
{
/// <summary>
/// <para>Mark the starting room</para>
/// <para>起点房间的标记</para>
/// </summary>
public const string StartingRoom = "StartingRoom" ;
}
2024-04-28 13:55:19 +00:00
/// <summary>
/// <para>Specify the type of damage used in the game</para>
/// <para>指定游戏内使用的伤害类型</para>
/// </summary>
2024-06-05 13:38:45 +00:00
public static class DamageType
2024-04-28 13:55:19 +00:00
{
/// <summary>
/// <para>physical injury</para>
/// <para>物理伤害</para>
/// </summary>
public const int Physical = 1 ;
/// <summary>
/// <para>Magic damage</para>
/// <para>魔法伤害</para>
/// </summary>
public const int Magic = 2 ;
}
}