complete refactor
This commit is contained in:
parent
65fe0e5c5d
commit
de2e8b1e50
71 changed files with 212 additions and 137 deletions
|
|
@ -1,6 +1,6 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
using System;
|
||||
using Newlon;
|
||||
|
||||
public partial class PlantHotbarSize : PanelContainer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Zombies;
|
||||
using System.Collections.Generic;
|
||||
using Newlon.Resources;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue