2022-01-11 00:17:29 +00:00
|
|
|
using UnityEngine;
|
2022-06-14 05:24:41 +00:00
|
|
|
using UnityEngine.Rendering;
|
2022-01-11 00:17:29 +00:00
|
|
|
using UnityEngine.UI;
|
|
|
|
|
2022-06-14 05:24:41 +00:00
|
|
|
using DG.Tweening;
|
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio.Editor
|
2022-01-11 00:17:29 +00:00
|
|
|
{
|
|
|
|
public class GridGameSelectorGame : MonoBehaviour
|
|
|
|
{
|
|
|
|
public GameObject GameTitlePreview;
|
|
|
|
|
|
|
|
public GridGameSelector GridGameSelector;
|
|
|
|
|
2022-06-14 05:24:41 +00:00
|
|
|
public Texture MaskTex;
|
|
|
|
public Texture BgTex;
|
|
|
|
private Material m_Material;
|
|
|
|
|
2022-01-15 05:20:47 +00:00
|
|
|
private void Start()
|
2022-01-11 00:17:29 +00:00
|
|
|
{
|
2022-01-18 00:40:23 +00:00
|
|
|
Tooltip.AddTooltip(this.gameObject, this.gameObject.name);
|
2022-01-11 00:17:29 +00:00
|
|
|
}
|
|
|
|
|
2022-06-14 05:24:41 +00:00
|
|
|
public void SetupTextures()
|
|
|
|
{
|
|
|
|
if (m_Material == null)
|
|
|
|
{
|
|
|
|
m_Material = Instantiate(GetComponent<Image>().material);
|
|
|
|
GetComponent<Image>().material = m_Material;
|
|
|
|
}
|
|
|
|
m_Material.SetTexture("_MaskTex", MaskTex);
|
|
|
|
m_Material.SetTexture("_BgTex", BgTex);
|
|
|
|
}
|
|
|
|
|
2022-01-15 05:20:47 +00:00
|
|
|
public void OnClick()
|
2022-01-11 00:17:29 +00:00
|
|
|
{
|
2022-01-15 05:20:47 +00:00
|
|
|
GridGameSelector.SelectGame(this.gameObject.name, this.transform.GetSiblingIndex());
|
2022-01-11 00:17:29 +00:00
|
|
|
}
|
2022-06-14 05:24:41 +00:00
|
|
|
|
|
|
|
//TODO: animate between shapes
|
|
|
|
public void ClickIcon()
|
|
|
|
{
|
|
|
|
transform.DOScale(new Vector3(1.15f, 1.15f, 1f), 0.1f);
|
|
|
|
BgTex = Resources.Load<Texture>($"Sprites/GeneralPurpose/Circle");
|
|
|
|
SetupTextures();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UnClickIcon()
|
|
|
|
{
|
|
|
|
transform.DOScale(new Vector3(1f, 1f, 1f), 0.1f);
|
|
|
|
BgTex = Resources.Load<Texture>($"Sprites/GeneralPurpose/Square");
|
|
|
|
SetupTextures();
|
|
|
|
}
|
2022-01-11 00:17:29 +00:00
|
|
|
}
|
|
|
|
}
|