添加 UI 资源并重构角色类
添加了新的 UI 资源:logo.png、uiskin.atlas 和 uiskin.json,以改进界面设计。 移除了过时的 FighterController 和 GameCore 类,以精简代码库。 引入了新的角色类:FighterList 和 Reimu,增加了角色选择选项。 实现了新的桌面屏幕:CharacterSelectScreen(角色选择屏幕)、GameScreen(游戏屏幕)、MainMenuScreen(主菜单屏幕)和 StartScreen(开始屏幕),以改善用户导航。 通过新的 ConnectClient、ConnectServer 和 NetworkManager 类建立了网络功能。 更新了工具类:ClearScreen、Font 和 SimpleFormatter,以提升功能。 创建了新的 ButtonActions 类来处理按钮交互。
This commit is contained in:
11
src/main/java/uno/mloluyu/util/ClearScreen.java
Normal file
11
src/main/java/uno/mloluyu/util/ClearScreen.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package uno.mloluyu.util;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
|
||||
public class ClearScreen {
|
||||
public ClearScreen() {
|
||||
Gdx.gl.glClearColor(0.3F, 0.3F, 0.5F, 1);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
31
src/main/java/uno/mloluyu/util/Font.java
Normal file
31
src/main/java/uno/mloluyu/util/Font.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package uno.mloluyu.util;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||
|
||||
public class Font {
|
||||
public static BitmapFont loadChineseFont() {
|
||||
FreeTypeFontGenerator generator = null;
|
||||
try {
|
||||
generator = new FreeTypeFontGenerator(Gdx.files.internal("FLyouzichati-Regular-2.ttf")); // 你的中文字体路径
|
||||
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
|
||||
parameter.size = 48;
|
||||
parameter.color = Color.WHITE;
|
||||
parameter.borderWidth = 1;
|
||||
parameter.borderColor = Color.DARK_GRAY;
|
||||
parameter.characters = "返回主菜单确认角色选择了角色人游戏加入联机模式 - 等待其他玩家连接...房间创建房间联机设置开始游戏设置联网中国abcdefghijklmnopqrstuvw暂定xyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
return generator.generateFont(parameter);
|
||||
} catch (Exception e) {
|
||||
Gdx.app.error("Font Error", "加载中文字体失败: " + e.getMessage());
|
||||
return new BitmapFont(); // 回退默认字体
|
||||
} finally {
|
||||
if (generator != null)
|
||||
generator.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user