From 4db005abcd4a99a99c557133f2a617986b7c1a5a Mon Sep 17 00:00:00 2001
From: playinful <82474412+playinful@users.noreply.github.com>
Date: Sun, 19 May 2024 14:41:41 -0400
Subject: [PATCH] default color override
---
Assets/Resources/Games/CatchOfTheDay.prefab | 8 ++++
.../Games/CatchOfTheDay/CatchOfTheDay.cs | 46 +++++++++++++++++++
.../Scripts/Games/CatchOfTheDay/LakeScene.cs | 5 +-
3 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/Assets/Resources/Games/CatchOfTheDay.prefab b/Assets/Resources/Games/CatchOfTheDay.prefab
index fc8a5f3c6..ce8709687 100644
--- a/Assets/Resources/Games/CatchOfTheDay.prefab
+++ b/Assets/Resources/Games/CatchOfTheDay.prefab
@@ -98,6 +98,14 @@ MonoBehaviour:
Angler: {fileID: 1182995623549289263}
LakeScenePrefab: {fileID: 7031810916068253247, guid: 85290dc3ea9c9e241b6da3b302a5da7c, type: 3}
LakeSceneHolder: {fileID: 4634833702056322427}
+ _TopColors:
+ - {r: 0.70980394, g: 0.8705883, b: 0.8705883, a: 1}
+ - {r: 0.70980394, g: 0.8745099, b: 0.6784314, a: 1}
+ - {r: 0.8705883, g: 0.8705883, b: 0.6784314, a: 1}
+ _BottomColors:
+ - {r: 0.4666667, g: 0.7372549, b: 0.8196079, a: 1}
+ - {r: 0.3529412, g: 0.7137255, b: 0.48235297, a: 1}
+ - {r: 0.70980394, g: 0.627451, b: 0.41960788, a: 1}
AnglerTransform: {fileID: 4349535315128336147}
_StickyCanvas: {fileID: 2247341267177786474}
--- !u!1 &1618518225377962056
diff --git a/Assets/Scripts/Games/CatchOfTheDay/CatchOfTheDay.cs b/Assets/Scripts/Games/CatchOfTheDay/CatchOfTheDay.cs
index c325147bf..9e3c57c4f 100644
--- a/Assets/Scripts/Games/CatchOfTheDay/CatchOfTheDay.cs
+++ b/Assets/Scripts/Games/CatchOfTheDay/CatchOfTheDay.cs
@@ -92,8 +92,27 @@ namespace HeavenStudio.Games.Loaders
new Param.CollapseParam((x, _) => (bool)x, new string[] { "fishDensity" })
}),
new Param("fishDensity", new EntityTypes.Float(0f, 1f, 1f), "Fish Density", "Set the density for the fish in the school."),
+ new Param("crossfade", true, "Crossfade", "Set whether or not this scene will fade smoothly into the next one."),
},
},
+ new GameAction("color", "Default Color Override")
+ {
+ function = delegate { var e = eventCaller.currentEntity; CatchOfTheDay.Instance.DefaultColorOverride(e["override"], e["topColorA"], e["bottomColorA"], e["topColorB"], e["bottomColorB"], e["topColorC"], e["bottomColorC"]); },
+ defaultLength = 0.5f,
+ parameters = new List()
+ {
+ new Param("override", true, "Override", "Set whether or not to use a set of overridden colors.", new List()
+ {
+ new Param.CollapseParam((x, _) => (bool)x, new string[] { "topColorA", "bottomColorA", "topColorB", "bottomColorB", "topColorC", "bottomColorC" })
+ }),
+ new Param("topColorA", new Color(0.7098039f, 0.8705882f, 0.8705882f), "Top Color A", "Set the top color for Layout A."),
+ new Param("bottomColorA", new Color(0.4666667f, 0.7372549f, 0.8196079f), "Bottom Color A", "Set the bottom color for Layout A."),
+ new Param("topColorB", new Color(0.7098039f, 0.8745099f, 0.6784314f), "Top Color B", "Set the top color for Layout B."),
+ new Param("bottomColorB", new Color(0.3529412f, 0.7137255f, 0.482353f), "Bottom Color B", "Set the bottom color for Layout B."),
+ new Param("topColorC", new Color(0.8705883f, 0.8705883f, 0.6784314f), "Top Color C", "Set the top color for Layout C."),
+ new Param("bottomColorC", new Color(0.7098039f, 0.627451f, 0.4196079f), "Bottom Color C", "Set the bottom color for Layout C."),
+ }
+ },
new GameAction("moveAngler", "Move Angler")
{
function = delegate { var e = eventCaller.currentEntity; CatchOfTheDay.Instance.SetAnglerMovement(e); },
@@ -171,6 +190,13 @@ namespace HeavenStudio.Games
[SerializeField] GameObject LakeScenePrefab;
[SerializeField] Transform LakeSceneHolder;
+ [SerializeField] Color[] _TopColors;
+ [SerializeField] Color[] _BottomColors;
+ private Color[] TopColorOverrides = null;
+ private Color[] BottomColorOverrides = null;
+ public Color[] TopColors => TopColorOverrides ?? _TopColors;
+ public Color[] BottomColors => BottomColorOverrides ?? _BottomColors;
+
public int? LastLayout;
public Dictionary ActiveLakes = new();
@@ -278,6 +304,11 @@ namespace HeavenStudio.Games
SetAnglerMovement(e);
}
+ if (EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "color" }).LastOrDefault(e => e.beat <= beat) is RiqEntity colorEntity)
+ {
+ DefaultColorOverride(colorEntity["override"], colorEntity["topColorA"], colorEntity["bottomColorA"], colorEntity["topColorB"], colorEntity["bottomColorB"], colorEntity["topColorC"], colorEntity["bottomColorC"]);
+ }
+
// get active fishes
foreach (RiqEntity e in GetActiveFishes(beat))
{
@@ -388,6 +419,19 @@ namespace HeavenStudio.Games
}
_StickyCanvas.Sticky = (bool)e["sticky"];
}
+ public void DefaultColorOverride(bool doOverride, Color topColorA, Color bottomColorA, Color topColorB, Color bottomColorB, Color topColorC, Color bottomColorC)
+ {
+ if (doOverride)
+ {
+ TopColorOverrides = new Color[] { topColorA, topColorB, topColorC };
+ BottomColorOverrides = new Color[] { bottomColorA, bottomColorB, bottomColorC };
+ }
+ else
+ {
+ TopColorOverrides = null;
+ BottomColorOverrides = null;
+ }
+ }
public void DoPickAnim()
{
@@ -477,6 +521,8 @@ namespace HeavenStudio.Games
RiqEntity nextFish = GetNextFish(beat);
if (nextFish is not null)
{
+ if (EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "color" }).LastOrDefault(e => e.beat >= beat && e.beat <= nextFish.beat) is RiqEntity e)
+ DefaultColorOverride(e["override"], e["topColorA"], e["bottomColorA"], e["topColorB"], e["bottomColorB"], e["topColorC"], e["bottomColorC"]);
NewLake(nextFish);
return true;
}
diff --git a/Assets/Scripts/Games/CatchOfTheDay/LakeScene.cs b/Assets/Scripts/Games/CatchOfTheDay/LakeScene.cs
index 9c2fef389..08967e2d6 100644
--- a/Assets/Scripts/Games/CatchOfTheDay/LakeScene.cs
+++ b/Assets/Scripts/Games/CatchOfTheDay/LakeScene.cs
@@ -24,9 +24,6 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
[SerializeField] public GameObject[] SchoolFishes;
[SerializeField] public ParticleSystem[] Bubbles;
- [SerializeField] Color[] TopColors;
- [SerializeField] Color[] BottomColors;
-
public RiqEntity Entity;
public PlayerActionEvent ReelAction;
public CatchOfTheDay Minigame;
@@ -162,7 +159,7 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
}
else
{
- SetBGColors(TopColors[layout], BottomColors[layout]);
+ SetBGColors(minigame.TopColors[layout], minigame.BottomColors[layout]);
}
float xOffset = UnityEngine.Random.Range(-0.5f, 0.5f);