mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
Game event selector needs to be rewritten, will do that soon
This commit is contained in:
parent
9af52ba043
commit
5fb90e8212
4 changed files with 11 additions and 102 deletions
|
@ -27,7 +27,7 @@ MonoBehaviour:
|
||||||
defaultAutoPlay: 3
|
defaultAutoPlay: 3
|
||||||
defaultUpdateType: 0
|
defaultUpdateType: 0
|
||||||
defaultTimeScaleIndependent: 0
|
defaultTimeScaleIndependent: 0
|
||||||
defaultEaseType: 6
|
defaultEaseType: 1
|
||||||
defaultEaseOvershootOrAmplitude: 1.70158
|
defaultEaseOvershootOrAmplitude: 1.70158
|
||||||
defaultEasePeriod: 0
|
defaultEasePeriod: 0
|
||||||
defaultAutoKill: 1
|
defaultAutoKill: 1
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ MonoBehaviour:
|
||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_text: Select events for "Game Manager"
|
m_text: Title
|
||||||
m_isRightToLeft: 0
|
m_isRightToLeft: 0
|
||||||
m_fontAsset: {fileID: 11400000, guid: 35949c950a936b744936efd75ae436ea, type: 2}
|
m_fontAsset: {fileID: 11400000, guid: 35949c950a936b744936efd75ae436ea, type: 2}
|
||||||
m_sharedMaterial: {fileID: -212896991529246517, guid: 35949c950a936b744936efd75ae436ea, type: 2}
|
m_sharedMaterial: {fileID: -212896991529246517, guid: 35949c950a936b744936efd75ae436ea, type: 2}
|
||||||
|
@ -6867,6 +6867,7 @@ MonoBehaviour:
|
||||||
Screen: {fileID: 558010761}
|
Screen: {fileID: 558010761}
|
||||||
GridGameSelector: {fileID: 1154875943}
|
GridGameSelector: {fileID: 1154875943}
|
||||||
Timeline: {fileID: 1861169747}
|
Timeline: {fileID: 1861169747}
|
||||||
|
GameEventSelectorTitle: {fileID: 246861490}
|
||||||
NewBTN: {fileID: 1683100750}
|
NewBTN: {fileID: 1683100750}
|
||||||
OpenBTN: {fileID: 1665554291}
|
OpenBTN: {fileID: 1665554291}
|
||||||
SaveBTN: {fileID: 678553526}
|
SaveBTN: {fileID: 678553526}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
namespace RhythmHeavenMania.Editor
|
namespace RhythmHeavenMania.Editor
|
||||||
{
|
{
|
||||||
|
@ -22,6 +23,7 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
[Header("Components")]
|
[Header("Components")]
|
||||||
[SerializeField] private Timeline Timeline;
|
[SerializeField] private Timeline Timeline;
|
||||||
|
[SerializeField] private TMP_Text GameEventSelectorTitle;
|
||||||
|
|
||||||
[Header("Toolbar")]
|
[Header("Toolbar")]
|
||||||
[SerializeField] private Button NewBTN;
|
[SerializeField] private Button NewBTN;
|
||||||
|
@ -91,5 +93,10 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
Debug.Log(json);
|
Debug.Log(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetGameEventTitle(string txt)
|
||||||
|
{
|
||||||
|
GameEventSelectorTitle.text = txt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -79,69 +79,6 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
public void UpdateIndex(int amount)
|
public void UpdateIndex(int amount)
|
||||||
{
|
{
|
||||||
currentEventIndex = amount;
|
|
||||||
|
|
||||||
EventRef.transform.parent.parent.DOKill();
|
|
||||||
CurrentSelected.transform.DOKill();
|
|
||||||
|
|
||||||
if (currentEventIndex < 0)
|
|
||||||
{
|
|
||||||
currentEventIndex = EventRef.transform.parent.childCount - (ignoreSelectCount + 1);
|
|
||||||
}
|
|
||||||
else if (currentEventIndex > EventRef.transform.parent.childCount - (ignoreSelectCount + 1))
|
|
||||||
{
|
|
||||||
currentEventIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentEventIndex > 2)
|
|
||||||
{
|
|
||||||
if (EventRef.transform.parent.childCount - ignoreSelectCount - 4 > currentEventIndex)
|
|
||||||
{
|
|
||||||
EventRef.transform.parent.parent.DOLocalMoveY((EventRef.GetComponent<RectTransform>().sizeDelta.y + 5) * (currentEventIndex - 2), 0.35f).SetEase(Ease.OutExpo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EventRef.transform.parent.parent.DOLocalMoveY((EventRef.GetComponent<RectTransform>().sizeDelta.y + 5) * (EventRef.transform.parent.childCount - 9), 0.35f).SetEase(Ease.OutExpo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EventRef.transform.parent.parent.transform.DOLocalMoveY(0, 0.35f).SetEase(Ease.OutExpo);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = ignoreSelectCount; i < EventRef.transform.parent.childCount; i++)
|
|
||||||
{
|
|
||||||
float easeTime = 0.35f;
|
|
||||||
Ease ease = Ease.OutCirc;
|
|
||||||
int curIndex = currentEventIndex + ignoreSelectCount;
|
|
||||||
|
|
||||||
EventRef.transform.parent.GetChild(i).DOKill();
|
|
||||||
|
|
||||||
EventRef.transform.parent.GetChild(i).localPosition = new Vector3(EventRef.transform.parent.GetChild(i).localPosition.x, EventRef.transform.localPosition.y - ((i - ignoreSelectCount) * EventRef.GetComponent<RectTransform>().sizeDelta.y));
|
|
||||||
|
|
||||||
if (i < curIndex)
|
|
||||||
{
|
|
||||||
EventRef.transform.parent.GetChild(i).transform.DOLocalMove(new Vector3
|
|
||||||
(EventRef.transform.localPosition.x + (posDif),
|
|
||||||
EventRef.transform.parent.GetChild(i).transform.localPosition.y), easeTime).SetEase(ease);
|
|
||||||
}
|
|
||||||
else if (i > curIndex)
|
|
||||||
{
|
|
||||||
EventRef.transform.parent.GetChild(i).transform.DOLocalMove(new Vector3
|
|
||||||
(EventRef.transform.localPosition.x + (posDif),
|
|
||||||
EventRef.transform.parent.GetChild(i).transform.localPosition.y), easeTime).SetEase(ease);
|
|
||||||
}
|
|
||||||
else if (i == curIndex)
|
|
||||||
{
|
|
||||||
EventRef.transform.parent.GetChild(i).transform.DOLocalMove(new Vector3
|
|
||||||
(EventRef.transform.localPosition.x,
|
|
||||||
EventRef.transform.parent.GetChild(i).transform.localPosition.y), easeTime).SetEase(ease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CurrentSelected.transform.DOLocalMoveY(EventRef.transform.parent.GetChild(currentEventIndex + ignoreSelectCount).transform.localPosition.y, 0.35f).SetEase(Ease.OutExpo);
|
|
||||||
|
|
||||||
SetColor(currentEventIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectGame(string gameName, int index)
|
public void SelectGame(string gameName, int index)
|
||||||
|
@ -160,53 +97,17 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
currentEventIndex = 0;
|
currentEventIndex = 0;
|
||||||
|
|
||||||
UpdateIndex(0);
|
Editor.instance.SetGameEventTitle($"Select game event for {gameName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddEvents()
|
private void AddEvents()
|
||||||
{
|
{
|
||||||
if (mg.name != "gameManager")
|
|
||||||
{
|
|
||||||
GameObject sg = Instantiate(EventRef, EventRef.transform.parent);
|
|
||||||
sg.GetComponent<TMP_Text>().text = "switchGame";
|
|
||||||
sg.SetActive(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < mg.actions.Count; i++)
|
|
||||||
{
|
|
||||||
if (mg.actions[i].actionName != "switchGame")
|
|
||||||
{
|
|
||||||
GameObject e = Instantiate(EventRef, EventRef.transform.parent);
|
|
||||||
e.GetComponent<TMP_Text>().text = mg.actions[i].actionName;
|
|
||||||
e.SetActive(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetColor(int ind)
|
|
||||||
{
|
|
||||||
for (int i = ignoreSelectCount; i < EventRef.transform.parent.childCount; i++)
|
|
||||||
{
|
|
||||||
EventRef.transform.parent.GetChild(i).GetComponent<TMP_Text>().color = EditorTheme.theme.properties.EventNormalCol.Hex2RGB();
|
|
||||||
}
|
|
||||||
|
|
||||||
EventRef.transform.parent.GetChild(ind + ignoreSelectCount).GetComponent<TMP_Text>().color = EditorTheme.theme.properties.EventSelectedCol.Hex2RGB();
|
|
||||||
CurrentSelected.GetComponent<Image>().color = EditorTheme.theme.properties.EventSelectedCol.Hex2RGB();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DestroyEvents()
|
private void DestroyEvents()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < transform.childCount; i++)
|
|
||||||
{
|
|
||||||
transform.GetChild(i).GetChild(0).gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = ignoreSelectCount; i < EventRef.transform.parent.childCount; i++)
|
|
||||||
{
|
|
||||||
Destroy(EventRef.transform.parent.GetChild(i).gameObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
gameOpen = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue