学习了如何处理像素风

This commit is contained in:
wjsjwr 2025-12-06 23:50:24 +08:00
parent 70c19e7972
commit 47360863c1
15 changed files with 304 additions and 8 deletions

View File

@ -11,7 +11,7 @@ config_version=5
[application]
config/name="最强导师"
run/main_scene="res://scenes/logo_scene.tscn"
run/main_scene="uid://cf6b1t8pujosf"
config/features=PackedStringArray("4.5", "C#", "GL Compatibility")
config/icon="res://icon.svg"
@ -50,9 +50,12 @@ save/encryption_on_exports_only=true
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
window/size/viewport_width=960
window/size/viewport_height=540
window/size/window_width_override=1920
window/size/window_height_override=1080
window/stretch/mode="viewport"
window/stretch/scale_mode="integer"
[dotnet]

Binary file not shown.

BIN
res_src/scroll-bar-bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bilmun5leavcp"
path="res://.godot/imported/scroll-bar-bg.png-0c6c669d5e4f1a9ecb9479d207dc8639.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://res_src/scroll-bar-bg.png"
dest_files=["res://.godot/imported/scroll-bar-bg.png-0c6c669d5e4f1a9ecb9479d207dc8639.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://4co5g8v60w5o"
path="res://.godot/imported/scroll-bar-grabber.png-603da1836b075795b62c04d82734f51d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://res_src/scroll-bar-grabber.png"
dest_files=["res://.godot/imported/scroll-bar-grabber.png-603da1836b075795b62c04d82734f51d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -15,7 +15,7 @@ dest_files=["res://.godot/imported/unifont-16.0.01.otf-24565f95e8120912d339509ec
Rendering=null
antialiasing=0
generate_mipmaps=false
disable_embedded_bitmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
@ -25,7 +25,7 @@ modulate_color_glyphs=false
hinting=1
subpixel_positioning=0
keep_rounding_remainders=true
oversampling=0.0
oversampling=1.0
Fallbacks=null
fallbacks=[]
Compress=null

Binary file not shown.

View File

@ -0,0 +1,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://1xg1ofw27hbp"
path="res://.godot/imported/unifont-17.0.03.otf-2df8b1d999820e22329e26c7081f4dab.fontdata"
[deps]
source_file="res://resources/Font/unifont-17.0.03.otf"
dest_files=["res://.godot/imported/unifont-17.0.03.otf-2df8b1d999820e22329e26c7081f4dab.fontdata"]
[params]
Rendering=null
antialiasing=0
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=1
subpixel_positioning=0
keep_rounding_remainders=true
oversampling=1.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

View File

@ -0,0 +1,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://cexdvv8qg3x01"
path="res://.godot/imported/文泉驿点阵正黑.TTF-5d75f2a3bb936df79dd8b419d3073790.fontdata"
[deps]
source_file="res://resources/Font/文泉驿点阵正黑.TTF"
dest_files=["res://.godot/imported/文泉驿点阵正黑.TTF-5d75f2a3bb936df79dd8b419d3073790.fontdata"]
[params]
Rendering=null
antialiasing=0
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=1
subpixel_positioning=0
keep_rounding_remainders=true
oversampling=1.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@ -930,6 +930,7 @@ frame = 156
libraries = {
&"": SubResource("AnimationLibrary_fw47y")
}
autoplay = "RESET"
[node name="StudentName" type="Node" parent="."]
script = ExtResource("8_kvqca")

110
scenes/test.tscn Normal file
View File

@ -0,0 +1,110 @@
[gd_scene load_steps=10 format=3 uid="uid://cf6b1t8pujosf"]
[ext_resource type="Texture2D" uid="uid://bilmun5leavcp" path="res://res_src/scroll-bar-bg.png" id="1_bl13t"]
[ext_resource type="FontFile" uid="uid://cexdvv8qg3x01" path="res://resources/Font/文泉驿点阵正黑.TTF" id="1_errlg"]
[ext_resource type="FontFile" uid="uid://1xg1ofw27hbp" path="res://resources/Font/unifont-17.0.03.otf" id="2_bl13t"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_iyx0m"]
bg_color = Color(0.296, 0.54800004, 0.8, 1)
border_width_left = 1
border_width_right = 1
border_color = Color(0.8, 0.8, 0.8, 0)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bl13t"]
bg_color = Color(0.48000002, 0.64000005, 0.8, 1)
border_width_left = 1
border_width_right = 1
border_color = Color(0.8, 0.8, 0.8, 0)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_74lek"]
bg_color = Color(0.9, 0.9, 0.9, 1)
border_width_left = 1
border_width_right = 1
border_color = Color(0.8, 0.8, 0.8, 0)
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_bl13t"]
texture = ExtResource("1_bl13t")
texture_margin_left = 2.0
texture_margin_top = 2.0
texture_margin_right = 2.0
texture_margin_bottom = 2.0
axis_stretch_horizontal = 1
axis_stretch_vertical = 1
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_j5jx5"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(1, 1, 1, 0.75)
draw_center = false
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
corner_detail = 5
expand_margin_left = 2.0
expand_margin_top = 2.0
expand_margin_right = 2.0
expand_margin_bottom = 2.0
[sub_resource type="Theme" id="Theme_ij1v8"]
default_font = ExtResource("2_bl13t")
default_font_size = 12
VScrollBar/styles/grabber = SubResource("StyleBoxFlat_iyx0m")
VScrollBar/styles/grabber_highlight = SubResource("StyleBoxFlat_bl13t")
VScrollBar/styles/grabber_pressed = SubResource("StyleBoxFlat_74lek")
VScrollBar/styles/scroll = SubResource("StyleBoxTexture_bl13t")
VScrollBar/styles/scroll_focus = SubResource("StyleBoxFlat_j5jx5")
[node name="Node2D" type="Node2D"]
[node name="ScrollContainer" type="ScrollContainer" parent="."]
offset_right = 92.0
offset_bottom = 101.0
theme = SubResource("Theme_ij1v8")
draw_focus_border = true
[node name="Polygon2D" type="Polygon2D" parent="ScrollContainer"]
position = Vector2(-0.6560024, 1.4637735)
scale = Vector2(2.4320588, 3.3475094)
color = Color(0.16078432, 0.29803923, 0.45490196, 1)
polygon = PackedVector2Array(0.25320435, -0.7913666, 40.966705, -0.67121506, 40.975983, 31.40563, 0.23184204, 31.52679)
uv = PackedVector2Array(-626.6666, -67.33367, -113.33331, -66.000336, -208, 69.99967, -629.3333, 17.333)
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
layout_mode = 2
[node name="Button" type="Button" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
text = "ASCV发送给对"
[node name="Button2" type="Button" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
theme_override_fonts/font = ExtResource("1_errlg")
theme_override_font_sizes/font_size = 12
text = "ASCV发送给对"
[node name="Button3" type="Button" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
text = "ASCV发送给对"
[node name="Button4" type="Button" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
text = "ASCV发送给对"
[node name="Button5" type="Button" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
text = "ASCV发送给对"
[node name="Button6" type="Button" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
text = "ASCV发送给对"
[node name="Button7" type="Button" parent="ScrollContainer/VBoxContainer"]
layout_mode = 2
text = "ASCV发送给对"

View File

@ -28,7 +28,7 @@ public partial class GameManager : Node
public static int CurrentTurn { get; private set; } = 1;
// --- Domain Model ---
public MentorModel Mentor { get; private set; } = new MentorModel();
public MentorModel Mentor { get; private set; }
public List<StudentModel> Students { get; private set; } = new List<StudentModel>();
public List<Task> ActiveTasks { get; private set; } = new List<Task>();

View File

@ -3,14 +3,31 @@ namespace Models;
/// <summary>
/// 导师数据模型 (MentorModel)
/// 玩家的数值状态。
/// 单例模式。
/// </summary>
public class MentorModel
public class MentorModel : UnitModel
{
private static MentorModel _instance;
public static MentorModel Instance
{
get
{
if (_instance == null)
{
// 如果需要默认名称,这里可以硬编码或改为 Lazy 加载
_instance = new MentorModel("Player");
}
return _instance;
}
}
public enum MentorModeType
{
Worker,
Manager
}
/// <summary>
/// 精力值 (Energy)
/// 用于释放技能画饼、PUA、甚至亲自写代码
@ -37,4 +54,17 @@ public class MentorModel
public int ResearchPoints { get; set; } = 0;
public MentorModeType Mode { get; set; } = MentorModeType.Worker;
// 私有构造函数,防止外部实例化
private MentorModel(string name) : base(name)
{
// 初始化 Energy默认上限 10000 (100.00)
Energy = new StatusValue(new PropertyValue(10000), new PropertyValue(10000), new PropertyValue(0));
}
// 如果需要重置单例(例如新游戏),可以添加一个重置方法
public static void Reset(string name = "Player")
{
_instance = new MentorModel(name);
}
}