From b932e8255574a014ee928dafab519ebf48be99cd Mon Sep 17 00:00:00 2001 From: Rendo Date: Thu, 3 Jul 2025 19:34:09 +0500 Subject: [PATCH] Almanach --- assets/sprites/atlases/almanach.png | Bin 2046 -> 1574 bytes assets/sprites/gui/almanach/book.tres | 6 +- assets/sprites/gui/almanach/decrement.tres | 7 + assets/sprites/gui/almanach/decrement_h.tres | 7 + .../gui/almanach/description_panel.tres | 2 +- assets/sprites/gui/almanach/holder.tres | 7 + assets/sprites/gui/almanach/increment.tres | 7 + assets/sprites/gui/almanach/increment_h.tres | 7 + assets/sprites/gui/almanach/menu.tres | 7 + assets/sprites/gui/almanach/slider_bg.tres | 2 +- assets/sprites/gui/almanach/slider_h.tres | 7 + assets/sprites/gui/almanach/tab.tres | 7 + assets/sprites/gui/almanach/tab_disabled.tres | 7 + resources/plants/Aloe.tres | 4 +- resources/themes/GameStyle.tres | 167 ++++++++++++++++- resources/zombies/basic.tres | 13 +- resources/zombies/buckethead.tres | 13 +- resources/zombies/conehead.tres | 13 +- resources/zombies/hobo.tres | 13 +- scenes/gui/almanach.tscn | 171 ++++++++++++++++++ scripts/components/IEntity.cs | 4 +- .../components/gui/almanach/AlmanachGrid.cs | 36 ++++ .../gui/almanach/AlmanachGrid.cs.uid | 1 + .../gui/choose_your_seeds/GridLoader.cs | 2 +- .../gui/choose_your_seeds/Previewport.cs | 13 +- .../gui/seedpackets/AlmanachHandler.cs | 10 + .../gui/seedpackets/AlmanachHandler.cs.uid | 1 + .../gui/seedpackets/ChoosableHandler.cs | 2 +- .../gui/seedpackets/HotbarHandler.cs | 4 +- .../components/gui/seedpackets/Seedpacket.cs | 6 +- scripts/components/level/PlantField.cs | 12 +- scripts/components/level/RuntimeLevelData.cs | 8 +- .../zombe_spawners/SurvivalZombieSpawner.cs | 26 +-- .../level/zombe_spawners/ZombieSequencer.cs | 2 +- .../components/zombies/RuntimeZombieData.cs | 14 +- scripts/resources/DisplayResource.cs | 20 ++ scripts/resources/DisplayResource.cs.uid | 1 + scripts/resources/PlantResource.cs | 18 +- scripts/resources/ZombieResource.cs | 6 +- 39 files changed, 575 insertions(+), 78 deletions(-) create mode 100644 assets/sprites/gui/almanach/decrement.tres create mode 100644 assets/sprites/gui/almanach/decrement_h.tres create mode 100644 assets/sprites/gui/almanach/holder.tres create mode 100644 assets/sprites/gui/almanach/increment.tres create mode 100644 assets/sprites/gui/almanach/increment_h.tres create mode 100644 assets/sprites/gui/almanach/menu.tres create mode 100644 assets/sprites/gui/almanach/slider_h.tres create mode 100644 assets/sprites/gui/almanach/tab.tres create mode 100644 assets/sprites/gui/almanach/tab_disabled.tres create mode 100644 scenes/gui/almanach.tscn create mode 100644 scripts/components/gui/almanach/AlmanachGrid.cs create mode 100644 scripts/components/gui/almanach/AlmanachGrid.cs.uid create mode 100644 scripts/components/gui/seedpackets/AlmanachHandler.cs create mode 100644 scripts/components/gui/seedpackets/AlmanachHandler.cs.uid create mode 100644 scripts/resources/DisplayResource.cs create mode 100644 scripts/resources/DisplayResource.cs.uid diff --git a/assets/sprites/atlases/almanach.png b/assets/sprites/atlases/almanach.png index 56f635a90485fbcb5dc747854b992a7d3a83ab93..49c0ee13309d88a6d1770ad0e1d6314f176b66b7 100644 GIT binary patch literal 1574 zcmV+>2HE+EP)Px#Z%|BBMF0Q*|FyO2R!h2JR^w?_|B+_$re6QGaR20Z|NraH|8S4qT|A?3X8+?o zZg5Se|1v&LOIxcaCpJSvPhenhetwU_!qG=NcrqzRJ|jm$Bt=>#US2U0000bbW%=J0RR90|NsC0|NsC0|NsC0|NsC0|NsC0 z|NsC0|NsC0|NsC0|EQf2djJ3hG)Y83RCt{2+ih=~Fc1J>KA1WaB$1F7$x`wmlK=m2 zocxO4Ft#~^S-ELloTcs4>-jiB(tRPLdmGX5n9@Q#7zLv<;@iW;_btA@SaI(}(qiJ+ z@Rv2g-~I*_oU3xHxu29^T-5g%W9(#P-=Y4<|c;8Wnh!LvOzglY0=LQbv~M2!R@w&!+n)-h0Mi!N>rF8<+v5K8BMj^kp<#V6p>UOzc-hU`+Kb}#P5J=s<}8TaZ87x%2( z`dbY{a%uGu2a-#XY78gg25NUL4&+jwn-CW_f!i5gb>g1>(xGFx)a2&9Fe{0BgX4DW z0xlmIdYbTA`2o!B*cE5zIxb{Da~YV{!h&<{4Fn>z0+#EvEqE^|*K4xiUTCgy6h!kF?T5xBrTS>f2>&2DzB~eyrA!!@JF1- z%;h=I)L*6mp8{-y4*XfEtvzLTVMGCOcTq0%zGJDyn22?TFT7Y68RBSo^ zmvM)2@yzIWF3}Bwi1ZF)Vs?|XQSLK=>pX^Ss=1dj?vT3G4(BrCkh;~<8W}kEV{@f9 zeXETOB|eVw4!-pJ0t|PqT}p+@H_;eVXp~=ab!%|4iZ@ena01KZegmvhRLGV_4p5(Yg$VQ_9=3+o^ZE zs@*j#Z?$~x7~>Yy?)-EEnYD|>0Gr)1t~HTGpX;-=1zvD&VA)u9%>j}x`MbbEV27Ik zuCUdt0kR|d9c#WfzZk%|&Hzb}Ui#krVu;pmLAV2?J5ScE-GYz}OxG7-hVsHjX zqca4ioa1ZP9Uxh!;LFfe&+O#F_g!~@BytfNA@jM>>=tpI0n%MIRt#PFM7DLS?K?nj zE{2^4$oy&m;Fb=M$IQDM2FR`4g4i%X9?{6;0C~Ha1LW=2_5gVkKs7+hWvkqq^r?xA zuUEN8oVbet(&wfOkom<6!JTVY4Un=HYG?NvAZv09V#5HL!iArAf6V}S6gM@1i=lMh zE#n^c{BFhUj;G>AYq!B-h-J6=t+xHTT281-fV0#w2bSUolUEM+&90j{>ER~vW6YO> z71Rp*d)Kbr=r1}P?Qm1H4RKSv4Hd)Y?C!hO{zGoG7z*OZ?6${^X7^;p&>nYl-~Bz@ Yf5~n~Vhn?Pw*UYD07*qoM6N<$g6GgMl>h($ literal 2046 zcmVf=C900001b5ch_0Itp) z=>Px+xJg7oRCt{2onMF*RUF5ElNy`3XbQ#34J)O)_98-{SZ1q7{BzH5+g6PS;fr7ZWP^>7MDE?u3(7Ai=+?jJ{erL{| zbIyD}FL&?!J?#11-#Og`#-E7kw)n?JwvqL!D-8;t$`*J>BM zg+xUA-h3kOvRK36Pg8 zJlC>VLG^mmqT%z48W)_u)$sM}_nvHd*sjMHw%n%O%-p?CL_`fGo13_nS9y%5vv+0F zvf=ZK=(&NHrTe}6)gOr@5$WsdNL{`xIXiQw{&$nQolDyvN#<@g|1xc%zkf@^_wn&F z>|+JL+8?g`r(7;BJ6A1f_-;gO%R|bfq?I=ihAYbJrKef@Wx-F=|1>R&6~xYo**&~ep{w+$;#1tOOy8uOCdg?~rMPLI#fD|M8AhvQ~<2@Sw@bi}2*bD?w#C8E% z0YMl%%!p=_YBwDS!X#YbZ>`vAh1cE3MB}RCi&7xowqkv2f&UPjOL71ei zbXz5XAV3NPVZeTB|#^ZNg&7c)QyJ68m3QPqv?~69${Uxm}t#nDs?ZbM-$tC zAT8iN^;eg~av%r;F?z@lBZ;k11cCr55JWS!H#HChNWm~S14`Rh(%jAK)VXwd(`PWM ziJzLvEX2uU2oXdbG4H`yZ#sw|4902?XsG+)C)KVBYi>1t4wM(L$h!#IK?G4`WvF|0zniB zqDU5)_~t2$Vt^F$l(m2l&Qv|3ia+$m3K}^v+cJs-cfiLzJQciY%0wVYMsS*%TJ3^I zHoO+K&bkhwzwGaMw*xVX5K%pnkkDxj?n50pG5cuyW@@zyMn95?2%lC>O!VQzLL$#aAgYTobje^-g0%+e(XMGCU6BdcRaBe@}I?&fv9 z=Qfzh-NU^7Ca-CegK~)=5&=8Oz6syLvjTFNoa8-VrBe=S5Tsh%UvF9_E}iyNuISF( zy-yRDPJ2DHw%!Nn>EZr3^vOYiAcv3N)^Tj72_)g}8(!A)?E!XKbjd+P1=m}wXY6T$`g0}Sl}p+n9=0H+RY)EY&7|l-n##ixq_Sz& zxF*IlVO@bGh>4X^*)-esa`jDB+j_oM=qQgfeGs4rb`t}LX1*^a*s6W#D33Eu4A6r! zO$?;fgBC%=%Br4QQU4ybJg#EH`?T5)=s`ITB7Vk+5qu9u8fhyve2!Mqw2Q8{r*l1j z7#-#Dj$9t}#mXaL$Qbt-N7|ug+&PI+`ElnCcc`Pz@zU;n^$uR}PY#k!!O$_>0Te4E zZk?F83LhtGnJ92rDbuA|EUvC(dk<}Nk)mZ!CT8u^HAuNWu7J=N1 z9@u#h(<;QYCeIbvnN-s%#57@DL8*x;dZiR$n5)#pm=;Aq_BhkTEoIMc)+4`R^$AmAYw=1M>xq!>8U z2gw5rb3x%js$Bu(K_r;?Yz)XAbW#<-Fjs+%)Ek~53Gb|npC^_5QbUUPr;E!eR5<~00>;TH zl0*a!TtQy^R#0jF@NewD0szPPU#C73iaZQD+3BlE6Jvh@z1$uBM z4`Nz*T)~+Lg6CokyI}|v17`%m{2;htNQ!Aqo+~&bNFEUcHw=No#Fr))# c1Oa;ZABTYTTId;=mjD0&07*qoM6N<$g8zTA?EnA( diff --git a/assets/sprites/gui/almanach/book.tres b/assets/sprites/gui/almanach/book.tres index 4a0648e..38c3363 100644 --- a/assets/sprites/gui/almanach/book.tres +++ b/assets/sprites/gui/almanach/book.tres @@ -1,3 +1,7 @@ -[gd_resource type="AtlasTexture" format=3 uid="uid://drydueofrb448"] +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://drydueofrb448"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_hdhpm"] [resource] +atlas = ExtResource("1_hdhpm") +region = Rect2(95, 62, 27, 15) diff --git a/assets/sprites/gui/almanach/decrement.tres b/assets/sprites/gui/almanach/decrement.tres new file mode 100644 index 0000000..c68089f --- /dev/null +++ b/assets/sprites/gui/almanach/decrement.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://lg1o4pu0n0u6"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_dv0v8"] + +[resource] +atlas = ExtResource("1_dv0v8") +region = Rect2(130, 92, 15, 15) diff --git a/assets/sprites/gui/almanach/decrement_h.tres b/assets/sprites/gui/almanach/decrement_h.tres new file mode 100644 index 0000000..f566231 --- /dev/null +++ b/assets/sprites/gui/almanach/decrement_h.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://cdyfech0howdr"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_ldu2x"] + +[resource] +atlas = ExtResource("1_ldu2x") +region = Rect2(130, 107, 15, 15) diff --git a/assets/sprites/gui/almanach/description_panel.tres b/assets/sprites/gui/almanach/description_panel.tres index 362e309..fa7498e 100644 --- a/assets/sprites/gui/almanach/description_panel.tres +++ b/assets/sprites/gui/almanach/description_panel.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_bs0nq") -region = Rect2(77, 1, 14, 11) +region = Rect2(77, 0, 14, 12) diff --git a/assets/sprites/gui/almanach/holder.tres b/assets/sprites/gui/almanach/holder.tres new file mode 100644 index 0000000..f768670 --- /dev/null +++ b/assets/sprites/gui/almanach/holder.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dpfkai158kyfu"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_h0vdo"] + +[resource] +atlas = ExtResource("1_h0vdo") +region = Rect2(145, 78, 6, 14) diff --git a/assets/sprites/gui/almanach/increment.tres b/assets/sprites/gui/almanach/increment.tres new file mode 100644 index 0000000..f47bfb9 --- /dev/null +++ b/assets/sprites/gui/almanach/increment.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://vpuytn3nd6c1"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_6uq3c"] + +[resource] +atlas = ExtResource("1_6uq3c") +region = Rect2(145, 92, 15, 15) diff --git a/assets/sprites/gui/almanach/increment_h.tres b/assets/sprites/gui/almanach/increment_h.tres new file mode 100644 index 0000000..a62ae9d --- /dev/null +++ b/assets/sprites/gui/almanach/increment_h.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://cnio0bw2xla23"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_ya6ma"] + +[resource] +atlas = ExtResource("1_ya6ma") +region = Rect2(145, 107, 15, 15) diff --git a/assets/sprites/gui/almanach/menu.tres b/assets/sprites/gui/almanach/menu.tres new file mode 100644 index 0000000..978a980 --- /dev/null +++ b/assets/sprites/gui/almanach/menu.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://4cdp0k17u2l5"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_vdcpr"] + +[resource] +atlas = ExtResource("1_vdcpr") +region = Rect2(152, 77, 4, 14) diff --git a/assets/sprites/gui/almanach/slider_bg.tres b/assets/sprites/gui/almanach/slider_bg.tres index 179a60e..2ce91a3 100644 --- a/assets/sprites/gui/almanach/slider_bg.tres +++ b/assets/sprites/gui/almanach/slider_bg.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_o3v7f") -region = Rect2(0, 0, 77, 77) +region = Rect2(77, 12, 15, 15) diff --git a/assets/sprites/gui/almanach/slider_h.tres b/assets/sprites/gui/almanach/slider_h.tres new file mode 100644 index 0000000..e4bcd8b --- /dev/null +++ b/assets/sprites/gui/almanach/slider_h.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://cc8jaddr5lww3"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_q7xbj"] + +[resource] +atlas = ExtResource("1_q7xbj") +region = Rect2(136, 0, 32, 15) diff --git a/assets/sprites/gui/almanach/tab.tres b/assets/sprites/gui/almanach/tab.tres new file mode 100644 index 0000000..fbf3142 --- /dev/null +++ b/assets/sprites/gui/almanach/tab.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://2bk8ce82cmw"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_a3eui"] + +[resource] +atlas = ExtResource("1_a3eui") +region = Rect2(122, 65, 22, 12) diff --git a/assets/sprites/gui/almanach/tab_disabled.tres b/assets/sprites/gui/almanach/tab_disabled.tres new file mode 100644 index 0000000..13cf564 --- /dev/null +++ b/assets/sprites/gui/almanach/tab_disabled.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dssr8m4gbpks4"] + +[ext_resource type="Texture2D" uid="uid://do8e21lxo0xiu" path="res://assets/sprites/atlases/almanach.png" id="1_4d61d"] + +[resource] +atlas = ExtResource("1_4d61d") +region = Rect2(144, 65, 22, 12) diff --git a/resources/plants/Aloe.tres b/resources/plants/Aloe.tres index 0240395..ae8d7ba 100644 --- a/resources/plants/Aloe.tres +++ b/resources/plants/Aloe.tres @@ -18,16 +18,16 @@ metadata/_custom_type_script = "uid://3m7xks3xq3hl" [resource] script = ExtResource("1_vw2kg") +Layer = 1 display_name = "Aloe" display_description = "[p]Aloe heals injured plants.[/p] [p]Health points: [color=DARK_RED]3 bites[/color][/p] [p]Reload time: [color=DARK_RED]15 seconds[/color].[/p] [p]Ability recharge time: [color=DARK_RED]20 seconds[/color].[/p] [p]Heals plant when it has [color=DARK_RED]third[/color] of its health.[/p]" -Cost = 75 +Cost = 75.0 Scene = ExtResource("2_6a4ia") ReloadTime = 15.0 ReloadProgress = 0.0 Preview = ExtResource("1_t4137") -Layer = 1 customFrame = SubResource("Resource_5me4i") diff --git a/resources/themes/GameStyle.tres b/resources/themes/GameStyle.tres index 0233b06..42764e6 100644 --- a/resources/themes/GameStyle.tres +++ b/resources/themes/GameStyle.tres @@ -1,11 +1,22 @@ -[gd_resource type="Theme" load_steps=13 format=3 uid="uid://b8l285cjcgeyi"] +[gd_resource type="Theme" load_steps=40 format=3 uid="uid://b8l285cjcgeyi"] [ext_resource type="FontFile" uid="uid://nbrt5q3t8tud" path="res://assets/fonts/pico12.ttf" id="1_103to"] [ext_resource type="Texture2D" uid="uid://d0yhee0scl7mc" path="res://assets/sprites/gui/ButtonBackground.tres" id="1_y0kbp"] [ext_resource type="Texture2D" uid="uid://dxmg20mrnpt8r" path="res://assets/sprites/gui/SelectionGeneric.tres" id="2_h0nd2"] [ext_resource type="Texture2D" uid="uid://b5skdm3q7tkh3" path="res://assets/sprites/gui/ChooseYourSeeds/Grabber.tres" id="3_i6w8j"] +[ext_resource type="Texture2D" uid="uid://cc8jaddr5lww3" path="res://assets/sprites/gui/almanach/slider_h.tres" id="3_nec55"] [ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="3_yeah5"] [ext_resource type="Texture2D" uid="uid://cv255d4s0qopj" path="res://assets/sprites/gui/ChooseYourSeeds/Slider.tres" id="4_yeah5"] +[ext_resource type="Texture2D" uid="uid://lg1o4pu0n0u6" path="res://assets/sprites/gui/almanach/decrement.tres" id="5_ij6vn"] +[ext_resource type="Texture2D" uid="uid://dssr8m4gbpks4" path="res://assets/sprites/gui/almanach/tab_disabled.tres" id="5_w6b64"] +[ext_resource type="Texture2D" uid="uid://cdyfech0howdr" path="res://assets/sprites/gui/almanach/decrement_h.tres" id="6_nec55"] +[ext_resource type="Texture2D" uid="uid://2bk8ce82cmw" path="res://assets/sprites/gui/almanach/tab.tres" id="6_ygj8j"] +[ext_resource type="Texture2D" uid="uid://blr2uchlakvor" path="res://assets/sprites/gui/almanach/description_panel.tres" id="7_5pe7g"] +[ext_resource type="Texture2D" uid="uid://dpfkai158kyfu" path="res://assets/sprites/gui/almanach/holder.tres" id="7_ls06u"] +[ext_resource type="Texture2D" uid="uid://vpuytn3nd6c1" path="res://assets/sprites/gui/almanach/increment.tres" id="8_csc22"] +[ext_resource type="Texture2D" uid="uid://cnio0bw2xla23" path="res://assets/sprites/gui/almanach/increment_h.tres" id="9_r6ela"] +[ext_resource type="Texture2D" uid="uid://4cdp0k17u2l5" path="res://assets/sprites/gui/almanach/menu.tres" id="10_vatwx"] +[ext_resource type="Texture2D" uid="uid://drvrnblf2fvgk" path="res://assets/sprites/gui/almanach/slider_bg.tres" id="14_3qjha"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_na4u2"] texture = ExtResource("1_y0kbp") @@ -24,6 +35,55 @@ axis_stretch_horizontal = 1 axis_stretch_vertical = 1 draw_center = false +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_csc22"] +texture = ExtResource("3_nec55") +texture_margin_left = 7.0 +texture_margin_top = 4.0 +texture_margin_right = 7.0 +texture_margin_bottom = 4.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_r6ela"] +texture = ExtResource("14_3qjha") +texture_margin_left = 6.0 +texture_margin_top = 6.0 +texture_margin_right = 6.0 +texture_margin_bottom = 6.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_vatwx"] +texture = ExtResource("14_3qjha") +texture_margin_left = 6.0 +texture_margin_top = 6.0 +texture_margin_right = 6.0 +texture_margin_bottom = 6.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ij6vn"] +texture = ExtResource("4_yeah5") +texture_margin_left = 5.0 +texture_margin_top = 5.0 +texture_margin_right = 5.0 +texture_margin_bottom = 5.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_nec55"] +texture = ExtResource("4_yeah5") +texture_margin_left = 5.0 +texture_margin_top = 5.0 +texture_margin_right = 5.0 +texture_margin_bottom = 5.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ls06u"] +texture = ExtResource("4_yeah5") +texture_margin_left = 5.0 +texture_margin_top = 5.0 +texture_margin_right = 5.0 +texture_margin_bottom = 5.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_jjopa"] +texture = ExtResource("7_5pe7g") +texture_margin_left = 4.0 +texture_margin_top = 5.0 +texture_margin_right = 7.0 +texture_margin_bottom = 4.0 + [sub_resource type="AtlasTexture" id="AtlasTexture_5pe7g"] atlas = ExtResource("3_yeah5") region = Rect2(226, 77, 18, 18) @@ -42,6 +102,62 @@ texture_margin_top = 6.0 texture_margin_right = 6.0 texture_margin_bottom = 6.0 +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_g0cdn"] +texture = SubResource("AtlasTexture_5pe7g") +texture_margin_left = 6.0 +texture_margin_top = 6.0 +texture_margin_right = 6.0 +texture_margin_bottom = 6.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_gl5ke"] +texture = ExtResource("5_w6b64") +texture_margin_left = 8.0 +texture_margin_top = 6.0 +texture_margin_right = 8.0 +texture_margin_bottom = 1.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_xmjd3"] +texture = ExtResource("6_ygj8j") +texture_margin_left = 8.0 +texture_margin_top = 6.0 +texture_margin_right = 8.0 +texture_margin_bottom = 1.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_3qjha"] +texture = SubResource("AtlasTexture_5pe7g") +texture_margin_left = 6.0 +texture_margin_top = 6.0 +texture_margin_right = 6.0 +texture_margin_bottom = 6.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_gvd6y"] +texture = ExtResource("3_i6w8j") +texture_margin_left = 4.0 +texture_margin_top = 7.0 +texture_margin_right = 4.0 +texture_margin_bottom = 7.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_epvq8"] +texture = ExtResource("3_i6w8j") +texture_margin_left = 4.0 +texture_margin_top = 7.0 +texture_margin_right = 4.0 +texture_margin_bottom = 7.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_lfl2m"] +texture = ExtResource("3_i6w8j") +texture_margin_left = 4.0 +texture_margin_top = 7.0 +texture_margin_right = 4.0 +texture_margin_bottom = 7.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_41q1p"] +texture = ExtResource("14_3qjha") +texture_margin_left = 6.0 +texture_margin_top = 6.0 +texture_margin_right = 6.0 +texture_margin_bottom = 6.0 + [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_5pe7g"] texture = ExtResource("4_yeah5") texture_margin_left = 5.0 @@ -49,6 +165,13 @@ texture_margin_top = 5.0 texture_margin_right = 5.0 texture_margin_bottom = 5.0 +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_chra8"] +texture = ExtResource("7_5pe7g") +texture_margin_left = 4.0 +texture_margin_top = 5.0 +texture_margin_right = 7.0 +texture_margin_bottom = 4.0 + [resource] default_font = ExtResource("1_103to") Button/colors/font_color = Color(0, 0, 0, 1) @@ -60,11 +183,53 @@ Button/styles/focus = SubResource("StyleBoxTexture_mv7jy") Button/styles/hover = SubResource("StyleBoxTexture_na4u2") Button/styles/normal = SubResource("StyleBoxTexture_na4u2") Button/styles/pressed = SubResource("StyleBoxTexture_na4u2") +HScrollBar/styles/grabber = SubResource("StyleBoxTexture_csc22") +HScrollBar/styles/grabber_highlight = SubResource("StyleBoxTexture_csc22") +HScrollBar/styles/grabber_pressed = SubResource("StyleBoxTexture_csc22") +HScrollBar/styles/scroll = SubResource("StyleBoxTexture_r6ela") +HScrollBar/styles/scroll_focus = SubResource("StyleBoxTexture_vatwx") +HSlider/icons/grabber = ExtResource("3_nec55") +HSlider/icons/grabber_disabled = ExtResource("3_nec55") +HSlider/icons/grabber_highlight = ExtResource("3_nec55") +HSlider/styles/grabber_area = SubResource("StyleBoxTexture_ij6vn") +HSlider/styles/grabber_area_highlight = SubResource("StyleBoxTexture_nec55") +HSlider/styles/slider = SubResource("StyleBoxTexture_ls06u") +LineEdit/colors/font_color = Color(0, 0, 0, 1) +LineEdit/colors/font_selected_color = Color(0, 0, 0, 1) +LineEdit/colors/font_uneditable_color = Color(0, 0, 0, 0.501961) +LineEdit/styles/focus = SubResource("StyleBoxTexture_jjopa") +LineEdit/styles/normal = SubResource("StyleBoxTexture_jjopa") +LineEdit/styles/read_only = SubResource("StyleBoxTexture_jjopa") Panel/styles/panel = SubResource("StyleBoxTexture_pjyej") PanelContainer/styles/panel = SubResource("StyleBoxTexture_w6b64") +TabContainer/icons/decrement = ExtResource("5_ij6vn") +TabContainer/icons/decrement_highlight = ExtResource("6_nec55") +TabContainer/icons/drop_mark = ExtResource("7_ls06u") +TabContainer/icons/increment = ExtResource("8_csc22") +TabContainer/icons/increment_highlight = ExtResource("9_r6ela") +TabContainer/icons/menu = ExtResource("10_vatwx") +TabContainer/icons/menu_highlight = ExtResource("10_vatwx") +TabContainer/styles/panel = SubResource("StyleBoxTexture_g0cdn") +TabContainer/styles/tab_disabled = SubResource("StyleBoxTexture_gl5ke") +TabContainer/styles/tab_focus = SubResource("StyleBoxTexture_xmjd3") +TabContainer/styles/tab_hovered = SubResource("StyleBoxTexture_xmjd3") +TabContainer/styles/tab_selected = SubResource("StyleBoxTexture_xmjd3") +TabContainer/styles/tab_unselected = SubResource("StyleBoxTexture_gl5ke") +TextEdit/colors/font_color = Color(0, 0, 0, 1) +TextEdit/styles/focus = SubResource("StyleBoxTexture_jjopa") +TextEdit/styles/normal = SubResource("StyleBoxTexture_jjopa") +TextEdit/styles/read_only = SubResource("StyleBoxTexture_jjopa") +Tree/styles/panel = SubResource("StyleBoxTexture_3qjha") +VScrollBar/styles/grabber = SubResource("StyleBoxTexture_gvd6y") +VScrollBar/styles/grabber_highlight = SubResource("StyleBoxTexture_epvq8") +VScrollBar/styles/grabber_pressed = SubResource("StyleBoxTexture_lfl2m") +VScrollBar/styles/scroll = SubResource("StyleBoxTexture_41q1p") +VScrollBar/styles/scroll_focus = SubResource("StyleBoxTexture_41q1p") VSlider/icons/grabber = ExtResource("3_i6w8j") VSlider/icons/grabber_disabled = ExtResource("3_i6w8j") VSlider/icons/grabber_highlight = ExtResource("3_i6w8j") VSlider/styles/grabber_area = SubResource("StyleBoxTexture_5pe7g") VSlider/styles/grabber_area_highlight = SubResource("StyleBoxTexture_5pe7g") VSlider/styles/slider = SubResource("StyleBoxTexture_5pe7g") +description_panel_container/base_type = &"PanelContainer" +description_panel_container/styles/panel = SubResource("StyleBoxTexture_chra8") diff --git a/resources/zombies/basic.tres b/resources/zombies/basic.tres index e26d47f..2df65fa 100644 --- a/resources/zombies/basic.tres +++ b/resources/zombies/basic.tres @@ -1,10 +1,17 @@ -[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://buvacn56kyy2p"] +[gd_resource type="Resource" script_class="ZombieResource" load_steps=4 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="Texture2D" uid="uid://bwdqbrnn7ygtr" path="res://assets/sprites/atlases/zombies/Зондби.png" id="1_l6de4"] [resource] script = ExtResource("1_k277m") -cost = 1 -scene = ExtResource("1_c2mq3") +display_name = "Basic zombie" +display_description = "" +Cost = 1.0 +Scene = ExtResource("1_c2mq3") +ReloadTime = 1.0 +ReloadProgress = 0.0 +Preview = ExtResource("1_l6de4") +Layer = 1 metadata/_custom_type_script = "uid://cqxj7o8hdm82n" diff --git a/resources/zombies/buckethead.tres b/resources/zombies/buckethead.tres index 2721cfd..06eb9bf 100644 --- a/resources/zombies/buckethead.tres +++ b/resources/zombies/buckethead.tres @@ -1,10 +1,17 @@ -[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://dkhjlu7u0vny6"] +[gd_resource type="Resource" script_class="ZombieResource" load_steps=4 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="Texture2D" uid="uid://bwdqbrnn7ygtr" path="res://assets/sprites/atlases/zombies/Зондби.png" id="1_ufs7s"] [resource] script = ExtResource("1_sngfh") -cost = 5.0 -scene = ExtResource("1_lhcag") +display_name = "Buckethead zombie" +display_description = "" +Cost = 5.0 +Scene = ExtResource("1_lhcag") +ReloadTime = 1.0 +ReloadProgress = 0.0 +Preview = ExtResource("1_ufs7s") +Layer = 1 metadata/_custom_type_script = "uid://cqxj7o8hdm82n" diff --git a/resources/zombies/conehead.tres b/resources/zombies/conehead.tres index 8e21ed2..2f28793 100644 --- a/resources/zombies/conehead.tres +++ b/resources/zombies/conehead.tres @@ -1,10 +1,17 @@ -[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://nceohd32fkxk"] +[gd_resource type="Resource" script_class="ZombieResource" load_steps=4 format=3 uid="uid://nceohd32fkxk"] +[ext_resource type="Texture2D" uid="uid://bwdqbrnn7ygtr" path="res://assets/sprites/atlases/zombies/Зондби.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"] [resource] script = ExtResource("1_sw7hj") -cost = 2.0 -scene = ExtResource("1_llf5l") +display_name = "Conehead zombie" +display_description = "" +Cost = 2.0 +Scene = ExtResource("1_llf5l") +ReloadTime = 1.0 +ReloadProgress = 0.0 +Preview = ExtResource("1_f7g7v") +Layer = 1 metadata/_custom_type_script = "uid://cqxj7o8hdm82n" diff --git a/resources/zombies/hobo.tres b/resources/zombies/hobo.tres index 0be10aa..7b8e10f 100644 --- a/resources/zombies/hobo.tres +++ b/resources/zombies/hobo.tres @@ -1,10 +1,17 @@ -[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://c38vfdw5b60xw"] +[gd_resource type="Resource" script_class="ZombieResource" load_steps=4 format=3 uid="uid://c38vfdw5b60xw"] [ext_resource type="PackedScene" uid="uid://bgqmwsb6ynm81" path="res://scenes/entities/Zombies/hobo.tscn" id="1_4myt6"] +[ext_resource type="Texture2D" uid="uid://bwdqbrnn7ygtr" path="res://assets/sprites/atlases/zombies/Зондби.png" id="1_nt7w3"] [ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_u5qpq"] [resource] script = ExtResource("1_u5qpq") -cost = 7.0 -scene = ExtResource("1_4myt6") +display_name = "Garbage can zombie" +display_description = "" +Cost = 7.0 +Scene = ExtResource("1_4myt6") +ReloadTime = 1.0 +ReloadProgress = 0.0 +Preview = ExtResource("1_nt7w3") +Layer = 1 metadata/_custom_type_script = "uid://cqxj7o8hdm82n" diff --git a/scenes/gui/almanach.tscn b/scenes/gui/almanach.tscn new file mode 100644 index 0000000..33c0f64 --- /dev/null +++ b/scenes/gui/almanach.tscn @@ -0,0 +1,171 @@ +[gd_scene load_steps=7 format=3 uid="uid://bvpt0q4j6nx18"] + +[ext_resource type="Texture2D" uid="uid://dr8a0rx42o3qy" path="res://assets/sprites/gui/ChooseYourSeeds/PlantFrame.tres" id="1_1hnxi"] +[ext_resource type="Script" uid="uid://0mvmfvwe1bc7" path="res://scripts/components/gui/almanach/AlmanachGrid.cs" id="1_ru62c"] +[ext_resource type="Script" uid="uid://covbig00p22di" path="res://scripts/components/gui/choose_your_seeds/Previewport.cs" id="2_ru62c"] +[ext_resource type="Texture2D" uid="uid://dycdvvgmgmfu6" path="res://assets/sprites/gui/ChooseYourSeeds/FrameField.tres" id="3_oy57w"] + +[sub_resource type="ViewportTexture" id="ViewportTexture_ru62c"] +viewport_path = NodePath("Plants/Infobox/FrameAndTitle/Frame/Previewport") + +[sub_resource type="ViewportTexture" id="ViewportTexture_7yl8g"] +viewport_path = NodePath("Zombies/Infobox/FrameAndTitle/Frame/Previewport") + +[node name="Almanach" type="TabContainer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +tab_alignment = 1 +current_tab = 0 + +[node name="Plants" type="HBoxContainer" parent="."] +layout_mode = 2 +metadata/_tab_index = 0 + +[node name="SeedpacketsContainer" type="ScrollContainer" parent="Plants"] +layout_mode = 2 +horizontal_scroll_mode = 0 + +[node name="GridContainer" type="GridContainer" parent="Plants/SeedpacketsContainer"] +layout_mode = 2 +columns = 8 +script = ExtResource("1_ru62c") + +[node name="Infobox" type="VBoxContainer" parent="Plants"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="FrameAndTitle" type="HBoxContainer" parent="Plants/Infobox"] +layout_mode = 2 + +[node name="Frame" type="TextureRect" parent="Plants/Infobox/FrameAndTitle"] +clip_contents = true +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 +texture = ExtResource("1_1hnxi") + +[node name="Previewport" type="SubViewport" parent="Plants/Infobox/FrameAndTitle/Frame" node_paths=PackedStringArray("title", "description")] +canvas_item_default_texture_filter = 0 +size = Vector2i(65, 65) +script = ExtResource("2_ru62c") +title = NodePath("../../Label") +description = NodePath("../../../Description/ScrollContainer/RichTextLabel") + +[node name="FrameField" type="Sprite2D" parent="Plants/Infobox/FrameAndTitle/Frame/Previewport"] +texture = ExtResource("3_oy57w") + +[node name="Camera2D" type="Camera2D" parent="Plants/Infobox/FrameAndTitle/Frame/Previewport"] + +[node name="Render" type="TextureRect" parent="Plants/Infobox/FrameAndTitle/Frame"] +show_behind_parent = true +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("ViewportTexture_ru62c") + +[node name="Label" type="Label" parent="Plants/Infobox/FrameAndTitle"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Description" type="PanelContainer" parent="Plants/Infobox"] +layout_mode = 2 +size_flags_vertical = 3 +theme_type_variation = &"description_panel_container" + +[node name="ScrollContainer" type="ScrollContainer" parent="Plants/Infobox/Description"] +layout_mode = 2 +horizontal_scroll_mode = 0 + +[node name="RichTextLabel" type="RichTextLabel" parent="Plants/Infobox/Description/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_colors/default_color = Color(0, 0, 0, 1) +theme_override_colors/font_selected_color = Color(0, 0, 0, 1) +bbcode_enabled = true + +[node name="Zombies" type="HBoxContainer" parent="."] +visible = false +layout_mode = 2 +metadata/_tab_index = 1 + +[node name="SeedpacketsContainer" type="ScrollContainer" parent="Zombies"] +layout_mode = 2 +horizontal_scroll_mode = 0 + +[node name="GridContainer" type="GridContainer" parent="Zombies/SeedpacketsContainer"] +layout_mode = 2 +columns = 8 +script = ExtResource("1_ru62c") +_zombies = true + +[node name="Infobox" type="VBoxContainer" parent="Zombies"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="FrameAndTitle" type="HBoxContainer" parent="Zombies/Infobox"] +layout_mode = 2 + +[node name="Frame" type="TextureRect" parent="Zombies/Infobox/FrameAndTitle"] +clip_contents = true +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 +texture = ExtResource("1_1hnxi") + +[node name="Previewport" type="SubViewport" parent="Zombies/Infobox/FrameAndTitle/Frame" node_paths=PackedStringArray("title", "description")] +canvas_item_default_texture_filter = 0 +size = Vector2i(130, 130) +script = ExtResource("2_ru62c") +title = NodePath("../../Label") +description = NodePath("../../../Description/ScrollContainer/RichTextLabel") + +[node name="FrameField" type="Sprite2D" parent="Zombies/Infobox/FrameAndTitle/Frame/Previewport"] +texture = ExtResource("3_oy57w") + +[node name="Camera2D" type="Camera2D" parent="Zombies/Infobox/FrameAndTitle/Frame/Previewport"] +position = Vector2(0, -45) + +[node name="Render" type="TextureRect" parent="Zombies/Infobox/FrameAndTitle/Frame"] +show_behind_parent = true +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("ViewportTexture_7yl8g") +expand_mode = 1 + +[node name="Label" type="Label" parent="Zombies/Infobox/FrameAndTitle"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 1 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Description" type="PanelContainer" parent="Zombies/Infobox"] +layout_mode = 2 +size_flags_vertical = 3 +theme_type_variation = &"description_panel_container" + +[node name="ScrollContainer" type="ScrollContainer" parent="Zombies/Infobox/Description"] +layout_mode = 2 +horizontal_scroll_mode = 0 + +[node name="RichTextLabel" type="RichTextLabel" parent="Zombies/Infobox/Description/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_colors/default_color = Color(0, 0, 0, 1) +theme_override_colors/font_selected_color = Color(0, 0, 0, 1) +bbcode_enabled = true diff --git a/scripts/components/IEntity.cs b/scripts/components/IEntity.cs index 3a6368e..7446c70 100644 --- a/scripts/components/IEntity.cs +++ b/scripts/components/IEntity.cs @@ -9,7 +9,9 @@ public interface IEntity { public int Hp { get; } public int MaxHp { get; } - public void TakeDamage(int amount,Node origin, Utility.DamageTypes damageType = Utility.DamageTypes.PHYSICAL); + public void TakeDamage(int amount, Node origin, Utility.DamageTypes damageType = Utility.DamageTypes.PHYSICAL); public void Heal(int amount, Node origin); + public void DisableBrain(); + public void EnableBrain(); } \ No newline at end of file diff --git a/scripts/components/gui/almanach/AlmanachGrid.cs b/scripts/components/gui/almanach/AlmanachGrid.cs new file mode 100644 index 0000000..bc6e3ce --- /dev/null +++ b/scripts/components/gui/almanach/AlmanachGrid.cs @@ -0,0 +1,36 @@ +using Godot; +using Newlon.Components.GUI.Seedpackets; + +public partial class AlmanachGrid : GridContainer +{ + private PackedScene _plantCard; + [Export] + private bool _zombies; + public override void _Ready() + { + _plantCard = ResourceLoader.Load("res://scenes/gui/seedpacket.tscn"); + + if (_zombies) + { + foreach (var resource in GameRegistry.GetZombies()) + { + Seedpacket slot = _plantCard.Instantiate(); + AddChild(slot); + + slot.SetResource(resource); + slot.SetHandler(new AlmanachHandler(slot)); + } + } + else + { + foreach (var resource in GameRegistry.GetPlants()) + { + Seedpacket slot = _plantCard.Instantiate(); + AddChild(slot); + + slot.SetResource(resource); + slot.SetHandler(new AlmanachHandler(slot)); + } + } + } +} diff --git a/scripts/components/gui/almanach/AlmanachGrid.cs.uid b/scripts/components/gui/almanach/AlmanachGrid.cs.uid new file mode 100644 index 0000000..e30ab52 --- /dev/null +++ b/scripts/components/gui/almanach/AlmanachGrid.cs.uid @@ -0,0 +1 @@ +uid://0mvmfvwe1bc7 diff --git a/scripts/components/gui/choose_your_seeds/GridLoader.cs b/scripts/components/gui/choose_your_seeds/GridLoader.cs index 81b04e6..f728588 100644 --- a/scripts/components/gui/choose_your_seeds/GridLoader.cs +++ b/scripts/components/gui/choose_your_seeds/GridLoader.cs @@ -17,7 +17,7 @@ public partial class GridLoader : GridContainer Seedpacket slot = _plantCard.Instantiate(); AddChild(slot); - slot.SetPlantResource(resource); + slot.SetResource(resource); slot.SetHandler(new ChoosableHandler(slot)); } } diff --git a/scripts/components/gui/choose_your_seeds/Previewport.cs b/scripts/components/gui/choose_your_seeds/Previewport.cs index 021718c..45c899b 100644 --- a/scripts/components/gui/choose_your_seeds/Previewport.cs +++ b/scripts/components/gui/choose_your_seeds/Previewport.cs @@ -1,11 +1,12 @@ using Godot; using Newlon; +using Newlon.Components; using Newlon.Components.GUI.Seedpackets; using Newlon.Components.Plants; public partial class Previewport : SubViewport { - private RuntimePlantData current_display; + private Node current_display; private Texture2D start_Field; [Export] private Label title; @@ -19,13 +20,14 @@ public partial class Previewport : SubViewport public void OnFocusChanged(Control node) { + if (GetParent().IsVisibleInTree() == false) return; if (node is Seedpacket packet) { - ChangeDisplay(packet.GetPlantResource()); + ChangeDisplay(packet.GetResource()); } } - private void ChangeDisplay(PlantResource resource) + private void ChangeDisplay(DisplayResource resource) { // Expand with updates if (current_display != null) @@ -38,11 +40,12 @@ public partial class Previewport : SubViewport } else GetNode("FrameField").Texture = start_Field; - current_display = resource.Scene.Instantiate(); + current_display = resource.Scene.Instantiate(); title.Text = resource.display_name; description.Text = resource.display_description; AddChild(current_display); - current_display.DisableBrain(); + if (current_display is IEntity entity) + entity.DisableBrain(); } } diff --git a/scripts/components/gui/seedpackets/AlmanachHandler.cs b/scripts/components/gui/seedpackets/AlmanachHandler.cs new file mode 100644 index 0000000..66b96d3 --- /dev/null +++ b/scripts/components/gui/seedpackets/AlmanachHandler.cs @@ -0,0 +1,10 @@ +using Godot; + +namespace Newlon.Components.GUI.Seedpackets; + +public class AlmanachHandler : SeedpacketHandler +{ + public AlmanachHandler(Seedpacket owner) : base(owner) + { + } +} diff --git a/scripts/components/gui/seedpackets/AlmanachHandler.cs.uid b/scripts/components/gui/seedpackets/AlmanachHandler.cs.uid new file mode 100644 index 0000000..7fcdcce --- /dev/null +++ b/scripts/components/gui/seedpackets/AlmanachHandler.cs.uid @@ -0,0 +1 @@ +uid://pse018r220mt diff --git a/scripts/components/gui/seedpackets/ChoosableHandler.cs b/scripts/components/gui/seedpackets/ChoosableHandler.cs index d537b04..306309a 100644 --- a/scripts/components/gui/seedpackets/ChoosableHandler.cs +++ b/scripts/components/gui/seedpackets/ChoosableHandler.cs @@ -13,7 +13,7 @@ public class ChoosableHandler : SeedpacketHandler, ISeedpacketPress var hotbarSeedpacket = Seedpacket.Prefab.Instantiate(); LevelGUIElements.Instance.SeedpacketsHotbar.AddChild(hotbarSeedpacket); - hotbarSeedpacket.SetPlantResource(_owner.GetPlantResource()); + hotbarSeedpacket.SetResource(_owner.GetResource()); var pregameHandler = new HotbarPregameHandler(hotbarSeedpacket); hotbarSeedpacket.SetHandler(pregameHandler); diff --git a/scripts/components/gui/seedpackets/HotbarHandler.cs b/scripts/components/gui/seedpackets/HotbarHandler.cs index dfc90bc..7a20f12 100644 --- a/scripts/components/gui/seedpackets/HotbarHandler.cs +++ b/scripts/components/gui/seedpackets/HotbarHandler.cs @@ -10,13 +10,13 @@ public class HotbarHandler : SeedpacketHandler, ISeedpacketPress, ISeedpacketPro public void Pressed() { - PlantField.Instance.SetPlant(_owner, _owner.GetPlantResource()); + PlantField.Instance.SetPlant(_owner, _owner.GetResource()); AudioSequencer.Play("lift_seed", Seedpacket.LiftStream); } public void Process() { - _owner.disablePacket = RuntimeLevelData.Instance.SunCount < _owner.GetPlantResource().Cost; + _owner.disablePacket = RuntimeLevelData.Instance.SunCount < _owner.GetResource().Cost; } public void OnUnfocused() { diff --git a/scripts/components/gui/seedpackets/Seedpacket.cs b/scripts/components/gui/seedpackets/Seedpacket.cs index 5006b52..30e3691 100644 --- a/scripts/components/gui/seedpackets/Seedpacket.cs +++ b/scripts/components/gui/seedpackets/Seedpacket.cs @@ -8,7 +8,7 @@ public partial class Seedpacket : TextureButton public static AudioStream UntapStream; public static AudioStream LiftStream; private const string PATH_TO_PACKED_SCENE = "res://scenes/gui/seedpacket.tscn"; - private PlantResource _resource; + private DisplayResource _resource; private Label _cost; private TextureRect _icon; private Timer _timer; @@ -50,14 +50,14 @@ public partial class Seedpacket : TextureButton } if (_handler is ISeedpacketProcess processHandler) processHandler.Process(); } - public void SetPlantResource( PlantResource resource ) + public void SetResource(DisplayResource resource ) { _resource = resource; UpdateContents(); } - public PlantResource GetPlantResource() + public DisplayResource GetResource() { return _resource; } diff --git a/scripts/components/level/PlantField.cs b/scripts/components/level/PlantField.cs index a08f074..e82c9b1 100644 --- a/scripts/components/level/PlantField.cs +++ b/scripts/components/level/PlantField.cs @@ -7,7 +7,7 @@ namespace Newlon.Components.Level; public partial class PlantField : Node2D { private Node2D _plantSetter; - private PlantResource _resource; + private DisplayResource _resource; private Seedpacket _slot; private bool _previousCanPlace; private ChannelPlayer player; @@ -21,18 +21,18 @@ public partial class PlantField : Node2D player = GetNode("PlantPlayer"); } - public void SetPlant(Seedpacket slot, PlantResource plant) + public void SetPlant(Seedpacket slot, DisplayResource resource) { - _resource = plant; + _resource = resource; _slot = slot; - if (plant == null) + if (resource == null) { foreach(var child in _plantSetter.GetChildren()) child.QueueFree(); } else { - var scene = plant.Scene.Instantiate(); + var scene = resource.Scene.Instantiate(); _plantSetter.AddChild(scene); scene.UseParentMaterial = true; } @@ -93,7 +93,7 @@ public partial class PlantField : Node2D var plant = _resource.Scene.Instantiate(); PoolContainer.Instance.Plants.AddChild(plant); plant.GlobalPosition = (_plantSetter.GlobalPosition / Utility.Tile).Ceil() * Utility.Tile - new Vector2(20, 14); - plant.Resource = _resource; + plant.Resource = (PlantResource)_resource; PoolContainer.Instance.EntityField[_resource.Layer].Add(plant.GlobalPosition, plant); diff --git a/scripts/components/level/RuntimeLevelData.cs b/scripts/components/level/RuntimeLevelData.cs index 6234d4f..d7fb28c 100644 --- a/scripts/components/level/RuntimeLevelData.cs +++ b/scripts/components/level/RuntimeLevelData.cs @@ -15,7 +15,7 @@ public partial class RuntimeLevelData : Node } [Export] - public int SunCount { get; private set; } = 0; + public float SunCount { get; private set; } = 0; public event Action OnLevelStateChanged; public static RuntimeLevelData Instance { get; private set; } @@ -29,17 +29,17 @@ public partial class RuntimeLevelData : Node } #region Sun - public void AddSun(int amount) + public void AddSun(float amount) { SunCount += amount; } - public void SpendSun(int amount) + public void SpendSun(float amount) { SunCount -= amount; } - public bool CheckSpendSun(int amount) + public bool CheckSpendSun(float amount) { if (SunCount - amount < 0) return false; diff --git a/scripts/components/level/zombe_spawners/SurvivalZombieSpawner.cs b/scripts/components/level/zombe_spawners/SurvivalZombieSpawner.cs index 992e0e2..1927cbe 100644 --- a/scripts/components/level/zombe_spawners/SurvivalZombieSpawner.cs +++ b/scripts/components/level/zombe_spawners/SurvivalZombieSpawner.cs @@ -38,16 +38,16 @@ public partial class SurvivalZombieSpawner : Node cachedTankPool.Sort((x, y) => { - return (int)(x.cost - y.cost); + return (int)(x.Cost - y.Cost); }); cachedHordePool.Sort((x, y) => { - return (int)(x.cost - y.cost); + return (int)(x.Cost - y.Cost); }); - minSupportPoints = cachedSupportPool[0].cost; - minTankPoints = cachedTankPool[0].cost; - minHordePoints = cachedHordePool[0].cost; + minSupportPoints = cachedSupportPool[0].Cost; + minTankPoints = cachedTankPool[0].Cost; + minHordePoints = cachedHordePool[0].Cost; fin_a = (velocity_curve.Sample(velocity_curve.MaxDomain) - velocity_curve.Sample(velocity_curve.MaxDomain - 0.001f)) / 0.001f; } @@ -107,10 +107,10 @@ public partial class SurvivalZombieSpawner : Node while (given_points >= minSupportPoints) { var chosen_zombie = cachedSupportPool[rng.RandiRange(0, cachedSupportPool.Count - 1)]; - if (given_points - chosen_zombie.cost >= 0) + if (given_points - chosen_zombie.Cost >= 0) { wave.Add(chosen_zombie); - given_points -= chosen_zombie.cost; + given_points -= chosen_zombie.Cost; } } return given_points; @@ -124,14 +124,14 @@ public partial class SurvivalZombieSpawner : Node int zombieIndex = cachedTankPool.Count - 1; while (given_points >= minSupportPoints && zombieIndex > -1) { - if (cachedTankPool[zombieIndex].cost > given_points) + if (cachedTankPool[zombieIndex].Cost > given_points) { zombieIndex--; continue; } var chosen_zombie = cachedTankPool[zombieIndex]; wave.Add(chosen_zombie); - given_points -= chosen_zombie.cost; + given_points -= chosen_zombie.Cost; } return given_points; } @@ -141,18 +141,18 @@ public partial class SurvivalZombieSpawner : Node { return given_points; } - while (is_big == false && cachedHordePool.Count > 1 && cachedHordePool[1].cost * 15 <= given_points) + while (is_big == false && cachedHordePool.Count > 1 && cachedHordePool[1].Cost * 15 <= given_points) { cachedHordePool.RemoveAt(0); - minHordePoints = cachedHordePool[0].cost; + minHordePoints = cachedHordePool[0].Cost; } while (given_points >= minHordePoints) { var chosen_zombie = cachedHordePool[rng.RandiRange(0, cachedHordePool.Count - 1)]; - if (given_points - chosen_zombie.cost >= 0) + if (given_points - chosen_zombie.Cost >= 0) { wave.Add(chosen_zombie); - given_points -= chosen_zombie.cost; + given_points -= chosen_zombie.Cost; } } return given_points; diff --git a/scripts/components/level/zombe_spawners/ZombieSequencer.cs b/scripts/components/level/zombe_spawners/ZombieSequencer.cs index 5f4b284..7c0f1c6 100644 --- a/scripts/components/level/zombe_spawners/ZombieSequencer.cs +++ b/scripts/components/level/zombe_spawners/ZombieSequencer.cs @@ -58,7 +58,7 @@ public partial class ZombieSequencer : Node2D private void Spawn(string id, int lane) { - RuntimeZombieData zombie = GameRegistry.GetZombieByName(id).scene.Instantiate(); + RuntimeZombieData zombie = GameRegistry.GetZombieByName(id).Scene.Instantiate(); PoolContainer.Instance.Zombies.AddChild(zombie); zombie.GlobalPosition = new Vector2(GlobalPosition.X, Utility.RightFieldBoundary.Y - (lane - 1) * Utility.TileHeight); diff --git a/scripts/components/zombies/RuntimeZombieData.cs b/scripts/components/zombies/RuntimeZombieData.cs index 2faa22d..e0fcef0 100644 --- a/scripts/components/zombies/RuntimeZombieData.cs +++ b/scripts/components/zombies/RuntimeZombieData.cs @@ -146,5 +146,17 @@ public partial class RuntimeZombieData : Node2D, IEntity, ILocalTimescale, IEffe _activeEffectSlots[slot].Exit(this); _activeEffectSlots[slot] = null; } - #endregion + + public void DisableBrain() + { + GetNode("AnimationPlayer").ProcessMode = ProcessModeEnum.Pausable; + ProcessMode = ProcessModeEnum.Disabled; + } + + public void EnableBrain() + { + GetNode("AnimationPlayer").ProcessMode = ProcessModeEnum.Inherit; + ProcessMode = ProcessModeEnum.Inherit; + } + #endregion } diff --git a/scripts/resources/DisplayResource.cs b/scripts/resources/DisplayResource.cs new file mode 100644 index 0000000..a499473 --- /dev/null +++ b/scripts/resources/DisplayResource.cs @@ -0,0 +1,20 @@ +using Godot; + +public partial class DisplayResource : Resource +{ + [Export] public string display_name; + [Export(PropertyHint.MultilineText)] public string display_description; + [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; + public string internal_id; +} diff --git a/scripts/resources/DisplayResource.cs.uid b/scripts/resources/DisplayResource.cs.uid new file mode 100644 index 0000000..38bfd5f --- /dev/null +++ b/scripts/resources/DisplayResource.cs.uid @@ -0,0 +1 @@ +uid://j7wr5mj7j81b diff --git a/scripts/resources/PlantResource.cs b/scripts/resources/PlantResource.cs index 166af05..834f574 100644 --- a/scripts/resources/PlantResource.cs +++ b/scripts/resources/PlantResource.cs @@ -3,22 +3,6 @@ using Godot; namespace Newlon; [GlobalClass] -public partial class PlantResource : Resource +public partial class PlantResource : DisplayResource { - [Export] public string display_name; - [Export(PropertyHint.MultilineText)] public string display_description; - [Export] - public int 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 int Layer = 1; - [Export] public CustomSeedpacketFrame customFrame; - - public string internal_id; } diff --git a/scripts/resources/ZombieResource.cs b/scripts/resources/ZombieResource.cs index 55e5b4e..bee27b7 100644 --- a/scripts/resources/ZombieResource.cs +++ b/scripts/resources/ZombieResource.cs @@ -1,10 +1,6 @@ using Godot; [GlobalClass] -public partial class ZombieResource : Resource +public partial class ZombieResource : DisplayResource { - [Export] public float cost; - [Export] public PackedScene scene; - - public string internal_id; }