mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-25 19:15:16 +00:00
Game switching in every game
This commit is contained in:
parent
ff6eb94055
commit
660af3f678
5 changed files with 68 additions and 24 deletions
|
@ -5944,8 +5944,8 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: f86858990a87c764892672104bdaef1f, type: 3}
|
m_Script: {fileID: 11500000, guid: f86858990a87c764892672104bdaef1f, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
level: {fileID: 4900000, guid: 4b7512c586e16a847a5b8490bf35e852, type: 3}
|
level: {fileID: 4900000, guid: 244c565c8088cfa4597e0ebda9c7de98, type: 3}
|
||||||
music: {fileID: 0}
|
music: {fileID: 8300000, guid: e5cf71158cc9bff4a8fbfbca1e73e500, type: 3}
|
||||||
debugUI: 0
|
debugUI: 0
|
||||||
playOnStart: 0
|
playOnStart: 0
|
||||||
editor: 1
|
editor: 1
|
||||||
|
|
|
@ -176,21 +176,35 @@ namespace RhythmHeavenMania
|
||||||
|
|
||||||
currentEvent = entities.IndexOf(Mathp.GetClosestInList(entities, beat));
|
currentEvent = entities.IndexOf(Mathp.GetClosestInList(entities, beat));
|
||||||
|
|
||||||
var gameSwitchs = Beatmap.entities.FindAll(c => c.datamodel.Split(1) == "switchGame" && c.beat <= beat);
|
var gameSwitchs = Beatmap.entities.FindAll(c => c.datamodel.Split(1) == "switchGame");
|
||||||
|
|
||||||
string newGame = Beatmap.entities[currentEvent].datamodel.Split(0);
|
string newGame = Beatmap.entities[currentEvent].datamodel.Split(0);
|
||||||
|
|
||||||
if (gameSwitchs.Count > 0)
|
if (gameSwitchs.Count > 0)
|
||||||
{
|
{
|
||||||
newGame = gameSwitchs[gameSwitchs.IndexOf(gameSwitchs.Find(c => c.beat == Mathp.GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat)))].datamodel.Split(2);
|
int index = gameSwitchs.FindIndex(c => c.beat == Mathp.GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat));
|
||||||
|
var closestGameSwitch = gameSwitchs[index];
|
||||||
|
if (closestGameSwitch.beat <= beat)
|
||||||
|
{
|
||||||
|
newGame = closestGameSwitch.datamodel.Split(2);
|
||||||
|
}
|
||||||
|
else if (closestGameSwitch.beat > beat)
|
||||||
|
{
|
||||||
|
if (index - 1 >= 0)
|
||||||
|
{
|
||||||
|
newGame = gameSwitchs[index - 1].datamodel.Split(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newGame = Beatmap.entities[Beatmap.entities.IndexOf(closestGameSwitch) - 1].datamodel.Split(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// newGame = gameSwitchs[gameSwitchs.IndexOf(gameSwitchs.Find(c => c.beat == Mathp.GetClosestInList(gameSwitchs.Select(c => c.beat).ToList(), beat)))].datamodel.Split(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Beatmap.entities[currentEvent].datamodel.Split(1) != "switchGame" && Beatmap.entities[currentEvent].datamodel.Split(0) != "gameManager")
|
|
||||||
{
|
|
||||||
SetGame(newGame);
|
SetGame(newGame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,11 @@ namespace RhythmHeavenMania.Games.ForkLifter
|
||||||
|
|
||||||
public void CheckNextFlick()
|
public void CheckNextFlick()
|
||||||
{
|
{
|
||||||
// allPlayerActions = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "gulp", "sigh", "prepare" });
|
// var allPlayerActions = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "gulp", "sigh", "prepare" });
|
||||||
var allPlayerActions = EventCaller.GetAllPlayerEntities("forkLifter");
|
// var allPlayerActions = EventCaller.GetAllPlayerEntities("forkLifter");
|
||||||
int currentPlayerEvent = GameManager.instance.currentPlayerEvent - EventCaller.GetAllPlayerEntitiesExceptBeforeBeat("forkLifter", Conductor.instance.songPositionInBeats).Count;
|
// int currentPlayerEvent = GameManager.instance.currentEvent - EventCaller.GetAllPlayerEntitiesExceptBeforeBeat("forkLifter", Conductor.instance.songPositionInBeats).Count;
|
||||||
|
|
||||||
if (currentPlayerEvent < allPlayerActions.Count)
|
/* if (currentPlayerEvent < allPlayerActions.Count)
|
||||||
{
|
{
|
||||||
switch (allPlayerActions[currentPlayerEvent].datamodel.Split('/')[1])
|
switch (allPlayerActions[currentPlayerEvent].datamodel.Split('/')[1])
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,9 @@ namespace RhythmHeavenMania.Games.ForkLifter
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ForkLifter.instance.peaPreview.sprite = null;
|
ForkLifter.instance.peaPreview.sprite = null;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
// will fix later
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Prepare()
|
public void Prepare()
|
||||||
|
|
|
@ -48,7 +48,14 @@ namespace RhythmHeavenMania.Editor
|
||||||
if (Timeline.instance.CheckIfMouseInTimeline() && dragTimes < 1)
|
if (Timeline.instance.CheckIfMouseInTimeline() && dragTimes < 1)
|
||||||
{
|
{
|
||||||
dragTimes++;
|
dragTimes++;
|
||||||
Timeline.instance.AddEventObject(mg.name + "/" + mg.actions[currentEventIndex].actionName, true, new Vector3(0, 0));
|
if (currentEventIndex == 0)
|
||||||
|
{
|
||||||
|
Timeline.instance.AddEventObject($"gameManager/switchGame/{mg.name}", true, new Vector3(0, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Timeline.instance.AddEventObject(mg.name + "/" + mg.actions[currentEventIndex - 1].actionName, true, new Vector3(0, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,9 +76,9 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
if (currentEventIndex < 0)
|
if (currentEventIndex < 0)
|
||||||
{
|
{
|
||||||
currentEventIndex = mg.actions.Count - 1;
|
currentEventIndex = EventRef.transform.parent.childCount - 2;
|
||||||
}
|
}
|
||||||
else if (currentEventIndex > mg.actions.Count - 1)
|
else if (currentEventIndex > EventRef.transform.parent.childCount - 2)
|
||||||
{
|
{
|
||||||
currentEventIndex = 0;
|
currentEventIndex = 0;
|
||||||
}
|
}
|
||||||
|
@ -100,16 +107,31 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
mg = EventCaller.instance.minigames.Find(c => c.displayName == gameName);
|
mg = EventCaller.instance.minigames.Find(c => c.displayName == gameName);
|
||||||
|
|
||||||
|
AddEvents();
|
||||||
|
|
||||||
|
gameOpen = true;
|
||||||
|
currentEventIndex = 0;
|
||||||
|
SetColor(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
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++)
|
for (int i = 0; i < mg.actions.Count; i++)
|
||||||
|
{
|
||||||
|
if (mg.actions[i].actionName != "switchGame")
|
||||||
{
|
{
|
||||||
GameObject e = Instantiate(EventRef, EventRef.transform.parent);
|
GameObject e = Instantiate(EventRef, EventRef.transform.parent);
|
||||||
e.GetComponent<TMP_Text>().text = mg.actions[i].actionName;
|
e.GetComponent<TMP_Text>().text = mg.actions[i].actionName;
|
||||||
e.SetActive(true);
|
e.SetActive(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
gameOpen = true;
|
|
||||||
currentEventIndex = 0;
|
|
||||||
SetColor(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetColor(int ind)
|
private void SetColor(int ind)
|
||||||
|
|
|
@ -121,14 +121,16 @@ namespace RhythmHeavenMania.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lastBeatPos = Conductor.instance.songPositionInBeats;
|
|
||||||
|
|
||||||
if (Input.GetMouseButton(1) && !Conductor.instance.isPlaying && CheckIfMouseInTimeline())
|
if (Input.GetMouseButton(1) && !Conductor.instance.isPlaying && CheckIfMouseInTimeline())
|
||||||
{
|
{
|
||||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(TimelineContent, Input.mousePosition, Editor.instance.EditorCamera, out lastMousePos);
|
RectTransformUtility.ScreenPointToLocalPointInRectangle(TimelineContent, Input.mousePosition, Editor.instance.EditorCamera, out lastMousePos);
|
||||||
TimelineSlider.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(lastMousePos.x + 0.12f, 0.25f), 0, Mathf.Infinity), TimelineSlider.transform.localPosition.y);
|
TimelineSlider.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(lastMousePos.x + 0.12f, 0.25f), 0, Mathf.Infinity), TimelineSlider.transform.localPosition.y);
|
||||||
|
|
||||||
|
if (TimelineSlider.localPosition.x != lastBeatPos)
|
||||||
Conductor.instance.SetBeat(TimelineSlider.transform.localPosition.x);
|
Conductor.instance.SetBeat(TimelineSlider.transform.localPosition.x);
|
||||||
|
|
||||||
|
lastBeatPos = TimelineSlider.localPosition.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
float moveSpeed = 750;
|
float moveSpeed = 750;
|
||||||
|
@ -276,6 +278,10 @@ namespace RhythmHeavenMania.Editor
|
||||||
g.transform.GetChild(2).GetComponent<TMP_Text>().text = eventName.Split('/')[1];
|
g.transform.GetChild(2).GetComponent<TMP_Text>().text = eventName.Split('/')[1];
|
||||||
|
|
||||||
TimelineEventObj eventObj = g.GetComponent<TimelineEventObj>();
|
TimelineEventObj eventObj = g.GetComponent<TimelineEventObj>();
|
||||||
|
|
||||||
|
if (eventName.Split(1) == "switchGame")
|
||||||
|
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(2));
|
||||||
|
else
|
||||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(0));
|
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(0));
|
||||||
|
|
||||||
EventCaller.GameAction gameAction = EventCaller.instance.GetGameAction(EventCaller.instance.GetMinigame(eventName.Split(0)), eventName.Split(1));
|
EventCaller.GameAction gameAction = EventCaller.instance.GetGameAction(EventCaller.instance.GetMinigame(eventName.Split(0)), eventName.Split(1));
|
||||||
|
|
Loading…
Reference in a new issue