Distinguish log levels to solve the problem of overlapping room splicing borders.
区分日志等级,解决房间拼接边框重叠的问题。
This commit is contained in:
parent
c73bc185a5
commit
5ec6b3065b
|
@ -12,27 +12,27 @@
|
|||
"FromPort": 0,
|
||||
"ToPort": 0
|
||||
},
|
||||
{
|
||||
"FromId": "4ae948ea-82b7-4b2d-bec2-19ed8a9d4c03",
|
||||
"ToId": "cf04b0af-5940-4d8d-b081-d0b597583771",
|
||||
"FromPort": 0,
|
||||
"ToPort": 0
|
||||
},
|
||||
{
|
||||
"FromId": "9d764cca-5057-470a-976d-ba472a21e2cc",
|
||||
"ToId": "08c9d2be-6174-4efe-91fc-e1b205c4dd53",
|
||||
"ToId": "96f264c0-7169-4916-904f-e0384564e491",
|
||||
"FromPort": 0,
|
||||
"ToPort": 0
|
||||
},
|
||||
{
|
||||
"FromId": "08c9d2be-6174-4efe-91fc-e1b205c4dd53",
|
||||
"ToId": "55d2ef86-49d0-4f8c-9f06-286673a5e1da",
|
||||
"FromId": "96f264c0-7169-4916-904f-e0384564e491",
|
||||
"ToId": "197d7935-be4f-4808-9264-0848c8069309",
|
||||
"FromPort": 0,
|
||||
"ToPort": 0
|
||||
},
|
||||
{
|
||||
"FromId": "55d2ef86-49d0-4f8c-9f06-286673a5e1da",
|
||||
"ToId": "07cc5f19-df5c-44aa-9997-81e48f4e2c4e",
|
||||
"FromPort": 0,
|
||||
"ToPort": 0
|
||||
},
|
||||
{
|
||||
"FromId": "07cc5f19-df5c-44aa-9997-81e48f4e2c4e",
|
||||
"ToId": "ea62a8ef-5575-4259-814a-b3454ff688f5",
|
||||
"FromId": "cf04b0af-5940-4d8d-b081-d0b597583771",
|
||||
"ToId": "26822086-6b19-482f-92b9-71fa8eb3f20c",
|
||||
"FromPort": 0,
|
||||
"ToPort": 0
|
||||
}
|
||||
|
@ -49,6 +49,15 @@
|
|||
"StartingRoom"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Id": "4ae948ea-82b7-4b2d-bec2-19ed8a9d4c03",
|
||||
"Title": "大厅",
|
||||
"Description": "比普通房间要大一些的房间,有多个门,用于连接到其他房间。",
|
||||
"RoomTemplateSet": [
|
||||
"res://prefab/roomTemplates/dungeon/utilityRoom.tscn"
|
||||
],
|
||||
"Tags": null
|
||||
},
|
||||
{
|
||||
"Id": "9d764cca-5057-470a-976d-ba472a21e2cc",
|
||||
"Title": "房间3",
|
||||
|
@ -59,16 +68,16 @@
|
|||
"Tags": null
|
||||
},
|
||||
{
|
||||
"Id": "08c9d2be-6174-4efe-91fc-e1b205c4dd53",
|
||||
"Title": "房间4",
|
||||
"Id": "cf04b0af-5940-4d8d-b081-d0b597583771",
|
||||
"Title": "房间8",
|
||||
"Description": "",
|
||||
"RoomTemplateSet": [
|
||||
"res://prefab/roomTemplates/dungeon"
|
||||
"res://prefab/roomTemplates/dungeon/"
|
||||
],
|
||||
"Tags": null
|
||||
},
|
||||
{
|
||||
"Id": "55d2ef86-49d0-4f8c-9f06-286673a5e1da",
|
||||
"Id": "96f264c0-7169-4916-904f-e0384564e491",
|
||||
"Title": "房间5",
|
||||
"Description": "",
|
||||
"RoomTemplateSet": [
|
||||
|
@ -77,16 +86,7 @@
|
|||
"Tags": null
|
||||
},
|
||||
{
|
||||
"Id": "ea62a8ef-5575-4259-814a-b3454ff688f5",
|
||||
"Title": "房间7",
|
||||
"Description": "",
|
||||
"RoomTemplateSet": [
|
||||
"res://prefab/roomTemplates/dungeon"
|
||||
],
|
||||
"Tags": null
|
||||
},
|
||||
{
|
||||
"Id": "07cc5f19-df5c-44aa-9997-81e48f4e2c4e",
|
||||
"Id": "197d7935-be4f-4808-9264-0848c8069309",
|
||||
"Title": "房间6",
|
||||
"Description": "",
|
||||
"RoomTemplateSet": [
|
||||
|
@ -95,11 +95,11 @@
|
|||
"Tags": null
|
||||
},
|
||||
{
|
||||
"Id": "4ae948ea-82b7-4b2d-bec2-19ed8a9d4c03",
|
||||
"Title": "大厅",
|
||||
"Description": "比普通房间要大一些的房间,有多个门,用于连接到其他房间。",
|
||||
"Id": "26822086-6b19-482f-92b9-71fa8eb3f20c",
|
||||
"Title": "房间7",
|
||||
"Description": "",
|
||||
"RoomTemplateSet": [
|
||||
"res://prefab/roomTemplates/dungeon/utilityRoom.tscn"
|
||||
"res://prefab/roomTemplates/dungeon"
|
||||
],
|
||||
"Tags": null
|
||||
}
|
||||
|
|
|
@ -28,4 +28,5 @@ filename,文件名,File name,ファイル名
|
|||
cancel,取消,Cancel,キャンセル
|
||||
load,加载,Load,ろーど
|
||||
delete_selected_node,删除选中的节点,Delete selected node,選択されたノードを削除します
|
||||
re_create_map,重新创建地图,Re-create map,地図を再作成します
|
||||
re_create_map,重新创建地图,Re-create map,地図を再作成します
|
||||
seed_info,种子:{0},Seed: {0},シード:{0}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,9 +1,9 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://b0uurp551pku"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://b0uurp551pku"]
|
||||
|
||||
[ext_resource type="TileSet" uid="uid://c4wpp12rr44hi" path="res://tileSets/dungeon.tres" id="1_a15hy"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_kiih8"]
|
||||
size = Vector2(508.75, 191)
|
||||
size = Vector2(508.75, 194)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_o85u0"]
|
||||
size = Vector2(20, 48)
|
||||
|
@ -11,6 +11,9 @@ size = Vector2(20, 48)
|
|||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_30r3c"]
|
||||
size = Vector2(20, 46)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_7tsse"]
|
||||
size = Vector2(53, 24)
|
||||
|
||||
[node name="InitialRoom" type="Node2D"]
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
|
@ -18,17 +21,17 @@ tile_set = ExtResource("1_a15hy")
|
|||
format = 2
|
||||
layer_0/name = "BackgroundWall"
|
||||
layer_0/navigation_enabled = false
|
||||
layer_0/tile_data = PackedInt32Array(65550, 393217, 5, 131086, 393217, 5, 196622, 393217, 5, 262158, 393217, 5, 262157, 393217, 5, 196621, 393217, 5, 131085, 393217, 5, 65549, 393217, 5, 65548, 393217, 5, 65547, 393217, 5, 65546, 393217, 5, 65545, 393217, 5, 65544, 393217, 5, 65543, 393217, 5, 65542, 393217, 5, 65541, 393217, 5, 65540, 393217, 5, 65539, 393217, 5, 65538, 393217, 5, 65537, 393217, 5, 131073, 393217, 5, 131074, 393217, 5, 131075, 393217, 5, 131076, 393217, 5, 131077, 393217, 5, 131078, 393217, 5, 131079, 393217, 5, 131080, 393217, 5, 131081, 393217, 5, 131082, 393217, 5, 131083, 393217, 5, 131084, 393217, 5, 196620, 393217, 5, 196619, 393217, 5, 196618, 393217, 5, 196617, 393217, 5, 196616, 262145, 5, 196615, 393217, 5, 196614, 393217, 5, 196613, 262145, 5, 196612, 393217, 5, 196611, 393217, 5, 196610, 393217, 5, 196609, 393217, 5, 262145, 393217, 5, 262146, 393217, 5, 262147, 393217, 5, 262148, 393217, 5, 262149, 393217, 5, 262150, 393217, 5, 262151, 393217, 5, 262152, 393217, 5, 262153, 393217, 5, 262154, 393217, 5, 262155, 393217, 5, 262156, 393217, 5, 196608, 393217, 5, 262144, 393217, 5, 262159, 393217, 5, 196623, 393217, 5)
|
||||
layer_0/tile_data = PackedInt32Array(65550, 393217, 5, 131086, 393217, 5, 196622, 393217, 5, 262158, 393217, 5, 262157, 393217, 5, 196621, 393217, 5, 131085, 393217, 5, 65549, 393217, 5, 65548, 393217, 5, 65547, 393217, 5, 65546, 393217, 5, 65545, 393217, 5, 65544, 393217, 5, 65543, 393217, 5, 65542, 393217, 5, 65541, 393217, 5, 65540, 393217, 5, 65539, 393217, 5, 65538, 393217, 5, 65537, 393217, 5, 131073, 393217, 5, 131074, 393217, 5, 131075, 393217, 5, 131076, 393217, 5, 131077, 393217, 5, 131078, 393217, 5, 131079, 393217, 5, 131080, 393217, 5, 131081, 393217, 5, 131082, 393217, 5, 131083, 393217, 5, 131084, 393217, 5, 196620, 393217, 5, 196619, 393217, 5, 196618, 393217, 5, 196617, 393217, 5, 196616, 262145, 5, 196615, 393217, 5, 196614, 393217, 5, 196613, 262145, 5, 196612, 393217, 5, 196611, 393217, 5, 196610, 393217, 5, 196609, 393217, 5, 262145, 393217, 5, 262146, 393217, 5, 262147, 393217, 5, 262148, 393217, 5, 262149, 393217, 5, 262150, 393217, 5, 262151, 393217, 5, 262152, 393217, 5, 262153, 393217, 5, 262154, 393217, 5, 262155, 393217, 5, 262156, 393217, 5, 196608, 393217, 5, 262144, 393217, 5, 262159, 393217, 5, 196623, 393217, 5, 5, 393217, 5, 6, 393217, 5)
|
||||
layer_1/name = "BackgroundDecoration"
|
||||
layer_1/tile_data = PackedInt32Array()
|
||||
layer_2/name = "Ground"
|
||||
layer_2/tile_data = PackedInt32Array(0, 1, 3, 65536, 131073, 1, 131072, 131073, 1, 1, 65537, 2, 2, 65537, 2, 3, 65537, 2, 4, 65537, 2, 5, 65537, 2, 6, 65537, 2, 7, 65537, 2, 8, 65537, 2, 9, 65537, 2, 10, 65537, 2, 11, 65537, 2, 12, 65537, 2, 13, 65537, 2, 14, 65537, 3, 15, 131073, 3, 65551, 131073, 4, 131087, 131073, 4, 327681, 65537, 0, 327682, 65537, 0, 327683, 65537, 0, 327684, 65537, 0, 327685, 65537, 0, 327686, 65537, 0, 327687, 65537, 0, 327688, 65537, 0, 327689, 65537, 0, 327690, 65537, 0, 327691, 65537, 0, 327692, 65537, 0, 327693, 65537, 0, 327694, 65537, 0, 327680, 1, 5, 327695, 131073, 5)
|
||||
layer_2/tile_data = PackedInt32Array(0, 1, 3, 65536, 131073, 1, 131072, 131073, 1, 1, 65537, 2, 2, 65537, 2, 3, 65537, 2, 4, 65537, 2, 7, 65537, 2, 8, 65537, 2, 9, 65537, 2, 10, 65537, 2, 11, 65537, 2, 12, 65537, 2, 13, 65537, 2, 14, 65537, 3, 15, 131073, 3, 65551, 131073, 4, 131087, 131073, 4, 327681, 65537, 0, 327682, 65537, 0, 327683, 65537, 0, 327684, 65537, 0, 327685, 65537, 0, 327686, 65537, 0, 327687, 65537, 0, 327688, 65537, 0, 327689, 65537, 0, 327690, 65537, 0, 327691, 65537, 0, 327692, 65537, 0, 327693, 65537, 0, 327694, 65537, 0, 327680, 1, 5, 327695, 131073, 5, 5, 262145, 4, 6, 262145, 4)
|
||||
|
||||
[node name="RoomArea" type="Area2D" parent="."]
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RoomArea"]
|
||||
position = Vector2(256.625, 98.5)
|
||||
position = Vector2(256.625, 97)
|
||||
shape = SubResource("RectangleShape2D_kiih8")
|
||||
|
||||
[node name="RoomSlotList" type="Node2D" parent="."]
|
||||
|
@ -44,3 +47,9 @@ shape = SubResource("RectangleShape2D_o85u0")
|
|||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RoomSlotList/Area2D2"]
|
||||
position = Vector2(498, 128)
|
||||
shape = SubResource("RectangleShape2D_30r3c")
|
||||
|
||||
[node name="Area2D3" type="Area2D" parent="RoomSlotList"]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RoomSlotList/Area2D3"]
|
||||
position = Vector2(193, 15)
|
||||
shape = SubResource("RectangleShape2D_7tsse")
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -147,6 +147,7 @@ hotbar_previous={
|
|||
[internationalization]
|
||||
|
||||
locale/translations=PackedStringArray("res://locals/UI.en.translation", "res://locals/UI.zh.translation", "res://locals/Error.zh.translation", "res://locals/Error.en.translation", "res://locals/slogan.en.translation", "res://locals/slogan.zh.translation", "res://locals/Log.en.translation", "res://locals/Log.zh.translation", "res://locals/Weapon.en.translation", "res://locals/Weapon.zh.translation", "res://locals/InputMapping.en.translation", "res://locals/InputMapping.zh.translation", "res://locals/Error.jp.translation", "res://locals/InputMapping.jp.translation", "res://locals/Log.jp.translation", "res://locals/slogan.jp.translation", "res://locals/UI.jp.translation", "res://locals/Weapon.jp.translation")
|
||||
locale/test="jp"
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using ColdMint.scripts.utils;
|
||||
using Godot;
|
||||
using FileAccess = Godot.FileAccess;
|
||||
|
||||
|
@ -59,6 +60,6 @@ public static class SloganProvider
|
|||
return null;
|
||||
}
|
||||
|
||||
return TranslationServer.Translate(_sloganKeys[GD.Randi() % _sloganKeys.Length]);
|
||||
return TranslationServerUtils.Translate(_sloganKeys[GD.Randi() % _sloganKeys.Length]);
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ public partial class Player : CharacterTemplate
|
|||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
CharacterName = TranslationServer.Translate("default_player_name");
|
||||
CharacterName = TranslationServerUtils.Translate("default_player_name");
|
||||
_floatLabelPackedScene = GD.Load<PackedScene>("res://prefab/ui/FloatLabel.tscn");
|
||||
_parabola = GetNode<Line2D>("Parabola");
|
||||
_platformDetectionRayCast2D = GetNode<RayCast2D>("PlatformDetectionRayCast");
|
||||
|
@ -77,32 +77,32 @@ public partial class Player : CharacterTemplate
|
|||
operationTipBuilder.Append("[color=");
|
||||
operationTipBuilder.Append(Config.OperationTipActionColor);
|
||||
operationTipBuilder.Append(']');
|
||||
operationTipBuilder.Append(TranslationServer.Translate(InputMap.ActionGetEvents("ui_left")[0].AsText()));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate(InputMap.ActionGetEvents("ui_left")[0].AsText()));
|
||||
operationTipBuilder.Append("[/color]");
|
||||
operationTipBuilder.Append(TranslationServer.Translate("move_left"));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate("move_left"));
|
||||
operationTipBuilder.Append(' ');
|
||||
operationTipBuilder.Append("[color=");
|
||||
operationTipBuilder.Append(Config.OperationTipActionColor);
|
||||
operationTipBuilder.Append(']');
|
||||
operationTipBuilder.Append(TranslationServer.Translate(InputMap.ActionGetEvents("ui_right")[0].AsText()));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate(InputMap.ActionGetEvents("ui_right")[0].AsText()));
|
||||
operationTipBuilder.Append("[/color]");
|
||||
operationTipBuilder.Append(TranslationServer.Translate("move_right"));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate("move_right"));
|
||||
operationTipBuilder.Append(' ');
|
||||
operationTipBuilder.Append("[color=");
|
||||
operationTipBuilder.Append(Config.OperationTipActionColor);
|
||||
operationTipBuilder.Append(']');
|
||||
operationTipBuilder.Append(TranslationServer.Translate(InputMap.ActionGetEvents("ui_up")[0].AsText()));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate(InputMap.ActionGetEvents("ui_up")[0].AsText()));
|
||||
operationTipBuilder.Append("[/color]");
|
||||
operationTipBuilder.Append(TranslationServer.Translate("jump"));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate("jump"));
|
||||
if (_collidingWithPlatform)
|
||||
{
|
||||
operationTipBuilder.Append(' ');
|
||||
operationTipBuilder.Append("[color=");
|
||||
operationTipBuilder.Append(Config.OperationTipActionColor);
|
||||
operationTipBuilder.Append(']');
|
||||
operationTipBuilder.Append(TranslationServer.Translate(InputMap.ActionGetEvents("ui_down")[0].AsText()));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate(InputMap.ActionGetEvents("ui_down")[0].AsText()));
|
||||
operationTipBuilder.Append("[/color]");
|
||||
operationTipBuilder.Append(TranslationServer.Translate("jump_down"));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate("jump_down"));
|
||||
}
|
||||
|
||||
//If the PickingRangeBodiesList is not null and the length is greater than 0
|
||||
|
@ -114,9 +114,9 @@ public partial class Player : CharacterTemplate
|
|||
operationTipBuilder.Append(Config.OperationTipActionColor);
|
||||
operationTipBuilder.Append(']');
|
||||
operationTipBuilder.Append(
|
||||
TranslationServer.Translate(InputMap.ActionGetEvents("pick_up")[0].AsText()));
|
||||
TranslationServerUtils.Translate(InputMap.ActionGetEvents("pick_up")[0].AsText()));
|
||||
operationTipBuilder.Append("[/color]");
|
||||
operationTipBuilder.Append(TranslationServer.Translate("pick_up"));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate("pick_up"));
|
||||
operationTipLabel.Text = operationTipBuilder.ToString();
|
||||
}
|
||||
|
||||
|
@ -126,22 +126,22 @@ public partial class Player : CharacterTemplate
|
|||
operationTipBuilder.Append("[color=");
|
||||
operationTipBuilder.Append(Config.OperationTipActionColor);
|
||||
operationTipBuilder.Append(']');
|
||||
operationTipBuilder.Append(TranslationServer.Translate(InputMap.ActionGetEvents("throw")[0].AsText()));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate(InputMap.ActionGetEvents("throw")[0].AsText()));
|
||||
operationTipBuilder.Append("[/color]");
|
||||
operationTipBuilder.Append(TranslationServer.Translate("throw"));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate("throw"));
|
||||
if (CurrentItem is WeaponTemplate weaponTemplate)
|
||||
{
|
||||
operationTipBuilder.Append(TranslationServer.Translate(weaponTemplate.Name));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate(weaponTemplate.Name));
|
||||
//提示武器攻击
|
||||
operationTipBuilder.Append(' ');
|
||||
operationTipBuilder.Append("[color=");
|
||||
operationTipBuilder.Append(Config.OperationTipActionColor);
|
||||
operationTipBuilder.Append(']');
|
||||
operationTipBuilder.Append(
|
||||
TranslationServer.Translate(InputMap.ActionGetEvents("use_item")[0].AsText()));
|
||||
TranslationServerUtils.Translate(InputMap.ActionGetEvents("use_item")[0].AsText()));
|
||||
operationTipBuilder.Append("[/color]");
|
||||
operationTipBuilder.Append(TranslationServer.Translate("use_item"));
|
||||
operationTipBuilder.Append(TranslationServer.Translate(weaponTemplate.Name));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate("use_item"));
|
||||
operationTipBuilder.Append(TranslationServerUtils.Translate(weaponTemplate.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,10 +397,10 @@ public partial class Player : CharacterTemplate
|
|||
if (weapon.Owner is CharacterTemplate characterTemplate)
|
||||
{
|
||||
stringBuilder.Append(characterTemplate.ReadOnlyCharacterName);
|
||||
stringBuilder.Append(TranslationServer.Translate("de"));
|
||||
stringBuilder.Append(TranslationServerUtils.Translate("de"));
|
||||
}
|
||||
|
||||
stringBuilder.Append(TranslationServer.Translate(weapon.Name));
|
||||
stringBuilder.Append(TranslationServerUtils.Translate(weapon.Name));
|
||||
label.Text = stringBuilder.ToString();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,75 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using ColdMint.scripts.utils;
|
||||
using Godot;
|
||||
|
||||
namespace ColdMint.scripts.debug;
|
||||
|
||||
public static class LogCat
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Information log level</para>
|
||||
/// <para>信息日志等级</para>
|
||||
/// </summary>
|
||||
public const int InfoLogLevel = 0;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Warning level</para>
|
||||
/// <para>警告等级</para>
|
||||
/// </summary>
|
||||
public const int WarningLogLevel = 1;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Error log level</para>
|
||||
/// <para>错误日志等级</para>
|
||||
/// </summary>
|
||||
public const int ErrorLogLevel = 2;
|
||||
|
||||
/// <summary>
|
||||
///<para>Disable all logs</para>
|
||||
///<para>禁用所有日志</para>
|
||||
/// </summary>
|
||||
public const int DisableAllLogLevel = int.MaxValue;
|
||||
|
||||
private static int _minLogLevel = InfoLogLevel;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Set the minimum log level</para>
|
||||
/// <para>设置最小日志等级</para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///<para>Set a value for it so that LogCat only prints logs with a level higher than the set value.</para>
|
||||
///<para>为其设置一个值,使LogCat仅打印等级高于设定值的日志。</para>
|
||||
/// </remarks>
|
||||
public static int MinLogLevel
|
||||
{
|
||||
get => _minLogLevel;
|
||||
set => _minLogLevel = value;
|
||||
}
|
||||
|
||||
private static readonly StringBuilder StringBuilder = new StringBuilder();
|
||||
|
||||
|
||||
private static StringBuilder HandleMessage(string message)
|
||||
private static StringBuilder HandleMessage(int level, string message)
|
||||
{
|
||||
StringBuilder.Clear();
|
||||
StringBuilder.Append(DateTime.Now.ToString("yyyy-M-d HH:mm:ss |"));
|
||||
StringBuilder.Append(TranslationServer.Translate(message));
|
||||
switch (level)
|
||||
{
|
||||
case InfoLogLevel:
|
||||
StringBuilder.Append("INFO");
|
||||
break;
|
||||
case WarningLogLevel:
|
||||
StringBuilder.Append("WARNING");
|
||||
break;
|
||||
case ErrorLogLevel:
|
||||
StringBuilder.Append("ERROR");
|
||||
break;
|
||||
default:
|
||||
StringBuilder.Append("INFO");
|
||||
break;
|
||||
}
|
||||
StringBuilder.Append(DateTime.Now.ToString(" yyyy-M-d HH:mm:ss : "));
|
||||
StringBuilder.Append(TranslationServerUtils.Translate(message));
|
||||
return StringBuilder;
|
||||
}
|
||||
|
||||
|
@ -29,7 +85,12 @@ public static class LogCat
|
|||
/// </param>
|
||||
public static void Log(string message)
|
||||
{
|
||||
GD.Print(HandleMessage(message));
|
||||
if (_minLogLevel > InfoLogLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GD.Print(HandleMessage(InfoLogLevel, message));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -44,18 +105,43 @@ public static class LogCat
|
|||
/// </param>
|
||||
public static void LogError(string message)
|
||||
{
|
||||
GD.PrintErr(HandleMessage(message));
|
||||
if (_minLogLevel > ErrorLogLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GD.PrintErr(HandleMessage(ErrorLogLevel, message));
|
||||
}
|
||||
|
||||
public static void LogWarning(string message)
|
||||
{
|
||||
if (_minLogLevel > WarningLogLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GD.PrintErr(HandleMessage(WarningLogLevel, message));
|
||||
}
|
||||
|
||||
public static void LogErrorWithFormat(string message, params object?[] args)
|
||||
{
|
||||
GD.PrintErr(string.Format(HandleMessage(message).ToString(), args));
|
||||
if (_minLogLevel > ErrorLogLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GD.PrintErr(string.Format(HandleMessage(ErrorLogLevel, message).ToString(), args));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void LogWithFormat(string message, params object?[] args)
|
||||
{
|
||||
GD.Print(string.Format(HandleMessage(message).ToString(), args));
|
||||
if (_minLogLevel > InfoLogLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GD.Print(string.Format(HandleMessage(InfoLogLevel, message).ToString(), args));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -67,6 +153,6 @@ public static class LogCat
|
|||
{
|
||||
//Log an exception here or send it to the server.
|
||||
//请在这里记录异常或将异常发送至服务器。
|
||||
GD.PrintErr(HandleMessage(e.Message).Append('\n').Append(e.StackTrace));
|
||||
GD.PrintErr(HandleMessage(ErrorLogLevel, e.Message).Append('\n').Append(e.StackTrace));
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
using ColdMint.scripts.utils;
|
||||
using Godot;
|
||||
|
||||
namespace ColdMint.scripts.inventory;
|
||||
|
@ -181,15 +182,19 @@ public partial class ItemSlotNode : MarginContainer
|
|||
|
||||
if (Config.IsDebug())
|
||||
{
|
||||
_control.TooltipText = string.Format(TranslationServer.Translate("item_prompt_debug"), item.Id,
|
||||
TranslationServer.Translate(item.Name),
|
||||
item.Quantity, item.MaxStackQuantity, item.GetType().Name,
|
||||
TranslationServer.Translate(item.Description));
|
||||
var debugText = TranslationServerUtils.Translate("item_prompt_debug");
|
||||
if (debugText != null)
|
||||
{
|
||||
_control.TooltipText = string.Format(debugText, item.Id,
|
||||
TranslationServerUtils.Translate(item.Name),
|
||||
item.Quantity, item.MaxStackQuantity, item.GetType().Name,
|
||||
TranslationServerUtils.Translate(item.Description));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_control.TooltipText = TranslationServer.Translate(item.Name) + "\n" +
|
||||
TranslationServer.Translate(item.Description);
|
||||
_control.TooltipText = TranslationServerUtils.Translate(item.Name) + "\n" +
|
||||
TranslationServerUtils.Translate(item.Description);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,12 +59,22 @@ public partial class GameSceneLoader : SceneLoaderTemplate
|
|||
/// </summary>
|
||||
private async Task GenerateMap()
|
||||
{
|
||||
MapGenerator.Seed = GuidUtils.GetGuid();
|
||||
//2757235769 房间边框重叠!
|
||||
//4175259928 房间内容重叠!
|
||||
MapGenerator.Seed = "4175259928";
|
||||
if (_seedLabel != null)
|
||||
{
|
||||
//If you have a seedLabel, then set the seed to it.
|
||||
//如果有seedLabel,那么将种子设置上去。
|
||||
_seedLabel.Text = "Seed:" + MapGenerator.Seed;
|
||||
var seedInfo = TranslationServerUtils.TranslateWithFormat("seed_info", MapGenerator.Seed);
|
||||
if (seedInfo == null)
|
||||
{
|
||||
_seedLabel.Text = $"Seed: {MapGenerator.Seed}";
|
||||
}
|
||||
else
|
||||
{
|
||||
_seedLabel.Text = seedInfo;
|
||||
}
|
||||
}
|
||||
|
||||
await MapGenerator.GenerateMap();
|
||||
|
|
|
@ -54,7 +54,7 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
{
|
||||
base.InitializeData();
|
||||
_roomNodeScene = (PackedScene)GD.Load("res://prefab/ui/RoomNode.tscn");
|
||||
_defaultRoomName = TranslationServer.Translate("default_room_name");
|
||||
_defaultRoomName = TranslationServerUtils.Translate("default_room_name");
|
||||
var folder = Config.GetLevelGraphExportDirectory();
|
||||
if (!Directory.Exists(folder))
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
var dirExists = DirAccess.DirExistsAbsolute(lastLine);
|
||||
if (!fileExists && !dirExists)
|
||||
{
|
||||
var lineError = TranslationServer.Translate("error_specifying_room_template_line");
|
||||
var lineError = TranslationServerUtils.Translate("error_specifying_room_template_line");
|
||||
if (lineError == null)
|
||||
{
|
||||
return;
|
||||
|
@ -358,7 +358,7 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
|
||||
if (_nodeBinding.ActionButton != null)
|
||||
{
|
||||
_nodeBinding.ActionButton.Text = TranslationServer.Translate("load");
|
||||
_nodeBinding.ActionButton.Text = TranslationServerUtils.Translate("load");
|
||||
}
|
||||
|
||||
if (_nodeBinding.FileNameLineEdit != null)
|
||||
|
@ -368,7 +368,7 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
|
||||
if (_nodeBinding.SaveOrLoadPanelTitleLabel != null)
|
||||
{
|
||||
_nodeBinding.SaveOrLoadPanelTitleLabel.Text = TranslationServer.Translate("load");
|
||||
_nodeBinding.SaveOrLoadPanelTitleLabel.Text = TranslationServerUtils.Translate("load");
|
||||
}
|
||||
|
||||
_saveMode = false;
|
||||
|
@ -386,7 +386,7 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
|
||||
if (_nodeBinding.ActionButton != null)
|
||||
{
|
||||
_nodeBinding.ActionButton.Text = TranslationServer.Translate("save");
|
||||
_nodeBinding.ActionButton.Text = TranslationServerUtils.Translate("save");
|
||||
}
|
||||
|
||||
if (_nodeBinding.FileNameLineEdit != null)
|
||||
|
@ -396,7 +396,7 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
|
||||
if (_nodeBinding.SaveOrLoadPanelTitleLabel != null)
|
||||
{
|
||||
_nodeBinding.SaveOrLoadPanelTitleLabel.Text = TranslationServer.Translate("save");
|
||||
_nodeBinding.SaveOrLoadPanelTitleLabel.Text = TranslationServerUtils.Translate("save");
|
||||
}
|
||||
|
||||
_saveMode = true;
|
||||
|
|
|
@ -23,6 +23,18 @@ public partial class MainMenuLoader : UiLoaderTemplate
|
|||
|
||||
public override void InitializeData()
|
||||
{
|
||||
if (Config.IsDebug())
|
||||
{
|
||||
//Set the minimum log level to Info in debug mode.(Print all logs)
|
||||
//在调试模式下将最小日志等级设置为Info。(打印全部日志)
|
||||
LogCat.MinLogLevel = LogCat.InfoLogLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Disable all logs in the release version.
|
||||
//在发行版禁用所有日志。
|
||||
LogCat.MinLogLevel = LogCat.DisableAllLogLevel;
|
||||
}
|
||||
//Load the slogan
|
||||
//加载标语
|
||||
SloganProvider.LoadSloganCsv();
|
||||
|
@ -35,6 +47,7 @@ public partial class MainMenuLoader : UiLoaderTemplate
|
|||
{
|
||||
Directory.CreateDirectory(dataPath);
|
||||
}
|
||||
|
||||
//Registered camp
|
||||
//注册阵营
|
||||
var defaultCamp = new Camp(Config.CampId.Default)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ColdMint.scripts.debug;
|
||||
using ColdMint.scripts.levelGraphEditor;
|
||||
using ColdMint.scripts.serialization;
|
||||
|
||||
namespace ColdMint.scripts.map.LayoutParsingStrategy;
|
||||
|
||||
|
@ -63,6 +65,7 @@ public class SequenceLayoutParsingStrategy : ILayoutParsingStrategy
|
|||
|
||||
_roomNodeDataDictionary.Add(roomNodeData.Id, roomNodeData);
|
||||
}
|
||||
|
||||
_checkLegality = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public static class MapGenerator
|
|||
var roomDictionary = new Dictionary<string, Room>();
|
||||
var randomNumberGenerator = new RandomNumberGenerator();
|
||||
randomNumberGenerator.Seed = _seed;
|
||||
LogCat.Log("Seed:" + _seed);
|
||||
LogCat.LogWithFormat("seed_info", _seed);
|
||||
var startRoomNodeData = await _layoutParsingStrategy.GetStartRoomNodeData();
|
||||
if (startRoomNodeData == null || string.IsNullOrEmpty(startRoomNodeData.Id))
|
||||
{
|
||||
|
|
|
@ -27,19 +27,23 @@ public interface IRoomPlacementStrategy
|
|||
/// </returns>
|
||||
public Task<bool> PlaceRoom(Node mapRoot, RoomPlacementData roomPlacementData);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Calculate new room placement information</para>
|
||||
/// <para>计算新的房间放置信息</para>
|
||||
/// </summary>
|
||||
/// <param name="parentRoomNode">
|
||||
///<para>Parent room node</para>
|
||||
///<para>父房间节点</para>
|
||||
/// <summary>
|
||||
/// <para>Calculate new room placement information</para>
|
||||
/// <para>计算新的房间放置信息</para>
|
||||
/// </summary>
|
||||
/// <param name="randomNumberGenerator">
|
||||
///<para>randomNumberGenerator</para>
|
||||
///<para>随机数生成器</para>
|
||||
/// </param>
|
||||
/// <param name="newRoomNodeData">
|
||||
///<para>New room data to be placed</para>
|
||||
///<para>欲放置的新房间数据</para>
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <param name="parentRoomNode">
|
||||
/// <para>Parent room node</para>
|
||||
/// <para>父房间节点</para>
|
||||
/// </param>
|
||||
/// <param name="newRoomNodeData">
|
||||
/// <para>New room data to be placed</para>
|
||||
/// <para>欲放置的新房间数据</para>
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public Task<RoomPlacementData?> CalculateNewRoomPlacementData(RandomNumberGenerator randomNumberGenerator,
|
||||
Room? parentRoomNode,
|
||||
RoomNodeData newRoomNodeData);
|
||||
|
|
|
@ -79,18 +79,20 @@ public class Room
|
|||
return null;
|
||||
}
|
||||
|
||||
//region 我们计算房间的中点
|
||||
//We calculate the midpoint of the room
|
||||
//我们计算房间的中点
|
||||
var roomAreaCollisionShape2D = roomArea2D.GetChild<CollisionShape2D>(0);
|
||||
var roomAreaRect2 = roomAreaCollisionShape2D.Shape.GetRect();
|
||||
var midpoint = roomAreaCollisionShape2D.Position + roomAreaRect2.Position + roomAreaRect2.Size / 2;
|
||||
//endregion
|
||||
var roomSlots = new List<RoomSlot>();
|
||||
for (var i = 0; i < slotCount; i++)
|
||||
{
|
||||
//拿到了房间卡槽对象
|
||||
//Got the object in the room slot
|
||||
//拿到了房间槽对象
|
||||
var area2D = slotList.GetChild<Area2D>(i);
|
||||
var collisionShape2D = area2D.GetChild<CollisionShape2D>(0);
|
||||
var rect2 = collisionShape2D.Shape.GetRect();
|
||||
//Round the size of the impactor to the tile size For example, the impactor size 44 is converted to the tile size 44/32=1.375 rounded to 1
|
||||
//将碰撞体的尺寸四舍五入到瓦片尺寸例如:碰撞体尺寸44,转为瓦片尺寸为 44/32=1.375 四舍五入为1
|
||||
var intSize = new Vector2I((int)Math.Round(rect2.Size.X / Config.CellSize),
|
||||
(int)Math.Round(rect2.Size.Y / Config.CellSize));
|
||||
|
@ -100,10 +102,12 @@ public class Room
|
|||
continue;
|
||||
}
|
||||
|
||||
//Gets the absolute position of the slot
|
||||
//获取槽位的绝对位置
|
||||
var startPosition = area2D.Position + collisionShape2D.Position + rect2.Position;
|
||||
var endPosition = area2D.Position + collisionShape2D.Position + rect2.Position + rect2.Size;
|
||||
var midpointOfRoomSlots = area2D.Position + collisionShape2D.Position + rect2.Position + rect2.Size / 2;
|
||||
//Convert to tile map coordinates (midpoint)
|
||||
//转为瓦片地图的坐标(中点)
|
||||
var tileMapStartPosition = tileMap.LocalToMap(startPosition);
|
||||
var tileMapEndPosition = tileMap.LocalToMap(endPosition);
|
||||
|
@ -111,6 +115,7 @@ public class Room
|
|||
{
|
||||
EndPosition = tileMapEndPosition,
|
||||
StartPosition = tileMapStartPosition,
|
||||
//Calculate the orientation of the slot (the midpoint of the room is the origin, the vector pointing to the midpoint of the slot)
|
||||
//计算槽位的方向(房间中点为原点,指向槽位中点的向量)
|
||||
DistanceToMidpointOfRoom = CoordinateUtils.VectorToOrientationArray(midpoint, midpointOfRoomSlots)
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@ using ColdMint.scripts.levelGraphEditor;
|
|||
using ColdMint.scripts.map.dateBean;
|
||||
using ColdMint.scripts.map.interfaces;
|
||||
using ColdMint.scripts.map.room;
|
||||
using ColdMint.scripts.utils;
|
||||
using Godot;
|
||||
|
||||
namespace ColdMint.scripts.map.RoomPlacer;
|
||||
|
@ -62,7 +63,7 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
{
|
||||
return Task.FromResult<RoomPlacementData?>(null);
|
||||
}
|
||||
|
||||
|
||||
//Saves all data in the room template that matches the parent room.
|
||||
//保存房间模板内所有与父房间匹配的数据。
|
||||
var useableRoomPlacementData = new List<RoomPlacementData>();
|
||||
|
@ -80,6 +81,7 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mainRoomSlot == null || newRoomSlot == null)
|
||||
{
|
||||
continue;
|
||||
|
@ -208,9 +210,7 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LogCat.Log(distanceToMidpointOfRoom[0] + "-" + distanceToMidpointOfRoom[1] + "和" +
|
||||
newDistanceToMidpointOfRoom[0] + "-" + newDistanceToMidpointOfRoom[1] + "匹配成功");
|
||||
|
||||
mainRoomSlot.Matched = true;
|
||||
newRoomSlot.Matched = true;
|
||||
outMainRoomSlot = mainRoomSlot;
|
||||
|
@ -262,7 +262,7 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
{
|
||||
//Horizontal slot, offset in the Y direction.
|
||||
//水平方向槽,向Y方向偏移。
|
||||
if (result.Y < 0)
|
||||
if (newOrientationDescribe[1] == CoordinateUtils.OrientationDescribe.Up)
|
||||
{
|
||||
result.Y += Config.CellSize;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
{
|
||||
//Vertical slot, offset in the X direction.
|
||||
//垂直方向槽向X方向偏移。
|
||||
if (result.X < 0)
|
||||
if (newOrientationDescribe[0] == CoordinateUtils.OrientationDescribe.Right)
|
||||
{
|
||||
result.X -= Config.CellSize;
|
||||
}
|
||||
|
@ -285,7 +285,6 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Task.FromResult<Vector2?>(result);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ColdMint.scripts.utils;
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ColdMint.scripts.debug;
|
||||
using ColdMint.scripts.map.dateBean;
|
||||
using Godot;
|
||||
using Godot;
|
||||
|
||||
namespace ColdMint.scripts.utils;
|
||||
|
||||
|
@ -32,184 +28,5 @@ public static class TileMapUtils
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Resolve the slots in the room layer</para>
|
||||
/// <para>在房间图层内解析槽位</para>
|
||||
/// </summary>
|
||||
/// <param name="tileMap"></param>
|
||||
/// <param name="layerName"></param>
|
||||
/// <remarks>
|
||||
///<para>This method was written by Github Copilot.</para>
|
||||
///<para>此方法由Github Copilot编写。</para>
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
public static RoomSlot[]? GetRoomSlots(TileMap tileMap, string layerName)
|
||||
{
|
||||
var layer = GetTileMapLayer(tileMap, layerName);
|
||||
if (layer == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var cells = tileMap.GetUsedCells(layer);
|
||||
if (cells.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//保存上一个瓦片
|
||||
var roomSlots = new List<RoomSlot>();
|
||||
var currentSlot = new RoomSlot();
|
||||
for (int i = 0; i < cells.Count; i++)
|
||||
{
|
||||
var currentCell = cells[i];
|
||||
if (i == 0)
|
||||
{
|
||||
//首次循环时初始化瓦片,设置起始位置和结束位置
|
||||
currentSlot.StartPosition = currentCell;
|
||||
currentSlot.EndPosition = currentCell;
|
||||
continue;
|
||||
}
|
||||
|
||||
var distance = currentSlot.EndPosition - currentSlot.StartPosition;
|
||||
LogCat.Log("距离从" + currentSlot.StartPosition + "到" + currentSlot.EndPosition + "为" + distance);
|
||||
if (distance == Vector2I.Zero)
|
||||
{
|
||||
//原点可匹配临近瓦片,不需要方向判断
|
||||
var formCellDistance = currentCell - currentSlot.EndPosition;
|
||||
if (Math.Abs(formCellDistance.X) == 1 || Math.Abs(formCellDistance.Y) == 1)
|
||||
{
|
||||
//方块是相邻的(将终点设置到此方块)
|
||||
LogCat.Log("添加与原点" + currentSlot.EndPosition + "相邻的坐标" + currentCell);
|
||||
currentSlot.EndPosition = currentCell;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (distance.X == 0)
|
||||
{
|
||||
//垂直方向
|
||||
var formCellDistanceEnd = currentCell - currentSlot.EndPosition;
|
||||
LogCat.Log("更新垂直:" + currentCell + "到终点" + currentSlot.EndPosition + "起点" + currentSlot.StartPosition +
|
||||
"为" + formCellDistanceEnd);
|
||||
if (formCellDistanceEnd.X != 0)
|
||||
{
|
||||
//新瓦片不与终点和起点在一条直线上
|
||||
continue;
|
||||
}
|
||||
|
||||
//方块是相邻的(将终点设置到此方块)
|
||||
if (Math.Abs(formCellDistanceEnd.Y) == 1)
|
||||
{
|
||||
currentSlot.EndPosition = currentCell;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
var formCellDistanceStart = currentCell - currentSlot.StartPosition;
|
||||
LogCat.Log("更新垂直:" + currentCell + "到终点" + currentSlot.StartPosition + "终点" +
|
||||
currentSlot.StartPosition +
|
||||
"为" + formCellDistanceEnd);
|
||||
|
||||
//方块是相邻的(将终点设置到此方块)
|
||||
if (Math.Abs(formCellDistanceStart.Y) == 1)
|
||||
{
|
||||
currentSlot.StartPosition = currentCell;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (distance.Y == 0)
|
||||
{
|
||||
//水平方向
|
||||
var formCellDistanceEnd = currentCell - currentSlot.EndPosition;
|
||||
LogCat.Log("更新水平:" + currentCell + "到" + currentSlot.EndPosition + "为" + formCellDistanceEnd);
|
||||
if (formCellDistanceEnd.Y != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//方块是相邻的(将终点设置到此方块)
|
||||
if (Math.Abs(formCellDistanceEnd.X) == 1)
|
||||
{
|
||||
currentSlot.EndPosition = currentCell;
|
||||
continue;
|
||||
}
|
||||
|
||||
var formCellDistanceStart = currentCell - currentSlot.StartPosition;
|
||||
LogCat.Log("更新水平:" + currentCell + "到终点" + currentSlot.StartPosition + "终点" +
|
||||
currentSlot.StartPosition +
|
||||
"为" + formCellDistanceEnd);
|
||||
|
||||
//方块是相邻的(将终点设置到此方块)
|
||||
if (Math.Abs(formCellDistanceStart.X) == 1)
|
||||
{
|
||||
currentSlot.StartPosition = currentCell;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//如果不是临近方块,那么提交槽位
|
||||
LogCat.Log("新方块" + currentCell + "与槽位" + currentSlot.StartPosition + "到" + currentSlot.EndPosition +
|
||||
"不匹配。");
|
||||
roomSlots.Add(currentSlot);
|
||||
currentSlot = new RoomSlot();
|
||||
currentSlot.StartPosition = currentCell;
|
||||
currentSlot.EndPosition = currentCell;
|
||||
}
|
||||
|
||||
//添加没有提交的值
|
||||
roomSlots.Add(currentSlot);
|
||||
return roomSlots.ToArray();
|
||||
}
|
||||
|
||||
|
||||
// public static RoomSlot[] GetRoomSlots(TileMap tileMap, string layerName)
|
||||
// {
|
||||
// var layer = GetTileMapLayer(tileMap, layerName);
|
||||
// if (layer == -1)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// var cells = tileMap.GetUsedCells(layer).OrderBy(c => c.Y).ThenBy(c => c.X).ToList();
|
||||
// var roomSlots = new List<RoomSlot>();
|
||||
// RoomSlot currentSlot = null;
|
||||
//
|
||||
// for (int i = 0; i < cells.Count - 1; i++)
|
||||
// {
|
||||
// var currentCell = cells[i];
|
||||
// var nextCell = cells[i + 1];
|
||||
//
|
||||
// // Check if the current cell and the next cell are consecutive
|
||||
// if ((currentCell.X == nextCell.X && Math.Abs(currentCell.Y - nextCell.Y) == 1) ||
|
||||
// (currentCell.Y == nextCell.Y && Math.Abs(currentCell.X - nextCell.X) == 1))
|
||||
// {
|
||||
// if (currentSlot == null)
|
||||
// {
|
||||
// currentSlot = new RoomSlot { StartPosition = currentCell, EndPosition = nextCell };
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// currentSlot.EndPosition = nextCell;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (currentSlot != null)
|
||||
// {
|
||||
// roomSlots.Add(currentSlot);
|
||||
// currentSlot = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Add the last slot if it's not null
|
||||
// if (currentSlot != null)
|
||||
// {
|
||||
// roomSlots.Add(currentSlot);
|
||||
// }
|
||||
// return roomSlots.ToArray();
|
||||
// }
|
||||
|
||||
}
|
30
scripts/utils/TranslationServerUtils.cs
Normal file
30
scripts/utils/TranslationServerUtils.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using Godot;
|
||||
|
||||
namespace ColdMint.scripts.utils;
|
||||
|
||||
public static class TranslationServerUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>Gets a translation of a field and displays it formatted</para>
|
||||
/// <para>获取某个字段的翻译,并且将其格式化显示</para>
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
public static string? TranslateWithFormat(string key, params object[] args)
|
||||
{
|
||||
var value = TranslationServer.Translate(key);
|
||||
return value == null ? null : string.Format(value, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets a translation of a field</para>
|
||||
/// <para>获取某个字段的翻译</para>
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string? Translate(string? key)
|
||||
{
|
||||
return TranslationServer.Translate(key);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user