Now the player ui and the nameplates are dynamically allocated aswell.

This commit is contained in:
Relintai 2020-04-24 14:32:04 +02:00
parent dee366cbf7
commit 39e28c2035
8 changed files with 17 additions and 21 deletions

View File

@ -580,9 +580,13 @@ func on_c_controlled_changed(val):
var cam_scene : PackedScene = ResourceLoader.load("res://data/camera/CameraPivot.tscn")
camera_pivot = cam_scene.instance() as Spatial
add_child(camera_pivot)
camera = camera_pivot.get_node("Camera") as Camera
var uiscn : PackedScene = ResourceLoader.load("res://ui/player_ui/player_ui.tscn")
var ui = uiscn.instance()
add_child(ui)
set_process_input(true)
set_process_unhandled_input(true)
else:
@ -593,6 +597,10 @@ func on_c_controlled_changed(val):
set_process_input(false)
set_process_unhandled_input(false)
var nameplatescn : PackedScene = ResourceLoader.load("res://ui/nameplates/NamePlate.tscn")
var nameplate = nameplatescn.instance()
add_child(nameplate)
func on_sdied(entity):

View File

@ -20,7 +20,7 @@ extends Control
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
export (NodePath) var player_path : NodePath
export (String) var player_path : String = "../../.."
export (Array, NodePath) var child_controls : Array
func _ready() -> void:

View File

@ -1,7 +1,6 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=2 format=2]
[ext_resource path="res://player/Mob.gd" type="Script" id=2]
[ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3]
[node name="Mob" type="Entity" groups=[
"mobs",
@ -9,6 +8,3 @@
body_path = NodePath("Body")
character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character")
script = ExtResource( 2 )
[node name="NamePlate" parent="." instance=ExtResource( 3 )]
max_distance = 50.0

View File

@ -51,7 +51,7 @@ func _ready():
health_bar = get_node(health_bar_path) as TextureProgress
health_bar_label = get_node(health_bar_label_path) as Label
entity = get_node("..") as Entity
entity = get_node("../..") as Entity
health = entity.get_health()
health.connect("c_changed", self, "c_health_changed")

View File

@ -1,12 +1,8 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=2 format=2]
[ext_resource path="res://player/NetworkedPlayer.gd" type="Script" id=1]
[ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3]
[node name="NetworkedPlayer" type="Entity"]
body_path = NodePath("Body")
character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character")
script = ExtResource( 1 )
[node name="NamePlate" parent="." instance=ExtResource( 3 )]
max_distance = 50.0

View File

@ -1,14 +1,8 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=2 format=2]
[ext_resource path="res://player/Player.gd" type="Script" id=2]
[ext_resource path="res://ui/player_ui/player_ui.tscn" type="PackedScene" id=3]
[node name="Player" type="Entity" groups=[
"players",
]]
body_path = NodePath("HumanFemale")
character_skeleton_path = NodePath("HumanFemale/Rotation_Helper/Model/character")
script = ExtResource( 2 )
[node name="GUILayer" parent="." instance=ExtResource( 3 )]
[connection signal="onc_open_loot_winow_request" from="." to="GUILayer" method="_on_Player_onc_open_loot_winow_request"]

View File

@ -57,6 +57,7 @@ func refresh():
func set_player(p_player : Entity) -> void:
player = p_player
player.connect("ctarget_bag_changed", self, "ctarget_bag_changed")
player.connect("onc_open_loot_winow_request", self, "onc_open_loot_winow_request")
func on_visibility_changed():
if visible:
@ -81,3 +82,5 @@ func ctarget_bag_changed(entity: Entity, bag: Bag) -> void:
target_bag.connect("item_removed", self, "on_item_removed")
func onc_open_loot_winow_request() -> void:
show()

View File

@ -42,7 +42,6 @@ __meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
player_path = NodePath("../..")
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") ]
[node name="TouchTargetControls" type="MarginContainer" parent="GUI"]