implement #648 "properly"

try to fix weird performance regression in board meeting
This commit is contained in:
minenice55 2024-01-21 19:36:12 -05:00
parent 7b9a8036d0
commit 89da70002f
4 changed files with 44 additions and 42 deletions

View file

@ -643,22 +643,22 @@ namespace HeavenStudio.Games
bgMat.SetColor("_Color", bgColorFrom);
cloudMat.SetColor("_Color", cloudColorFrom);
objectMat.SetColor("_Color", objectsColorFrom);
lightsColor = (lastTime == DayNightCycle.Night) ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0);
lightsColor = (lastTime == DayNightCycle.Twilight) ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0);
}
else if (normalizedBeat >= 0 && normalizedBeat <= 1f)
{
bgMat.SetColor("_Color", GetEasedColor(bgColorFrom, bgColorTo));
cloudMat.SetColor("_Color", GetEasedColor(cloudColorFrom, cloudColorTo));
objectMat.SetColor("_Color", GetEasedColor(objectsColorFrom, objectsColorTo));
lightsColor = GetEasedColor((lastTime == DayNightCycle.Night) ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0),
(currentTime == DayNightCycle.Night) ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0));
lightsColor = GetEasedColor((lastTime == DayNightCycle.Twilight) ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0),
(currentTime == DayNightCycle.Twilight) ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0));
}
else if (normalizedBeat > 1)
{
bgMat.SetColor("_Color", bgColorTo);
cloudMat.SetColor("_Color", cloudColorTo);
objectMat.SetColor("_Color", objectsColorTo);
lightsColor = (currentTime == DayNightCycle.Night) ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0);
lightsColor = (currentTime == DayNightCycle.Twilight) ? new Color(1, 1, 1, 1) : new Color(1, 1, 1, 0);
}
island2Lights.color = lightsColor;
@ -698,7 +698,7 @@ namespace HeavenStudio.Games
{
DayNightCycle.Day => Color.white,
DayNightCycle.Noon => noonColor,
DayNightCycle.Night => nightColor,
DayNightCycle.Twilight => nightColor,
_ => throw new System.NotImplementedException()
};
@ -706,7 +706,7 @@ namespace HeavenStudio.Games
{
DayNightCycle.Day => Color.white,
DayNightCycle.Noon => noonColor,
DayNightCycle.Night => nightColor,
DayNightCycle.Twilight => nightColor,
_ => throw new System.NotImplementedException()
};
@ -714,7 +714,7 @@ namespace HeavenStudio.Games
{
DayNightCycle.Day => Color.white,
DayNightCycle.Noon => noonColorCloud,
DayNightCycle.Night => nightColorCloud,
DayNightCycle.Twilight => nightColorCloud,
_ => throw new System.NotImplementedException()
};
@ -722,7 +722,7 @@ namespace HeavenStudio.Games
{
DayNightCycle.Day => Color.white,
DayNightCycle.Noon => noonColorCloud,
DayNightCycle.Night => nightColorCloud,
DayNightCycle.Twilight => nightColorCloud,
_ => throw new System.NotImplementedException()
};
DayNightCycleUpdate();
@ -760,7 +760,7 @@ namespace HeavenStudio.Games
{
Day = 0,
Noon = 1,
Night = 2
Twilight = 2
}
public void ServeObject(double beat, double targetBeat, bool type)

View file

