complete refactor

This commit is contained in:
Rendo 2025-07-25 18:48:49 +05:00
commit de2e8b1e50
71 changed files with 212 additions and 137 deletions

View file

@ -1,5 +1,6 @@
using Godot;
using Godot.Collections;
using Newlon.Resources;
[GlobalClass]
[Tool]

View file

@ -1,5 +1,6 @@
using Godot;
using Godot.Collections;
using Newlon.Resources;
[Tool]
[GlobalClass]

View file

@ -1,4 +1,5 @@
using Godot;
using Newlon.Resources;
[Tool]

View file

@ -1,4 +1,6 @@
using Godot;
using Newlon.Resources;
[Tool]
public partial class ZE_AssetBrowserButton : PanelContainer

View file

@ -1,4 +1,5 @@
using Godot;
using Newlon.Resources;
[Tool]

View file

@ -1,4 +1,6 @@
using Godot;
using Newlon.Resources;
[Tool]
public partial class ZE_RowEditor : VBoxContainer

View file

@ -5,7 +5,7 @@
[ext_resource type="Script" uid="uid://cw7yc3i2lgcja" path="res://addons/pvzadventure/WaveEvent.cs" id="2_otfbt"]
[ext_resource type="Script" uid="uid://7rptlb5qr3b6" path="res://addons/pvzadventure/WaveData.cs" id="3_cugtx"]
[ext_resource type="Script" uid="uid://dl12rj75tk2qi" path="res://addons/pvzadventure/RowSpawn.cs" id="4_y1e37"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="5_uatri"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/entities/ZombieResource.cs" id="5_uatri"]
[ext_resource type="Resource" uid="uid://buvacn56kyy2p" path="res://assets/zombies/basic.tres" id="6_qsvr4"]
[ext_resource type="Resource" uid="uid://nceohd32fkxk" path="res://assets/zombies/conehead.tres" id="7_qsvr4"]

View file

@ -5,7 +5,7 @@
[ext_resource type="Script" uid="uid://cw7yc3i2lgcja" path="res://addons/pvzadventure/WaveEvent.cs" id="3_icaa5"]
[ext_resource type="Script" uid="uid://7rptlb5qr3b6" path="res://addons/pvzadventure/WaveData.cs" id="4_kc7t2"]
[ext_resource type="Script" uid="uid://dl12rj75tk2qi" path="res://addons/pvzadventure/RowSpawn.cs" id="5_66y5q"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="6_66y5q"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/entities/ZombieResource.cs" id="6_66y5q"]
[ext_resource type="Resource" uid="uid://buvacn56kyy2p" path="res://assets/zombies/basic.tres" id="7_c21si"]
[ext_resource type="Resource" uid="uid://nceohd32fkxk" path="res://assets/zombies/conehead.tres" id="8_c21si"]
[ext_resource type="Resource" uid="uid://dkhjlu7u0vny6" path="res://assets/zombies/buckethead.tres" id="9_tuvrx"]

View file

@ -5,7 +5,7 @@
[ext_resource type="Script" uid="uid://cw7yc3i2lgcja" path="res://addons/pvzadventure/WaveEvent.cs" id="2_pkoaj"]
[ext_resource type="Script" uid="uid://7rptlb5qr3b6" path="res://addons/pvzadventure/WaveData.cs" id="3_mtsmf"]
[ext_resource type="Script" uid="uid://dl12rj75tk2qi" path="res://addons/pvzadventure/RowSpawn.cs" id="4_tpjav"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="5_tpjav"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/entities/ZombieResource.cs" id="5_tpjav"]
[ext_resource type="Resource" uid="uid://buvacn56kyy2p" path="res://assets/zombies/basic.tres" id="6_swlbc"]
[ext_resource type="Resource" uid="uid://nceohd32fkxk" path="res://assets/zombies/conehead.tres" id="7_swlbc"]

View file

@ -1,13 +1,13 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://bf7vjtufjc8kt"]
[ext_resource type="Texture2D" uid="uid://d4btl7vqi4v0q" path="res://assets/sprites/plants/aloe.tres" id="1_t4137"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_vw2kg"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_vw2kg"]
[ext_resource type="PackedScene" uid="uid://bw1w8jp0yeypy" path="res://scenes/entities/plants/aloe.tscn" id="2_6a4ia"]
[resource]
script = ExtResource("1_vw2kg")
name_key = "aloe"
description_key = "aloe_desc"
NameKey = "aloe"
DescriptionKey = "aloe_desc"
Cost = 75.0
Scene = ExtResource("2_6a4ia")
ReloadTime = 15.0

View file

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://ciewunnfalrbb"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_jrx81"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_jrx81"]
[ext_resource type="Texture2D" uid="uid://bt76iudw2qgnv" path="res://assets/sprites/atlases/plants/cumbucer.png" id="1_tdg4d"]
[ext_resource type="PackedScene" uid="uid://cjoyh54cpjla7" path="res://scenes/entities/plants/cucumber.tscn" id="2_0mr6r"]
@ -10,8 +10,8 @@ region = Rect2(2, 1, 41, 65)
[resource]
script = ExtResource("1_jrx81")
name_key = "cucumber"
description_key = "cucumber_desc"
NameKey = "cucumber"
DescriptionKey = "cucumber_desc"
Cost = 75.0
Scene = ExtResource("2_0mr6r")
ReloadTime = 5.0

View file

@ -1,13 +1,13 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://btkkaow4tyw55"]
[ext_resource type="Texture2D" uid="uid://m8e84blnx7yu" path="res://assets/sprites/plants/garlic.tres" id="1_datic"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_e15gf"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_e15gf"]
[ext_resource type="PackedScene" uid="uid://qq0cw8xtcoj3" path="res://scenes/entities/plants/garlic.tscn" id="2_81n0p"]
[resource]
script = ExtResource("1_e15gf")
name_key = "garlic"
description_key = "garlic_desc"
NameKey = "garlic"
DescriptionKey = "garlic_desc"
Cost = 50.0
Scene = ExtResource("2_81n0p")
ReloadTime = 7.5

View file

@ -2,7 +2,7 @@
[ext_resource type="Texture2D" uid="uid://b06e8xhdy77d1" path="res://assets/sprites/atlases/plants/nerdus.png" id="1_of51r"]
[ext_resource type="PackedScene" uid="uid://k5aj2slxar7w" path="res://scenes/entities/plants/nerdus.tscn" id="2_0i6qf"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="3_30qd0"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="3_30qd0"]
[sub_resource type="AtlasTexture" id="AtlasTexture_ivp5w"]
atlas = ExtResource("1_of51r")
@ -10,8 +10,8 @@ region = Rect2(477, 9, 60, 59)
[resource]
script = ExtResource("3_30qd0")
name_key = "nerdus"
description_key = "nerdus_desc"
NameKey = "nerdus"
DescriptionKey = "nerdus_desc"
Cost = 125.0
Scene = ExtResource("2_0i6qf")
ReloadTime = 10.0

View file

@ -1,13 +1,13 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://c8rr1dc7mjr3d"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_amvh8"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_amvh8"]
[ext_resource type="Texture2D" uid="uid://ot1n4nval86w" path="res://assets/sprites/plants/peashooter.tres" id="1_rnq6r"]
[ext_resource type="PackedScene" uid="uid://dy41q1kxray5t" path="res://scenes/entities/plants/peashooter.tscn" id="1_rqf2x"]
[resource]
script = ExtResource("1_amvh8")
name_key = "peashooter"
description_key = "peashooter_desc"
NameKey = "peashooter"
DescriptionKey = "peashooter_desc"
Cost = 75.0
Scene = ExtResource("1_rqf2x")
ReloadTime = 5.0

View file

@ -1,13 +1,13 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://bu25xgjd68gv8"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_33j6b"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_33j6b"]
[ext_resource type="Texture2D" uid="uid://bhmnt3x5aj1l8" path="res://assets/sprites/plants/potatomine.tres" id="1_xk2pg"]
[ext_resource type="PackedScene" uid="uid://b5x35v3w2u8dx" path="res://scenes/entities/plants/potato_mine.tscn" id="2_ig2ti"]
[resource]
script = ExtResource("1_33j6b")
name_key = "potatomine"
description_key = "potatomine_desc"
NameKey = "potatomine"
DescriptionKey = "potatomine_desc"
Cost = 25.0
Scene = ExtResource("2_ig2ti")
ReloadTime = 25.0

View file

@ -1,13 +1,13 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://duflq3eexs6m"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_0cpi0"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_0cpi0"]
[ext_resource type="Texture2D" uid="uid://cu7h8bot6jlug" path="res://assets/sprites/plants/snowpea.tres" id="1_7fyy2"]
[ext_resource type="PackedScene" uid="uid://b7innrovtmf5u" path="res://scenes/entities/plants/snowpea.tscn" id="2_k47h0"]
[resource]
script = ExtResource("1_0cpi0")
name_key = "snowpea"
description_key = "snowpea_desc"
NameKey = "snowpea"
DescriptionKey = "snowpea_desc"
Cost = 175.0
Scene = ExtResource("2_k47h0")
ReloadTime = 5.0

View file

@ -1,13 +1,13 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://cas11tg6chiu4"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_0bymo"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_0bymo"]
[ext_resource type="Texture2D" uid="uid://baqfahxkcvfe1" path="res://assets/sprites/plants/Spikeweed.tres" id="1_2ol2i"]
[ext_resource type="PackedScene" uid="uid://bdhod5c6o53ha" path="res://scenes/entities/plants/spikeweed.tscn" id="2_iv8de"]
[resource]
script = ExtResource("1_0bymo")
name_key = "spikeweed"
description_key = "spikeweed_desc"
NameKey = "spikeweed"
DescriptionKey = "spikeweed_desc"
Cost = 100.0
Scene = ExtResource("2_iv8de")
ReloadTime = 5.0

View file

@ -2,12 +2,12 @@
[ext_resource type="Texture2D" uid="uid://iw75j816gbc" path="res://assets/sprites/plants/sunflower.tres" id="1_8rd5i"]
[ext_resource type="PackedScene" uid="uid://bg7lomiorxo2c" path="res://scenes/entities/plants/sunflower.tscn" id="2_gcyr5"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="3_vt4jc"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="3_vt4jc"]
[resource]
script = ExtResource("3_vt4jc")
name_key = "sunflower"
description_key = "sunflower_desc"
NameKey = "sunflower"
DescriptionKey = "sunflower_desc"
Cost = 50.0
Scene = ExtResource("2_gcyr5")
ReloadTime = 5.0

View file

@ -2,12 +2,12 @@
[ext_resource type="Texture2D" uid="uid://8se1nscal0em" path="res://assets/sprites/plants/threepeater.tres" id="1_hinp6"]
[ext_resource type="PackedScene" uid="uid://eegv1qihfv2q" path="res://scenes/entities/plants/threepeater.tscn" id="2_uqpu0"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="3_3lugi"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="3_3lugi"]
[resource]
script = ExtResource("3_3lugi")
name_key = "threepeater"
description_key = "threepeater_desc"
NameKey = "threepeater"
DescriptionKey = "threepeater_desc"
Cost = 275.0
Scene = ExtResource("2_uqpu0")
ReloadTime = 5.0

View file

@ -1,13 +1,13 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://c2e2yj7rgoswi"]
[ext_resource type="Texture2D" uid="uid://g2oppl54efja" path="res://assets/sprites/plants/Wallnut.tres" id="1_2akap"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_27l0t"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_27l0t"]
[ext_resource type="PackedScene" uid="uid://bq7imkpr2yqyr" path="res://scenes/entities/plants/wallnut.tscn" id="2_rkn3h"]
[resource]
script = ExtResource("1_27l0t")
name_key = "wallnut"
description_key = "wallnut_desc"
NameKey = "wallnut"
DescriptionKey = "wallnut_desc"
Cost = 50.0
Scene = ExtResource("2_rkn3h")
ReloadTime = 20.0

View file

@ -1,7 +1,7 @@
[gd_resource type="Resource" script_class="ZombieResource" load_steps=5 format=3 uid="uid://buvacn56kyy2p"]
[ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_c2mq3"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_k277m"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/entities/ZombieResource.cs" id="1_k277m"]
[ext_resource type="Texture2D" uid="uid://5gpf2sodhn6e" path="res://assets/sprites/zombies/previews.png" id="1_l6de4"]
[sub_resource type="AtlasTexture" id="AtlasTexture_wu2q8"]
@ -10,8 +10,8 @@ region = Rect2(0, 0, 43, 88)
[resource]
script = ExtResource("1_k277m")
name_key = "basic"
description_key = "basic_desc"
NameKey = "basic"
DescriptionKey = "basic_desc"
Cost = 1.0
Scene = ExtResource("1_c2mq3")
ReloadTime = 1.0

View file

@ -1,7 +1,7 @@
[gd_resource type="Resource" script_class="ZombieResource" load_steps=5 format=3 uid="uid://dkhjlu7u0vny6"]
[ext_resource type="PackedScene" uid="uid://xu4i6tmkv00a" path="res://scenes/entities/Zombies/bucket_zombie.tscn" id="1_lhcag"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_sngfh"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/entities/ZombieResource.cs" id="1_sngfh"]
[ext_resource type="Texture2D" uid="uid://5gpf2sodhn6e" path="res://assets/sprites/zombies/previews.png" id="1_ufs7s"]
[sub_resource type="AtlasTexture" id="AtlasTexture_drksh"]
@ -10,8 +10,8 @@ region = Rect2(137, 0, 47, 101)
[resource]
script = ExtResource("1_sngfh")
name_key = "buckethead"
description_key = "buckethead_desc"
NameKey = "buckethead"
DescriptionKey = "buckethead_desc"
Cost = 5.0
Scene = ExtResource("1_lhcag")
ReloadTime = 1.0

View file

@ -2,7 +2,7 @@
[ext_resource type="Texture2D" uid="uid://5gpf2sodhn6e" path="res://assets/sprites/zombies/previews.png" id="1_f7g7v"]
[ext_resource type="PackedScene" uid="uid://hhjbqkjqpt7x" path="res://scenes/entities/Zombies/cone_zombie.tscn" id="1_llf5l"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_sw7hj"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/entities/ZombieResource.cs" id="1_sw7hj"]
[sub_resource type="AtlasTexture" id="AtlasTexture_q44xp"]
atlas = ExtResource("1_f7g7v")
@ -10,8 +10,8 @@ region = Rect2(92, 0, 45, 106)
[resource]
script = ExtResource("1_sw7hj")
name_key = "conehead"
description_key = "conehead_desc"
NameKey = "conehead"
DescriptionKey = "conehead_desc"
Cost = 2.0
Scene = ExtResource("1_llf5l")
ReloadTime = 1.0

View file

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://bgqmwsb6ynm81" path="res://scenes/entities/Zombies/hobo.tscn" id="1_4myt6"]
[ext_resource type="Texture2D" uid="uid://5gpf2sodhn6e" path="res://assets/sprites/zombies/previews.png" id="1_nt7w3"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_u5qpq"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/entities/ZombieResource.cs" id="1_u5qpq"]
[sub_resource type="AtlasTexture" id="AtlasTexture_73ahc"]
atlas = ExtResource("1_nt7w3")
@ -10,8 +10,8 @@ region = Rect2(43, 0, 49, 95)
[resource]
script = ExtResource("1_u5qpq")
name_key = "hobo"
description_key = "hobo_desc"
NameKey = "hobo"
DescriptionKey = "hobo_desc"
Cost = 7.0
Scene = ExtResource("1_4myt6")
ReloadTime = 1.0

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=15 format=3 uid="uid://bpekho7leatr5"]
[ext_resource type="Shader" uid="uid://bk8uy5se3fo0" path="res://assets/shaders/shared_outline.gdshader" id="1_jcu1f"]
[ext_resource type="Script" uid="uid://qgeovvluk8yj" path="res://scripts/Sun.cs" id="2_m8xcj"]
[ext_resource type="Script" uid="uid://qgeovvluk8yj" path="res://scripts/projectiles/Sun.cs" id="2_m8xcj"]
[ext_resource type="Texture2D" uid="uid://bkmphus5wjadi" path="res://assets/sprites/atlases/sun_atlas.png" id="2_phn3y"]
[ext_resource type="Script" uid="uid://c36bj8u7jghc7" path="res://scripts/audio/ChannelPlayer.cs" id="4_t1pnj"]
[ext_resource type="AudioStream" uid="uid://c0cq80nvld37p" path="res://assets/audio/sfx/sun.mp3" id="5_i8fpp"]

View file

@ -1,5 +1,4 @@
using Godot;
using System;
namespace Newlon;

View file

@ -1,9 +1,11 @@
using Godot;
using Godot.Collections;
using Newlon;
using Newlon.Resources;
using System.Text.Json;
using System.Collections.Generic;
namespace Newlon;
public partial class SaveSerializer : Node
{
const string SAVE_PATH = "user://save.json";

View file

@ -1,5 +1,7 @@
using Godot;
namespace Newlon.Components.Droppables;
public partial class DropMover : Node
{
public float ySpeed = -200.0f;

View file

@ -1,5 +1,6 @@
using Godot;
namespace Newlon.Components.Droppables;
[GlobalClass]
public partial class DroppableItem : Area2D

View file

@ -1,5 +1,7 @@
using Godot;
using Newlon;
using Newlon.Resources;
namespace Newlon.Components.Droppables;
public partial class DroppableSeedpacket : DroppableItem
{
@ -11,10 +13,10 @@ public partial class DroppableSeedpacket : DroppableItem
{
_cost.Text = plant.Cost.ToString();
_icon.Texture = plant.Preview;
if (plant.customFrame != null)
if (plant.CustomFrame != null)
{
_packet.Texture = plant.customFrame.frame;
_cost.LabelSettings = plant.customFrame.font;
_packet.Texture = plant.CustomFrame.frame;
_cost.LabelSettings = plant.CustomFrame.font;
}
}
}

View file

@ -1,5 +1,7 @@
using Godot;
using Newlon.Projectiles;
using Newlon.Components.Level;
using Newlon.Components.Droppables;
namespace Newlon.Components.Plants;

View file

@ -1,5 +1,6 @@
using Godot;
using Newlon.Components.Level;
using Newlon.Resources;
namespace Newlon.Components.Plants;

View file

@ -1,6 +1,6 @@
using Godot;
using Newlon.Components.Level;
using System;
using Newlon;
public partial class PlantHotbarSize : PanelContainer
{

View file

@ -1,7 +1,7 @@
using Godot;
using Newlon;
using Newlon.Components;
using Newlon.Components.Plants;
using Newlon.Resources;
public partial class RewardScene : Node
{
@ -18,9 +18,9 @@ public partial class RewardScene : Node
descriptionLabel.Text = Tr(reward.Description);
continueButton.Pressed += LevelController.Instance.ReturnToInitiator;
if (reward is PlantReward plantReward && plantReward.Plant.customFrame != null)
if (reward is PlantReward plantReward && plantReward.Plant.CustomFrame != null)
{
field.Texture = plantReward.Plant.customFrame.almanachField;
field.Texture = plantReward.Plant.CustomFrame.almanachField;
}
var rewardedObject = reward.GetPreview().Instantiate();

View file

@ -1,6 +1,7 @@
using Godot;
using Newlon.Components.Zombies;
using System.Collections.Generic;
using Newlon.Resources;
namespace Newlon.Components.Level;

View file

@ -1,4 +1,5 @@
using Godot;
using Newlon;
using Newlon.Components.GUI.Seedpackets;
public partial class AlmanachGrid : GridContainer
@ -20,7 +21,7 @@ public partial class AlmanachGrid : GridContainer
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
AddChild(slot);
slot.SetResource(resource);
slot.SetResource(resource.ToGridEntity());
slot.SetHandler(new AlmanachHandler(slot));
}
}

View file

@ -33,15 +33,15 @@ public partial class Previewport : SubViewport
{
current_display.QueueFree();
}
if (resource.customFrame != null && resource.customFrame.almanachField != null)
if (resource.CustomFrame != null && resource.CustomFrame.almanachField != null)
{
_frameField.Texture = resource.customFrame.almanachField;
_frameField.Texture = resource.CustomFrame.almanachField;
}
else
_frameField.Texture = start_Field;
current_display = resource.Scene.Instantiate();
title.Text = Tr(resource.name_key);
description.Text = Tr("rwd_"+resource.name_key)+"\n"+ Tr(resource.description_key);
title.Text = Tr(resource.NameKey);
description.Text = Tr("rwd_"+resource.NameKey)+"\n"+ Tr(resource.DescriptionKey);
AddChild(current_display);
if (current_display is Entity entity)
entity.DisableBrain();

View file

@ -1,4 +1,5 @@
using Godot;
using Newlon.Resources;
namespace Newlon.Components.GUI.Seedpackets;
@ -8,7 +9,7 @@ public partial class Seedpacket : TextureButton
public static AudioStream UntapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap2.mp3");
public static AudioStream LiftStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/seedlift.mp3");
private const string PATH_TO_PACKED_SCENE = "res://scenes/gui/seedpacket.tscn";
private EntityResource _resource;
private GridEntityResource _resource;
private Label _cost;
private TextureRect _icon;
private Timer _timer;
@ -46,14 +47,14 @@ public partial class Seedpacket : TextureButton
}
if (_handler is ISeedpacketProcess processHandler) processHandler.Process();
}
public void SetResource(EntityResource resource)
public void SetResource(GridEntityResource resource)
{
_resource = resource;
UpdateContents();
}
public EntityResource GetResource()
public GridEntityResource GetResource()
{
return _resource;
}
@ -69,10 +70,10 @@ public partial class Seedpacket : TextureButton
_cost.Text = _resource.Cost.ToString();
_icon.Texture = _resource.Preview;
_timer.WaitTime = _resource.ReloadTime;
if (_resource.customFrame != null)
if (_resource.CustomFrame != null)
{
TextureNormal = _resource.customFrame.frame;
_cost.LabelSettings = _resource.customFrame.font;
TextureNormal = _resource.CustomFrame.frame;
_cost.LabelSettings = _resource.CustomFrame.font;
}
}

View file

@ -1,5 +1,6 @@
using Godot;
using Newlon;
using Newlon.Resources;
using Newlon.Components;
using Newlon.Components.Level;
using Newlon.Components.Plants;

View file

@ -1,5 +1,6 @@
using Godot;
using Newlon.Components.Level;
using Newlon.Resources;
namespace Newlon;

View file

@ -1,6 +1,8 @@
using Godot;
using Newlon.Components.Zombies;
using System.Collections.Generic;
using Newlon.Resources;
using Newlon.Components.Droppables;
namespace Newlon.Components.Level;

View file

@ -1,13 +1,14 @@
using Godot;
using Newlon.Components.GUI.Seedpackets;
using Newlon.Components.Plants;
using Newlon.Resources;
namespace Newlon.Components.Level;
public partial class PlantField : Node2D
{
private Node2D _plantSetter;
private EntityResource _resource;
private GridEntityResource _resource;
private Seedpacket _slot;
private bool _previousCanPlace;
private ChannelPlayer player;
@ -21,7 +22,7 @@ public partial class PlantField : Node2D
player = GetNode<ChannelPlayer>("PlantPlayer");
}
public void SetPlant(Seedpacket slot, EntityResource resource)
public void SetPlant(Seedpacket slot, GridEntityResource resource)
{
_resource = resource;
_slot = slot;

View file

@ -1,5 +1,6 @@
using Godot;
using System.Collections.Generic;
using Newlon.Particles;
namespace Newlon.Components.Level;

View file

@ -1,4 +1,5 @@
using Godot;
using Newlon.Projectiles;
namespace Newlon.Components.Level;

View file

@ -2,6 +2,7 @@ using Godot;
using System.Collections.Generic;
using Newlon.Components.Zombies;
using Godot.Collections;
using Newlon.Resources;
namespace Newlon.Components.Level;

View file

@ -1,6 +1,8 @@
using System.Collections.Generic;
using Godot;
using Godot.Collections;
using Newlon;
using Newlon.Resources;
public partial class SurvivalZombieSpawner : Node
{

View file

@ -2,6 +2,8 @@ using System;
using Godot;
using Godot.Collections;
namespace Newlon.Particles;
public partial class FallFloor : Node2D
{
private static FallFloor Instance;

View file

@ -2,7 +2,7 @@ using Godot;
using Newlon.Components.Level;
using Newlon.Components.Zombies;
namespace Newlon.Components;
namespace Newlon.Particles;
[GlobalClass]
public partial class FallParticle : RigidBody2D

View file

@ -1,5 +1,7 @@
using Godot;
namespace Newlon.Particles;
public partial class StandardParticles : Node2D
{
private int counter = 0;

View file

@ -1,4 +1,4 @@
namespace Newlon.Components;
namespace Newlon.Projectiles;
//
// Base interface for entities

View file

@ -1,8 +1,9 @@
using Godot;
using Newlon.Components.Level;
using Newlon.Systems.Effects;
using Newlon.Components;
namespace Newlon.Components;
namespace Newlon.Projectiles;
//
// Projectile that travels from left to right

View file

@ -3,7 +3,7 @@ using Newlon.Components.GUI;
using Newlon.Components.Level;
namespace Newlon;
namespace Newlon.Projectiles;
public partial class Sun : Area2D
{

View file

@ -1,22 +0,0 @@
using Godot;
[Tool]
public partial class EntityResource : Resource
{
[Export] public string name_key;
[Export] public string description_key;
[Export]
public float Cost;
[Export]
public PackedScene Scene;
[Export]
public float ReloadTime;
[Export(PropertyHint.Range, "0,1,0.01")]
public float ReloadProgress;
[Export]
public Texture2D Preview;
[Export] public CustomSeedpacketFrame customFrame;
[Export] public int Layer = 1;
[Export] public int Order = 0;
public string internal_id;
}

View file

@ -1,5 +1,7 @@
using Godot;
namespace Newlon.Resources;
[GlobalClass]
[Tool]
public partial class MoneyReward : RewardResource

View file

@ -1,9 +0,0 @@
using Godot;
namespace Newlon;
[GlobalClass]
[Tool]
public partial class PlantResource : EntityResource
{
}

View file

@ -1,5 +1,6 @@
using Godot;
using Newlon;
namespace Newlon.Resources;
[GlobalClass]
[Tool]

View file

@ -1,5 +1,7 @@
using Godot;
namespace Newlon.Resources;
[GlobalClass]
[Tool]
public abstract partial class RewardResource : Resource

View file

@ -1,7 +0,0 @@
using Godot;
[GlobalClass]
[Tool]
public partial class ZombieResource : EntityResource
{
}

View file

@ -0,0 +1,16 @@
using Godot;
[Tool]
public partial class EntityResource : Resource
{
[Export] public string NameKey;
[Export] public string DescriptionKey;
[Export] public float Cost;
[Export] public PackedScene Scene;
[Export] public float ReloadTime;
[Export(PropertyHint.Range, "0,1,0.01")] public float ReloadProgress;
[Export] public Texture2D Preview;
[Export] public CustomSeedpacketFrame CustomFrame;
[Export] public int Order = 0;
public string internal_id;
}

View file

@ -0,0 +1,11 @@
using Godot;
namespace Newlon.Resources;
[GlobalClass]
[Tool]
public partial class GridEntityResource : EntityResource
{
[Export] public int Layer = 1;
[Export] public bool DontRegister = false;
}

View file

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

View file

@ -0,0 +1,9 @@
using Godot;
namespace Newlon.Resources;
[GlobalClass]
[Tool]
public partial class PlantResource : GridEntityResource
{
}

View file

@ -0,0 +1,28 @@
using Godot;
namespace Newlon.Resources;
[GlobalClass]
[Tool]
public partial class ZombieResource : EntityResource
{
public GridEntityResource ToGridEntity()
{
GridEntityResource result = new();
result.NameKey = NameKey;
result.DescriptionKey = DescriptionKey;
result.Cost = Cost;
result.Scene = Scene;
result.ReloadTime = ReloadTime;
result.ReloadProgress = ReloadProgress;
result.Preview = Preview;
result.CustomFrame = CustomFrame;
result.Order = Order;
result.Layer = 1;
result.DontRegister = true;
return result;
}
}

View file

@ -1,7 +1,9 @@
using Godot;
using Newlon;
using Newlon.Resources;
using System.Collections.Generic;
namespace Newlon;
public partial class GameRegistry : Node
{
private const string PLANT_RESOURCE_PATH = "res://assets/plants/";

View file

@ -1,4 +1,7 @@
using Godot;
namespace Newlon;
public class FieldParams
{
public const int TileWidth = 50;

View file

@ -1,6 +1,8 @@
using System.Collections.Generic;
using Godot;
using Newlon;
using Newlon.Resources;
namespace Newlon;
public partial class PlayerProgress : Node
{

View file

@ -1,5 +1,6 @@
using Godot;
using System;
namespace Newlon;
public partial class Settings : Node
{