mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 17:15:55 +00:00
Changed UI sprites to use sprite in resource
This commit is contained in:
parent
9717ca8a55
commit
f2482e4e38
10 changed files with 47 additions and 13 deletions
|
|
@ -92,7 +92,12 @@ public partial class Hud : CanvasLayer
|
|||
var hbox = new HBoxContainer();
|
||||
_itemsContainer.AddChild(hbox);
|
||||
|
||||
var instance = item.HudItemScene.Instantiate<TextureRect>();
|
||||
var instance = new TextureRect();
|
||||
instance.Texture = item.InventorySprite;
|
||||
instance.StretchMode = TextureRect.StretchModeEnum.Keep;
|
||||
// change transform size?
|
||||
|
||||
//var instance = item.HudItemScene.Instantiate<TextureRect>();
|
||||
//_in.CallDeferred("add_child", instance);
|
||||
hbox.AddChild(instance);
|
||||
|
||||
|
|
|
|||
|
|
@ -348,11 +348,11 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
EmitSignal(nameof(InteractableAreaEntered), interactable);
|
||||
|
||||
if (_selector == null) return;
|
||||
//_selector.Position = interactable.Position;
|
||||
_selector.SelectedInteractable = interactable;
|
||||
//_selector.AddInteractable(interactable);
|
||||
//_selector.Visible = true;
|
||||
//_lastInteractable = interactable;
|
||||
|
||||
_selector.AddInteractable(interactable);
|
||||
|
||||
//_selector.SelectedInteractable = interactable;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public partial class LootItem : Resource
|
|||
[Export] public bool ConsumeOnUse;
|
||||
[Export] public UiItemType UiType;
|
||||
|
||||
[Export] public AtlasTexture InventorySprite;
|
||||
[Export] public Texture2D InventorySprite;
|
||||
[Export] public SpriteFrames WorldSprite;
|
||||
[Export] public PackedScene HudItemScene;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,15 @@ public partial class Selector : Node2D
|
|||
if (Input.IsActionJustPressed("scan"))
|
||||
{
|
||||
SelectNext();
|
||||
|
||||
}
|
||||
|
||||
if (SelectedInteractable != null) {
|
||||
this.Visible = true;
|
||||
this.GlobalPosition = SelectedInteractable.GlobalPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +115,7 @@ public partial class Selector : Node2D
|
|||
|
||||
public void UpdatePosition()
|
||||
{
|
||||
return;
|
||||
if (SelectedInteractable != null)
|
||||
{
|
||||
this.Position = SelectedInteractable.Position;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue