This commit is contained in:
Rendo 2025-07-05 20:51:04 +05:00
commit 0e9e17cfdc
20 changed files with 267 additions and 1 deletions

View file

@ -0,0 +1,11 @@
using Godot;
using Godot.Collections;
[GlobalClass]
[Tool]
public partial class AdventureLevelResource : Resource
{
[Export] public float startSun;
//[Export] public Array<Conditions> conditions;
[Export] public Array<WaveData> waves;
}

View file

@ -0,0 +1 @@
uid://bximdujbkj2n4

View file

@ -0,0 +1,44 @@
#if TOOLS
using Godot;
[Tool]
public partial class PvZAdventure : EditorPlugin
{
private PackedScene panel = ResourceLoader.Load<PackedScene>("res://addons/pvzadventure/scenes/adventure_editor.tscn");
private Control panelInstance;
public override void _EnterTree()
{
panelInstance = panel.Instantiate<Control>();
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

View file

@ -0,0 +1 @@
uid://cef32inw0wu7b

View file

@ -0,0 +1,8 @@
using Godot;
[GlobalClass]
[Tool]
public partial class WaveData : Resource
{
}

View file

@ -0,0 +1 @@
uid://7rptlb5qr3b6

View file

@ -0,0 +1,7 @@
[plugin]
name="PvZAdventure"
description=""
author="R34nd0"
version="1.0"
script="PvZAdventure.cs"

View file

@ -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

View file

@ -0,0 +1,18 @@
using Godot;
[Tool]
public partial class AdventureEditor : MarginContainer
{
public AdventureLevelResource editedResource;
public string editedPath;
public void Reload()
{
editedResource = ResourceLoader.Load<AdventureLevelResource>(editedPath);
}
public void Save()
{
ResourceSaver.Save(editedResource, editedPath);
}
}

View file

@ -0,0 +1 @@
uid://dkgxtig5fwdgi

View file

@ -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>("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();
}
}
}

View file

@ -0,0 +1 @@
uid://binuuattefn7d

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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"