Now modules can be disabled. Also now player ui will automatically call set_player on windows (if the method exists).

This commit is contained in:
Relintai 2020-09-22 15:23:13 +02:00
parent e7334f483b
commit 392cca545b
6 changed files with 17 additions and 4 deletions

View File

@ -28,7 +28,6 @@ func _ready() -> void:
if player_path != null:
var player = get_node(player_path)
for child_path in child_controls:
var child = get_node(child_path)

View File

@ -49,8 +49,9 @@ func load_modules_at(path : String) -> void:
res = ResourceLoader.load(path + file_name)
else:
res = ResourceLoader.load(path + "/" + file_name)
_modules.append(res)
if res.enabled:
_modules.append(res)
file_name = dir.get_next()
else:

View File

@ -1,6 +1,8 @@
extends Resource
class_name GameModule
export(bool) var enabled : bool = true
export(ESSResourceDB) var resource_db : ESSResourceDB
func load_module():

View File

@ -6,5 +6,6 @@
[resource]
script = ExtResource( 1 )
enabled = true
character_scene = ExtResource( 2 )
opener_button_texture = ExtResource( 3 )

View File

@ -20,6 +20,9 @@ extends CanvasLayer
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
export (String) var player_path : String = "../.."
export(NodePath) var gui_base_path : NodePath
export(NodePath) var buttons_path : NodePath
export(NodePath) var windows_path : NodePath
@ -33,6 +36,13 @@ var loot_window : Control
func _ready():
initialize()
if player_path != null:
var player = get_node(player_path)
for c in windows.get_children():
if c.has_method("set_player"):
c.set_player(player)
func initialize():
gui_base = get_node(gui_base_path)

View File

@ -48,7 +48,7 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_lock_": true
}
child_controls = [ NodePath("Unitframes"), NodePath("Actionbars"), NodePath("Windows/SpellBookWindow"), NodePath("Buttons"), NodePath("Castbar"), NodePath("AuraFrame"), NodePath("Windows/Inventory"), NodePath("Windows/LootWindow"), NodePath("Windows/TalentWindow"), NodePath("Windows/CraftingWindow"), NodePath("IngameMenu/KeybindWindow"), NodePath("Windows/CharacterWindow"), NodePath("Windows/TrainerWindow"), NodePath("IngameMenu/InterfaceOptions"), NodePath("Windows/VendorWindow") ]
child_controls = [ NodePath("Unitframes"), NodePath("Actionbars"), NodePath("Buttons"), NodePath("Castbar"), NodePath("AuraFrame"), NodePath("IngameMenu/KeybindWindow"), NodePath("IngameMenu/InterfaceOptions") ]
[node name="TouchTargetControls" type="MarginContainer" parent="GUI"]
visible = false