mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:47:38 +02:00
Icon Improvement Concept & Resizeable Window (#104)
* Editor: mostly PoC icon effects * slightly more responsive selection * resizeable window game camera still doesn't letterbox properly, will need a bit more work * letterbox both in editor and in fullscreen * restore camera rects when returning to editor
This commit is contained in:
@ -16,6 +16,7 @@ namespace HeavenStudio.Editor
|
||||
public string SelectedMinigame;
|
||||
|
||||
[Header("Components")]
|
||||
public GameObject SelectedGameIcon;
|
||||
public GameObject GameEventSelector;
|
||||
public GameObject EventRef;
|
||||
public GameObject CurrentSelected;
|
||||
@ -96,6 +97,10 @@ namespace HeavenStudio.Editor
|
||||
|
||||
public void SelectGame(string gameName, int index)
|
||||
{
|
||||
if (SelectedGameIcon != null)
|
||||
{
|
||||
SelectedGameIcon.GetComponent<GridGameSelectorGame>().UnClickIcon();
|
||||
}
|
||||
mg = EventCaller.instance.minigames.Find(c => c.displayName == gameName);
|
||||
SelectedMinigame = gameName;
|
||||
gameOpen = true;
|
||||
@ -103,7 +108,9 @@ namespace HeavenStudio.Editor
|
||||
DestroyEvents();
|
||||
AddEvents();
|
||||
|
||||
transform.GetChild(index).GetChild(0).gameObject.SetActive(true);
|
||||
// transform.GetChild(index).GetChild(0).gameObject.SetActive(true);
|
||||
SelectedGameIcon = transform.GetChild(index).gameObject;
|
||||
SelectedGameIcon.GetComponent<GridGameSelectorGame>().ClickIcon();
|
||||
|
||||
currentEventIndex = 0;
|
||||
UpdateIndex(0, false);
|
||||
|
@ -1,6 +1,9 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using DG.Tweening;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class GridGameSelectorGame : MonoBehaviour
|
||||
@ -9,14 +12,44 @@ namespace HeavenStudio.Editor
|
||||
|
||||
public GridGameSelector GridGameSelector;
|
||||
|
||||
public Texture MaskTex;
|
||||
public Texture BgTex;
|
||||
private Material m_Material;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Tooltip.AddTooltip(this.gameObject, this.gameObject.name);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
GridGameSelector.SelectGame(this.gameObject.name, this.transform.GetSiblingIndex());
|
||||
}
|
||||
|
||||
//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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user