35 lines
972 B
C#
35 lines
972 B
C#
using Godot;
|
|
using Newlon;
|
|
using Newlon.Components;
|
|
using Newlon.Resources;
|
|
|
|
public partial class RewardScene : Node
|
|
{
|
|
public override void _Ready()
|
|
{
|
|
var reward = LevelController.Instance.Reward;
|
|
var subviewport = GetNode<SubViewport>("%SubViewport");
|
|
var nameLabel = GetNode<Label>("%NameLabel");
|
|
var descriptionLabel = GetNode<RichTextLabel>("%DescriptionLabel");
|
|
var continueButton = GetNode<Button>("%ContinueButton");
|
|
var field = GetNode<Sprite2D>("%Field");
|
|
|
|
nameLabel.Text = Tr(reward.Name);
|
|
descriptionLabel.Text = Tr(reward.Description);
|
|
continueButton.Pressed += LevelController.Instance.ReturnToInitiator;
|
|
|
|
if (reward is PlantReward plantReward && plantReward.Plant.CustomFrame != null)
|
|
{
|
|
field.Texture = plantReward.Plant.CustomFrame.almanachField;
|
|
}
|
|
|
|
var rewardedObject = reward.GetPreview().Instantiate();
|
|
|
|
if (rewardedObject is Entity entity)
|
|
{
|
|
entity.DisableBrain();
|
|
}
|
|
subviewport.AddChild(rewardedObject);
|
|
|
|
}
|
|
}
|