mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:47:38 +02:00
Put Minigame Definitions in a Dictionary (#614)
* put minigame definitions in a dictionary why haven't we done this two years ago * paranoia
This commit is contained in:
@ -873,10 +873,8 @@ namespace HeavenStudio.Editor.Track
|
||||
|
||||
public TimelineEventObj AddEventObject(string eventName, bool dragNDrop = false, Vector3 pos = new Vector3(), RiqEntity entity = null, bool addEvent = false)
|
||||
{
|
||||
var game = EventCaller.instance.GetMinigame(eventName.Split(0));
|
||||
var action = EventCaller.instance.GetGameAction(game, eventName.Split(1));
|
||||
|
||||
var gameAction = EventCaller.instance.GetGameAction(EventCaller.instance.GetMinigame(eventName.Split(0)), eventName.Split(1));
|
||||
string[] split = eventName.Split('/');
|
||||
var action = EventCaller.instance.GetGameAction(split[0], split[1]);
|
||||
|
||||
if (addEvent)
|
||||
{
|
||||
@ -884,7 +882,7 @@ namespace HeavenStudio.Editor.Track
|
||||
|
||||
if (entity == null)
|
||||
{
|
||||
RiqEntity en = GameManager.instance.Beatmap.AddNewEntity(eventName, 0, gameAction.defaultLength);
|
||||
RiqEntity en = GameManager.instance.Beatmap.AddNewEntity(eventName, 0, action.defaultLength);
|
||||
|
||||
tempEntity = en;
|
||||
|
||||
|
@ -87,32 +87,31 @@ namespace HeavenStudio.Editor.Track
|
||||
|
||||
var eventName = entity.datamodel;
|
||||
|
||||
var game = EventCaller.instance.GetMinigame(eventName.Split(0));
|
||||
var action = EventCaller.instance.GetGameAction(game, eventName.Split(1));
|
||||
var gameAction = EventCaller.instance.GetGameAction(EventCaller.instance.GetMinigame(eventName.Split(0)), eventName.Split(1));
|
||||
string[] split = eventName.Split('/');
|
||||
var action = EventCaller.instance.GetGameAction(split[0], split[1]);
|
||||
|
||||
if (eventName.Split(1) == "switchGame")
|
||||
Icon.sprite = Editor.GameIcon(eventName.Split(2));
|
||||
if (split[1] == "switchGame")
|
||||
Icon.sprite = Editor.GameIcon(split[2]);
|
||||
else
|
||||
Icon.sprite = Editor.GameIcon(eventName.Split(0));
|
||||
Icon.sprite = Editor.GameIcon(split[0]);
|
||||
|
||||
if (gameAction != null)
|
||||
if (action != null)
|
||||
{
|
||||
this.resizable = gameAction.resizable;
|
||||
if (gameAction.resizable == false)
|
||||
this.resizable = action.resizable;
|
||||
if (action.resizable == false)
|
||||
{
|
||||
rectTransform.sizeDelta = new Vector2(gameAction.defaultLength * Timeline.instance.PixelsPerBeat, Timeline.instance.LayerHeight());
|
||||
this.length = gameAction.defaultLength;
|
||||
rectTransform.sizeDelta = new Vector2(action.defaultLength * Timeline.instance.PixelsPerBeat, Timeline.instance.LayerHeight());
|
||||
this.length = action.defaultLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entity != null && gameAction.defaultLength != entity.length)
|
||||
if (entity != null && action.defaultLength != entity.length)
|
||||
{
|
||||
rectTransform.sizeDelta = new Vector2(entity.length * Timeline.instance.PixelsPerBeat, Timeline.instance.LayerHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.sizeDelta = new Vector2(gameAction.defaultLength * Timeline.instance.PixelsPerBeat, Timeline.instance.LayerHeight());
|
||||
rectTransform.sizeDelta = new Vector2(action.defaultLength * Timeline.instance.PixelsPerBeat, Timeline.instance.LayerHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -383,13 +382,13 @@ namespace HeavenStudio.Editor.Track
|
||||
}
|
||||
else if (Input.GetMouseButton(2))
|
||||
{
|
||||
var mgs = EventCaller.instance.minigames;
|
||||
// var mgs = EventCaller.instance.minigames;
|
||||
string[] datamodels = entity.datamodel.Split('/');
|
||||
Debug.Log("Selected entity's datamodel : " + entity.datamodel);
|
||||
|
||||
bool isSwitchGame = datamodels[1] == "switchGame";
|
||||
int gameIndex = mgs.FindIndex(c => c.name == datamodels[isSwitchGame ? 2 : 0]);
|
||||
int block = isSwitchGame ? 0 : mgs[gameIndex].actions.FindIndex(c => c.actionName == datamodels[1]) + 1;
|
||||
// int gameIndex = mgs.FindIndex(c => c.name == datamodels[isSwitchGame ? 2 : 0]);
|
||||
int block = isSwitchGame ? 0 : EventCaller.instance.minigames[datamodels[isSwitchGame ? 2 : 0]].actions.FindIndex(c => c.actionName == datamodels[1]) + 1;
|
||||
|
||||
if (!isSwitchGame)
|
||||
{
|
||||
|
Reference in New Issue
Block a user