-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
add:任务栏
- Loading branch information
tuzhanhong
committed
Feb 27, 2024
1 parent
6305f01
commit 7731041
Showing
12 changed files
with
237 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class_name UI任务栏 extends MonoTrait | ||
|
||
var id := &"UI任务栏" | ||
var requires := [&"ui"] | ||
|
||
var props := { | ||
# | ||
# 方法 | ||
# | ||
|
||
# 打开任务栏 | ||
&"task/toggle": func (ctx: LisperContext, this: Mono, ctrl: SekaiControl) -> void: | ||
if await this.applymRSU(ctx, &"ui/toggle", [ctrl, &"task"]) != null: | ||
this.emitmRSUY(ctx, &"control/block") | ||
else: | ||
this.emitc(ctx, &"on_task_closed") | ||
this.emitmRSUY(ctx, &"control/unblock") | ||
var node = this.applymRSUY(ctx, &"ui/get", [ctrl, &"slots"]) | ||
pass, | ||
|
||
# | ||
# 信号 | ||
# | ||
|
||
# 任务栏被关闭时触发 | ||
&"on_task_closed": Prop.Stack(), | ||
|
||
#--------------------------------------------------------------------------# | ||
&"ui_data": { | ||
&"task": preload("任务栏/task.tscn"), | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
extends Control | ||
|
||
var this: Mono | ||
var context: LisperContext | ||
var control: SekaiControl | ||
|
||
func _ready() -> void: | ||
draw_task() | ||
|
||
func _enter_tree() -> void: | ||
this.putsB.call_deferred(&"on_input", [&"0:UI任务栏", _on_input]) | ||
|
||
func _exit_tree() -> void: | ||
this.delsB(&"on_input", &"0:UI任务栏") | ||
|
||
func _on_input(ctx: LisperContext, this: Mono, ctrl: SekaiControl, sets: InputSet) -> void: | ||
if sets.pressings.has(&"task_toggle"): await this.callmRSU(ctx, &"task/toggle", ctrl) | ||
|
||
func draw_task(): | ||
var tasks = await sekai.gikou.callm(context, &"taskm/get_by_status", 0) | ||
for task in tasks.values(): | ||
var name = task["data"]["name"] | ||
var desc = task["data"]["desc"] | ||
var node = TaskButton.new() | ||
node.text = name | ||
node.desc = desc | ||
node.connect("press", _on_button_pressed) | ||
%CraftList.add_child(node) | ||
|
||
func _on_button_pressed(desc: String): | ||
$describe.text = desc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
[gd_scene load_steps=7 format=3 uid="uid://dxfigiu78vxil"] | ||
|
||
[ext_resource type="Texture2D" uid="uid://dh0fifljiutht" path="res://test-next/define/实体/ui/任务栏/任务书.png" id="1_cs245"] | ||
[ext_resource type="Script" path="res://test-next/define/实体/ui/任务栏/task.gd" id="2_i7b1d"] | ||
[ext_resource type="Texture2D" uid="uid://ciy146m8dp43d" path="res://test-next/define/实体/ui/合成台/拖动条.png" id="3_xvfrj"] | ||
[ext_resource type="Texture2D" uid="uid://coct8kk3p6ce" path="res://test-next/define/实体/ui/合成台/拖动闲置.png" id="4_bnu4i"] | ||
[ext_resource type="Texture2D" uid="uid://7qy76xr4b1do" path="res://test-next/define/实体/ui/合成台/拖动点击.png" id="5_44h56"] | ||
[ext_resource type="Script" path="res://test-next/define/实体/ui/合成台/scroll.gd" id="6_46hpq"] | ||
|
||
[node name="Task" type="TextureRect"] | ||
anchors_preset = 8 | ||
anchor_left = 0.5 | ||
anchor_top = 0.5 | ||
anchor_right = 0.5 | ||
anchor_bottom = 0.5 | ||
offset_left = -255.0 | ||
offset_top = -224.0 | ||
offset_right = 256.0 | ||
offset_bottom = 96.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
texture = ExtResource("1_cs245") | ||
expand_mode = 3 | ||
stretch_mode = 4 | ||
script = ExtResource("2_i7b1d") | ||
|
||
[node name="scrollBar" type="TextureRect" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = -1 | ||
anchor_left = 0.412916 | ||
anchor_top = 0.15625 | ||
anchor_right = 0.430528 | ||
anchor_bottom = 0.78125 | ||
texture = ExtResource("3_xvfrj") | ||
metadata/_edit_use_anchors_ = true | ||
|
||
[node name="scroll" type="TextureButton" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = -1 | ||
anchor_left = 0.398453 | ||
anchor_top = 0.152174 | ||
anchor_right = 0.437137 | ||
anchor_bottom = 0.220497 | ||
offset_left = -1.08622e-05 | ||
offset_right = 1.22303 | ||
offset_bottom = 1.22976 | ||
keep_pressed_outside = true | ||
texture_normal = ExtResource("4_bnu4i") | ||
texture_pressed = ExtResource("5_44h56") | ||
script = ExtResource("6_46hpq") | ||
y_max = 235 | ||
y_min = 50 | ||
|
||
[node name="list" type="ScrollContainer" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = -1 | ||
anchor_left = 0.0841487 | ||
anchor_top = 0.146875 | ||
anchor_right = 0.389432 | ||
anchor_bottom = 0.771875 | ||
vertical_scroll_mode = 3 | ||
metadata/_edit_use_anchors_ = true | ||
|
||
[node name="CraftList" type="VBoxContainer" parent="list"] | ||
unique_name_in_owner = true | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
|
||
[node name="describe" type="Label" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = -1 | ||
anchor_left = 0.549902 | ||
anchor_top = 0.134375 | ||
anchor_right = 0.917808 | ||
anchor_bottom = 0.496875 | ||
offset_left = 1.33976e-05 | ||
offset_right = -1.07714e-05 | ||
autowrap_mode = 1 | ||
text_overrun_behavior = 1 | ||
metadata/_edit_use_anchors_ = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class_name TaskButton extends Button | ||
|
||
signal press(desc) | ||
|
||
var desc: String | ||
|
||
func _ready(): | ||
self.pressed.connect(self._on_pressed) | ||
|
||
func _on_pressed(): | ||
emit_signal("press", desc) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://dh0fifljiutht" | ||
path="res://.godot/imported/任务书.png-d670ce3c0c8acbdd6272c752157d3be7.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://test-next/define/实体/ui/任务栏/任务书.png" | ||
dest_files=["res://.godot/imported/任务书.png-d670ce3c0c8acbdd6272c752157d3be7.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
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/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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://d2mkilxqpouix" | ||
path="res://.godot/imported/任务图标.png-420747cfc0dca53e705f4f34d88b2a71.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://test-next/define/实体/ui/任务栏/任务图标.png" | ||
dest_files=["res://.godot/imported/任务图标.png-420747cfc0dca53e705f4f34d88b2a71.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
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/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters