Added WindowComponents class

This commit is contained in:
Pasha Bibko
2026-01-13 10:33:34 +00:00
parent fcbbed1db8
commit e700523706
5 changed files with 74 additions and 2 deletions

View File

@@ -4,6 +4,8 @@ namespace InterfaceOff
{
public abstract class WindowBase : MonoBehaviour
{
public WindowComponents Components { get; set; }
public void InstantiateWindowBase()
{
}

View File

@@ -0,0 +1,10 @@
using UnityEngine;
using UnityEngine.UI;
namespace InterfaceOff
{
public class WindowComponents : MonoBehaviour
{
[field: SerializeField] public Image WindowImage { get; private set; }
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5a14e8386dd24e3793287ff572cb78f8
timeCreated: 1768300161

View File

@@ -36,15 +36,18 @@ namespace InterfaceOff
if (Input.GetKeyDown(KeyCode.Space))
{
GameObject go = Instantiate(SampleChild, GameCanvas.transform);
Type type = WindowTypes.GetRandom();
go.SetActive(true);
Type type = WindowTypes.GetRandom();
WindowBase windowBase = go.AddComponent(type) as WindowBase;
if (DebugUtils.IsNull(windowBase))
{
Debug.LogError("How did this happen");
return;
}
windowBase.Components = go.GetComponent<WindowComponents>();
windowBase.InstantiateWindowBase();
}
}