Now player_ui will automatically call set_player on the childs of gui_base. Removed the set_player calls from GUI.gd.

This commit is contained in:
Relintai 2020-09-22 16:43:05 +02:00
parent a1810628e9
commit c292704eb2
3 changed files with 4 additions and 14 deletions

View File

@ -20,16 +20,3 @@ extends Control
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
export (String) var player_path : String = "../../.."
export (Array, NodePath) var child_controls : Array
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)
child.set_player(player)

View File

@ -43,6 +43,10 @@ func _ready():
for c in windows.get_children():
if c.has_method("set_player"):
c.set_player(player)
for c in gui_base.get_children():
if c.has_method("set_player"):
c.set_player(player)
func initialize():
gui_base = get_node(gui_base_path)

View File

@ -42,7 +42,6 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_lock_": true
}
child_controls = [ NodePath("Unitframes"), NodePath("Actionbars"), NodePath("Buttons"), NodePath("Castbar"), NodePath("AuraFrame"), NodePath("IngameMenu/KeybindWindow"), NodePath("IngameMenu/InterfaceOptions") ]
[node name="Buttons" type="HBoxContainer" parent="GUI"]
anchor_top = 1.0