main menu

This commit is contained in:
Rendo 2025-07-01 17:31:12 +05:00
commit 089ebc4797
35 changed files with 389 additions and 117 deletions

View file

@ -1,10 +1,9 @@
using Godot;
using System;
public partial class ExitButton : Button
{
public override void _Pressed()
{
GetTree().Quit();
GetTree().ChangeSceneToFile("uid://bfstrli64u23y");
}
}

View file

@ -21,7 +21,7 @@ public partial class PauseMenu : Control
}
public void Exit()
{
GetTree().Quit();
GetTree().ChangeSceneToFile("uid://bfstrli64u23y");
}
public static void Pause()
{

View file

@ -6,6 +6,7 @@ using Newlon.Components.Plants;
public partial class Previewport : SubViewport
{
private RuntimePlantData current_display;
private Texture2D start_Field;
[Export] private Label title;
[Export] private RichTextLabel description;
@ -13,6 +14,7 @@ public partial class Previewport : SubViewport
public override void _Ready()
{
GetParent().GetViewport().GuiFocusChanged += OnFocusChanged;
start_Field = GetNode<Sprite2D>("FrameField").Texture;
}
public void OnFocusChanged(Control node)
@ -30,6 +32,12 @@ public partial class Previewport : SubViewport
{
current_display.QueueFree();
}
if (resource.customFrame != null && resource.customFrame.almanachField != null)
{
GetNode<Sprite2D>("FrameField").Texture = resource.customFrame.almanachField;
}
else
GetNode<Sprite2D>("FrameField").Texture = start_Field;
current_display = resource.Scene.Instantiate<RuntimePlantData>();
title.Text = resource.display_name;
description.Text = resource.display_description;

View file

@ -0,0 +1,5 @@
extends RichTextLabel
func _on_meta_clicked(meta: Variant) -> void:
OS.shell_open(meta)

View file

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

View file

@ -0,0 +1,16 @@
extends Node
func _on_play_button_pressed() -> void:
get_tree().change_scene_to_file("res://scenes/prototype_survival.tscn")
$ChannelPlayer.call("Play")
func _on_exit_button_pressed() -> void:
get_tree().quit()
$ChannelPlayer.call("Play")
func _on_button_pressed() -> void:
$"../AboutWindow".popup_centered()
$ChannelPlayer.call("Play")

View file

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

View file

@ -0,0 +1,9 @@
extends AcceptDialog
static var seen = false
func _ready() -> void:
if seen:
return
seen = true
popup_centered()

View file

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

View file

@ -0,0 +1,9 @@
using Godot;
[GlobalClass]
public partial class CustomSeedpacketFrame : Resource
{
[Export] public Texture2D frame;
[Export] public LabelSettings font;
[Export] public Texture2D almanachField;
}

View file

@ -0,0 +1 @@
uid://3m7xks3xq3hl

View file

@ -73,6 +73,11 @@ public partial class Seedpacket : TextureButton
_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()

View file

@ -18,6 +18,7 @@ public partial class PlantResource : Resource
[Export]
public Texture2D Preview;
[Export] public int Layer = 1;
[Export] public CustomSeedpacketFrame customFrame;
public string internal_id;
}

14
scripts/sacrifice.gd Normal file
View file

@ -0,0 +1,14 @@
extends TextureButton
@onready var confirm = $CONFIRM
func _pressed() -> void:
confirm.popup_centered()
func _on_confirm_close_requested() -> void:
get_tree().change_scene_to_file("res://scenes/sacrifice.tscn")
func _on_confirm_confirmed() -> void:
get_tree().change_scene_to_file("res://scenes/sacrifice.tscn")

1
scripts/sacrifice.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://6e8n6kc0y11o