dev: 更新代码,并准备LuaMod
This commit is contained in:
1 parent
3fa39fc71e
commit
13450ea09a
20 files changed
+469
-380
No files matched your search
+1
-1
@@ -23,7 +23,7 @@ android/
|
||||
Bin/
|
||||
bin/
|
||||
*.aseprite
|
||||
*.csproj.old
|
||||
*.csproj.old*
|
||||
*.sln
|
||||
*.error
|
||||
*.key*
|
||||
|
||||
@@ -11,7 +11,7 @@ data = {
|
||||
|
||||
[sub_resource type="Image" id="Image_t7xhb"]
|
||||
data = {
|
||||
"data": PackedByteArray("/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/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8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/yT/Hv8A/x//I/8A/wD/AP8A/7D///8q/wD/AP9A////mP8A/wD/AP/I////DP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ov///yb/s//Y/wD/zf/D/xP//v+v/wD/AP8A/wD/AP8A/wT/uf///9H/C/8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/8P///8c/wD/AP8Y////3P8A/wD/AP8A/7D///8o/wD/AP8A/+z/7P8A/wD/AP8A/wD/AP8A/xn/kP/+/+b/Af8A/wD/AP8A/zL///+7/wD/AP8A/9z///8I/wD/AP8A/wD/AP8L//P/yP83////jP8A/wD/AP8A/wD/AP8e////0/9E/0T/RP9E/0T/HvLine truncated
|
||||
"format": "LumAlpha8",
|
||||
"height": 256,
|
||||
"mipmaps": false,
|
||||
@@ -55,7 +55,7 @@ cache/0/16/0/descent = 5.0
|
||||
cache/0/16/0/underline_position = 1.60938
|
||||
cache/0/16/0/underline_thickness = 0.796875
|
||||
cache/0/16/0/scale = 1.0
|
||||
cache/0/16/0/textures/0/offsets = PackedInt32Array(256, 0, 0, 13, 255, 13, 1, 16, 253, 29, 3, 18, 252, 47, 4, 20, 256, 67, 0, 16, 255, 83, 1, 19, 248, 102, 8, 20, 253, 122, 3, 16, 255, 138, 1, 17, 53, 155, 203, 16)
|
||||
cache/0/16/0/textures/0/offsets = PackedInt32Array(256, 0, 0, 13, 255, 13, 1, 16, 253, 29, 3, 18, 252, 47, 4, 20, 256, 67, 0, 16, 255, 83, 1, 19, 248, 102, 8, 20, 253, 122, 3, 16, 255, 138, 1, 17, 172, 155, 84, 16, 13, 171, 243, 17)
|
||||
cache/0/16/0/textures/0/image = SubResource("Image_t7xhb")
|
||||
cache/0/16/0/glyphs/88/advance = Vector2(10.1563, 16.0938)
|
||||
cache/0/16/0/glyphs/88/offset = Vector2(0, -10)
|
||||
@@ -1012,6 +1012,56 @@ cache/0/16/0/glyphs/402653259/offset = Vector2(1, -13)
|
||||
cache/0/16/0/glyphs/402653259/size = Vector2(10, 14)
|
||||
cache/0/16/0/glyphs/402653259/uv_rect = Rect2(42, 156, 10, 14)
|
||||
cache/0/16/0/glyphs/402653259/texture_idx = 0
|
||||
cache/0/16/0/glyphs/268435507/advance = Vector2(9.84375, 16.0938)
|
||||
cache/0/16/0/glyphs/268435507/offset = Vector2(1, -13)
|
||||
cache/0/16/0/glyphs/268435507/size = Vector2(10, 14)
|
||||
cache/0/16/0/glyphs/268435507/uv_rect = Rect2(54, 156, 10, 14)
|
||||
cache/0/16/0/glyphs/268435507/texture_idx = 0
|
||||
cache/0/16/0/glyphs/134217820/advance = Vector2(8.57813, 16.0938)
|
||||
cache/0/16/0/glyphs/134217820/offset = Vector2(-1, -10)
|
||||
cache/0/16/0/glyphs/134217820/size = Vector2(11, 15)
|
||||
cache/0/16/0/glyphs/134217820/uv_rect = Rect2(1, 172, 11, 15)
|
||||
cache/0/16/0/glyphs/134217820/texture_idx = 0
|
||||
cache/0/16/0/glyphs/268436374/advance = Vector2(4.89063, 16.0938)
|
||||
cache/0/16/0/glyphs/268436374/offset = Vector2(1, -13)
|
||||
cache/0/16/0/glyphs/268436374/size = Vector2(4, 14)
|
||||
cache/0/16/0/glyphs/268436374/uv_rect = Rect2(66, 156, 4, 14)
|
||||
cache/0/16/0/glyphs/268436374/texture_idx = 0
|
||||
cache/0/16/0/glyphs/268435506/advance = Vector2(12.5938, 16.0938)
|
||||
cache/0/16/0/glyphs/268435506/offset = Vector2(0, -13)
|
||||
cache/0/16/0/glyphs/268435506/size = Vector2(14, 14)
|
||||
cache/0/16/0/glyphs/268435506/uv_rect = Rect2(72, 156, 14, 14)
|
||||
cache/0/16/0/glyphs/268435506/texture_idx = 0
|
||||
cache/0/16/0/glyphs/402653239/advance = Vector2(9.0625, 16.0938)
|
||||
cache/0/16/0/glyphs/402653239/offset = Vector2(-1, -13)
|
||||
cache/0/16/0/glyphs/402653239/size = Vector2(12, 14)
|
||||
cache/0/16/0/glyphs/402653239/uv_rect = Rect2(88, 156, 12, 14)
|
||||
cache/0/16/0/glyphs/402653239/texture_idx = 0
|
||||
cache/0/16/0/glyphs/134217783/advance = Vector2(9.0625, 16.0938)
|
||||
cache/0/16/0/glyphs/134217783/offset = Vector2(-1, -13)
|
||||
cache/0/16/0/glyphs/134217783/size = Vector2(12, 14)
|
||||
cache/0/16/0/glyphs/134217783/uv_rect = Rect2(102, 156, 12, 14)
|
||||
cache/0/16/0/glyphs/134217783/texture_idx = 0
|
||||
cache/0/16/0/glyphs/402653234/advance = Vector2(12.5938, 16.0938)
|
||||
cache/0/16/0/glyphs/402653234/offset = Vector2(0, -13)
|
||||
cache/0/16/0/glyphs/402653234/size = Vector2(14, 14)
|
||||
cache/0/16/0/glyphs/402653234/uv_rect = Rect2(116, 156, 14, 14)
|
||||
cache/0/16/0/glyphs/402653234/texture_idx = 0
|
||||
cache/0/16/0/glyphs/402653255/advance = Vector2(9.96875, 16.0938)
|
||||
cache/0/16/0/glyphs/402653255/offset = Vector2(0, -13)
|
||||
cache/0/16/0/glyphs/402653255/size = Vector2(11, 14)
|
||||
cache/0/16/0/glyphs/402653255/uv_rect = Rect2(132, 156, 11, 14)
|
||||
cache/0/16/0/glyphs/402653255/texture_idx = 0
|
||||
cache/0/16/0/glyphs/134217778/advance = Vector2(12.5938, 16.0938)
|
||||
cache/0/16/0/glyphs/134217778/offset = Vector2(0, -13)
|
||||
cache/0/16/0/glyphs/134217778/size = Vector2(13, 14)
|
||||
cache/0/16/0/glyphs/134217778/uv_rect = Rect2(145, 156, 13, 14)
|
||||
cache/0/16/0/glyphs/134217778/texture_idx = 0
|
||||
cache/0/16/0/glyphs/268435509/advance = Vector2(10.2344, 16.0938)
|
||||
cache/0/16/0/glyphs/268435509/offset = Vector2(1, -13)
|
||||
cache/0/16/0/glyphs/268435509/size = Vector2(11, 14)
|
||||
cache/0/16/0/glyphs/268435509/uv_rect = Rect2(160, 156, 11, 14)
|
||||
cache/0/16/0/glyphs/268435509/texture_idx = 0
|
||||
cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0)
|
||||
cache/0/16/0/kerning_overrides/30/0 = Vector2(0, 0)
|
||||
cache/0/16/0/kerning_overrides/32/0 = Vector2(0, 0)
|
||||
+4
-2
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.4.1">
|
||||
<Project Sdk="Godot.NET.Sdk/4.4.0">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
@@ -7,7 +7,9 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Test\**\*" />
|
||||
<Protobuf Include="Protos\chess.proto" GrpcServices="Client" />
|
||||
<Compile Remove="android\**\*" />
|
||||
<Compile Remove="Protos\**\*" />
|
||||
<!-- <Protobuf Include="Protos\chess.proto" GrpcServices="Client" /> -->
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.30.2" />
|
||||
|
||||
@@ -1,45 +1,10 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Main : Node2D
|
||||
{
|
||||
|
||||
// public void ResizeChessboardToFitScreen()
|
||||
// {
|
||||
// var viewportSize = GetViewportRect().Size;
|
||||
// var designSize = new Vector2(800, 800); // 设计时棋盘的尺寸,这里假设为正方形
|
||||
// var screenAspectRatio = viewportSize.X / viewportSize.Y;
|
||||
// var boardAspectRatio = designSize.X / designSize.Y;
|
||||
|
||||
// // 计算保持棋盘比例的缩放因子
|
||||
// float scaleFactor;
|
||||
// if (screenAspectRatio > boardAspectRatio)
|
||||
// {
|
||||
// // 屏幕更宽,按高度缩放
|
||||
// scaleFactor = viewportSize.Y / designSize.Y;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 屏幕更高或相等,按宽度缩放
|
||||
// scaleFactor = viewportSize.X / designSize.X;
|
||||
// }
|
||||
|
||||
// // 应用缩放
|
||||
// GetNode<Node2D>("Chessboard").Scale = new Vector2(scaleFactor, scaleFactor);
|
||||
// }
|
||||
|
||||
public partial class Main : Node2D {
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
GlobalManager global = null!;
|
||||
public override void _Ready() {
|
||||
// GetTree().Connect("screen_resized", ResizeChessboardToFitScreen);
|
||||
// Button undo = GetNode<Button>("Undo");
|
||||
// undo.Connect("pressed", (event) => {
|
||||
// });
|
||||
|
||||
// ChessBoard board = GetNodeAndResource("res://res/ChessBoard.tscn");
|
||||
// ChessBoard board1 = GetChild<ChessBoard>(0);
|
||||
// board.Visible = false;
|
||||
// board.Can
|
||||
global = GlobalManager.Instance;
|
||||
global.GlobalTheme = GetChild<Control>(GetChildCount() - 1).Theme;
|
||||
global.GlobalThemeConfigFlush();
|
||||
@@ -50,12 +15,10 @@ public partial class Main : Node2D
|
||||
}
|
||||
|
||||
private void GoToSignlePlayer() {
|
||||
// global.GotoScene("res://Scenes/SinglePlayer.tscn");
|
||||
global?.GotoScene("res://Scenes/ChessGame.tscn");
|
||||
}
|
||||
|
||||
private void GoToMultiPlayer() {
|
||||
// global.GotoScene("res://Scenes/MultiPlayer.tscn");
|
||||
global?.GotoScene("res://Scenes/GameLobby.tscn");
|
||||
}
|
||||
|
||||
@@ -66,8 +29,4 @@ public partial class Main : Node2D
|
||||
private void GotoMods() {
|
||||
global?.GotoScene("res://Scenes/Mods.tscn");
|
||||
}
|
||||
|
||||
// private void goToMenu() {
|
||||
// global.GotoScene("res://Scenes/Menu.tscn");
|
||||
// }
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://boa4od72355o4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://kdxc7ummin4b" path="res://Main.cs" id="1_h4cv2"]
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/defaultTheme.tres" id="2_afihr"]
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/GameTheme.tres" id="2_afihr"]
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
script = ExtResource("1_h4cv2")
|
||||
|
||||
+43
-34
@@ -2,86 +2,85 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://cqgctouhh8qok" path="res://Scripts/Controllers/ChessGame.cs" id="1_3x8ac"]
|
||||
[ext_resource type="PackedScene" uid="uid://b1tx7v3230wab" path="res://Scenes/Entities/Chessboard.tscn" id="1_yheur"]
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/defaultTheme.tres" id="3_rcfhx"]
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/GameTheme.tres" id="3_rcfhx"]
|
||||
|
||||
[node name="ChessGame" type="Node2D"]
|
||||
script = ExtResource("1_3x8ac")
|
||||
|
||||
[node name="Chessboard" parent="." instance=ExtResource("1_yheur")]
|
||||
position = Vector2(360, 650)
|
||||
scale = Vector2(2.5, 2.5)
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
custom_minimum_size = Vector2(720, 1280)
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 720.0
|
||||
offset_bottom = 1280.0
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("3_rcfhx")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
offset_bottom = 133.0
|
||||
grow_horizontal = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Control/VBoxContainer"]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer/MarginContainer"]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Control/VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Home" type="Button" parent="Control/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer"]
|
||||
[node name="Home" type="Button" parent="VBoxContainer/MarginContainer/HBoxContainer/MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "KEY_BackHome"
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="Control/VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Undo" type="Button" parent="Control/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer2"]
|
||||
[node name="Undo" type="Button" parent="VBoxContainer/MarginContainer/HBoxContainer/MarginContainer2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
text = "KEY_GameUndo"
|
||||
|
||||
[node name="MarginContainer3" type="MarginContainer" parent="Control/VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
[node name="MarginContainer3" type="MarginContainer" parent="VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ReInit" type="Button" parent="Control/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3"]
|
||||
[node name="ReInit" type="Button" parent="VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "KEY_GameReInit"
|
||||
|
||||
[node name="MarginContainer3" type="MarginContainer" parent="Control/VBoxContainer"]
|
||||
[node name="MarginContainer3" type="MarginContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HFlowContainer" type="HFlowContainer" parent="Control/VBoxContainer/MarginContainer3"]
|
||||
[node name="HFlowContainer" type="HFlowContainer" parent="VBoxContainer/MarginContainer3"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer/MarginContainer3/HFlowContainer"]
|
||||
[node name="Label" type="Label" parent="VBoxContainer/MarginContainer3/HFlowContainer"]
|
||||
layout_mode = 2
|
||||
text = "KEY_Content_YouAre"
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="Control/VBoxContainer/MarginContainer3/HFlowContainer"]
|
||||
[node name="LineEdit_YouAre" type="LineEdit" parent="VBoxContainer/MarginContainer3/HFlowContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
editable = false
|
||||
|
||||
[node name="Label2" type="Label" parent="Control/VBoxContainer/MarginContainer3/HFlowContainer"]
|
||||
[node name="Label2" type="Label" parent="VBoxContainer/MarginContainer3/HFlowContainer"]
|
||||
layout_mode = 2
|
||||
text = "KEY_Content_TurnOn"
|
||||
|
||||
[node name="LineEdit2" type="LineEdit" parent="Control/VBoxContainer/MarginContainer3/HFlowContainer"]
|
||||
[node name="LineEdit_TurnSide" type="LineEdit" parent="VBoxContainer/MarginContainer3/HFlowContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
editable = false
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="Control"]
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
@@ -91,11 +90,21 @@ offset_top = -114.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="Over" type="Button" parent="Control/MarginContainer2"]
|
||||
[node name="Over" type="Button" parent="MarginContainer2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "KEY_OverThisTurn"
|
||||
|
||||
[connection signal="pressed" from="Control/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer/Home" to="." method="GoHome"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer2/Undo" to="." method="Undo"]
|
||||
[connection signal="pressed" from="Control/VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3/ReInit" to="." method="ReInit"]
|
||||
[connection signal="pressed" from="Control/MarginContainer2/Over" to="." method="BtnOver"]
|
||||
[node name="ChessGame" type="Node2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("1_3x8ac")
|
||||
|
||||
[node name="Chessboard" parent="ChessGame" instance=ExtResource("1_yheur")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(360, 650)
|
||||
scale = Vector2(2.5, 2.5)
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/MarginContainer/HBoxContainer/MarginContainer/Home" to="ChessGame" method="GoHome"]
|
||||
[connection signal="pressed" from="VBoxContainer/MarginContainer/HBoxContainer/MarginContainer2/Undo" to="ChessGame" method="Undo"]
|
||||
[connection signal="pressed" from="VBoxContainer/MarginContainer/HBoxContainer/MarginContainer3/ReInit" to="ChessGame" method="ReInit"]
|
||||
[connection signal="pressed" from="MarginContainer2/Over" to="ChessGame" method="BtnOver"]
|
||||
@@ -15,3 +15,9 @@ text = "KEY_ServerConnectStatus"
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
custom_minimum_size = Vector2(15, 15)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TextureProgressBar" type="TextureProgressBar" parent="."]
|
||||
layout_mode = 2
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://00jxjgnmfbn7"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/defaultTheme.tres" id="1_ge0tq"]
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/GameTheme.tres" id="1_ge0tq"]
|
||||
[ext_resource type="Script" uid="uid://cn273e4u256r" path="res://Scripts/Controllers/GameLobby.cs" id="2_blx46"]
|
||||
|
||||
[node name="GameLobby" type="Control"]
|
||||
@@ -53,7 +53,8 @@ size_flags_horizontal = 3
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="MarginContainer/VBoxContainer/MarginContainer3"]
|
||||
[node name="ItemList_Users" type="ItemList" parent="MarginContainer/VBoxContainer/MarginContainer3"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Dialogs" type="Control" parent="."]
|
||||
@@ -74,4 +75,4 @@ initial_position = 2
|
||||
size = Vector2i(200, 118)
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/MarginContainer/Button" to="." method="OnBack"]
|
||||
[connection signal="item_activated" from="MarginContainer/VBoxContainer/MarginContainer3/ItemList" to="." method="OnItemSelected"]
|
||||
[connection signal="item_activated" from="MarginContainer/VBoxContainer/MarginContainer3/ItemList_Users" to="." method="OnItemSelected"]
|
||||
+41
-4
@@ -1,11 +1,14 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://c2ov83uk7r6rq"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/defaultTheme.tres" id="1_mhtia"]
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/GameTheme.tres" id="1_mhtia"]
|
||||
[ext_resource type="Script" uid="uid://c8t8d8e7inajy" path="res://Scripts/Controllers/Mods.cs" id="1_mnyng"]
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer"]
|
||||
offset_right = 720.0
|
||||
offset_bottom = 1280.0
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_mhtia")
|
||||
theme_override_constants/margin_left = 30
|
||||
theme_override_constants/margin_top = 30
|
||||
@@ -18,6 +21,40 @@ layout_mode = 2
|
||||
|
||||
[node name="Button" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "back"
|
||||
text = "KEY_BackHome"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "KEY_EnableMod"
|
||||
|
||||
[node name="Button2" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "KEY_ReloadMod"
|
||||
|
||||
[node name="Button2" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "KEY_OpenModDir"
|
||||
|
||||
[node name="VScrollBar" type="VScrollBar" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="VBoxContainer/VScrollBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Button" to="." method="OnBack"]
|
||||
[connection signal="toggled" from="VBoxContainer/HBoxContainer/CheckButton" to="." method="OnEnableMods"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Button2" to="." method="OnReSearchMods"]
|
||||
[connection signal="pressed" from="VBoxContainer/Button2" to="." method="OnOpenModFileDir"]
|
||||
+10
-6
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c6gxufppw1fu3"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/defaultTheme.tres" id="1_6yfoi"]
|
||||
[ext_resource type="Theme" uid="uid://intlbeu8h82r" path="res://Asserts/GameTheme.tres" id="1_6yfoi"]
|
||||
[ext_resource type="Script" uid="uid://71ril3nh84rw" path="res://Scripts/Controllers/Setting.cs" id="1_xbvb3"]
|
||||
[ext_resource type="PackedScene" uid="uid://pc83bstfltn" path="res://Scenes/Entities/ServerStatus.tscn" id="3_e50hu"]
|
||||
|
||||
@@ -49,7 +49,8 @@ layout_mode = 2
|
||||
layout_mode = 2
|
||||
text = "KEY_ServerIP"
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="BoxContainer/MarginContainer2/Server"]
|
||||
[node name="LineEdit_ServerIP" type="LineEdit" parent="BoxContainer/MarginContainer2/Server"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
@@ -63,7 +64,8 @@ layout_mode = 2
|
||||
layout_mode = 2
|
||||
text = "KEY_UserName"
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="BoxContainer/MarginContainer3/Name"]
|
||||
[node name="LineEdit_UserName" type="LineEdit" parent="BoxContainer/MarginContainer3/Name"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
@@ -98,6 +100,7 @@ layout_mode = 2
|
||||
text = "KEY_GlobalFontSize"
|
||||
|
||||
[node name="FontSize" type="LineEdit" parent="BoxContainer/MarginContainer5/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
editable = false
|
||||
|
||||
@@ -105,11 +108,12 @@ editable = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FontSizeBar" type="HSlider" parent="BoxContainer/MarginContainer6"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
min_value = 10.0
|
||||
max_value = 50.0
|
||||
max_value = 40.0
|
||||
value = 10.0
|
||||
|
||||
[node name="HBoxContainer2" type="HFlowContainer" parent="BoxContainer"]
|
||||
@@ -195,8 +199,8 @@ text = "Trace Color"
|
||||
[connection signal="pressed" from="BoxContainer/MarginContainer/Back" to="." method="OnBack"]
|
||||
[connection signal="pressed" from="BoxContainer/MarginContainer7/Button" to="." method="OnSave"]
|
||||
[connection signal="pressed" from="BoxContainer/MarginContainer9/Button" to="." method="OnGetSettingsFile"]
|
||||
[connection signal="text_changed" from="BoxContainer/MarginContainer2/Server/LineEdit" to="." method="OnServerUrlChanged"]
|
||||
[connection signal="text_changed" from="BoxContainer/MarginContainer3/Name/LineEdit" to="." method="OnNameChanged"]
|
||||
[connection signal="text_changed" from="BoxContainer/MarginContainer2/Server/LineEdit_ServerIP" to="." method="OnServerUrlChanged"]
|
||||
[connection signal="text_changed" from="BoxContainer/MarginContainer3/Name/LineEdit_UserName" to="." method="OnNameChanged"]
|
||||
[connection signal="value_changed" from="BoxContainer/MarginContainer6/FontSizeBar" to="." method="OnFontSizeChanged"]
|
||||
[connection signal="toggled" from="BoxContainer/HBoxContainer2/MarginContainer/Button" to="." method="ChangeLangZHCN"]
|
||||
[connection signal="toggled" from="BoxContainer/HBoxContainer2/MarginContainer2/Button2" to="." method="ChangeLangEN"]
|
||||
|
||||
@@ -1,31 +1,22 @@
|
||||
#nullable disable
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using ChineseChess;
|
||||
|
||||
public partial class ChessGame : Node2D {
|
||||
ChessBoard board;
|
||||
GlobalManager global = GlobalManager.Instance;
|
||||
ConfirmationDialog dialog;
|
||||
readonly Logging.Logger logger = Logging.GetLogger("ChessGame");
|
||||
ChessBoard board = null!;
|
||||
ConfirmationDialog dialog = null!;
|
||||
ChessCore Game = null!;
|
||||
private bool isSession = false;
|
||||
ChessCore Game;
|
||||
ChessCore.TurnsSideType sideSelf;
|
||||
ChessCore.TurnsSideType sideOpposite;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready() {
|
||||
// Init.Call();
|
||||
board = GetNode<ChessBoard>("Chessboard");
|
||||
// ChessGameAPI api = new();
|
||||
// api.BindToLua(global.ModManager.lua);
|
||||
|
||||
// isSession = global.RPClient.IsOnline();
|
||||
|
||||
GetNode<LineEdit>("Control/VBoxContainer/MarginContainer3/HFlowContainer/LineEdit")
|
||||
.Text = global.GlobalData["player_color"].AsString();
|
||||
LineEdit turnSideEdit = GetNode<LineEdit>("Control/VBoxContainer/MarginContainer3/HFlowContainer/LineEdit2");
|
||||
board = GetNode<ChessBoard>("%Chessboard");
|
||||
GetNode<LineEdit>("%LineEdit_YouAre").Text = global.GlobalData["player_color"].AsString();
|
||||
LineEdit turnSideEdit = GetNode<LineEdit>("%LineEdit_TurnSide");
|
||||
turnSideEdit.Text = "red";
|
||||
// GD.Print("ChessGame uid:", global.RPClient.GetUserId(), " color:",global.GlobalData["player_color"]);
|
||||
|
||||
dialog = new ConfirmationDialog {
|
||||
DialogAutowrap = true,
|
||||
@@ -52,107 +43,32 @@ public partial class ChessGame : Node2D {
|
||||
int posX = (int)pos.X;
|
||||
int posY = (int)pos.Y;
|
||||
Vector.Vector2I vector = new(posX, posY);
|
||||
if (isSession) {
|
||||
Game.OnPosClicked(vector, ChessCore.PlayerSideType.Self);
|
||||
// var res = global.RPClient.SendSessionToAll(global.sessionId, new Dictionary {
|
||||
// {"type", "mouseClicked"},
|
||||
// {"X", pos.X},
|
||||
// {"Y", pos.Y},
|
||||
// {"id", global.RPClient.GetUserId()}
|
||||
// });
|
||||
} else {
|
||||
Game.OnPosClicked(vector);
|
||||
}
|
||||
};
|
||||
|
||||
if (isSession) {
|
||||
GD.Print("ws is connected");
|
||||
|
||||
// global.RPClient.OnPRCSessionExit += (cmd, code) => {
|
||||
// GoHome();
|
||||
// };
|
||||
|
||||
// global.RPClient.OnPRCSessionRecv += (msg) => {
|
||||
// SessionMsgHandle(msg["msg"].AsGodotDictionary());
|
||||
// };
|
||||
}
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta) {
|
||||
}
|
||||
|
||||
// private void SessionMsgHandle(Dictionary msg) {
|
||||
// GD.PrintErr($"session msg: {msg}");
|
||||
// switch (msg["type"].AsString()) {
|
||||
// case "over":
|
||||
// if (global.RPClient.GetUserId() == msg["id"].AsString()) {
|
||||
// break;
|
||||
// }
|
||||
// dialog.Title = "Opponent Finished";
|
||||
// dialog.DialogText = "Turn On You\n";
|
||||
// dialog.Visible = true;
|
||||
// break;
|
||||
// case "mouseClicked":
|
||||
// if (msg["id"].ToString() == global.RPClient.GetUserId()) {
|
||||
// break;
|
||||
// }
|
||||
// Vector2 mouseClicked = new(GD.StrToVar(msg["X"].ToString()).AsInt32(),
|
||||
// GD.StrToVar(msg["Y"].ToString()).AsInt32());
|
||||
// Vector.Vector2I vector = new((int)mouseClicked.X, (int)mouseClicked.Y);
|
||||
// Game.OnPosClicked(vector, ChessCore.PlayerSideType.Opponent);
|
||||
// break;
|
||||
// case "undo":
|
||||
// Game.Undo();
|
||||
// break;
|
||||
// case "reInit":
|
||||
// Game.ReInit();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
private void BtnOver() {
|
||||
GD.Print($"BtnOver {isSession}");
|
||||
if (isSession == false) {
|
||||
return;
|
||||
}
|
||||
// global.RPClient.SendSessionToAll(global.sessionId, new Dictionary{
|
||||
// {"type", "over"},
|
||||
// {"id", global.RPClient.GetUserId()},
|
||||
// });
|
||||
logger.Info($"BtnOver");
|
||||
}
|
||||
|
||||
public void GoHome() {
|
||||
// if (global.RPClient.IsOnline()) {
|
||||
// global.RPClient.ExitServer();
|
||||
// }
|
||||
// TODO ClearServer();
|
||||
global.GotoScene("res://Main.tscn");
|
||||
}
|
||||
|
||||
public void Undo() {
|
||||
GD.Print($"Undo {isSession}");
|
||||
|
||||
if (isSession) {
|
||||
// global.RPClient.SendSessionToAll(global.sessionId, new Dictionary{
|
||||
// {"type", "undo"},
|
||||
// {"id", global.RPClient.GetUserId()},
|
||||
// });
|
||||
} else {
|
||||
logger.Info($"Undo");
|
||||
if (Game.board.Steps == 0) board.Clear();
|
||||
Game.Undo();
|
||||
}
|
||||
}
|
||||
|
||||
public void ReInit() {
|
||||
GD.PrintErr($"ReInit {isSession}");
|
||||
|
||||
if (isSession) {
|
||||
// global.RPClient.SendSessionToAll(global.sessionId, new Dictionary{
|
||||
// {"type", "reInit"},
|
||||
// });
|
||||
} else {
|
||||
// TODO using dialog to confirm
|
||||
logger.Info($"ReInit");
|
||||
Game.ReInit();
|
||||
board.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,140 +1,60 @@
|
||||
#nullable disable
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
public partial class GameLobby : Control {
|
||||
GlobalManager global = GlobalManager.Instance;
|
||||
Timer timer = null;
|
||||
readonly Logging.Logger logger = Logging.GetLogger("GameLobby");
|
||||
Timer timer = null!;
|
||||
|
||||
ItemList lists = null;
|
||||
ConfirmationDialog dialog = null;
|
||||
|
||||
string URL;
|
||||
string userName;
|
||||
bool isAcceptedPart = false;
|
||||
ItemList lists = null!;
|
||||
ConfirmationDialog dialog = null!;
|
||||
string URL = null!;
|
||||
string userName = null!;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready() {
|
||||
lists = GetNode<ItemList>("MarginContainer/VBoxContainer/MarginContainer3/ItemList");
|
||||
lists = GetNode<ItemList>("%ItemList_Users");
|
||||
// TODO using %
|
||||
dialog = GetNode<ConfirmationDialog>("Dialogs/ConfirmationDialog");
|
||||
URL = global.ConfigManager.GetValue<string>("server_url");
|
||||
|
||||
URL = global.ConfigManager.GetValue<string>("server_addr");
|
||||
userName = global.ConfigManager.GetValue<string>("user_name");
|
||||
|
||||
dialog.MinSize = new Vector2I(400, 200);
|
||||
dialog.DialogAutowrap = true;
|
||||
dialog.Canceled += () => {
|
||||
// if (dialog.Title == "Session Created")
|
||||
// global.RPClient.SessionAckCreate(dialog.GetMeta("sessionId").ToString(), false);
|
||||
// TODO Cancel to Accept Session Create
|
||||
};
|
||||
dialog.Confirmed += () => {
|
||||
if (dialog.Title == "Session Created") {
|
||||
// FIXME
|
||||
isAcceptedPart = true;
|
||||
// global.RPClient.SessionAckCreate(dialog.GetMeta("sessionId").ToString(), true);
|
||||
// TODO Create Session
|
||||
}
|
||||
};
|
||||
|
||||
// global.RPClient.OnOpen += (eventName, args) => {
|
||||
// global.RPClient.UserInit(userName, "godot chessboard", () => {
|
||||
// global.RPClient.UserRename(userName);
|
||||
// return global.RPClient.RegionAdd("server");
|
||||
// });
|
||||
// };
|
||||
// global.RPClient.OnOpen += (eventName, args) => {
|
||||
// global.RPClient.UserInit(userName, "none", () => {
|
||||
// GD.PrintErr($"User Init Success");
|
||||
|
||||
// return true;
|
||||
// });
|
||||
// // global.RPClient.UserRename(userName);
|
||||
// };
|
||||
// global.RPClient.RegSessionAckCreateCallback((sessionId, res, reqUserId, reqUserName) => {
|
||||
// if (reqUserId != null) {
|
||||
// dialog.Title = "Session Created";
|
||||
// dialog.SetMeta("reqUserName", reqUserName);
|
||||
// dialog.SetMeta("reqUserId", reqUserId);
|
||||
// dialog.SetMeta("sessionId", sessionId);
|
||||
// // dialog.GetLabel==>Text = $"{sessdata["reqUserName"]}";
|
||||
// dialog.DialogText = $"username: {reqUserName}\n" +
|
||||
// $"reqUserId: {reqUserId}\n";
|
||||
// dialog.Visible = true;
|
||||
// } else {
|
||||
// if (res) {
|
||||
// // TODO FIXME
|
||||
// global.sessionId = sessionId;
|
||||
// if (!isAcceptedPart) {
|
||||
// global.GlobalData["player_color"] = "red";
|
||||
// } else {
|
||||
// global.GlobalData["player_color"] = "black";
|
||||
// }
|
||||
// // GD.PrintErr("sessionId: ", reqUserId, "color: ", global.GlobalData["player_color"].AsString());
|
||||
// global.GotoScene("res://Scenes/ChessGame.tscn");
|
||||
// } else {
|
||||
// dialog.Title = "Failed";
|
||||
// dialog.DialogText = $"session create failed";
|
||||
// dialog.Visible = true;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// });
|
||||
|
||||
// timer = new Timer();
|
||||
// AddChild(timer);
|
||||
// TODO using new State Shower And Using Heartbeat to calucate the delay time
|
||||
ColorRect colorRect = GetNode<ColorRect>("MarginContainer/VBoxContainer/MarginContainer2/MarginContainer2/ColorRect");
|
||||
// timer.Connect("timeout", Callable.From(() => {
|
||||
// if (global.RPClient.GetIsConnected()) {
|
||||
// colorRect.Color = Colors.Green;
|
||||
// } else {
|
||||
// colorRect.Color = Colors.Red;
|
||||
// }
|
||||
// FlushData();
|
||||
// }));
|
||||
// timer.Start(1);
|
||||
|
||||
Connect();
|
||||
}
|
||||
|
||||
public void Connect() {
|
||||
GD.Print("Connect");
|
||||
// if (global.RPClient.GetIsConnected()) {
|
||||
// return;
|
||||
// }
|
||||
// global.RPClient.ExitServer();
|
||||
// global.RPClient.ConnectToUrlEx(URL);
|
||||
logger.Info("Connect To Server");
|
||||
// TODO connet to server
|
||||
global.SetProcess(true);
|
||||
}
|
||||
|
||||
private void OnItemSelected(int index) {
|
||||
Dictionary item = lists.GetItemMetadata(index).AsGodotDictionary();
|
||||
GD.Print($"Item {index} selected, {item}");
|
||||
string[] strings = { item["id"].ToString() };
|
||||
// global.RPClient.SessionCreate(strings);
|
||||
logger.Debug($"Item {index} selected, {item}");
|
||||
string[] _ = [item["id"].ToString()];
|
||||
// TODO new a Session
|
||||
}
|
||||
|
||||
private void FlushData() {
|
||||
// global.RPClient.RegionInspect("server", (data) => {
|
||||
// // GD.Print(data);
|
||||
// lists?.Clear();
|
||||
// foreach (Dictionary<string, string> user in data) {
|
||||
// string userId = user["id"].ToString();
|
||||
// string userName = user["name"].ToString();
|
||||
// if (userId == global.RPClient.GetUserId()) {
|
||||
// lists.SetItemDisabled(
|
||||
// lists.AddItem($"Name: {userName}"),
|
||||
// true);
|
||||
// continue;
|
||||
// }
|
||||
// var idx = lists.AddItem($"Name: {userName}");
|
||||
// lists.SetItemMetadata(idx, user);
|
||||
// lists.SetItemTooltip(idx, $"User ID: {userId}");
|
||||
// }
|
||||
// return true;
|
||||
// });
|
||||
private void FlushUserData() {
|
||||
// TODO Flush user data or heartbeat flush
|
||||
}
|
||||
|
||||
|
||||
private void OnBack() {
|
||||
// global.RPClient.ExitServer();
|
||||
// TODO ExitServer();
|
||||
global.GotoScene("res://Main.tscn");
|
||||
}
|
||||
}
|
||||
+27
-14
@@ -3,24 +3,37 @@ using System;
|
||||
|
||||
public partial class Mods : Control {
|
||||
GlobalManager global = GlobalManager.Instance;
|
||||
public override void _Ready() {
|
||||
// RunDemo();
|
||||
ItemList modsItemList = null!;
|
||||
|
||||
// ModManager modManager = new();
|
||||
// modManager.RegistryFunc("OnInit", () => { GD.Print("OnInit"); }, true);
|
||||
// modManager.RegistryFunc("foo", () => { GD.Print("Hello"); });
|
||||
// LuaMod mod = new(ProjectSettings.GlobalizePath("res://Protos/test.lua"));
|
||||
// mod.BindFunc(modManager);
|
||||
// try {
|
||||
// modManager.InvokeFunc<Action>("OnInit");
|
||||
// }
|
||||
// catch (System.Exception e) {
|
||||
// GD.PrintErr("OnInit error: ", e.Message, e.StackTrace);
|
||||
// }
|
||||
public override void _Ready() {
|
||||
// TODO
|
||||
modsItemList = GetNode<ItemList>("VBoxContainer/VScrollBar/ItemList");
|
||||
FlushModState();
|
||||
}
|
||||
|
||||
private void FlushModState() {
|
||||
modsItemList.Clear();
|
||||
foreach (var mod in global.Mods.ModList) {
|
||||
var item = modsItemList.AddItem(mod.Key);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnableMods(bool enable) {
|
||||
if (enable) {
|
||||
global.Mods.LoadAllMods();
|
||||
}
|
||||
else {
|
||||
global.Mods.ClearAllMods();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReSearchMods() {
|
||||
global.Mods.SearchAllMods(true);
|
||||
}
|
||||
|
||||
public void OnOpenModFileDir() {
|
||||
OS.ShellOpen(global.ConfigManager.GetValue<string>("mods_fpath") ?? "user://Mods/");
|
||||
string path = global.ConfigManager.GetValue<string>("mods_fpath") ?? "user://mods";
|
||||
OS.ShellOpen(ProjectSettings.GlobalizePath(path));
|
||||
}
|
||||
|
||||
public void OnBack() {
|
||||
|
||||
@@ -4,24 +4,21 @@ using System.IO;
|
||||
|
||||
public partial class Setting : Control {
|
||||
private GlobalManager global = GlobalManager.Instance;
|
||||
private IConfigManager config = GlobalManager.Instance.ConfigManager;
|
||||
int font_size;
|
||||
private readonly IConfigManager config = GlobalManager.Instance.ConfigManager;
|
||||
private int font_size;
|
||||
private LineEdit fontOut = null!;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready() {
|
||||
fontOut = GetNode<LineEdit>("BoxContainer/MarginContainer5/HBoxContainer/FontSize");
|
||||
fontOut = GetNode<LineEdit>("%FontSize");
|
||||
font_size = config.GetValue<int>("font_size");
|
||||
GetNode<HSlider>("BoxContainer/MarginContainer6/FontSizeBar")
|
||||
GetNode<HSlider>("%FontSizeBar")
|
||||
.Value = font_size;
|
||||
fontOut.Text = font_size.ToString();
|
||||
|
||||
FillingData();
|
||||
}
|
||||
private void FillingData() {
|
||||
GetNode<LineEdit>("BoxContainer/MarginContainer2/Server/LineEdit")
|
||||
.Text = config.GetValue<string>("server_url");
|
||||
GetNode<LineEdit>("BoxContainer/MarginContainer3/Name/LineEdit")
|
||||
GetNode<LineEdit>("%LineEdit_ServerIP")
|
||||
.Text = config.GetValue<string>("server_addr");
|
||||
GetNode<LineEdit>("%LineEdit_UserName")
|
||||
.Text = config.GetValue<string>("user_name");
|
||||
}
|
||||
|
||||
@@ -35,17 +32,14 @@ public partial class Setting : Control {
|
||||
|
||||
private void OnSave() {
|
||||
global.SaveConfig();
|
||||
// OS.Alert("Saved", "Setting");
|
||||
}
|
||||
|
||||
void OnNameChanged(string Value) {
|
||||
config.SetValue("user_name", Value);
|
||||
// config.GetValue<>Flush();
|
||||
}
|
||||
|
||||
private void OnServerUrlChanged(string Value) {
|
||||
config.SetValue("server_url", Value);
|
||||
// config.GetValue<>Flush();
|
||||
}
|
||||
|
||||
private void OnFontSizeChanged(float Value) {
|
||||
|
||||
@@ -2,23 +2,26 @@ using System.Collections.Generic;
|
||||
using Godot;
|
||||
|
||||
public partial class GlobalManager : Node {
|
||||
private static readonly Logging.Logger logger = Logging.GetLogger("GlobalManager");
|
||||
public static GlobalManager Instance { get; private set; } = null!;
|
||||
public static string ConfigPath { get; private set; } = "user://config.json";
|
||||
private GlobalManager() {
|
||||
ConfigManager.SetFilePath(ProjectSettings.GlobalizePath(ConfigPath));
|
||||
ConfigManager.SetDefault(_default_config);
|
||||
ConfigManager.LoadFromFile();
|
||||
GD.Print("GameSystem Singleton Initialized");
|
||||
|
||||
Mods = new GlobalModManager(ConfigManager.GetValue<string>("mods_fpath"));
|
||||
Mods.SearchAllMods();
|
||||
}
|
||||
|
||||
// TODO Will Change It
|
||||
public readonly GlobalModManager Mods = null!;
|
||||
public readonly IConfigManager ConfigManager = new JsonConfigManager();
|
||||
private static readonly Dictionary<string, object> _default_config = new() {
|
||||
{"font_size", 20},
|
||||
{"server_url", "wss://game.zzyxyz.com/"},
|
||||
{"server_addr", "wss://game.zzyxyz.com/"},
|
||||
{"user_name", "undefined"},
|
||||
|
||||
{"mods_fpath", "user://Mods/"},
|
||||
{"mods_fpath", "user://mods"},
|
||||
{"mods_allowed", false},
|
||||
};
|
||||
|
||||
@@ -39,23 +42,15 @@ public partial class GlobalManager : Node {
|
||||
Instance = this;
|
||||
}
|
||||
else {
|
||||
GD.PushError("GlobalManager already exists");
|
||||
logger.Error("GlobalManager already exists");
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
if (OS.GetName() == "Android") {
|
||||
bool ret = OS.RequestPermissions();
|
||||
GD.Print($"RequestPermissions ret is {ret}");
|
||||
logger.Warning($"RequestPermissions ret is {ret}");
|
||||
}
|
||||
|
||||
// OS.RequestPermissions();
|
||||
// RPClient.OnRPCError += (errCode, type, cmd, errMsg) => {
|
||||
// GD.PrintErr($"errCode {errCode}, type/cmd {type}/{cmd}, errMsg {errMsg}");
|
||||
// };
|
||||
// RPClient.OnClose += (eventName, args) => {
|
||||
// SetProcess(false);
|
||||
// };
|
||||
|
||||
Viewport root = GetTree().Root;
|
||||
CurrentScene = root.GetChild(root.GetChildCount() - 1);
|
||||
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// 仿照 Python logging 的 日志系统
|
||||
/// </summary>
|
||||
public static class Logging {
|
||||
// ========== 日志级别 ==========
|
||||
public enum Level {
|
||||
NOSET = 0,
|
||||
DEBUG = 10,
|
||||
INFO = 20,
|
||||
WARNING = 30,
|
||||
ERROR = 40,
|
||||
CRITICAL = 50
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 日志记录器
|
||||
/// </summary>
|
||||
public class Logger(string name) {
|
||||
public string Name { get; } = name;
|
||||
public Level LogLevel { get; set; } = Level.INFO;
|
||||
private readonly List<Action<Level, string, string, string>> _handlers = [];
|
||||
|
||||
public void AddHandler(Action<Level, string, string, string> handler) =>
|
||||
_handlers.Add(handler);
|
||||
|
||||
// ===== 日志方法 =====
|
||||
public void Debug(string fmt, params object[] args) =>
|
||||
Log(Level.DEBUG, fmt, false, args);
|
||||
|
||||
public void Info(string fmt, params object[] args) =>
|
||||
Log(Level.INFO, fmt, false, args);
|
||||
|
||||
public void Warning(string fmt, params object[] args) =>
|
||||
Log(Level.WARNING, fmt, false, args);
|
||||
|
||||
public void Error(string fmt, params object[] args) =>
|
||||
Log(Level.ERROR, fmt, false, args);
|
||||
|
||||
public void Critical(string fmt, params object[] args) =>
|
||||
Log(Level.CRITICAL, fmt, true, args);
|
||||
|
||||
public void Exception(string fmt, Exception e, params object[] args) {
|
||||
// TODO for godot not support /r/n yet
|
||||
string stackTrace = e.StackTrace?.Replace("\r\n", "\n") ?? "";
|
||||
string exceptionMessage = $"{fmt}\n{e.Message}\n{stackTrace}";
|
||||
|
||||
Log(Level.ERROR, exceptionMessage, false, args);
|
||||
}
|
||||
|
||||
// ===== 核心Log方法 =====
|
||||
private void Log(Level level, string fmt, bool isExec = false, params object[] args) {
|
||||
if (level < LogLevel) return;
|
||||
|
||||
// 格式化消息
|
||||
string message = args.Length > 0 ?
|
||||
string.Format(fmt, args) : fmt;
|
||||
|
||||
// 添加执行堆栈信息
|
||||
string stackInfo = isExec ?
|
||||
$"\nExecution Stack:\n{System.Environment.StackTrace}" : "";
|
||||
|
||||
// 构建前缀
|
||||
string prefix = $"[{DateTime.Now:HH:mm:ss}] [{level}] [{Name}]";
|
||||
|
||||
// 调用所有处理器
|
||||
foreach (var handler in _handlers) {
|
||||
handler(level, prefix, message, stackInfo);
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public void Assert(bool condition, string fmt, params object[] args) {
|
||||
if (condition) return;
|
||||
string message = args.Length > 0 ?
|
||||
string.Format(fmt, args) : fmt;
|
||||
Error("Assertion Failed: " + message, true);
|
||||
|
||||
if (Debugger.IsAttached)
|
||||
Debugger.Break();
|
||||
|
||||
System.Diagnostics.Debug.Assert(condition, message);
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 全局管理器 ==========
|
||||
private static readonly Dictionary<string, Logger> _loggers = [];
|
||||
private static readonly Logger _root = GetLogger("root");
|
||||
|
||||
/// <summary>
|
||||
/// 获取或创建日志记录器
|
||||
/// </summary>
|
||||
public static Logger GetLogger(string name = "root") {
|
||||
if (!_loggers.TryGetValue(name, out var logger)) {
|
||||
logger = new Logger(name);
|
||||
logger.AddHandler(DefaultHandler);
|
||||
_loggers[name] = logger;
|
||||
}
|
||||
return logger;
|
||||
}
|
||||
|
||||
// ========== 优化的默认处理器 ==========
|
||||
private static void DefaultHandler(Level level, string prefix, string message, string stackInfo) {
|
||||
// 构建完整日志消息
|
||||
string fullMessage = $"{prefix} {message}{stackInfo}";
|
||||
|
||||
switch (level) {
|
||||
case Level.DEBUG:
|
||||
// DEBUG级别:使用GD.Print + OS条件
|
||||
if (OS.IsStdOutVerbose())
|
||||
GD.Print(fullMessage);
|
||||
break;
|
||||
|
||||
case Level.INFO:
|
||||
// INFO级别:使用GD.Print
|
||||
GD.Print(fullMessage);
|
||||
break;
|
||||
|
||||
case Level.WARNING:
|
||||
// WARNING级别:使用PrintRich + 黄色
|
||||
GD.PrintRich($"[color=yellow]{fullMessage}[/color]");
|
||||
break;
|
||||
|
||||
case Level.ERROR:
|
||||
// ERROR级别:使用GD.PrintErr
|
||||
GD.PrintRich($"[color=red][b]{fullMessage}[/b][/color]");
|
||||
// GD.PrintErr(fullMessage);
|
||||
break;
|
||||
|
||||
case Level.CRITICAL:
|
||||
// CRITICAL级别:使用GD.PushError
|
||||
GD.PushError(fullMessage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 快捷操作方式 ==========
|
||||
public static void Debug(string fmt, params object[] args) =>
|
||||
_root.Debug(fmt, args);
|
||||
|
||||
public static void Info(string fmt, params object[] args) =>
|
||||
_root.Info(fmt, args);
|
||||
|
||||
public static void Warning(string fmt, params object[] args) =>
|
||||
_root.Warning(fmt, args);
|
||||
|
||||
public static void Error(string fmt, params object[] args) =>
|
||||
_root.Error(fmt, args);
|
||||
|
||||
public static void Critical(string fmt, params object[] args) =>
|
||||
_root.Critical(fmt, args);
|
||||
|
||||
// ===== C语言风格的宏断言快捷方式 =====
|
||||
[Conditional("DEBUG")]
|
||||
public static void Assert(bool condition, string fmt, params object[] args) =>
|
||||
_root.Assert(condition, fmt, args);
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void TestPrint() {
|
||||
GD.Print("GameSystem Singleton Initialized");
|
||||
GD.PrintErr("This is a print error");
|
||||
GD.PushWarning("This is a warning");
|
||||
GD.PushError("This is a error");
|
||||
Debug("This is a debug");
|
||||
Info("This is a info");
|
||||
Warning("This is a warn");
|
||||
Error("This is a error");
|
||||
Critical("This is a critical");
|
||||
Assert(true, "This is a assert");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bud682vprk1w6
|
||||
@@ -1,67 +1,70 @@
|
||||
using Godot;
|
||||
using NLua;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
public class GlobalModManager
|
||||
{
|
||||
public readonly Lua lua = new();
|
||||
private readonly string modsPath;
|
||||
public class GlobalModManager(string modPath = "user://mods") {
|
||||
public static GlobalModManager Instance { get; } = new();
|
||||
private readonly Dictionary<string, LuaModManager> _mods = [];
|
||||
public ReadOnlyDictionary<string, LuaModManager> Mods => new(_mods);
|
||||
private readonly Dictionary<string, string> _modList = [];
|
||||
public ReadOnlyDictionary<string, string> ModList => new(_modList);
|
||||
private readonly string modPath = modPath;
|
||||
private static readonly Logging.Logger logger = Logging.GetLogger("GlobalMod");
|
||||
|
||||
public GlobalModManager(string modsPath = "user://Mods/") {
|
||||
this.modsPath = modsPath;
|
||||
lua.State.Encoding = Encoding.UTF8;
|
||||
// lua.State.SetHook(KeraLua.LuaHookMask.Count, 1000000);
|
||||
|
||||
InitSandBox();
|
||||
// RegisterAPI();
|
||||
public void SearchAllMods(bool isFlush = false) {
|
||||
if (isFlush) {
|
||||
_modList.Clear();
|
||||
}
|
||||
|
||||
public void LoadAllMods()
|
||||
{
|
||||
if (!DirAccess.DirExistsAbsolute(modsPath))
|
||||
if (!DirAccess.DirExistsAbsolute(modPath))
|
||||
return;
|
||||
|
||||
using var dir = DirAccess.Open(modsPath);
|
||||
using var dir = DirAccess.Open(modPath);
|
||||
if (dir == null) return;
|
||||
|
||||
dir.ListDirBegin();
|
||||
string fileName = dir.GetNext();
|
||||
while (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
if (fileName.EndsWith(".lua"))
|
||||
{
|
||||
LoadMod(fileName);
|
||||
while (!string.IsNullOrEmpty(fileName)) {
|
||||
string fullPath = $"{modPath}/{fileName}";
|
||||
const string entryFileName = "main.lua";
|
||||
|
||||
if (dir.CurrentIsDir() && !fileName.StartsWith('.') &&
|
||||
FileAccess.FileExists($"{fullPath}/{entryFileName}")) {
|
||||
_modList.Add($"{fullPath}/{entryFileName}", fullPath);
|
||||
}
|
||||
fileName = dir.GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitSandBox() {
|
||||
public void LoadAllMods(bool isFlush = false) {
|
||||
if (isFlush) {
|
||||
_mods.Clear();
|
||||
}
|
||||
|
||||
private void LoadMod(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
string luaCode = LoadFile(filePath);
|
||||
lua.DoString(luaCode);
|
||||
GD.Print($"成功加载Mod: {filePath}");
|
||||
foreach (var mod in _modList) {
|
||||
try {
|
||||
LoadMod(mod.Key, mod.Value);
|
||||
}
|
||||
catch (System.Exception e) {
|
||||
logger.Exception("Failed to load mod {0}", e, mod.Key);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
GD.PrintErr($"加载Mod {filePath} 失败: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SaveFile(string path, string content)
|
||||
{
|
||||
public void ClearAllMods() {
|
||||
_mods.Clear();
|
||||
}
|
||||
|
||||
private void LoadMod(string filePath, string modPath) {
|
||||
string _filePath = ProjectSettings.GlobalizePath(filePath);
|
||||
string _modPath = ProjectSettings.GlobalizePath(modPath);
|
||||
_mods.Add(filePath, new LuaModManager(_filePath, _modPath));
|
||||
}
|
||||
|
||||
private static void SaveFile(string path, string content) {
|
||||
using var file = FileAccess.Open(path, FileAccess.ModeFlags.Write);
|
||||
file.StoreString(content);
|
||||
}
|
||||
|
||||
private static string LoadFile(string path)
|
||||
{
|
||||
private static string LoadFile(string path) {
|
||||
using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read);
|
||||
string content = file.GetAsText();
|
||||
return content;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
using NLua;
|
||||
|
||||
class LuaMod : IDisposable {
|
||||
public class LuaModManager : IDisposable {
|
||||
private readonly Lua lua = new();
|
||||
private static readonly Logging.Logger logger = Logging.GetLogger("LuaMod");
|
||||
|
||||
public LuaMod(string path, string? package_path = null) {
|
||||
public LuaModManager(string path, string? package_path = null) {
|
||||
lua.LoadCLRPackage();
|
||||
lua.State.Encoding = System.Text.Encoding.UTF8;
|
||||
lua["package.path"] = package_path ?? Path.GetDirectoryName(path) + "/?.lua;";
|
||||
lua.RegisterFunction("print", new Action<object[]>(GD.Print).Method);
|
||||
// Action bar = () => { GD.Print("bar"); };
|
||||
// lua.RegisterFunction("bar", bar.Target, bar.Method);
|
||||
lua.RegisterFunction("print", new Action<object[]>(Godot.GD.Print).Method);
|
||||
|
||||
logger.Info("Loading Lua Mod: " + path);
|
||||
lua.DoFile(path);
|
||||
}
|
||||
|
||||
@@ -36,5 +36,9 @@ class LuaMod : IDisposable {
|
||||
lua?.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public static void WriteComment(Delegate @delegate) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
|
||||
class ModManager {
|
||||
public class ModManager {
|
||||
private readonly Dictionary<string, Delegate> _api = [];
|
||||
private readonly Dictionary<string, Delegate> _hooks = [];
|
||||
public delegate bool OnCallback(params object[] args);
|
||||
|
||||
Reference in new issue
Block a user