using System;
using System.IO;
using System.Text;
using Godot;
using Environment = System.Environment;
namespace ColdMint.scripts;
public static class Config
{
///
/// Loot table ID
/// 战利品表ID
///
public static class LootListId
{
///
/// A trophy table for testing
/// 测试用的战利品表
///
public const string Test = "test";
}
///
/// Difficulty
/// 游戏难度
///
public static class Difficulty
{
///
/// Simple mode
/// 简单模式
///
public const int Easy = 0;
///
/// Normal mode
/// 正常模式
///
public const int Normal = 1;
///
/// Hard mode
/// 困难模式
///
public const int Hard = 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";
}
///
/// Path of the App configuration file
/// App配置文件路径
///
public const string AppConfigPath = "res://AppConfig.yaml";
///
/// The percentage of speed reduced after a thrown item hits an enemy
/// 抛出的物品击中敌人后减少的速度百分比
///
public const float ThrownItemsHitEnemiesReduceSpeedByPercentage = 0.5f;
///
/// Scale of the room preview view
/// 房间预览图的缩放
///
public const float RoomPreviewScale = 3f;
///
/// How much blood does a heart represent
/// 一颗心代表多少血量
///
public const int HeartRepresentsHealthValue = 4;
///
/// The name of the mod manifest file
/// 模组清单文件的名字
///
public const string ModManifestFileName = "ModManifest.yaml";
///
/// 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";
///
/// Module life handler name
/// 模组生命周期处理器名称
///
public const string ModLifecycleHandlerName = "ModLifecycleHandler";
///
/// Solution Name
/// 解决方案名称
///
public const string SolutionName = "ColdMint.Traveler";
///
/// How many item slots are there on the shortcut bar
/// 快捷栏上有多少个物品槽
///
public const int HotBarSize = 9;
///
/// Whether version isolation is enabled
/// 是否启用版本隔离
///
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");
}
///
/// Whether to enable Mod
/// 是否启用Mod
///
///
public static bool EnableMod()
{
return OS.HasFeature("enableMod");
}
///
/// Default version name
/// 默认的版本名称
///
///
///Used when version isolation is disabled
///在禁用版本隔离时用的
///
public const string DefaultVersionName = "Default";
///
/// EmptyVariant
/// 空变量
///
public static readonly Variant EmptyVariant = new();
///
/// 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 class ZIndexManager
{
///
/// Floating icon
/// 悬浮图标
///
public const int FloatingIcon = 1;
}
///
/// Item data changes the event type
/// 物品数据改变事件类型
///
public enum ItemDataChangeEventType
{
///
/// add
/// 添加
///
Add,
///
/// Quantity Added
/// 物品数量增加
///
QuantityAdded,
///
/// remove
/// 移除
///
Remove,
///
/// Replace
/// 被替换
///
Replace,
///
/// Clear
/// 被清空
///
Clear
}
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,
//Running on editor
//在编辑器内运行
Editor
}
///
/// Get what platform is currently running on
/// 获取当前在什么平台上运行
///
///
///Whether to include an editor environment
///是否包含编辑器环境
///
///
public static OsEnum GetOs(bool containEditor = false)
{
if (containEditor && OS.HasFeature("editor"))
{
return OsEnum.Editor;
}
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(),
ProjectSettings.GetSetting("application/config/version").AsString());
}
else
{
return Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), CompanyName,
ProjectSettings.GetSetting("application/config/name").AsString(),
DefaultVersionName);
}
}
///
/// GetDataBaseDirectory
/// 获取数据库文件夹
///
///
public static string GetDataBaseDirectory()
{
return Path.Join(GetGameDataDirectory(), "Databases");
}
///
/// GetModDataDirectory
/// 获取模组文件夹
///
///
public static string GetModDataDirectory()
{
return Path.Join(GetGameDataDirectory(), "Mods");
}
///
/// 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;
///
/// The default durability of furniture
/// 家具的默认耐久度
///
public const int DefaultMaxDurability = 50;
///
/// 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;
public static class OffsetAngleMode
{
///
/// Random(Default)
/// 随机的(默认)
///
public const int Random = 0;
///
/// AlwaysSame
/// 永远不变的偏移角度
///
public const int AlwaysSame = 1;
///
/// Cross
/// 交叉变换
///
public const int Cross = 2;
}
///
/// Physical collision layer number
/// 物理碰撞层 序号
///
public static class LayerNumber
{
public const int RoomArea = 1;
///
/// Floor
/// 地板
///
public const int Floor = 2;
public const int Player = 3;
public const int PickAbleItem = 4;
public const int Projectile = 5;
///
/// Platform
/// 平台
///
public const int Platform = 6;
public const int Mob = 7;
///
/// Wall
/// 墙壁
///
public const int Wall = 8;
///
/// Furniture
/// 家具
///
public const int Furniture = 9;
}
///
/// TileMapLayerName
/// 瓦片节点名称
///
public static class TileMapLayerName
{
///
/// Ground Layer
/// 地面层
///
///
///There are collision nodes on which players and creatures can stand.
///拥有碰撞节点,玩家和生物可以站在上面。
///
public const string Ground = "Ground";
///
/// Barrier
/// 屏障
///
public const string Barrier = "Barrier";
///
/// Background decorative layer
/// 背景装饰层
///
public const string BackgroundDecoration = "BackgroundDecoration";
///
/// Background wall layer
/// 背景墙
///
public const string BackgroundWall = "BackgroundWall";
}
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;
}
}