Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
pk5 Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
DrRetro2033 committed Mar 19, 2022
1 parent 2d57ce2 commit 9d6dc05
Show file tree
Hide file tree
Showing 28 changed files with 941 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pokemon-gen7x/
pkmdb/
save/
sprites/
.import/
*.png
*.import
32 changes: 22 additions & 10 deletions Bank.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=18 format=2]

[ext_resource path="res://pkm.gd" type="Script" id=1]
[ext_resource path="res://Panel.tscn" type="PackedScene" id=2]
Expand All @@ -13,6 +13,7 @@
[ext_resource path="res://ProfileInfo.gd" type="Script" id=11]
[ext_resource path="res://ProfileMaker.gd" type="Script" id=12]
[ext_resource path="res://PartyCreator.tscn" type="PackedScene" id=13]
[ext_resource path="res://Menu.tscn" type="PackedScene" id=14]

[sub_resource type="GDScript" id=7]
script/source = "extends Panel
Expand Down Expand Up @@ -174,7 +175,7 @@ margin_bottom = -4.0
[node name="TextureRect" type="TextureRect" parent="PopupPanel/VBoxContainer"]
margin_right = 128.0
margin_bottom = 124.0
margin_bottom = 106.0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 3.0
Expand All @@ -183,15 +184,21 @@ expand = true
stretch_mode = 6
[node name="Label" type="Label" parent="PopupPanel/VBoxContainer"]
margin_top = 128.0
margin_top = 110.0
margin_right = 128.0
margin_bottom = 170.0
margin_bottom = 146.0
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Name"
align = 1
valign = 1
[node name="Main Menu" type="Button" parent="PopupPanel/VBoxContainer"]
margin_top = 150.0
margin_right = 128.0
margin_bottom = 170.0
text = "Main Menu"
[node name="ProfilePic" type="Button" parent="."]
margin_left = 8.0
margin_top = 3.0
Expand Down Expand Up @@ -262,8 +269,8 @@ __meta__ = {
[node name="Control" type="Control" parent="Loading Screen"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = 6144.0
margin_bottom = 3600.0
margin_right = 10240.0
margin_bottom = 6000.0
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
Expand Down Expand Up @@ -297,7 +304,7 @@ texture = ExtResource( 10 )
[node name="PopupMenu" type="PopupMenu" parent="."]
margin_right = 88.0
margin_bottom = 128.0
items = [ "Box", null, 0, false, true, -1, 0, null, "", true, "New Box", null, 0, false, false, 0, 0, null, "", false, "Rename Box", null, 0, false, false, 1, 0, null, "", false, "Pokemon", null, 0, false, true, -1, 0, null, "", true, "Search for Pokemon", null, 0, false, false, 2, 0, null, "", false ]
items = [ "Box", null, 0, false, true, -1, 0, null, "", true, "New Box", null, 0, false, false, 0, 0, null, "", false, "Rename Box", null, 0, false, false, 1, 0, null, "", false, "Pokemon", null, 0, false, true, -1, 0, null, "", true, "Search for Pokemon", null, 0, false, false, 2, 0, null, "", false, "Manage Parties", null, 0, false, false, 3, 0, null, "", false ]
script = ExtResource( 3 )
[node name="Rename" type="PopupDialog" parent="."]
Expand Down Expand Up @@ -342,9 +349,6 @@ placeholder_text = "Box"
[node name="Search" parent="." instance=ExtResource( 5 )]
visible = false
[node name="Panel" parent="." groups=["Info Panel"] instance=ExtResource( 2 )]
visible = false
[node name="ProfileMaker" type="WindowDialog" parent="."]
anchor_left = 0.5
anchor_top = 0.5
Expand Down Expand Up @@ -451,6 +455,14 @@ current_path = "/Users/Colly/OneDrive/Documents/GitHub/Pokemon-Manager/"
[node name="PartyCreator" parent="." instance=ExtResource( 13 )]
visible = false
[node name="Panel" parent="." instance=ExtResource( 2 )]
visible = false
[node name="Menu" parent="." instance=ExtResource( 14 )]
visible = false
[connection signal="pressed" from="PopupPanel/VBoxContainer/Main Menu" to="PopupPanel" method="_on_Main_Menu_pressed"]
[connection signal="pressed" from="PopupPanel/VBoxContainer/Main Menu" to="Menu" method="_on_Main_Menu_pressed"]
[connection signal="pressed" from="ProfilePic" to="PopupPanel" method="_on_ProfilePic_pressed"]
[connection signal="request_completed" from="PokemonRequest" to="." method="_on_PokemonRequest_request_completed"]
[connection signal="request_completed" from="MoveRequest" to="." method="_on_MoveRequest_request_completed"]
Expand Down
4 changes: 2 additions & 2 deletions Bank_Layout.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func loadPokemon(bank):
var overflow = int(bank.data.size() / max_per_page)
var array = bank.box_names
print(overflow)
while overflow >= 0:
while overflow >= 0: #if there are more pokemon that can't all fit into one box it creates new ones
var new_box = box.instance()
if bank.box_names.size() - 1 >= overflow:
new_box.name = array.front()
Expand Down Expand Up @@ -58,7 +58,7 @@ func _on_Rename_newName(new_name):
func addPokemon(pokemon):
var overflow = int(pokemon.size() / max_per_page)
print(overflow)
while overflow >= 0:
while overflow >= 0:
var new_box = box.instance()
new_box.name = "Box%s" % str(get_child_count() + 1)
boxes.push_back(new_box.name)
Expand Down
3 changes: 0 additions & 3 deletions Box.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ size_flags_horizontal = 3
size_flags_vertical = 3
columns = 5
script = SubResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Button" parent="." instance=ExtResource( 1 )]
anchor_right = 0.0
Expand Down
112 changes: 112 additions & 0 deletions Member_Button.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://abomasnow.png" type="Texture" id=1]

[sub_resource type="GDScript" id=1]
script/source = "extends Button
signal dragged_and_dropped
const path = \"res://sprites/pokemon/icons/\"
onready var label = $VBoxContainer/Label
onready var sprite = $VBoxContainer/TextureRect
onready var hold_timer = $Timer
const button = preload(\"res://drag.tscn\")
var id
var can_drag = true
func _ready():
pass

func pokeButton(var info):
label = $VBoxContainer/Label
sprite = $VBoxContainer/TextureRect
if info != null:
id = info
var pokemon = Pokemon.pokemon[info]
disabled = false
label.visible = true
sprite.visible = true
label.text = pokemon[\"nickname\"]
var path_name = str(pokemon[\"sprite\"])
var temp_path = path+path_name
sprite.set_texture(load(temp_path))
else:
id = null
disabled = true
label.visible = false
sprite.visible = false


func _on_Button_pressed():
for panel in get_tree().get_nodes_in_group(\"Info Panel\"):
panel.open(id)
hold_timer.stop()


func _on_Button_button_down():
yield(get_tree().create_timer(2.0), \"timeout\")
get_drag_data(Vector2(0.0,0.0))

func get_drag_data(position):
if not disabled and can_drag:
var data = {}
data[\"origin\"] = self
data[\"pokemon\"] = id
var drag_button = TextureRect.new()
drag_button.texture = get_child(0).get_child(0).texture
drag_button.rect_size = Vector2(100,100)
var control = Control.new()
control.add_child(drag_button)
drag_button.rect_position = -0.5 * drag_button.rect_size
set_drag_preview(control)
return data

func can_drop_data(position, data):
return true

func drop_data(position, data):
data[\"origin\"].pokeButton(id)
pokeButton(data[\"pokemon\"])
emit_signal(\"dragged_and_dropped\")

"
[node name="Button" type="Button"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
disabled = true
script = SubResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="TextureRect" type="TextureRect" parent="VBoxContainer"]
visible = false
margin_right = 1024.0
margin_bottom = 470.0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 3.75
texture = ExtResource( 1 )
expand = true
stretch_mode = 6
[node name="Label" type="Label" parent="VBoxContainer"]
visible = false
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Name"
align = 1
valign = 1
[node name="Timer" type="Timer" parent="."]
wait_time = 2.0
[connection signal="button_down" from="." to="." method="_on_Button_button_down"]
[connection signal="button_up" from="." to="." method="_on_Button_button_up"]
[connection signal="pressed" from="." to="." method="_on_Button_pressed"]
47 changes: 47 additions & 0 deletions Menu.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
extends Control
onready var bank = $"../Bank Manager"

# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var reset_accept = $Panel/Reset
onready var quit_accept = $Panel/Quit

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass


func _on_Reset_pressed():
reset_accept.popup()


func _on_Quit_pressed():
quit_accept.popup()


func _on_QuitSave_pressed():
bank.save()
get_tree().quit()


func _on_Quit_confirmed():
get_tree().quit()


func _on_Reset_confirmed():
bank.reset()
get_tree().quit()


func _on_Main_Menu_pressed():
visible = true


func _on_Back_pressed():
visible = false
100 changes: 100 additions & 0 deletions Menu.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://Futura Condensed Extra Bold.otf" type="DynamicFontData" id=1]
[ext_resource path="res://Menu.gd" type="Script" id=2]

[sub_resource type="DynamicFont" id=1]
size = 32
font_data = ExtResource( 1 )

[sub_resource type="Theme" id=2]

[node name="Menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )

[node name="Panel" type="Panel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0

[node name="Label" type="Label" parent="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 192.0
margin_top = 94.0
margin_right = -192.0
margin_bottom = -440.0
custom_fonts/font = SubResource( 1 )
text = "Pokemon Manager"
align = 1
valign = 1

[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 312.0
margin_top = 176.0
margin_right = -312.0
margin_bottom = -48.0

[node name="Reset" type="Button" parent="Panel/VBoxContainer"]
margin_right = 400.0
margin_bottom = 122.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Reset"

[node name="Quit" type="Button" parent="Panel/VBoxContainer"]
margin_top = 126.0
margin_right = 400.0
margin_bottom = 249.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Quit without Saving"

[node name="QuitSave" type="Button" parent="Panel/VBoxContainer"]
margin_top = 253.0
margin_right = 400.0
margin_bottom = 376.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Quit and Save"

[node name="Reset" type="ConfirmationDialog" parent="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 272.0
margin_top = 236.0
margin_right = -272.0
margin_bottom = -284.0
theme = SubResource( 2 )
dialog_text = "Are you sure you want to reset everything? (All pokémon, parties, boxes, and trainer info will have to be added to the bank or created from scratch)"
dialog_autowrap = true

[node name="Quit" type="ConfirmationDialog" parent="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 272.0
margin_top = 236.0
margin_right = -272.0
margin_bottom = -284.0
theme = SubResource( 2 )
dialog_text = "Are you sure you want to quit without saving? (Any pokémon, parties, or boxes that were added after the latest save will have to be added to the bank or created again)"
dialog_autowrap = true

[node name="Back" type="Button" parent="."]
anchor_top = 1.0
anchor_bottom = 1.0
margin_left = 16.0
margin_top = -64.0
margin_right = 136.0
margin_bottom = -16.0
text = "Back"

[connection signal="pressed" from="Panel/VBoxContainer/Reset" to="." method="_on_Reset_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/Quit" to="." method="_on_Quit_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/QuitSave" to="." method="_on_QuitSave_pressed"]
[connection signal="confirmed" from="Panel/Reset" to="." method="_on_Reset_confirmed"]
[connection signal="confirmed" from="Panel/Quit" to="." method="_on_Quit_confirmed"]
[connection signal="pressed" from="Back" to="." method="_on_Back_pressed"]
Loading

0 comments on commit 9d6dc05

Please sign in to comment.