diff --git a/addons/pvzadventure/AdventureLevelResource.cs b/addons/pvzadventure/AdventureLevelResource.cs new file mode 100644 index 0000000..46e05a4 --- /dev/null +++ b/addons/pvzadventure/AdventureLevelResource.cs @@ -0,0 +1,11 @@ +using Godot; +using Godot.Collections; + +[GlobalClass] +[Tool] +public partial class AdventureLevelResource : Resource +{ + [Export] public float startSun; + //[Export] public Array conditions; + [Export] public Array waves; +} diff --git a/addons/pvzadventure/AdventureLevelResource.cs.uid b/addons/pvzadventure/AdventureLevelResource.cs.uid new file mode 100644 index 0000000..2a1a182 --- /dev/null +++ b/addons/pvzadventure/AdventureLevelResource.cs.uid @@ -0,0 +1 @@ +uid://bximdujbkj2n4 diff --git a/addons/pvzadventure/PvZAdventure.cs b/addons/pvzadventure/PvZAdventure.cs new file mode 100644 index 0000000..c996d1f --- /dev/null +++ b/addons/pvzadventure/PvZAdventure.cs @@ -0,0 +1,44 @@ +#if TOOLS +using Godot; + +[Tool] +public partial class PvZAdventure : EditorPlugin +{ + private PackedScene panel = ResourceLoader.Load("res://addons/pvzadventure/scenes/adventure_editor.tscn"); + + private Control panelInstance; + public override void _EnterTree() + { + panelInstance = panel.Instantiate(); + EditorInterface.Singleton.GetEditorMainScreen().AddChild(panelInstance); + _MakeVisible(false); + + } + public override void _ExitTree() + { + if (panelInstance != null) + { + panelInstance.QueueFree(); + } + } + + + public override bool _HasMainScreen() + { + return true; + } + + public override void _MakeVisible(bool visible) + { + if (panelInstance != null) + { + panelInstance.Visible = visible; + } + } + + public override string _GetPluginName() + { + return "Adventure"; + } +} +#endif diff --git a/addons/pvzadventure/PvZAdventure.cs.uid b/addons/pvzadventure/PvZAdventure.cs.uid new file mode 100644 index 0000000..e55b39a --- /dev/null +++ b/addons/pvzadventure/PvZAdventure.cs.uid @@ -0,0 +1 @@ +uid://cef32inw0wu7b diff --git a/addons/pvzadventure/WaveData.cs b/addons/pvzadventure/WaveData.cs new file mode 100644 index 0000000..120ad63 --- /dev/null +++ b/addons/pvzadventure/WaveData.cs @@ -0,0 +1,8 @@ +using Godot; + +[GlobalClass] +[Tool] +public partial class WaveData : Resource +{ + +} diff --git a/addons/pvzadventure/WaveData.cs.uid b/addons/pvzadventure/WaveData.cs.uid new file mode 100644 index 0000000..f8d4b68 --- /dev/null +++ b/addons/pvzadventure/WaveData.cs.uid @@ -0,0 +1 @@ +uid://7rptlb5qr3b6 diff --git a/addons/pvzadventure/plugin.cfg b/addons/pvzadventure/plugin.cfg new file mode 100644 index 0000000..0f16885 --- /dev/null +++ b/addons/pvzadventure/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="PvZAdventure" +description="" +author="R34nd0" +version="1.0" +script="PvZAdventure.cs" diff --git a/addons/pvzadventure/scenes/adventure_editor.tscn b/addons/pvzadventure/scenes/adventure_editor.tscn new file mode 100644 index 0000000..6df6086 --- /dev/null +++ b/addons/pvzadventure/scenes/adventure_editor.tscn @@ -0,0 +1,54 @@ +[gd_scene load_steps=3 format=3 uid="uid://dkq82o31vr3i2"] + +[ext_resource type="Script" uid="uid://dkgxtig5fwdgi" path="res://addons/pvzadventure/scripts/AdventureEditor.cs" id="1_go5yu"] +[ext_resource type="Script" uid="uid://binuuattefn7d" path="res://addons/pvzadventure/scripts/FileButton.cs" id="2_d5hwn"] + +[node name="AdventureEditor" type="MarginContainer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 5 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 5 +theme_override_constants/margin_bottom = 5 +script = ExtResource("1_go5yu") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 + +[node name="StatusBar" type="PanelContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/StatusBar"] +layout_mode = 2 + +[node name="FileButton" type="MenuButton" parent="VBoxContainer/StatusBar/HBoxContainer"] +layout_mode = 2 +text = "File" +switch_on_hover = true +item_count = 3 +popup/item_0/text = "New" +popup/item_0/id = 0 +popup/item_1/text = "Save" +popup/item_1/id = 1 +popup/item_2/text = "Open" +popup/item_2/id = 2 +script = ExtResource("2_d5hwn") + +[node name="FileDialog" type="FileDialog" parent="VBoxContainer/StatusBar/HBoxContainer/FileButton"] + +[node name="WorkArea" type="HSplitContainer" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +split_offset = 500 + +[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/WorkArea"] +layout_mode = 2 + +[node name="Inspector" type="VSplitContainer" parent="VBoxContainer/WorkArea"] +layout_mode = 2 + +[node name="LevelInspector" type="Tree" parent="VBoxContainer/WorkArea/Inspector"] +layout_mode = 2 diff --git a/addons/pvzadventure/scripts/AdventureEditor.cs b/addons/pvzadventure/scripts/AdventureEditor.cs new file mode 100644 index 0000000..982d9b8 --- /dev/null +++ b/addons/pvzadventure/scripts/AdventureEditor.cs @@ -0,0 +1,18 @@ +using Godot; + +[Tool] +public partial class AdventureEditor : MarginContainer +{ + public AdventureLevelResource editedResource; + public string editedPath; + + public void Reload() + { + editedResource = ResourceLoader.Load(editedPath); + } + + public void Save() + { + ResourceSaver.Save(editedResource, editedPath); + } +} diff --git a/addons/pvzadventure/scripts/AdventureEditor.cs.uid b/addons/pvzadventure/scripts/AdventureEditor.cs.uid new file mode 100644 index 0000000..dc8c522 --- /dev/null +++ b/addons/pvzadventure/scripts/AdventureEditor.cs.uid @@ -0,0 +1 @@ +uid://dkgxtig5fwdgi diff --git a/addons/pvzadventure/scripts/FileButton.cs b/addons/pvzadventure/scripts/FileButton.cs new file mode 100644 index 0000000..0b2c3b2 --- /dev/null +++ b/addons/pvzadventure/scripts/FileButton.cs @@ -0,0 +1,53 @@ +using Godot; + +[Tool] +public partial class FileButton : MenuButton +{ + const int NEWFILE = 0; + const int SAVEFILE = 1; + const int OPENFILE = 2; + private AdventureEditor editor; + private FileDialog dialog; + private int chosenOption = -1; + public override void _Ready() + { + editor = (AdventureEditor)FindParent("AdventureEditor"); + dialog = GetNode("FileDialog"); + + GetPopup().IndexPressed += OnIndexPressed; + dialog.FileSelected += OnFileSelected; + } + + private void OnIndexPressed(long index) + { + chosenOption = (int)index; + if (index == NEWFILE) + { + editor.editedResource = new AdventureLevelResource(); + dialog.PopupCentered(); + dialog.FileMode = FileDialog.FileModeEnum.SaveFile; + } + else if (index == SAVEFILE) + { + editor.Save(); + } + else if (index == OPENFILE) + { + dialog.PopupCentered(); + dialog.FileMode = FileDialog.FileModeEnum.OpenFile; + } + } + private void OnFileSelected(string path) + { + editor.editedPath = path; + if (chosenOption == NEWFILE) + { + editor.Save(); + } + else if (chosenOption == OPENFILE) + { + editor.Reload(); + } + } + +} diff --git a/addons/pvzadventure/scripts/FileButton.cs.uid b/addons/pvzadventure/scripts/FileButton.cs.uid new file mode 100644 index 0000000..ca890dd --- /dev/null +++ b/addons/pvzadventure/scripts/FileButton.cs.uid @@ -0,0 +1 @@ +uid://binuuattefn7d diff --git a/assets/audio/music/Минус - Звенит январская вьюга.mp3 b/assets/audio/music/Минус - Звенит январская вьюга.mp3 new file mode 100644 index 0000000..425ae12 Binary files /dev/null and b/assets/audio/music/Минус - Звенит январская вьюга.mp3 differ diff --git a/assets/audio/music/Минус - Звенит январская вьюга.mp3.import b/assets/audio/music/Минус - Звенит январская вьюга.mp3.import new file mode 100644 index 0000000..6b4a536 --- /dev/null +++ b/assets/audio/music/Минус - Звенит январская вьюга.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://dk2gfbvt2l3fh" +path="res://.godot/imported/Минус - Звенит январская вьюга.mp3-8d4ebdcccd5d4a614b1ee64f1ab327e9.mp3str" + +[deps] + +source_file="res://assets/audio/music/Минус - Звенит январская вьюга.mp3" +dest_files=["res://.godot/imported/Минус - Звенит январская вьюга.mp3-8d4ebdcccd5d4a614b1ee64f1ab327e9.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/audio/music/Музыка из фильмов - Кин-дза-дза.mp3 b/assets/audio/music/Музыка из фильмов - Кин-дза-дза.mp3 new file mode 100644 index 0000000..0dfcfdd Binary files /dev/null and b/assets/audio/music/Музыка из фильмов - Кин-дза-дза.mp3 differ diff --git a/assets/audio/music/Музыка из фильмов - Кин-дза-дза.mp3.import b/assets/audio/music/Музыка из фильмов - Кин-дза-дза.mp3.import new file mode 100644 index 0000000..2fdd143 --- /dev/null +++ b/assets/audio/music/Музыка из фильмов - Кин-дза-дза.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://cknp3hkc16j8v" +path="res://.godot/imported/Музыка из фильмов - Кин-дза-дза.mp3-baca265e7d3002fd1a84da29462a6f28.mp3str" + +[deps] + +source_file="res://assets/audio/music/Музыка из фильмов - Кин-дза-дза.mp3" +dest_files=["res://.godot/imported/Музыка из фильмов - Кин-дза-дза.mp3-baca265e7d3002fd1a84da29462a6f28.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/audio/music/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3 b/assets/audio/music/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3 new file mode 100644 index 0000000..2b9b6cf Binary files /dev/null and b/assets/audio/music/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3 differ diff --git a/assets/audio/music/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3.import b/assets/audio/music/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3.import new file mode 100644 index 0000000..8e2abbe --- /dev/null +++ b/assets/audio/music/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://nwv8ndo7qxbb" +path="res://.godot/imported/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3-14b547e759f2391f6454fc5d81759af5.mp3str" + +[deps] + +source_file="res://assets/audio/music/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3" +dest_files=["res://.godot/imported/Юлия Коган, Frenetic Virtual Orchestra, Atomic Heart - В синем море, в белой пене (Оставайся, мальчик, с нами) (Instrumental).mp3-14b547e759f2391f6454fc5d81759af5.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/project.godot b/project.godot index 0ada405..2e08b3e 100644 --- a/project.godot +++ b/project.godot @@ -37,7 +37,7 @@ project/assembly_name="NewLON" [editor_plugins] -enabled=PackedStringArray("res://addons/floatmodifiers/plugin.cfg") +enabled=PackedStringArray("res://addons/floatmodifiers/plugin.cfg", "res://addons/pvzadventure/plugin.cfg") [file_customization] diff --git a/resources/levels/testlvl.tres b/resources/levels/testlvl.tres new file mode 100644 index 0000000..2f6adda --- /dev/null +++ b/resources/levels/testlvl.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="AdventureLevelResource" load_steps=2 format=3 uid="uid://bx1wnrgickeyd"] + +[ext_resource type="Script" uid="uid://bximdujbkj2n4" path="res://addons/pvzadventure/AdventureLevelResource.cs" id="1_ed2ji"] + +[resource] +script = ExtResource("1_ed2ji") +startSun = 0.0 +waves = null +metadata/_custom_type_script = "uid://bximdujbkj2n4"