Animate the splash screen.

为启动画面加入动画。
This commit is contained in:
Cold-Mint 2024-07-16 22:11:57 +08:00
parent 2ba5d304a9
commit dd16e14947
Signed by: Cold-Mint
GPG Key ID: C5A9BF8A98E0CE99
4 changed files with 310 additions and 94 deletions

View File

@ -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...,読み込み中...

1 id zh en ja
33 ui_character_voice 角色配音 character_voice キャラクターボイスです
34 ui_translator 翻译 translator 翻訳
35 ui_unordered_list_tip 排名不分先后 Ranking is not in order 順位は関係ありません
36 ui_loading 正在加载... Loading... 読み込み中...

View File

@ -1,8 +1,166 @@
[gd_scene load_steps=3 format=3 uid="uid://rx7t26ldvonc"]
[gd_scene load_steps=7 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"]
[sub_resource type="Animation" id="Animation_bisl3"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ColdMintTextureRect:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("ColdMintLabel:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("GodotLabel:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("GodotTextureRect:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("loadingStateLabel:modulate")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("NameLabel:modulate")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_j4ppv"]
resource_name = "startup"
length = 4.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ColdMintTextureRect:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5, 1.5, 2),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("ColdMintLabel:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.5, 1.5, 2),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("GodotLabel:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(2.5, 3, 3.5, 4),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("GodotTextureRect:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(2.5, 3, 3.5, 4),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("loadingStateLabel:modulate")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(4, 4.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("NameLabel:modulate")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(4, 4.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_mraly"]
_data = {
"RESET": SubResource("Animation_bisl3"),
"startup": SubResource("Animation_j4ppv")
}
[node name="SplashScreen" type="Control"]
layout_mode = 3
anchors_preset = 15
@ -10,6 +168,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
@ -21,93 +180,107 @@ grow_vertical = 2
color = Color(0.129412, 0.129412, 0.129412, 1)
[node name="ColdMintTextureRect" type="TextureRect" parent="."]
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 104.0
offset_left = -96.0
offset_top = -196.0
offset_right = 296.0
offset_bottom = -4.0
offset_right = 96.0002
offset_bottom = -3.99969
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_0333i")
[node name="GodotTextureRect" type="TextureRect" parent="."]
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -296.0
offset_left = -96.0
offset_top = -196.0
offset_right = -104.0
offset_right = 96.0
offset_bottom = -4.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_y25sr")
[node name="ColdMintLabel" type="Label" parent="."]
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 131.0
offset_top = 28.0
offset_right = 260.0
offset_bottom = 77.0
offset_left = -64.5
offset_top = 25.5
offset_right = 64.5
offset_bottom = 74.5
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 32
text = "ColdMint"
[node name="GodotLabel" type="Label" parent="."]
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -286.0
offset_top = 22.0
offset_right = -96.0
offset_bottom = 71.0
offset_left = -95.0
offset_top = 25.5
offset_right = 95.0
offset_bottom = 74.5
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 32
text = "Godot Engine"
[node name="ColorRect2" type="ColorRect" parent="."]
[node name="loadingStateLabel" type="Label" parent="."]
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchors_preset = 14
anchor_top = 0.5
anchor_right = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -0.5
offset_top = -196.0
offset_right = 0.5
offset_bottom = 74.0
offset_top = 53.0
offset_bottom = 98.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 24
text = "ui_loading"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label" type="Label" parent="."]
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_mraly")
}
autoplay = "startup"
[node name="NameLabel" type="Label" parent="."]
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchors_preset = 14
anchor_top = 0.5
anchor_right = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -66.0
offset_top = 184.5
offset_right = 66.0
offset_bottom = 215.5
offset_left = 1.0
offset_top = -141.0
offset_right = 1.0
offset_bottom = -94.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 20
text = "Now Loading..."
theme_override_font_sizes/font_size = 34
text = "ui_product_name"
horizontal_alignment = 1
vertical_alignment = 1

View File

@ -1,14 +1,7 @@
using System;
using System.IO;
using System.Text;
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 ColdMint.scripts.utils;
using Godot;
@ -33,64 +26,9 @@ public partial class MainMenuLoader : UiLoaderTemplate
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<PackedScene>("res://scenes/game.tscn");
_contributor = GD.Load<PackedScene>("res://scenes/contributor.tscn");
_levelGraphEditor = GD.Load<PackedScene>("res://scenes/levelGraphEditor.tscn");
//Register ItemTypes from file
//从文件注册物品类型
ItemTypeRegister.RegisterFromFile();
//Hardcoded ItemTypes Register
//硬编码注册物品类型
ItemTypeRegister.StaticRegister();
//静态注册掉落表
LootRegister.StaticRegister();
}
public override void InitializeUi()

View File

@ -0,0 +1,104 @@
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;
/// <summary>
/// <para>SplashScreenLoader</para>
/// <para>启动画面加载器</para>
/// </summary>
public partial class SplashScreenLoader : UiLoaderTemplate
{
private Label? _loadingLabel;
private PackedScene? _mainMenuScene;
private AnimationPlayer? _animationPlayer;
public override void InitializeData()
{
_mainMenuScene = GD.Load<PackedScene>("res://scenes/mainMenu.tscn");
}
public override void InitializeUi()
{
_loadingLabel = GetNode<Label>("loadingStateLabel");
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
_animationPlayer.AnimationFinished += AnimationFinished;
}
private async void AnimationFinished(StringName name)
{
await LoadingGlobalData();
if (_mainMenuScene == null)
{
return;
}
GetTree().ChangeSceneToPacked(_mainMenuScene);
}
/// <summary>
/// <para>Load the game's global data</para>
/// <para>加载游戏的全局数据</para>
/// </summary>
private async Task LoadingGlobalData()
{
//Loading App configuration
//加载App配置
var appConfigData = AppConfig.LoadFromFile();
if (appConfigData != null)
{
AppConfig.ApplyAppConfig(appConfigData);
}
//Set the minimum log level to Info in debug mode.(Print all logs)
//在调试模式下将最小日志等级设置为Info。打印全部日志
//Disable all logs in the release version.
//在发行版禁用所有日志。
LogCat.MinLogLevel = Config.IsDebug() ? LogCat.InfoLogLevel : 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);
//Register ItemTypes from file
//从文件注册物品类型
ItemTypeRegister.RegisterFromFile();
//Hardcoded ItemTypes Register
//硬编码注册物品类型
ItemTypeRegister.StaticRegister();
//静态注册掉落表
LootRegister.StaticRegister();
await Task.Delay(TimeSpan.FromMilliseconds(500));
}
}