brand new start
This commit is contained in:
parent
a41ca5669b
commit
f15f38bfc4
464 changed files with 5 additions and 20007 deletions
|
|
@ -1,10 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
|
||||
public partial class ExitButton : Button
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
LevelController.Instance.EndLevel();
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://dpdpv2oyxdna7
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class FastForwardButton : Button
|
||||
{
|
||||
[Export] private Texture2D firstSpeed;
|
||||
[Export] private Texture2D secondSpeed;
|
||||
[Export] private Texture2D thirdSpeed;
|
||||
|
||||
[Export] private AnimationPlayer flashAnimator;
|
||||
|
||||
private int speed = 1;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
}
|
||||
|
||||
private void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state == RuntimeLevelData.LevelStates.Game) return;
|
||||
|
||||
speed = 1;
|
||||
Update();
|
||||
}
|
||||
|
||||
public void OnPressed()
|
||||
{
|
||||
if (RuntimeLevelData.Instance.GetLevelState() != RuntimeLevelData.LevelStates.Game) return;
|
||||
|
||||
speed = Mathf.Wrap(speed + 1, 1, 4);
|
||||
|
||||
flashAnimator.Play("flash");
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
switch (speed)
|
||||
{
|
||||
case 1:
|
||||
Icon = firstSpeed;
|
||||
break;
|
||||
case 2:
|
||||
Icon = secondSpeed;
|
||||
break;
|
||||
case 3:
|
||||
Icon = thirdSpeed;
|
||||
break;
|
||||
}
|
||||
|
||||
Engine.TimeScale = speed;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cwn3bd2k7mdq6
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon;
|
||||
|
||||
//
|
||||
// Button that contains level to load
|
||||
//
|
||||
|
||||
public partial class LevelButton : TextureButton
|
||||
{
|
||||
[Export] private Script _levelScript;
|
||||
[Export] private PackedScene _levelTileset;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cn3q18jh2rej7
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.GUI;
|
||||
|
||||
namespace Newlon.Components;
|
||||
|
||||
public partial class LevelGUIElements : Control
|
||||
{
|
||||
public static LevelGUIElements Instance;
|
||||
|
||||
[Export]
|
||||
public HBoxContainer SeedpacketsHotbar;
|
||||
[Export]
|
||||
public SunCounter SunCounter;
|
||||
public override void _EnterTree()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cwa1eydeiy3y4
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
using Newlon;
|
||||
|
||||
public partial class PlantHotbarSize : PanelContainer
|
||||
{
|
||||
const int MARGIN = 4;
|
||||
const int PACKET_WIDTH = 41;
|
||||
const int MINIMUM_Y = 64;
|
||||
public override void _Ready()
|
||||
{
|
||||
CustomMinimumSize = new Vector2(MARGIN * 2 + PACKET_WIDTH * PlayerProgress.Instance.MaxSeedpackets, MINIMUM_Y);
|
||||
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
}
|
||||
|
||||
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds)
|
||||
{
|
||||
CustomMinimumSize = new Vector2(0, MINIMUM_Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://bygqu13os20wi
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
|
||||
public partial class PrototypeWindow : AcceptDialog
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
if (Settings.Splash) return;
|
||||
Settings.Splash = true;
|
||||
PopupCentered();
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cghu4i3bnyavg
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
|
||||
public partial class RestartButton : Button
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
GetTree().Paused = false;
|
||||
LevelController.Instance.RestartLevel();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://btqwxelqxheh3
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cqlghusry0hej
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Plants;
|
||||
using Newlon.Components.Level;
|
||||
using Newlon.Components.Zombies;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class ShovelButton : TextureButton
|
||||
{
|
||||
const float CONE_HEALTH = 295.0f;
|
||||
[Export] private PackedScene particles;
|
||||
private Entity hoveredEntity;
|
||||
private bool Selected => hoveredEntity != null;
|
||||
[Export]
|
||||
private RayCast2D raycast;
|
||||
[Export]
|
||||
private Timer timer;
|
||||
private void OnFocusExited()
|
||||
{
|
||||
ButtonPressed = false;
|
||||
}
|
||||
public override void _Ready()
|
||||
{
|
||||
raycast.Reparent(PoolContainer.Instance);
|
||||
FocusExited += OnFocusExited;
|
||||
timer.Timeout += OnTimerTimeout;
|
||||
}
|
||||
|
||||
public override void _Toggled(bool toggledOn)
|
||||
{
|
||||
Cursor.Instance.shovel = toggledOn;
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
|
||||
if (@event.IsActionPressed("primary_action") && ButtonPressed)
|
||||
{
|
||||
if (hoveredEntity != null)
|
||||
{
|
||||
if (hoveredEntity is RuntimePlantData hoveredPlant)
|
||||
{
|
||||
hoveredPlant.Kill();
|
||||
PoolContainer.Instance.SpawnParticles(particles, hoveredPlant.GlobalPosition + Vector2.Down * FieldParams.TileHeight / 2.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
hoveredEntity.TakeDamage(CONE_HEALTH, null);
|
||||
timer.Start();
|
||||
Disabled = true;
|
||||
}
|
||||
}
|
||||
GetViewport().SetInputAsHandled();
|
||||
hoveredEntity?.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = null;
|
||||
ButtonPressed = false;
|
||||
}
|
||||
if (@event.IsActionPressed("cancel_action") && ButtonPressed)
|
||||
{
|
||||
hoveredEntity?.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = null;
|
||||
ButtonPressed = false;
|
||||
}
|
||||
}
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
UpdateTimer();
|
||||
|
||||
if (ButtonPressed)
|
||||
{
|
||||
var gridEntity = GetTile(Cursor.GetCursorPosition());
|
||||
if (TrySetGridEntity(gridEntity)) return;
|
||||
if (TrySetDynEntity()) return;
|
||||
|
||||
else
|
||||
{
|
||||
if (Selected)
|
||||
{
|
||||
hoveredEntity.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Selected)
|
||||
{
|
||||
hoveredEntity.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
private Entity GetTile(Vector2 position)
|
||||
{
|
||||
var checkedPosition = (position / FieldParams.Tile).Ceil() * FieldParams.Tile - new Vector2(20, 14);
|
||||
for (int i = FieldParams.LayersCount - 1; i >= 0; i--)
|
||||
{
|
||||
if (PoolContainer.Instance.TryGetEntity(checkedPosition, out RuntimePlantData plantData,i))
|
||||
{
|
||||
return plantData;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private bool TrySetGridEntity(Entity chosenEntity)
|
||||
{
|
||||
if (chosenEntity != null && Selected == false)
|
||||
{
|
||||
hoveredEntity = chosenEntity;
|
||||
hoveredEntity.GetNode<FlashShaderController>("FlashController").Select();
|
||||
return true;
|
||||
}
|
||||
if (chosenEntity == null && Selected && hoveredEntity is RuntimePlantData)
|
||||
{
|
||||
hoveredEntity.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = null;
|
||||
return true;
|
||||
}
|
||||
if (hoveredEntity == null || chosenEntity == null) return false;
|
||||
if (chosenEntity != hoveredEntity && Selected)
|
||||
{
|
||||
hoveredEntity.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = chosenEntity;
|
||||
hoveredEntity.GetNode<FlashShaderController>("FlashController").Select();
|
||||
return true;
|
||||
}
|
||||
return hoveredEntity != null && hoveredEntity is RuntimeZombieData == false;
|
||||
}
|
||||
private bool TrySetDynEntity()
|
||||
{
|
||||
raycast.GlobalPosition = Cursor.GetCursorPosition();
|
||||
|
||||
if (raycast.IsColliding())
|
||||
{
|
||||
var entity = ((Area2D)raycast.GetCollider()).GetParent() as Entity;
|
||||
|
||||
if (entity == null) return false;
|
||||
|
||||
if (Selected == false)
|
||||
{
|
||||
hoveredEntity = entity;
|
||||
hoveredEntity.GetNode<FlashShaderController>("FlashController").Select();
|
||||
return true;
|
||||
}
|
||||
if (hoveredEntity == null) return false;
|
||||
if (Selected && hoveredEntity != entity)
|
||||
{
|
||||
hoveredEntity.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
entity.GetNode<FlashShaderController>("FlashController").Select();
|
||||
hoveredEntity = entity;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hoveredEntity?.GetNode<FlashShaderController>("FlashController").Deselect();
|
||||
hoveredEntity = null;
|
||||
return false;
|
||||
}
|
||||
return hoveredEntity != null && hoveredEntity is RuntimeZombieData;
|
||||
}
|
||||
private void UpdateTimer()
|
||||
{
|
||||
((ShaderMaterial)Material).SetShaderParameter("progress", 1.0-timer.TimeLeft/timer.WaitTime);
|
||||
}
|
||||
private void OnTimerTimeout()
|
||||
{
|
||||
Disabled = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://d4dbg0us5ngxy
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
using System.Globalization;
|
||||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class SunCounter : Control
|
||||
{
|
||||
public static SunCounter Instance { get; private set; }
|
||||
private Tween tween;
|
||||
[Export] private Label text;
|
||||
[Export] public TextureRect sunImage { get; private set;}
|
||||
public override void _EnterTree()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
if (Instance.tween != null) Instance.tween.Kill();
|
||||
Instance.tween = Instance.CreateTween();
|
||||
Instance.tween.TweenMethod(Callable.From<int>(Instance.SetText), int.Parse(Instance.text.Text), RuntimeLevelData.Instance.SunCount, 1.0);
|
||||
}
|
||||
public static void UpdateInstantly()
|
||||
{
|
||||
Instance.text.Text = RuntimeLevelData.Instance.SunCount.ToString();
|
||||
}
|
||||
private void SetText(int value)
|
||||
{
|
||||
text.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://dwxohya1exdkh
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class VeilResizer : TextureProgressBar
|
||||
{
|
||||
[Export] private Timer _referenceTimer;
|
||||
private Seedpacket seedpacket;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
seedpacket = GetParent<Seedpacket>();
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Value = _referenceTimer.TimeLeft / _referenceTimer.WaitTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://ddi84kmmq1qla
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using Godot;
|
||||
|
||||
|
||||
public partial class WaveFlag : TextureRect
|
||||
{
|
||||
public int waveIndex;
|
||||
public double anim_time;
|
||||
public void HugeWaveApproached(int what)
|
||||
{
|
||||
if (waveIndex == what)
|
||||
{
|
||||
var tween = CreateTween().SetEase(Tween.EaseType.Out).SetTrans(Tween.TransitionType.Cubic).SetParallel();
|
||||
tween.TweenProperty(this, "anchor_top", 0.1, anim_time);
|
||||
tween.TweenProperty(this, "anchor_bottom", 0.1, anim_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://06ns8r18dalm
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
using Godot;
|
||||
|
||||
public partial class WaveProgress : TextureProgressBar
|
||||
{
|
||||
private TextureRect head;
|
||||
private Tween tween;
|
||||
private PackedScene flagScene = ResourceLoader.Load<PackedScene>("uid://drobbh5x1v7mi");
|
||||
[Export] private double progressTime = 2.0f;
|
||||
[Signal] public delegate void HugeWaveInitiatedEventHandler(int waveNumber);
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
head = GetNode<TextureRect>("Head");
|
||||
}
|
||||
public void OnWaveChanged(int to)
|
||||
{
|
||||
if (Visible == false) Visible = true;
|
||||
if (tween != null) tween.Kill();
|
||||
tween = CreateTween().SetParallel(true).SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
|
||||
tween.TweenProperty(this, "value", to + 1, progressTime);
|
||||
tween.TweenProperty(head, "anchor_right", 1.0 - (float)(to + 1.0f) / MaxValue, progressTime);
|
||||
tween.TweenProperty(head, "anchor_left", 1.0 - (float)(to + 1.0f) / MaxValue, progressTime);
|
||||
}
|
||||
public void SetLevelData(AdventureLevelResource resource)
|
||||
{
|
||||
MaxValue = resource.waves.Count;
|
||||
for (int i = 0; i < resource.waves.Count; i++)
|
||||
{
|
||||
if (resource.waves[i].isHugeWave)
|
||||
{
|
||||
var flag = flagScene.Instantiate<WaveFlag>();
|
||||
AddChild(flag);
|
||||
flag.AnchorTop = 0.5f;
|
||||
flag.AnchorBottom = 0.5f;
|
||||
flag.AnchorLeft = 1.0f - (float)(i + 1) / resource.waves.Count;
|
||||
flag.AnchorRight = 1.0f - (float)(i + 1) / resource.waves.Count;
|
||||
flag.anim_time = progressTime;
|
||||
flag.waveIndex = i;
|
||||
HugeWaveInitiated += flag.HugeWaveApproached;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void OnHugeWaveApproached(int what)
|
||||
{
|
||||
EmitSignal(SignalName.HugeWaveInitiated, what);
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://bsnt4slsbathn
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Zombies;
|
||||
using System.Collections.Generic;
|
||||
using Newlon.Resources;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
public partial class ZombieLevelPreviewer : Node2D
|
||||
{
|
||||
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case RuntimeLevelData.LevelStates.ChooseYourSeeds:
|
||||
SetupZombies();
|
||||
break;
|
||||
case RuntimeLevelData.LevelStates.Pregame:
|
||||
break;
|
||||
default:
|
||||
QueueFree();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void SetupZombies()
|
||||
{
|
||||
var to_spawn = FindUnique();
|
||||
|
||||
foreach (var zombie in to_spawn)
|
||||
{
|
||||
var rng_x = (float)GD.RandRange(0.0, 2.0);
|
||||
var rng_y = (float)GD.RandRange(1.0, 5.0);
|
||||
|
||||
var spawned = zombie.Scene.Instantiate<RuntimeZombieData>();
|
||||
spawned.DisableBrain();
|
||||
AddChild(spawned);
|
||||
spawned.Position += new Vector2(rng_x*FieldParams.TileWidth, rng_y*FieldParams.TileHeight);
|
||||
}
|
||||
}
|
||||
public List<ZombieResource> FindUnique()
|
||||
{
|
||||
List<ZombieResource> zombies = new();
|
||||
|
||||
foreach (var wave in RuntimeLevelData.LevelResource.waves)
|
||||
{
|
||||
foreach (var spawn in wave.zombiesOrdered)
|
||||
{
|
||||
foreach (var zombie in spawn.zombies)
|
||||
{
|
||||
if (zombie == null || zombies.Contains(zombie)) continue;
|
||||
zombies.Add(zombie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return zombies;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://bc3s06ejbotma
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public partial class AlmanachGrid : GridContainer
|
||||
{
|
||||
private PackedScene _plantCard = ResourceLoader.Load<PackedScene>("res://scenes/gui/seedpacket.tscn");
|
||||
[Export]
|
||||
private bool _zombies;
|
||||
public override void _Ready()
|
||||
{
|
||||
if (_zombies)
|
||||
{
|
||||
var list = GameRegistry.GetZombies();
|
||||
list.Sort((a, b) =>
|
||||
{
|
||||
return a.Order - b.Order;
|
||||
});
|
||||
foreach (var resource in list)
|
||||
{
|
||||
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
|
||||
AddChild(slot);
|
||||
|
||||
slot.SetResource(resource.ToGridEntity());
|
||||
slot.SetHandler(new AlmanachHandler(slot));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var list = GameRegistry.GetPlants();
|
||||
list.Sort((a, b) =>
|
||||
{
|
||||
return a.Order - b.Order;
|
||||
});
|
||||
foreach (var resource in list)
|
||||
{
|
||||
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
|
||||
AddChild(slot);
|
||||
|
||||
slot.SetResource(resource);
|
||||
slot.SetLocked(PlayerProgress.Instance.PlayerPlants.Contains(resource) == false);
|
||||
slot.SetHandler(new AlmanachHandler(slot));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://0mvmfvwe1bc7
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class CYSFocusSetup : Node
|
||||
{
|
||||
[Export] private GridContainer grid;
|
||||
[Export] private Button button;
|
||||
[Export] private ScrollContainer textContainer;
|
||||
public override void _Ready()
|
||||
{
|
||||
for (int i = 0; i < grid.GetChildCount(); i++)
|
||||
{
|
||||
int x = i % grid.Columns;
|
||||
int y = i / grid.Columns;
|
||||
|
||||
Control control = grid.GetChild<Control>(i);
|
||||
|
||||
if (y == 0)
|
||||
{
|
||||
control.FocusNeighborTop = control.GetPathTo(textContainer);
|
||||
}
|
||||
if (x == grid.Columns - 1)
|
||||
{
|
||||
control.FocusNeighborRight = control.GetPathTo(button);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://bksslrqq5vhm3
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public partial class CYSResetButton : Button
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
foreach (Seedpacket packet in LevelGUIElements.Instance.SeedpacketsHotbar.GetChildren())
|
||||
{
|
||||
packet._Pressed();
|
||||
packet.EmitSignal(Seedpacket.SignalName.Pressed);
|
||||
}
|
||||
GrabFocus();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://diwjgekhvn017
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class GridLoader : GridContainer
|
||||
{
|
||||
private PackedScene _plantCard;
|
||||
public const string SEEDPACKED_UID = "uid://e7vutg71l6f2";
|
||||
public override void _Ready()
|
||||
{
|
||||
_plantCard = ResourceLoader.Load<PackedScene>(SEEDPACKED_UID);
|
||||
|
||||
var list = GameRegistry.GetPlants();
|
||||
list.Sort((a, b) =>
|
||||
{
|
||||
return a.Order - b.Order;
|
||||
});
|
||||
foreach (var resource in list)
|
||||
{
|
||||
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
|
||||
AddChild(slot);
|
||||
|
||||
|
||||
slot.SetResource(resource);
|
||||
slot.SetForbidden(RuntimeLevelData.LevelResource.forbiddenPlants.Contains(resource.GetInternalID()));
|
||||
slot.SetLocked(PlayerProgress.Instance.PlayerPlants.Contains(resource) == false);
|
||||
if (GetChildCount() == 1) slot.GrabFocus();
|
||||
|
||||
if (RuntimeLevelData.LevelResource.prepickedPlants.Contains(resource.GetInternalID()))
|
||||
{
|
||||
slot.SetHandler(new PrepickedDummyHandler(slot));
|
||||
slot.disablePacket = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.SetHandler(new ChoosableHandler(slot));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://eq3ecja30mlj
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class LevelRunButton : Button
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
RuntimeLevelData.Instance.SetLevelState(RuntimeLevelData.LevelStates.Pregame);
|
||||
LevelGUIElements.Instance.SeedpacketsHotbar.GetChild<Seedpacket>(0).GrabFocus();
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://d26waisd3v488
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
using Newlon.Components;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
|
||||
public partial class Previewport : SubViewport
|
||||
{
|
||||
private Node current_display;
|
||||
private Texture2D start_Field;
|
||||
|
||||
[Export] private Label title;
|
||||
[Export] private RichTextLabel description;
|
||||
[Export] private Sprite2D _frameField;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GetParent().GetViewport().GuiFocusChanged += OnFocusChanged;
|
||||
start_Field = _frameField.Texture;
|
||||
}
|
||||
|
||||
public void OnFocusChanged(Control node)
|
||||
{
|
||||
if (GetParent<Control>().IsVisibleInTree() == false) return;
|
||||
if (node is Seedpacket packet)
|
||||
{
|
||||
ChangeDisplay(packet.GetResource());
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeDisplay(EntityResource resource)
|
||||
{
|
||||
// Expand with updates
|
||||
if (current_display != null)
|
||||
{
|
||||
current_display.QueueFree();
|
||||
}
|
||||
if (resource.CustomFrame != null && resource.CustomFrame.almanachField != null)
|
||||
{
|
||||
_frameField.Texture = resource.CustomFrame.almanachField;
|
||||
}
|
||||
else
|
||||
_frameField.Texture = start_Field;
|
||||
current_display = resource.Scene.Instantiate();
|
||||
title.Text = Tr(resource.NameKey);
|
||||
AddChild(current_display);
|
||||
if (current_display is Entity entity)
|
||||
entity.DisableBrain();
|
||||
|
||||
|
||||
var rwd = Tr("rwd_" + resource.NameKey);
|
||||
if (rwd == "rwd_" + resource.NameKey)
|
||||
{
|
||||
rwd = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
rwd += "\n";
|
||||
}
|
||||
|
||||
description.Text = rwd + DescriptionParser.GetParsed(resource,current_display);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://covbig00p22di
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
extends RichTextLabel
|
||||
|
||||
func _on_meta_clicked(meta: Variant) -> void:
|
||||
OS.shell_open(meta)
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://drru785m4eep
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
extends Node
|
||||
|
||||
func _ready() -> void:
|
||||
$InfoButtons/AboutButton.grab_focus()
|
||||
|
||||
func _on_play_button_pressed() -> void:
|
||||
LevelController.call("StartLevel",preload("uid://dd3yegl1xo44m"),preload("uid://dwd5oqr0tuvhv"))
|
||||
$ChannelPlayer.call("Play")
|
||||
|
||||
|
||||
func _on_exit_button_pressed() -> void:
|
||||
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
|
||||
get_tree().quit()
|
||||
$ChannelPlayer.call("Play")
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
$"../AboutWindow".popup_centered()
|
||||
$ChannelPlayer.call("Play")
|
||||
|
||||
func _on_almanach_button_pressed() -> void:
|
||||
$"../Almanach".visible = true
|
||||
$ChannelPlayer.call("Play")
|
||||
|
||||
|
||||
func _on_splash_button_pressed() -> void:
|
||||
$"../PrototypeWindow".popup_centered()
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://c06k4k3ww48ev
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PM_GamepadFocus : Node
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cc8loabsf43m0
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PauseButton : Button
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
PauseMenu.Pause();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cmfhiun6yrlr6
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
using System;
|
||||
|
||||
public partial class PauseMenu : Control
|
||||
{
|
||||
private static PauseMenu Instance;
|
||||
private bool previousPaused;
|
||||
private bool currently_paused = false;
|
||||
private AudioStream pauseSound = ResourceLoader.Load<AudioStream>("uid://ckja8ym50y0d4");
|
||||
private Control stolenFocus;
|
||||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
GetViewport().GuiFocusChanged += OnFocusChanged;
|
||||
}
|
||||
|
||||
public void Continue()
|
||||
{
|
||||
GetParent<Control>().Visible = false;
|
||||
GetTree().Paused = previousPaused;
|
||||
currently_paused = false;
|
||||
stolenFocus.GrabFocus();
|
||||
}
|
||||
public void Restart()
|
||||
{
|
||||
GetTree().Paused = false;
|
||||
LevelController.Instance.RestartLevel();
|
||||
currently_paused = false;
|
||||
}
|
||||
public void Exit()
|
||||
{
|
||||
LevelController.Instance.EndLevel();
|
||||
currently_paused = false;
|
||||
}
|
||||
public static void Pause()
|
||||
{
|
||||
if (Instance.currently_paused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Instance.currently_paused = true;
|
||||
Instance.GetNode<Control>("%ContinueButton").GrabFocus();
|
||||
|
||||
Instance.GetParent<Control>().Visible = true;
|
||||
Instance.previousPaused = Instance.GetTree().Paused;
|
||||
Instance.GetTree().Paused = true;
|
||||
AudioSequencer.Play("pause", Instance.pauseSound);
|
||||
}
|
||||
public override void _ExitTree()
|
||||
{
|
||||
GetViewport().GuiFocusChanged -= OnFocusChanged;
|
||||
}
|
||||
|
||||
public void OnFocusChanged(Control to)
|
||||
{
|
||||
if (currently_paused) return;
|
||||
stolenFocus = to;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://gvwhpjoame6m
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
using Godot;
|
||||
|
||||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class AlmanachHandler : SeedpacketHandler
|
||||
{
|
||||
public AlmanachHandler(Seedpacket owner) : base(owner)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://pse018r220mt
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class ChoosableHandler : SeedpacketHandler, ISeedpacketPress
|
||||
{
|
||||
public ChoosableHandler(Seedpacket owner) : base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
public void Pressed()
|
||||
{
|
||||
if (LevelGUIElements.Instance.SeedpacketsHotbar.GetChildCount() >= PlayerProgress.Instance.MaxSeedpackets) return;
|
||||
_owner.disablePacket = true;
|
||||
|
||||
var hotbarSeedpacket = Seedpacket.Prefab.Instantiate<Seedpacket>();
|
||||
LevelGUIElements.Instance.SeedpacketsHotbar.AddChild(hotbarSeedpacket);
|
||||
hotbarSeedpacket.SetResource(_owner.GetResource());
|
||||
|
||||
var pregameHandler = new HotbarPregameHandler(hotbarSeedpacket);
|
||||
hotbarSeedpacket.SetHandler(pregameHandler);
|
||||
pregameHandler.Clicked += OnHotbarClicked;
|
||||
AudioSequencer.Play("tap", Seedpacket.TapStream);
|
||||
}
|
||||
|
||||
public void OnHotbarClicked()
|
||||
{
|
||||
_owner.disablePacket = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://b3sut12n56w1y
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
using Newlon.Components.Level;
|
||||
using System;
|
||||
|
||||
public partial class CostVeil : ColorRect
|
||||
{
|
||||
private Seedpacket packet;
|
||||
public override void _Ready()
|
||||
{
|
||||
packet = GetParent<Seedpacket>();
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
//Visible = RuntimeLevelData.Instance.SunCount < packet.GetResource().Cost;
|
||||
|
||||
Visible = packet.disablePacket || packet._locked;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://chag6sgjsjb2u
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
using Godot;
|
||||
|
||||
[GlobalClass]
|
||||
[Tool]
|
||||
public partial class CustomSeedpacketFrame : Resource
|
||||
{
|
||||
[Export] public Texture2D frame;
|
||||
[Export] public LabelSettings font;
|
||||
[Export] public Texture2D almanachField;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://3m7xks3xq3hl
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class HotbarHandler : SeedpacketHandler, ISeedpacketPress, ISeedpacketProcess, ISeedpacketUnfocus
|
||||
{
|
||||
public HotbarHandler(Seedpacket owner) : base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
public void Pressed()
|
||||
{
|
||||
PlantField.Instance.SetPlant(_owner, _owner.GetResource());
|
||||
AudioSequencer.Play("lift_seed", Seedpacket.LiftStream);
|
||||
}
|
||||
|
||||
public void Process()
|
||||
{
|
||||
_owner.disablePacket = RuntimeLevelData.Instance.SunCount < _owner.GetResource().Cost || RuntimeLevelData.Instance.GetLevelState() != RuntimeLevelData.LevelStates.Game;
|
||||
}
|
||||
public void OnUnfocused()
|
||||
{
|
||||
PlantField.Instance.ResetPlant();
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://gvgt14v1hndn
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
using System;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class HotbarPregameHandler : SeedpacketHandler, ISeedpacketPress
|
||||
{
|
||||
public HotbarPregameHandler(Seedpacket owner) : base(owner)
|
||||
{
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
|
||||
}
|
||||
|
||||
public event Action Clicked;
|
||||
public void Pressed()
|
||||
{
|
||||
if (RuntimeLevelData.Instance.GetLevelState() != RuntimeLevelData.LevelStates.ChooseYourSeeds) return;
|
||||
if (Clicked != null) Clicked();
|
||||
_owner.QueueFree();
|
||||
AudioSequencer.Play("tap", Seedpacket.UntapStream);
|
||||
}
|
||||
|
||||
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state == RuntimeLevelData.LevelStates.Game)
|
||||
{
|
||||
_owner.SetHandler(new HotbarHandler(_owner));
|
||||
_owner.StartWithResourceOffset();
|
||||
}
|
||||
else if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds)
|
||||
{
|
||||
_owner.disablePacket = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://bnygd8pcmoewp
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
public partial class HotbarShortcutSetter : Node
|
||||
{
|
||||
[Export] private Array<Shortcut> shortcuts;
|
||||
[Export] private Control hotbar;
|
||||
public override void _Ready()
|
||||
{
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
}
|
||||
private void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state == RuntimeLevelData.LevelStates.Pregame)
|
||||
{
|
||||
for (int i = 0; i < hotbar.GetChildCount(); i++)
|
||||
{
|
||||
((Seedpacket)hotbar.GetChild(i)).Shortcut = shortcuts[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://di45o67gxmiql
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public interface ISeedpacketPress
|
||||
{
|
||||
public void Pressed();
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://o0ly38oqcuwu
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public interface ISeedpacketProcess
|
||||
{
|
||||
public void Process();
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://q2r43hym7s82
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public interface ISeedpacketUnfocus
|
||||
{
|
||||
public void OnUnfocused();
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://mdm8cepvvo4t
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
public class PrepickedDummyHandler : SeedpacketHandler
|
||||
{
|
||||
public PrepickedDummyHandler(Seedpacket owner) : base(owner)
|
||||
{
|
||||
if (LevelGUIElements.Instance.SeedpacketsHotbar.GetChildCount() >= PlayerProgress.Instance.MaxSeedpackets) return;
|
||||
_owner.disablePacket = true;
|
||||
|
||||
var hotbarSeedpacket = Seedpacket.Prefab.Instantiate<Seedpacket>();
|
||||
LevelGUIElements.Instance.SeedpacketsHotbar.AddChild(hotbarSeedpacket);
|
||||
hotbarSeedpacket.SetResource(_owner.GetResource());
|
||||
|
||||
hotbarSeedpacket.SetHandler(new PrepickedHandler(hotbarSeedpacket));
|
||||
hotbarSeedpacket.disablePacket = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://c7uf1ygofsurs
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class PrepickedHandler : SeedpacketHandler
|
||||
{
|
||||
public PrepickedHandler(Seedpacket owner) : base(owner)
|
||||
{
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
}
|
||||
|
||||
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state == RuntimeLevelData.LevelStates.Game)
|
||||
{
|
||||
_owner.SetHandler(new HotbarHandler(_owner));
|
||||
_owner.StartWithResourceOffset();
|
||||
}
|
||||
else if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds)
|
||||
{
|
||||
_owner.disablePacket = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://d3da4b6e4qwtm
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
using Godot;
|
||||
using Newlon.Resources;
|
||||
|
||||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public partial class Seedpacket : TextureButton
|
||||
{
|
||||
public static AudioStream TapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap.mp3");
|
||||
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 GridEntityResource _resource;
|
||||
private Label _cost;
|
||||
private TextureRect _icon;
|
||||
private Timer _timer;
|
||||
private SeedpacketHandler _handler;
|
||||
public bool _forbidden;
|
||||
public bool _locked;
|
||||
|
||||
public bool disablePacket = false;
|
||||
|
||||
public static PackedScene Prefab { get; private set; }
|
||||
|
||||
// Node overrides
|
||||
public override void _Ready()
|
||||
{
|
||||
if (_resource != null)
|
||||
UpdateContents();
|
||||
if (Prefab == null)
|
||||
{
|
||||
Prefab = ResourceLoader.Load<PackedScene>(PATH_TO_PACKED_SCENE);
|
||||
}
|
||||
_cost = GetNode<Label>("Cost");
|
||||
_icon = GetNode<TextureRect>("PlantPreviewContainer/Preview");
|
||||
_timer = GetNode<Timer>("RechargeTimer");
|
||||
}
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Disabled = disablePacket || _timer.TimeLeft > 0;
|
||||
if (_handler is ISeedpacketProcess processHandler) processHandler.Process();
|
||||
}
|
||||
public void SetResource(GridEntityResource resource)
|
||||
{
|
||||
_resource = resource;
|
||||
|
||||
UpdateContents();
|
||||
}
|
||||
|
||||
public GridEntityResource GetResource()
|
||||
{
|
||||
return _resource;
|
||||
}
|
||||
|
||||
public void SetHandler(SeedpacketHandler newHandler)
|
||||
{
|
||||
disablePacket = false;
|
||||
_handler = newHandler;
|
||||
}
|
||||
|
||||
protected virtual void UpdateContents()
|
||||
{
|
||||
_cost.Text = _resource.Cost.ToString();
|
||||
_icon.Texture = _resource.Preview;
|
||||
_timer.WaitTime = _resource.ReloadTime;
|
||||
if (_resource.CustomFrame != null)
|
||||
{
|
||||
TextureNormal = _resource.CustomFrame.frame;
|
||||
_cost.LabelSettings = _resource.CustomFrame.font;
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Pressed()
|
||||
{
|
||||
GrabFocus();
|
||||
if (_forbidden || _locked) return;
|
||||
if (_handler is ISeedpacketPress pressHandler)
|
||||
pressHandler.Pressed();
|
||||
}
|
||||
|
||||
public void Recharge()
|
||||
{
|
||||
_timer.Start();
|
||||
}
|
||||
public void StartWithResourceOffset()
|
||||
{
|
||||
_timer.Start(_resource.ReloadTime * (1.0 - _resource.ReloadProgress)+0.05);
|
||||
Callable.From(()=>{ _timer.WaitTime = _resource.ReloadTime; }).CallDeferred();
|
||||
}
|
||||
|
||||
public void OnUnfocused()
|
||||
{
|
||||
if (_handler is ISeedpacketUnfocus unfocusHandler) unfocusHandler.OnUnfocused();
|
||||
}
|
||||
public void SetForbidden(bool value)
|
||||
{
|
||||
_forbidden = value;
|
||||
GetNode<TextureRect>("ForbiddenTexture").Visible = value;
|
||||
}
|
||||
public void SetLocked(bool value)
|
||||
{
|
||||
_locked = value;
|
||||
GetNode<TextureRect>("LockedTexture").Visible = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cn6ddajdtf4ep
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class SeedpacketHandler
|
||||
{
|
||||
protected Seedpacket _owner;
|
||||
|
||||
public SeedpacketHandler(Seedpacket owner)
|
||||
{
|
||||
_owner = owner;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://cr774updc04fu
|
||||
Loading…
Add table
Add a link
Reference in a new issue