@ -66,9 +66,9 @@ namespace HeavenStudio.Games.Loaders
}
}
},
new List<string>() {"rvl", "normal"},
new List<string>() { "rvl", "normal" },
"rvlrotation", "en",
new List<string>() {"en"}
new List<string>() { "en" }
);
}
}
@ -108,7 +108,7 @@ namespace HeavenStudio.Games
private void OnDestroy()
{
foreach(var evt in scheduledInputs)
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
@ -125,7 +125,7 @@ namespace HeavenStudio.Games
if (cond.isPlaying && !cond.isPaused)
{
if (PlayerInput.GetIsAction(InputAction_BasicPressing) && !IsExpectingInputNow(InputAction_BasicPress.inputLockCategory))
if (PlayerInput.GetIsAction(InputAction_BasicPressing) && !IsExpectingInputNow(InputAction_BasicPress))
{
if (executives[executiveCount - 1].spinning)
{
@ -133,10 +133,6 @@ namespace HeavenStudio.Games
SoundByte.PlayOneShotGame("boardMeeting/miss");
SoundByte.PlayOneShot("miss");
ScoreMiss();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
}
}
}
@ -150,7 +146,7 @@ namespace HeavenStudio.Games
void SingleBop()
{
if (assistantCanBop)
if (assistantCanBop)
{
if (missCounter > 0) assistantAnim.DoScaledAnimationAsync("MissBop", 0.5f);
else assistantAnim.DoScaledAnimationAsync("Bop", 0.5f);
@ -196,8 +192,8 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat, delegate { assistantAnim.DoScaledAnimationAsync("One", 0.5f); }),
new BeatAction.Action(beat + 1, delegate { assistantAnim.DoScaledAnimationAsync("Three", 0.5f); }),
new BeatAction.Action(beat + 2, delegate
{
new BeatAction.Action(beat + 2, delegate
{
foreach (var executive in executives)
{
if (executive.player) continue;
@ -214,7 +210,7 @@ namespace HeavenStudio.Games
}),
new BeatAction.Action(beat + 2.5f, delegate { assistantCanBop = true; })
});
ScheduleInput(beat, 2f, InputAction_BasicPress, JustAssistant, MissAssistant, Empty);
ScheduleInput(beat, 2f, InputAction_BasicPress, JustAssistant, MissAssistant, Empty, CanJust);
}
public void Stop(double beat, float length)
@ -225,23 +221,22 @@ namespace HeavenStudio.Games
{
if (executives[i].player) break;
int index = i;
stops.Add(new BeatAction.Action(beat + length * i, delegate
int ex = executiveCount;
if (executiveCount < 4) ex = 4;
if (index < ex - 3)
{
SoundByte.PlayOneShotGame("boardMeeting/stopA", beat + length * i);
}
else if (index == ex - 3)
{
SoundByte.PlayOneShotGame("boardMeeting/stopB", beat + length * i);
}
else if (index == ex - 2)
{
SoundByte.PlayOneShotGame("boardMeeting/stopC", beat + length * i);
}
stops.Add(new BeatAction.Action(beat + length * i, delegate
{
int ex = executiveCount;
if (executiveCount < 4) ex = 4;
if (index < ex - 3)
{
SoundByte.PlayOneShotGame("boardMeeting/stopA");
}
else if (index == ex - 3)
{
SoundByte.PlayOneShotGame("boardMeeting/stopB");
}
else if (index == ex - 2)
{
SoundByte.PlayOneShotGame("boardMeeting/stopC");
}
if (index == executiveCount - 2 && !executives[executiveCount - 1].spinning)
{
if (chairLoopSound != null)
@ -250,12 +245,12 @@ namespace HeavenStudio.Games
chairLoopSound = null;
}
}
executives[index].Stop();
executives[index].Stop();
}));
}
stops.Add(new BeatAction.Action(beat + length * executiveCount + 0.5f, delegate { executivesCanBop = true; }));
BeatAction.New(instance, stops);
ScheduleInput(beat, length * (executiveCount - 1), InputAction_BasicPress, Just, Miss, Empty);
ScheduleInput(beat, length * (executiveCount - 1), InputAction_BasicPress, Just, Miss, Empty, CanJust);
}
public void Prepare()
@ -303,6 +298,7 @@ namespace HeavenStudio.Games
{
if (start > executiveCount || end > executiveCount) return;
bool forceStart = false;
chairLoopSound?.KillLoop(0);
if (chairLoopSound == null)
{
chairLoopSound = SoundByte.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true);
@ -386,6 +382,11 @@ namespace HeavenStudio.Games
InitExecutives();
}
bool CanJust()
{
return executives[executiveCount - 1].spinning;
}
void Just(PlayerActionEvent caller, float state)
{
if (chairLoopSound != null)

View file

@ -79,7 +79,7 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 0.5f,
parameters = new()
{
new("d", DoubleDate.DayTime.Noon, "Time", "Set the time of day.")
new("d", DoubleDate.DayTime.Sunset, "Time", "Set the time of day.")
}
}
},
@ -192,7 +192,7 @@ namespace HeavenStudio.Games
public enum DayTime
{
Day,
Noon
Sunset
}
private void DayTimeCheck(double beat)
@ -206,7 +206,7 @@ namespace HeavenStudio.Games
public void SetTime(int time)
{
if (time == (int)DayTime.Noon)
if (time == (int)DayTime.Sunset)
{
doubleDateCellAnim.SetColor("_Color", noonColor);
bgSquare.color = squareColor;

View file

@ -41,5 +41,6 @@ MonoBehaviour:
- Assets/Scripts/Games/AirRally/AirRally.cs
- Assets/Scripts/LevelEditor/Editor.cs
- Assets/Scripts/Common/MemRenderer.cs
- Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs
PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: []