mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:47:37 +02:00
Better game selection
This commit is contained in:
@ -45,6 +45,8 @@ namespace RhythmHeavenMania.Editor
|
||||
GameIcon_.gameObject.SetActive(true);
|
||||
GameIcon_.name = EventCaller.instance.minigames[i].displayName;
|
||||
}
|
||||
|
||||
GridGameSelector.GetComponent<GridGameSelector>().SelectGame("Game Manager", 1);
|
||||
}
|
||||
|
||||
public static Sprite GameIcon(string name)
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using TMPro;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace RhythmHeavenMania.Editor
|
||||
{
|
||||
@ -13,6 +14,7 @@ namespace RhythmHeavenMania.Editor
|
||||
[Header("Components")]
|
||||
public GameObject GameEventSelector;
|
||||
public GameObject EventRef;
|
||||
public GameObject CurrentSelected;
|
||||
|
||||
[Header("Properties")]
|
||||
private EventCaller.MiniGame mg;
|
||||
@ -72,13 +74,26 @@ namespace RhythmHeavenMania.Editor
|
||||
currentEventIndex = 0;
|
||||
}
|
||||
|
||||
if (currentEventIndex > 2)
|
||||
{
|
||||
EventRef.transform.parent.parent.transform.DOLocalMoveY((EventRef.GetComponent<RectTransform>().sizeDelta.y + 5) * (currentEventIndex - 2), 0.35f).SetEase(Ease.OutExpo);
|
||||
}
|
||||
else
|
||||
{
|
||||
EventRef.transform.parent.parent.transform.DOLocalMoveY(0, 0.35f).SetEase(Ease.OutExpo);
|
||||
}
|
||||
|
||||
CurrentSelected.transform.DOLocalMoveY(EventRef.transform.parent.GetChild(currentEventIndex + 1).transform.localPosition.y, 0.35f).SetEase(Ease.OutExpo);
|
||||
|
||||
SetColor(currentEventIndex);
|
||||
}
|
||||
|
||||
public void SelectGame(string gameName)
|
||||
public void SelectGame(string gameName, int index)
|
||||
{
|
||||
DestroyEvents();
|
||||
|
||||
transform.GetChild(index).GetChild(0).gameObject.SetActive(true);
|
||||
|
||||
SelectedMinigame = gameName;
|
||||
|
||||
mg = EventCaller.instance.minigames.Find(c => c.displayName == gameName);
|
||||
@ -104,6 +119,11 @@ namespace RhythmHeavenMania.Editor
|
||||
|
||||
private void DestroyEvents()
|
||||
{
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
transform.GetChild(i).GetChild(0).gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
for (int i = 1; i < EventRef.transform.parent.childCount; i++)
|
||||
{
|
||||
Destroy(EventRef.transform.parent.GetChild(i).gameObject);
|
||||
|
@ -11,7 +11,7 @@ namespace RhythmHeavenMania.Editor
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
GridGameSelector.SelectGame(this.gameObject.name);
|
||||
GridGameSelector.SelectGame(this.gameObject.name, this.transform.GetSiblingIndex());
|
||||
}
|
||||
|
||||
public void OnEnter()
|
||||
|
Reference in New Issue
Block a user