mirror of
https://github.com/HarmonyHoney/ROTA.git
synced 2026-07-17 16:46:17 +00:00
MenuBase.select()
remove OnOff and change Scroll to accomodate! (:
This commit is contained in:
parent
d6e0ccc2a4
commit
b6f4b6fb1a
20 changed files with 161 additions and 181 deletions
|
|
@ -34,11 +34,6 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://src/menu/MenuBase.gd"
|
||||
}, {
|
||||
"base": "Control",
|
||||
"class": "OnOff",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/menu/options/onoff/OnOff.gd"
|
||||
}, {
|
||||
"base": "Node2D",
|
||||
"class": "PaletteSwap",
|
||||
"language": "GDScript",
|
||||
|
|
@ -130,7 +125,6 @@ _global_script_class_icons={
|
|||
"Door": "",
|
||||
"EaseMover": "",
|
||||
"MenuBase": "",
|
||||
"OnOff": "",
|
||||
"PaletteSwap": "",
|
||||
"Player": "",
|
||||
"SaveDict": "",
|
||||
|
|
@ -345,4 +339,19 @@ reset={
|
|||
2d_physics/layer_1="solid"
|
||||
2d_physics/layer_2="player"
|
||||
2d_physics/layer_3="box"
|
||||
2d_physics/layer_4="spik
|
||||
2d_physics/layer_4="spike"
|
||||
2d_physics/layer_5="spinner"
|
||||
2d_physics/layer_6="arrow"
|
||||
2d_physics/layer_7="portal"
|
||||
2d_physics/layer_8="exit"
|
||||
2d_physics/layer_11="door"
|
||||
2d_physics/layer_12="goal"
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_clear_color=Color( 0, 0.741176, 1, 1 )
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|
|
|
|||
|
|
@ -28,8 +28,49 @@ pitch_to = 0.5
|
|||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
modulate = Color( 0.494118, 0.890196, 0.337255, 1 )
|
||||
self_modulate = Color( 1, 1, 1, 0 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="Line2D" type="Line2D" parent="Sprite"]
|
||||
points = PoolVector2Array( 0, -130, 0, 130 )
|
||||
width = 140.0
|
||||
default_color = Color( 1, 1, 1, 1 )
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
round_precision = 12
|
||||
antialiased = true
|
||||
|
||||
[node name="Line2D2" type="Line2D" parent="Sprite"]
|
||||
points = PoolVector2Array( -130, 0, 130, 0 )
|
||||
width = 140.0
|
||||
default_color = Color( 1, 1, 1, 1 )
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
round_precision = 12
|
||||
antialiased = true
|
||||
|
||||
[node name="Line2D3" type="Line2D" parent="Sprite"]
|
||||
points = PoolVector2Array( -100, -100, 100, 100 )
|
||||
width = 140.0
|
||||
default_color = Color( 1, 1, 1, 1 )
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
round_precision = 12
|
||||
antialiased = true
|
||||
|
||||
[node name="Line2D4" type="Line2D" parent="Sprite"]
|
||||
points = PoolVector2Array( 100, -100, -100, 100 )
|
||||
width = 140.0
|
||||
default_color = Color( 1, 1, 1, 1 )
|
||||
joint_mode = 2
|
||||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
round_precision = 12
|
||||
antialiased = true
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 0
|
||||
|
|
|
|||
|
|
@ -126,12 +126,18 @@ func menu_process(delta):
|
|||
scroll_node.rect_position.y = lerp(scroll_node.rect_position.y, (720 / 2.0) - (cursor_node.rect_position.y + cursor_node.rect_size.y / 2.0), 0.08)
|
||||
|
||||
func set_cursor(arg := 0):
|
||||
select(false)
|
||||
cursor = clamp(arg, 0, max(items.size() - 1, 0))
|
||||
select(true)
|
||||
if is_audio_cursor:
|
||||
audio_cursor()
|
||||
|
||||
func select(_is_select := true, _cursor := cursor):
|
||||
if _cursor < items.size() and items[_cursor].has_method("select"):
|
||||
items[_cursor].select(_is_select)
|
||||
|
||||
func reset_cursor():
|
||||
cursor = 0
|
||||
self.cursor = 0
|
||||
if items_node and cursor_node:
|
||||
cursor_node.rect_global_position = items[0].rect_global_position - cursor_margin
|
||||
cursor_node.rect_size = items[0].rect_size + (cursor_margin * 2.0)
|
||||
|
|
|
|||
|
|
@ -5,20 +5,20 @@
|
|||
[ext_resource path="res://media/font/profile/OptionsHeader.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://src/menu/options/MenuOptions.gd" type="Script" id=4]
|
||||
[ext_resource path="res://src/menu/options/OpenRemap.gd" type="Script" id=5]
|
||||
[ext_resource path="res://src/menu/options/Resolution.gd" type="Script" id=6]
|
||||
[ext_resource path="res://src/menu/options/onoff/OnOff.gd" type="Script" id=7]
|
||||
[ext_resource path="res://src/menu/options/scroll/Resolution.gd" type="Script" id=6]
|
||||
[ext_resource path="res://src/menu/options/scroll/Scroll.gd" type="Script" id=7]
|
||||
[ext_resource path="res://media/image/UI/Input.png" type="Texture" id=8]
|
||||
[ext_resource path="res://media/image/UI/Audio.png" type="Texture" id=9]
|
||||
[ext_resource path="res://media/audio/sfx/Randomize104.wav" type="AudioStream" id=10]
|
||||
[ext_resource path="res://media/audio/sfx/jump2.wav" type="AudioStream" id=11]
|
||||
[ext_resource path="res://media/image/UI/Video.png" type="Texture" id=12]
|
||||
[ext_resource path="res://src/menu/options/Volume.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://src/menu/options/onoff/Fullscreen.gd" type="Script" id=14]
|
||||
[ext_resource path="res://src/menu/options/scroll/Volume.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://src/menu/options/scroll/Fullscreen.gd" type="Script" id=14]
|
||||
[ext_resource path="res://src/menu/options/scroll/SpeedClock.gd" type="Script" id=15]
|
||||
[ext_resource path="res://src/menu/options/scroll/SpeedAlpha.gd" type="Script" id=16]
|
||||
[ext_resource path="res://src/menu/options/onoff/Vsync.gd" type="Script" id=17]
|
||||
[ext_resource path="res://src/menu/options/onoff/Mouse.gd" type="Script" id=18]
|
||||
[ext_resource path="res://src/menu/options/onoff/Borderless.gd" type="Script" id=19]
|
||||
[ext_resource path="res://src/menu/options/scroll/Vsync.gd" type="Script" id=17]
|
||||
[ext_resource path="res://src/menu/options/scroll/Mouse.gd" type="Script" id=18]
|
||||
[ext_resource path="res://src/menu/options/scroll/Borderless.gd" type="Script" id=19]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=18]
|
||||
bg_color = Color( 0.75, 0.375, 0.38125, 1 )
|
||||
|
|
@ -360,9 +360,6 @@ size_flags_vertical = 6
|
|||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Fullscreen"
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label2" type="Label" parent="Control/Menu/List/Fullscreen"]
|
||||
anchor_left = 0.5
|
||||
|
|
@ -427,11 +424,8 @@ size_flags_vertical = 6
|
|||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Window Size"
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Resolution" type="Label" parent="Control/Menu/List/Resolution"]
|
||||
[node name="Label2" type="Label" parent="Control/Menu/List/Resolution"]
|
||||
anchor_left = 0.25
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
extends Control
|
||||
|
||||
var cursor := 1
|
||||
|
||||
onready var list : Array = Shared.win_sizes
|
||||
onready var res := $Resolution
|
||||
|
||||
func _ready():
|
||||
var f = list.find(Shared.win_size)
|
||||
if f != -1:
|
||||
cursor = f
|
||||
|
||||
show()
|
||||
|
||||
func show():
|
||||
res.text = "< " + str(list[cursor].x) + " x " + str(list[cursor].y) + " >"
|
||||
|
||||
func axis_x(arg := 1):
|
||||
cursor = clamp(cursor + arg, 0, list.size() - 1)
|
||||
show()
|
||||
Shared.set_window_size(list[cursor])
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
extends Control
|
||||
|
||||
onready var label := $Label2
|
||||
onready var audio := $Audio
|
||||
|
||||
var volume := 5
|
||||
export var bus := 0
|
||||
|
||||
func _ready():
|
||||
volume = Shared.volume[bus] / 10
|
||||
audio.bus = AudioServer.get_bus_name(bus)
|
||||
show()
|
||||
|
||||
func axis_x(arg := 1):
|
||||
volume = clamp(volume + arg, 0, 10)
|
||||
Shared.set_volume(bus, volume * 10)
|
||||
show()
|
||||
|
||||
audio.pitch_scale = rand_range(0.5, 1.5)
|
||||
audio.play()
|
||||
|
||||
func show():
|
||||
label.text = "< " + str(volume) + " >"
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
extends OnOff
|
||||
|
||||
func _ready():
|
||||
is_on = OS.window_borderless
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
OS.window_borderless = is_on
|
||||
Shared.set_window_size()
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
extends OnOff
|
||||
|
||||
func _ready():
|
||||
is_on = OS.window_fullscreen
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
Shared.toggle_fullscreen()
|
||||
MenuOptions.fill_items()
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
extends OnOff
|
||||
|
||||
func _ready():
|
||||
is_on = Input.mouse_mode == Input.MOUSE_MODE_VISIBLE
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if is_on else Input.MOUSE_MODE_HIDDEN
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
extends Control
|
||||
class_name OnOff
|
||||
|
||||
onready var label := $Label2
|
||||
var is_on := false
|
||||
|
||||
export var on := "ON"
|
||||
export var off := "OFF"
|
||||
|
||||
func act():
|
||||
is_on = !is_on
|
||||
set_label()
|
||||
set_value()
|
||||
|
||||
func axis_x(arg):
|
||||
if (is_on and arg == -1) or (!is_on and arg == 1):
|
||||
act()
|
||||
|
||||
|
||||
func set_label(arg := is_on):
|
||||
label.text = "< " + (on if arg else off) + " >"
|
||||
|
||||
func set_value():
|
||||
pass
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://media/font/profile/OptionsItem.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://src/menu/options/onoff/OnOff.gd" type="Script" id=2]
|
||||
|
||||
[node name="OnOff" type="Control"]
|
||||
margin_top = 610.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 680.0
|
||||
rect_min_size = Vector2( 0, 70 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Label"
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 25.0
|
||||
size_flags_vertical = 6
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "< OFF >"
|
||||
align = 2
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
extends OnOff
|
||||
|
||||
func _ready():
|
||||
is_on = OS.vsync_enabled
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
OS.vsync_enabled = is_on
|
||||
10
src/menu/options/scroll/Borderless.gd
Normal file
10
src/menu/options/scroll/Borderless.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Scroll
|
||||
|
||||
func _ready():
|
||||
cursor = int(OS.window_borderless)
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
OS.window_borderless = bool(cursor)
|
||||
Shared.set_window_size()
|
||||
|
||||
10
src/menu/options/scroll/Fullscreen.gd
Normal file
10
src/menu/options/scroll/Fullscreen.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Scroll
|
||||
|
||||
func _ready():
|
||||
cursor = int(OS.window_fullscreen)
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
if cursor != int(OS.window_fullscreen):
|
||||
Shared.toggle_fullscreen()
|
||||
MenuOptions.fill_items()
|
||||
9
src/menu/options/scroll/Mouse.gd
Normal file
9
src/menu/options/scroll/Mouse.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
extends Scroll
|
||||
|
||||
func _ready():
|
||||
cursor = int(Input.mouse_mode == Input.MOUSE_MODE_VISIBLE)
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if bool(cursor) else Input.MOUSE_MODE_HIDDEN
|
||||
|
||||
14
src/menu/options/scroll/Resolution.gd
Normal file
14
src/menu/options/scroll/Resolution.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
extends Scroll
|
||||
|
||||
func _ready():
|
||||
list = []
|
||||
for i in Shared.win_sizes:
|
||||
list.append(str(i.x) + ", " + str(i.y))
|
||||
|
||||
var f = Array(Shared.win_sizes).find(Shared.win_size)
|
||||
if f != -1:
|
||||
cursor = f
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
Shared.set_window_size(Shared.win_sizes[cursor])
|
||||
|
|
@ -7,23 +7,32 @@ onready var label_value := get_node_or_null("Label2")
|
|||
var cursor := 0 setget set_cursor
|
||||
export var is_loop := false
|
||||
export var count := 0
|
||||
export var list : PoolStringArray = ["zero", "one", "two"]
|
||||
|
||||
export var list : PoolStringArray = ["OFF", "ON"]
|
||||
var is_select := false
|
||||
|
||||
func _ready():
|
||||
set_label()
|
||||
|
||||
func set_label():
|
||||
if is_instance_valid(label_value):
|
||||
var s = ["< " if is_select and (is_loop or cursor > 0) else "",
|
||||
" >" if is_select and (is_loop or cursor < max(count, list.size() - 1)) else ""]
|
||||
|
||||
label_value.text = s[0] + str(list[cursor] if count == 0 else cursor) + s[1]
|
||||
|
||||
func set_value():
|
||||
pass
|
||||
|
||||
func set_cursor(arg := cursor):
|
||||
cursor = posmod(arg, max(count + 1, list.size())) if is_loop else clamp(arg, 0, max(count, list.size() - 1))
|
||||
set_label()
|
||||
set_value()
|
||||
|
||||
func select(arg := is_select):
|
||||
is_select = arg
|
||||
set_label()
|
||||
|
||||
func axis_x(arg := 1):
|
||||
self.cursor += arg
|
||||
|
||||
func set_cursor(arg := cursor):
|
||||
cursor = posmod(arg, (count + 1) if count > 0 else list.size()) if is_loop else clamp(arg, 0, count if count > 0 else (list.size() - 1))
|
||||
set_label()
|
||||
set_value()
|
||||
|
||||
func set_label():
|
||||
if is_instance_valid(label_value):
|
||||
label_value.text = "< " + str(list[cursor] if count == 0 else cursor) + " >"
|
||||
|
||||
func set_value():
|
||||
pass
|
||||
|
|
|
|||
15
src/menu/options/scroll/Volume.gd
Normal file
15
src/menu/options/scroll/Volume.gd
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
extends Scroll
|
||||
|
||||
export var bus := 0
|
||||
onready var audio := $Audio
|
||||
|
||||
func _ready():
|
||||
count = 10
|
||||
audio.bus = AudioServer.get_bus_name(bus)
|
||||
cursor = Shared.volume[bus] / 10
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
Shared.set_volume(bus, cursor * 10)
|
||||
audio.pitch_scale = rand_range(0.5, 1.5)
|
||||
audio.play()
|
||||
|
|
@ -2,16 +2,14 @@
|
|||
|
||||
[ext_resource path="res://media/font/profile/OptionsItem.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://media/audio/sfx/coin1.wav" type="AudioStream" id=2]
|
||||
[ext_resource path="res://src/menu/options/Volume.gd" type="Script" id=3]
|
||||
[ext_resource path="res://src/menu/options/scroll/Volume.gd" type="Script" id=3]
|
||||
|
||||
[node name="Volume" type="Control"]
|
||||
margin_right = 1080.0
|
||||
margin_bottom = 80.0
|
||||
rect_min_size = Vector2( 0, 80 )
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
count = 10
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
anchor_right = 0.5
|
||||
8
src/menu/options/scroll/Vsync.gd
Normal file
8
src/menu/options/scroll/Vsync.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
extends Scroll
|
||||
|
||||
func _ready():
|
||||
cursor = int(OS.vsync_enabled)
|
||||
set_label()
|
||||
|
||||
func set_value():
|
||||
OS.vsync_enabled = bool(cursor)
|
||||
Loading…
Add table
Add a link
Reference in a new issue