-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Luna
committed
Dec 21, 2024
1 parent
7565bf7
commit af8391b
Showing
5 changed files
with
123 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
extends MenuButton | ||
class_name CustomMenuButton | ||
|
||
func _ready(): | ||
# 连接 popup 关信号 | ||
connect("popup", _on_popup) | ||
|
||
func _on_popup(): | ||
# todo 没有走到这里 | ||
# 获取菜单 | ||
var menu = get_popup() | ||
|
||
# 计算菜单的新位置 | ||
var position = get_global_rect().position | ||
var size = get_global_rect().size | ||
var menu_size = menu.get_size() | ||
|
||
# 计算新的 y 位置,使菜单向上展开 | ||
var new_y = position.y - menu_size.y | ||
|
||
# 设置菜单的新位置 | ||
menu.popup(Rect2(position.x, new_y, menu_size.x, menu_size.y)) |
Binary file not shown.
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,23 @@ | ||
[gd_scene format=3 uid="uid://bqa34s808mgg"] | ||
|
||
[node name="ItemListScene" type="Control"] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="ItemList" type="ItemList" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
item_count = 4 | ||
max_columns = 2 | ||
item_0/text = "test1" | ||
item_1/text = "test2" | ||
item_2/text = "item3" | ||
item_3/text = "item4" |
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,22 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://bd0qmo4dtfqmh"] | ||
|
||
[ext_resource type="VideoStream" path="res://Resources/startRoomBackgroundVideo.ogv" id="1_vlprb"] | ||
|
||
[node name="VideoTest" type="Control"] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="VideoStreamPlayer" type="VideoStreamPlayer" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
stream = ExtResource("1_vlprb") | ||
autoplay = true | ||
loop = true |