Added Harry
This commit is contained in:
46
Assets/Scripts/Windows/ImageWindow.cs
Normal file
46
Assets/Scripts/Windows/ImageWindow.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace InterfaceOff
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct ImageSet
|
||||
{
|
||||
[field: SerializeField] public Sprite[] Images { get; set; }
|
||||
}
|
||||
|
||||
[CreateAssetMenu(fileName = "Image Registry", menuName = "Custom/Create Image Registry")]
|
||||
public class ImageRegistry : ScriptableObject
|
||||
{
|
||||
[field: SerializeField] public ImageSet[] Registered { get; set; }
|
||||
}
|
||||
|
||||
public class ImageWindow : WindowBase
|
||||
{
|
||||
private static Vector3[] Positions =
|
||||
{
|
||||
new(-45, 45f),
|
||||
new(45f, 45f),
|
||||
new(-45, -45),
|
||||
new(45f, -45)
|
||||
};
|
||||
|
||||
public override void OnWindowInstantiation()
|
||||
{
|
||||
Sprite[] sprites = CanvasManager.Instance.Images.Registered[0].Images;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
GameObject go = Instantiate(CanvasManager.Instance.ImagePrefab, transform);
|
||||
RectTransform t = go.GetComponent<RectTransform>();
|
||||
|
||||
t.sizeDelta = new Vector2(80, 80);
|
||||
t.localPosition = Positions[i];
|
||||
|
||||
Image img = go.GetComponent<Image>();
|
||||
img.material = new Material(Shader.Find("UI/Default"));
|
||||
img.sprite = sprites[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Windows/ImageWindow.cs.meta
Normal file
3
Assets/Scripts/Windows/ImageWindow.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43636231300648f0b6d426d55df7ca56
|
||||
timeCreated: 1768313168
|
||||
Reference in New Issue
Block a user