From aa8c1553324601bd5129ea069a44c8600ac24d4f Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Tue, 16 Jul 2024 20:07:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=A1=B5=E9=9D=A2=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=94=BE=E5=88=B0=E5=90=AF=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locals/UI.csv | 1 + scenes/splashScreen.tscn | 9 +- scripts/loader/uiLoader/MainMenuLoader.cs | 62 ------------ scripts/loader/uiLoader/SplashScreenLoader.cs | 97 +++++++++++++++++++ 4 files changed, 104 insertions(+), 65 deletions(-) create mode 100644 scripts/loader/uiLoader/SplashScreenLoader.cs diff --git a/locals/UI.csv b/locals/UI.csv index caa5fee..cc5e626 100644 --- a/locals/UI.csv +++ b/locals/UI.csv @@ -33,3 +33,4 @@ ui_musician,音乐,musician,音楽 ui_character_voice,角色配音,character_voice,キャラクターボイスです ui_translator,翻译,translator,翻訳 ui_unordered_list_tip,排名不分先后,Ranking is not in order,順位は関係ありません +ui_loading,正在加载...,Loading...,読み込み中... diff --git a/scenes/splashScreen.tscn b/scenes/splashScreen.tscn index d843022..8d8e68a 100644 --- a/scenes/splashScreen.tscn +++ b/scenes/splashScreen.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=3 format=3 uid="uid://rx7t26ldvonc"] +[gd_scene load_steps=4 format=3 uid="uid://rx7t26ldvonc"] +[ext_resource type="Script" path="res://scripts/loader/uiLoader/SplashScreenLoader.cs" id="1_3pcuw"] [ext_resource type="Texture2D" uid="uid://cb3gn8xb5r4gm" path="res://sprites/icons/coldmint.png" id="1_0333i"] [ext_resource type="Texture2D" uid="uid://b877262di2jp5" path="res://sprites/icons/godot.png" id="2_y25sr"] @@ -10,6 +11,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_3pcuw") [node name="ColorRect" type="ColorRect" parent="."] layout_mode = 1 @@ -96,7 +98,7 @@ offset_bottom = 74.0 grow_horizontal = 2 grow_vertical = 2 -[node name="Label" type="Label" parent="."] +[node name="loadingStateLabel" type="Label" parent="."] layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 @@ -110,4 +112,5 @@ offset_bottom = 215.5 grow_horizontal = 2 grow_vertical = 2 theme_override_font_sizes/font_size = 20 -text = "Now Loading..." +text = "ui_loading" +horizontal_alignment = 1 diff --git a/scripts/loader/uiLoader/MainMenuLoader.cs b/scripts/loader/uiLoader/MainMenuLoader.cs index fb1071d..c1d7e43 100644 --- a/scripts/loader/uiLoader/MainMenuLoader.cs +++ b/scripts/loader/uiLoader/MainMenuLoader.cs @@ -31,68 +31,6 @@ public partial class MainMenuLoader : UiLoaderTemplate private Button? _levelGraphEditorButton; private LinkButton? _contributorButton; - public override void InitializeData() - { - AppConfigData? appConfigData = AppConfig.LoadFromFile(); - if (appConfigData != null) - { - AppConfig.ApplyAppConfig(appConfigData); - } - - 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; - } - - ContributorDataManager.RegisterAllContributorData(); - DeathInfoGenerator.RegisterDeathInfoHandler(new SelfDeathInfoHandler()); - MapGenerator.RegisterRoomInjectionProcessor(new ChanceRoomInjectionProcessor()); - MapGenerator.RegisterRoomInjectionProcessor(new TimeIntervalRoomInjectorProcessor()); - //Register the corresponding encoding provider to solve the problem of garbled Chinese path of the compressed package - //注册对应的编码提供程序,解决压缩包中文路径乱码问题 - Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); - //创建游戏数据文件夹 - var dataPath = Config.GetGameDataDirectory(); - if (!Directory.Exists(dataPath)) - { - Directory.CreateDirectory(dataPath); - } - - - //Registered camp - //注册阵营 - var defaultCamp = new Camp(Config.CampId.Default) - { - FriendInjury = true - }; - CampManager.SetDefaultCamp(defaultCamp); - var mazoku = new Camp(Config.CampId.Mazoku); - CampManager.AddCamp(mazoku); - var aborigines = new Camp(Config.CampId.Aborigines); - CampManager.AddCamp(aborigines); - _gameScene = GD.Load("res://scenes/game.tscn"); - _contributor = GD.Load("res://scenes/contributor.tscn"); - _levelGraphEditor = GD.Load("res://scenes/levelGraphEditor.tscn"); - - //Register ItemTypes from file - //从文件注册物品类型 - ItemTypeRegister.RegisterFromFile(); - //Hardcoded ItemTypes Register - //硬编码注册物品类型 - ItemTypeRegister.StaticRegister(); - - //静态注册掉落表 - LootRegister.StaticRegister(); - } - public override void InitializeUi() { _contributorButton = GetNode("VBoxContainer2/ContributorButton"); diff --git a/scripts/loader/uiLoader/SplashScreenLoader.cs b/scripts/loader/uiLoader/SplashScreenLoader.cs new file mode 100644 index 0000000..2b804bb --- /dev/null +++ b/scripts/loader/uiLoader/SplashScreenLoader.cs @@ -0,0 +1,97 @@ +using System; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using ColdMint.scripts.camp; +using ColdMint.scripts.contribute; +using ColdMint.scripts.deathInfo; +using ColdMint.scripts.debug; +using ColdMint.scripts.inventory; +using ColdMint.scripts.loot; +using ColdMint.scripts.map; +using ColdMint.scripts.map.roomInjectionProcessor; +using Godot; + +namespace ColdMint.scripts.loader.uiLoader; + +/// +/// SplashScreenLoader +/// 启动画面加载器 +/// +public partial class SplashScreenLoader : UiLoaderTemplate +{ + private Label? _loadingLabel; + private PackedScene? _mainMenuScene; + + public override void InitializeData() + { + _mainMenuScene = GD.Load("res://scenes/mainMenu.tscn"); + } + + public override async void InitializeUi() + { + _loadingLabel = GetNode