mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-21 13:16:49 +01:00
Implemented a trainer window, and trainer entities. Also updated ESS to get the support structure for them. Also added a naturalist trainer, and made the level spawn it in.
This commit is contained in:
parent
13fa745f16
commit
ab01405c5a
2
HEADS
2
HEADS
@ -1 +1 @@
|
||||
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "c7a98e704dd62782b9f8b4a22b74787278574657"}, "entity_spell_system": {"master": "0ddd4908fd3af76a50b2ddd0b112236bebed57f7"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "6f8e54879bcab6c628c761b545f6df4cd7534a07"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "6c99ddcaa6203e77163b4770e7af95bc2a181e3d"}, "procedural_animations": {"master": "ec465a7a683a047cd373959bb022bde1321fb72d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "bfb60df21570415b1860c25c2dae7722cf158ed9"}, "mesh_utils": {"master": "3365df3faf89a4c29c3b4664b53e9007e4e6267b"}, "broken_seals_module": {"master": "9f89e2a4e7b59351ac4cb4c4dc5f88e5b60a2f15"}, "thread_pool": {"master": "b1030eaf92ba595c56ae8caac90b58081303d16f"}}
|
||||
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "c7a98e704dd62782b9f8b4a22b74787278574657"}, "entity_spell_system": {"master": "749c0a5c2f4ec563493387aa7c41ec87b3c3b092"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "6f8e54879bcab6c628c761b545f6df4cd7534a07"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "6c99ddcaa6203e77163b4770e7af95bc2a181e3d"}, "procedural_animations": {"master": "ec465a7a683a047cd373959bb022bde1321fb72d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "bfb60df21570415b1860c25c2dae7722cf158ed9"}, "mesh_utils": {"master": "3365df3faf89a4c29c3b4664b53e9007e4e6267b"}, "broken_seals_module": {"master": "9f89e2a4e7b59351ac4cb4c4dc5f88e5b60a2f15"}, "thread_pool": {"master": "b1030eaf92ba595c56ae8caac90b58081303d16f"}}
|
@ -9,9 +9,6 @@
|
||||
[ext_resource path="res://cursors/forbidden.png" type="Texture" id=7]
|
||||
[ext_resource path="res://cursors/ibeam.png" type="Texture" id=8]
|
||||
|
||||
|
||||
|
||||
|
||||
[node name="CursorManager" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
default_cursor = ExtResource( 2 )
|
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,34 @@
|
||||
[gd_resource type="EntityData" load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=1]
|
||||
[ext_resource path="res://modules/species/species_human.tres" type="EntitySpeciesData" id=2]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/1_naturalist.tres" type="EntityClassData" id=3]
|
||||
|
||||
[sub_resource type="SimpleLevelStatData" id=1]
|
||||
agility = 3
|
||||
strength = 2
|
||||
stamina = 3
|
||||
intellect = 4
|
||||
spirit = 5
|
||||
|
||||
[sub_resource type="StatData" id=2]
|
||||
level_stat_data = SubResource( 1 )
|
||||
stat/agility = 14.0
|
||||
stat/strength = 15.0
|
||||
stat/stamina = 13.0
|
||||
stat/intellect = 13.0
|
||||
stat/spirit = 10.0
|
||||
stat/health = 20.0
|
||||
stat/mana = 20.0
|
||||
stat/global_cooldown = 1.5
|
||||
|
||||
[resource]
|
||||
resource_name = "Naturalist Trainer"
|
||||
id = 3
|
||||
entity_type = 4
|
||||
entity_interaction_type = 4
|
||||
text_name = "Naturalist Trainer"
|
||||
stat_data = SubResource( 2 )
|
||||
entity_species_data = ExtResource( 2 )
|
||||
entity_class_data = ExtResource( 3 )
|
||||
script = ExtResource( 1 )
|
@ -1,4 +1,4 @@
|
||||
[gd_resource type="ESSResourceDBStatic" load_steps=50 format=2]
|
||||
[gd_resource type="ESSResourceDBStatic" load_steps=51 format=2]
|
||||
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/spells/16_close_wounds_rank_1.tres" type="Spell" id=1]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/auras/16_ironbark_rank_1.tres" type="Aura" id=2]
|
||||
@ -49,8 +49,9 @@
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/specs/melee/talent_strike_r4.tres" type="Aura" id=47]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/specs/melee/talent_strike_r3.tres" type="Aura" id=48]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/specs/melee/talent_strike_r2.tres" type="Aura" id=49]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/entities/3_naturalist_trainer.tres" type="EntityData" id=50]
|
||||
|
||||
[resource]
|
||||
entity_datas = [ ExtResource( 36 ), ExtResource( 35 ) ]
|
||||
entity_datas = [ ExtResource( 36 ), ExtResource( 35 ), ExtResource( 50 ) ]
|
||||
spells = [ ExtResource( 11 ), ExtResource( 5 ), ExtResource( 25 ), ExtResource( 9 ), ExtResource( 23 ), ExtResource( 33 ), ExtResource( 1 ), ExtResource( 13 ), ExtResource( 34 ), ExtResource( 4 ), ExtResource( 30 ), ExtResource( 28 ), ExtResource( 27 ), ExtResource( 31 ), ExtResource( 14 ), ExtResource( 32 ), ExtResource( 26 ), ExtResource( 18 ), ExtResource( 20 ), ExtResource( 19 ), ExtResource( 22 ), ExtResource( 37 ), ExtResource( 38 ) ]
|
||||
auras = [ ExtResource( 12 ), ExtResource( 8 ), ExtResource( 29 ), ExtResource( 10 ), ExtResource( 3 ), ExtResource( 7 ), ExtResource( 2 ), ExtResource( 6 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 21 ), ExtResource( 24 ), ExtResource( 39 ), ExtResource( 41 ), ExtResource( 40 ), ExtResource( 43 ), ExtResource( 44 ), ExtResource( 42 ), ExtResource( 46 ), ExtResource( 49 ), ExtResource( 48 ), ExtResource( 47 ), ExtResource( 45 ) ]
|
||||
|
@ -1,8 +1,9 @@
|
||||
[gd_resource type="Biome" load_steps=3 format=2]
|
||||
[gd_resource type="Biome" load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://modules/planets/test_planet/biomes/simple_biome.gd" type="Script" id=1]
|
||||
[ext_resource path="res://modules/planets/test_planet/dungeons/vman_dungeon.tres" type="Dungeon" id=2]
|
||||
[ext_resource path="res://modules/planets/test_planet/villages/village.tres" type="Dungeon" id=3]
|
||||
|
||||
[resource]
|
||||
dungeons = [ ExtResource( 2 ) ]
|
||||
dungeons = [ ExtResource( 2 ), ExtResource( 3 ) ]
|
||||
script = ExtResource( 1 )
|
||||
|
@ -45,12 +45,11 @@ func _generate_chunk(chunk: VoxelChunk, spawn_mobs: bool) -> void:
|
||||
for i in range(get_dungeon_count()):
|
||||
var d : Dungeon = get_dungeon(i)
|
||||
|
||||
d.entrance_position.origin = entrance_position
|
||||
|
||||
# print(entrance_position)
|
||||
|
||||
entrance_position = d.next_level_teleporter_position_data_space
|
||||
entrance_position *= voxel_scale
|
||||
if d.has_method("has_entrance_position"):
|
||||
d.entrance_position.origin = entrance_position
|
||||
|
||||
entrance_position = d.next_level_teleporter_position_data_space
|
||||
entrance_position *= voxel_scale
|
||||
|
||||
terrarin_gen.generate_simple_terrarin(chunk, spawn_mobs)
|
||||
|
||||
|
@ -516,3 +516,5 @@ func cut_regions(free_regions, region_to_remove):
|
||||
func set_tile(x, y, type):
|
||||
map[x][y] = type
|
||||
|
||||
func has_entrance_position():
|
||||
return true
|
||||
|
@ -448,3 +448,5 @@ func cut_regions(free_regions, region_to_remove):
|
||||
func set_tile(x, y, type):
|
||||
map[x][y] = type
|
||||
|
||||
func has_entrance_position():
|
||||
return true
|
||||
|
20
game/modules/planets/test_planet/villages/village.gd
Normal file
20
game/modules/planets/test_planet/villages/village.gd
Normal file
@ -0,0 +1,20 @@
|
||||
extends Dungeon
|
||||
|
||||
export (EntityData) var trainer : EntityData
|
||||
|
||||
func _instance(p_seed, p_instance):
|
||||
._instance(p_seed, p_instance)
|
||||
|
||||
p_instance.trainer = trainer
|
||||
|
||||
return p_instance
|
||||
|
||||
func _generate_chunk(chunk : VoxelChunk, spawn_mobs : bool):
|
||||
if trainer == null:
|
||||
return
|
||||
|
||||
if chunk.position_x == 0 && chunk.position_y == 0 && chunk.position_z == 0:
|
||||
var pos : Vector3 = Vector3(4 * chunk.voxel_scale, 8 * chunk.voxel_scale, 4 * chunk.voxel_scale)
|
||||
|
||||
ESS.entity_spawner.spawn_mob(trainer.id, 1, pos)
|
||||
|
8
game/modules/planets/test_planet/villages/village.tres
Normal file
8
game/modules/planets/test_planet/villages/village.tres
Normal file
@ -0,0 +1,8 @@
|
||||
[gd_resource type="Dungeon" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://modules/planets/test_planet/villages/village.gd" type="Script" id=1]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/entities/3_naturalist_trainer.tres" type="EntityData" id=2]
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
trainer = ExtResource( 2 )
|
@ -26,12 +26,11 @@ class_name MobGD
|
||||
|
||||
var dead : bool = false
|
||||
var death_timer : float = 0
|
||||
|
||||
func _ready() -> void:
|
||||
ai_state = EntityEnums.AI_STATE_PATROL
|
||||
|
||||
func _enter_tree():
|
||||
set_process(true)
|
||||
|
||||
ai_state = EntityEnums.AI_STATE_PATROL
|
||||
|
||||
func _process(delta : float) -> void:
|
||||
if dead:
|
||||
@ -52,6 +51,8 @@ func _notification_cmouse_enter() -> void:
|
||||
Input.set_default_cursor_shape(Input.CURSOR_CROSS)
|
||||
elif centity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_NONE:
|
||||
Input.set_default_cursor_shape(Input.CURSOR_ARROW)
|
||||
elif centity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_TRAIN:
|
||||
Input.set_default_cursor_shape(Input.CURSOR_HELP)
|
||||
else:
|
||||
Input.set_default_cursor_shape(Input.CURSOR_MOVE)
|
||||
|
||||
|
@ -51,6 +51,8 @@ func _sinteract(entity: Entity) -> void:
|
||||
entity.starget_bag = target.sbag
|
||||
|
||||
entity.ssend_open_window(EntityEnums.ENTITY_WINDOW_LOOT)
|
||||
elif target.sentity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_TRAIN:
|
||||
entity.ssend_open_window(EntityEnums.ENTITY_WINDOW_TRAINER)
|
||||
|
||||
func _cans_interact(entity):
|
||||
var target : Entity = entity.gets_target()
|
||||
|
@ -57,7 +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")
|
||||
player.connect("onc_open_winow_request", self, "onc_open_loot_winow_request")
|
||||
|
||||
func on_player_moved():
|
||||
if visible:
|
||||
@ -86,7 +86,10 @@ 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:
|
||||
func onc_open_loot_winow_request(window_id) -> void:
|
||||
if window_id != EntityEnums.ENTITY_WINDOW_LOOT:
|
||||
return
|
||||
|
||||
show()
|
||||
|
||||
if player.has_signal("player_moved") && !player.is_connected("player_moved", self, "on_player_moved"):
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=31 format=2]
|
||||
[gd_scene load_steps=32 format=2]
|
||||
|
||||
[ext_resource path="res://player/GUI.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ui/ingame_menu/IngameMenu.tscn" type="PackedScene" id=2]
|
||||
@ -30,6 +30,7 @@
|
||||
[ext_resource path="res://ui/player_ui/player_ui.gd" type="Script" id=28]
|
||||
[ext_resource path="res://ui/windows/CharacterWindow.tscn" type="PackedScene" id=29]
|
||||
[ext_resource path="res://ui/theme/character_icon.tres" type="Texture" id=30]
|
||||
[ext_resource path="res://ui/windows/TrainerWindow.tscn" type="PackedScene" id=31]
|
||||
|
||||
[node name="GUILayer" type="CanvasLayer"]
|
||||
script = ExtResource( 28 )
|
||||
@ -44,7 +45,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") ]
|
||||
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") ]
|
||||
|
||||
[node name="TouchTargetControls" type="MarginContainer" parent="GUI"]
|
||||
visible = false
|
||||
@ -415,6 +416,13 @@ margin_top = 85.0
|
||||
margin_right = 242.0
|
||||
margin_bottom = 315.0
|
||||
|
||||
[node name="TrainerWindow" parent="GUI/Windows" instance=ExtResource( 31 )]
|
||||
visible = false
|
||||
margin_left = 99.6561
|
||||
margin_top = 88.3755
|
||||
margin_right = -704.344
|
||||
margin_bottom = -200.624
|
||||
|
||||
[node name="Unitframes" type="Control" parent="GUI"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -1,23 +1,218 @@
|
||||
# Copyright (c) 2019-2020 Péter Magyar
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
extends PanelContainer
|
||||
|
||||
export(NodePath) var spell_entry_container_path : NodePath
|
||||
export(NodePath) var learn_button_path : NodePath
|
||||
export(NodePath) var cost_points_label_path : NodePath
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
export(NodePath) var spell_icon_path : NodePath
|
||||
export(NodePath) var spell_name_label_path : NodePath
|
||||
export(NodePath) var spell_description_label_path : NodePath
|
||||
export(NodePath) var spell_requirements_label_path : NodePath
|
||||
|
||||
var _spell_entry_container : Node
|
||||
var _spell_entries : Array
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
var _learn_button : Button
|
||||
var _cost_points_label : Label
|
||||
|
||||
var _spell_icon : TextureRect
|
||||
var _spell_name_label : Label
|
||||
var _spell_description_label : Label
|
||||
var _spell_requirements_label : Label
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
var _player : Entity
|
||||
|
||||
var _entity_data : EntityData
|
||||
var _character_class : EntityClassData
|
||||
|
||||
func _on_Trainer_toggled(button_pressed):
|
||||
if button_pressed:
|
||||
show()
|
||||
var _spells : Array
|
||||
|
||||
var _spell_button_group : ButtonGroup
|
||||
|
||||
func _ready() -> void:
|
||||
_spell_button_group = ButtonGroup.new()
|
||||
|
||||
_spell_entry_container = get_node(spell_entry_container_path)
|
||||
|
||||
_spell_icon = get_node(spell_icon_path) as TextureRect
|
||||
_spell_name_label = get_node(spell_name_label_path) as Label
|
||||
_spell_description_label = get_node(spell_description_label_path) as Label
|
||||
_spell_requirements_label = get_node(spell_requirements_label_path) as Label
|
||||
|
||||
_learn_button = get_node(learn_button_path)
|
||||
_cost_points_label = get_node(cost_points_label_path)
|
||||
|
||||
_learn_button.connect("pressed", self, "learn")
|
||||
|
||||
connect("visibility_changed", self, "_visibility_changed")
|
||||
|
||||
func learn() -> void:
|
||||
if _character_class == null:
|
||||
return
|
||||
|
||||
if _player == null:
|
||||
return
|
||||
|
||||
var b : Button = _spell_button_group.get_pressed_button()
|
||||
|
||||
if b:
|
||||
var spell : Spell = b.get_meta("spell")
|
||||
|
||||
_player.spell_learn_requestc(spell.id)
|
||||
|
||||
refresh_entries()
|
||||
|
||||
func refresh_entries() -> void:
|
||||
if _character_class == null or _player == null:
|
||||
return
|
||||
|
||||
for c in _spell_entry_container.get_children():
|
||||
c.queue_free()
|
||||
|
||||
_spell_entries.clear()
|
||||
|
||||
for s in _spells:
|
||||
var spell : Spell = s
|
||||
|
||||
if !spell:
|
||||
continue
|
||||
|
||||
if _player.spell_hasc(spell):
|
||||
continue
|
||||
|
||||
var b : Button = Button.new()
|
||||
|
||||
b.text = spell.text_name + " (rank " + str(spell.rank) + ")"
|
||||
b.set_meta("spell", spell)
|
||||
b.group = _spell_button_group
|
||||
b.toggle_mode = true
|
||||
b.connect("pressed", self, "_button_pressed")
|
||||
|
||||
_spell_entries.append(b)
|
||||
_spell_entry_container.add_child(b)
|
||||
|
||||
if _spell_entries.size() > 0:
|
||||
_spell_entries[0].pressed = true
|
||||
_button_pressed()
|
||||
|
||||
func refresh_all() -> void:
|
||||
if _player == null:
|
||||
return
|
||||
|
||||
if _character_class == null:
|
||||
return
|
||||
|
||||
_cost_points_label.text = str(_player.getc_money())
|
||||
|
||||
refresh_entries()
|
||||
|
||||
|
||||
func _visibility_changed() -> void:
|
||||
if visible:
|
||||
refresh_all()
|
||||
|
||||
func set_player(p_player: Entity) -> void:
|
||||
if _player != null:
|
||||
_player.disconnect("centity_data_changed", self, "centity_data_changed")
|
||||
_player.disconnect("onc_open_winow_request", self, "onc_open_winow_request")
|
||||
|
||||
_player = p_player
|
||||
|
||||
_player.connect("centity_data_changed", self, "centity_data_changed")
|
||||
_player.connect("onc_open_winow_request", self, "onc_open_winow_request")
|
||||
|
||||
if _player != null:
|
||||
centity_data_changed(_player.centity_data)
|
||||
else:
|
||||
hide()
|
||||
centity_data_changed(null)
|
||||
|
||||
func centity_data_changed(data: EntityData):
|
||||
_spells.clear()
|
||||
|
||||
_entity_data = null
|
||||
_character_class = null
|
||||
|
||||
if data == null:
|
||||
return
|
||||
|
||||
_entity_data = _player.centity_data
|
||||
_character_class = _entity_data.entity_class_data
|
||||
|
||||
if _character_class == null:
|
||||
return
|
||||
|
||||
for i in range(_character_class.get_num_spells()):
|
||||
_spells.append(_character_class.get_spell(i))
|
||||
|
||||
_spells.sort_custom(CustomSpellSorter, "sort")
|
||||
|
||||
refresh_all()
|
||||
|
||||
func _button_pressed():
|
||||
var b : Button = _spell_button_group.get_pressed_button()
|
||||
|
||||
if b && b.has_meta("spell"):
|
||||
var spell : Spell = b.get_meta("spell")
|
||||
|
||||
_spell_icon.texture = spell.icon
|
||||
_spell_name_label.text = spell.text_name
|
||||
_spell_description_label.text = spell.text_description
|
||||
|
||||
if spell.training_required_spell:
|
||||
_spell_requirements_label.text = spell.training_required_spell.text_name + " (rank " + str(spell.training_required_spell.rank) + ")"
|
||||
else:
|
||||
_spell_requirements_label.text = ""
|
||||
else:
|
||||
_spell_icon.texture = null
|
||||
_spell_name_label.text = ""
|
||||
_spell_description_label.text = ""
|
||||
_spell_requirements_label.text = ""
|
||||
|
||||
|
||||
class CustomSpellSorter:
|
||||
static func sort(a, b):
|
||||
if a.level < b.level:
|
||||
return true
|
||||
elif a.level > b.level:
|
||||
return false
|
||||
else:
|
||||
var res = a.text_name.casecmp_to(b.text_name)
|
||||
|
||||
if res == 0:
|
||||
if a.rank < b.rank:
|
||||
return true
|
||||
return false
|
||||
elif res == 1:
|
||||
return false
|
||||
|
||||
return true
|
||||
|
||||
|
||||
func onc_open_winow_request(window_id : int) -> void:
|
||||
if window_id != EntityEnums.ENTITY_WINDOW_TRAINER:
|
||||
return
|
||||
|
||||
show()
|
||||
|
||||
# if player.has_signal("player_moved") && !player.is_connected("player_moved", self, "on_player_moved"):
|
||||
# player.connect("player_moved", self, "on_player_moved", [], CONNECT_ONESHOT)
|
||||
|
@ -13,6 +13,13 @@ script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
spell_entry_container_path = NodePath("VBoxContainer/PanelContainer3/ScrollContainer/Spells")
|
||||
learn_button_path = NodePath("VBoxContainer/HBoxContainer/Train")
|
||||
cost_points_label_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer2/Price")
|
||||
spell_icon_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer/Icon")
|
||||
spell_name_label_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer2/Name")
|
||||
spell_description_label_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer2/Description")
|
||||
spell_requirements_label_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer2/Requirements")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_left = 4.0
|
||||
@ -20,34 +27,28 @@ margin_top = 4.0
|
||||
margin_right = 1020.0
|
||||
margin_bottom = 596.0
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer"]
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_right = 1016.0
|
||||
margin_bottom = 34.0
|
||||
margin_bottom = 26.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/PanelContainer"]
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 1012.0
|
||||
margin_bottom = 30.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/PanelContainer/HBoxContainer"]
|
||||
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
|
||||
margin_top = 5.0
|
||||
margin_right = 974.0
|
||||
margin_right = 982.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Trainer"
|
||||
|
||||
[node name="Button" type="Button" parent="VBoxContainer/PanelContainer/HBoxContainer"]
|
||||
margin_left = 978.0
|
||||
margin_right = 1008.0
|
||||
margin_bottom = 26.269
|
||||
[node name="Button" type="Button" parent="VBoxContainer/HBoxContainer2"]
|
||||
margin_left = 986.0
|
||||
margin_right = 1016.0
|
||||
margin_bottom = 26.5702
|
||||
rect_min_size = Vector2( 30, 0 )
|
||||
text = "X"
|
||||
|
||||
[node name="PanelContainer3" type="PanelContainer" parent="VBoxContainer"]
|
||||
margin_top = 42.0
|
||||
margin_top = 34.0
|
||||
margin_right = 1016.0
|
||||
margin_bottom = 296.0
|
||||
margin_bottom = 292.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
@ -55,73 +56,18 @@ size_flags_vertical = 3
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 1012.0
|
||||
margin_bottom = 250.0
|
||||
margin_bottom = 254.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
scroll_horizontal_enabled = false
|
||||
|
||||
[node name="Spells" type="VBoxContainer" parent="VBoxContainer/PanelContainer3/ScrollContainer"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 306.0
|
||||
margin_right = 1008.0
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/separation = 2
|
||||
|
||||
[node name="Button" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_right = 998.0
|
||||
margin_bottom = 26.269
|
||||
|
||||
[node name="Button2" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 28.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 54.269
|
||||
|
||||
[node name="Button3" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 56.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 82.269
|
||||
|
||||
[node name="Button4" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 84.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 110.269
|
||||
|
||||
[node name="Button5" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 112.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 138.269
|
||||
|
||||
[node name="Button6" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 140.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 166.269
|
||||
|
||||
[node name="Button7" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 168.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 194.269
|
||||
|
||||
[node name="Button8" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 196.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 222.269
|
||||
|
||||
[node name="Button9" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 224.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 250.269
|
||||
|
||||
[node name="Button10" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 252.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 278.269
|
||||
|
||||
[node name="Button11" type="Button" parent="VBoxContainer/PanelContainer3/ScrollContainer/Spells"]
|
||||
margin_top = 280.0
|
||||
margin_right = 998.0
|
||||
margin_bottom = 306.269
|
||||
|
||||
[node name="PanelContainer2" type="PanelContainer" parent="VBoxContainer"]
|
||||
margin_top = 304.0
|
||||
margin_top = 300.0
|
||||
margin_right = 1016.0
|
||||
margin_bottom = 558.0
|
||||
size_flags_horizontal = 3
|
||||
@ -131,34 +77,56 @@ size_flags_vertical = 3
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 1012.0
|
||||
margin_bottom = 250.0
|
||||
margin_bottom = 254.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/PanelContainer2/VBoxContainer"]
|
||||
margin_right = 1008.0
|
||||
margin_bottom = 223.0
|
||||
margin_bottom = 227.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_right = 60.0
|
||||
margin_bottom = 223.0
|
||||
margin_bottom = 227.0
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
margin_right = 60.0
|
||||
margin_bottom = 60.0
|
||||
rect_min_size = Vector2( 60, 60 )
|
||||
expand = true
|
||||
|
||||
[node name="Description" type="Label" parent="VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer"]
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 64.0
|
||||
margin_right = 1008.0
|
||||
margin_bottom = 223.0
|
||||
margin_bottom = 227.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Name" type="Label" parent="VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
margin_right = 944.0
|
||||
margin_bottom = 15.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 5
|
||||
|
||||
[node name="Requirements" type="Label" parent="VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
margin_top = 23.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 38.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 5
|
||||
|
||||
[node name="Description" type="Label" parent="VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer2"]
|
||||
margin_top = 46.0
|
||||
margin_right = 944.0
|
||||
margin_bottom = 227.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 7
|
||||
autowrap = true
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/PanelContainer2/VBoxContainer"]
|
||||
margin_top = 231.0
|
||||
margin_top = 235.0
|
||||
margin_right = 1008.0
|
||||
margin_bottom = 246.0
|
||||
margin_bottom = 250.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer2"]
|
||||
margin_right = 36.0
|
||||
@ -179,6 +147,7 @@ alignment = 2
|
||||
[node name="Train" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 916.0
|
||||
margin_right = 1016.0
|
||||
margin_bottom = 26.269
|
||||
margin_bottom = 26.5702
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
text = "Learn"
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Button" to="." method="hide"]
|
||||
|
Loading…
Reference in New Issue
Block a user