dev: 更新代码,并准备LuaMod
This commit is contained in:
43
Main.cs
43
Main.cs
@ -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");
|
||||
// }
|
||||
}
|
||||
|
Reference in New Issue
Block a user