2023-03-03 04:24:02 +00:00
using System.Collections ;
using System.Linq ;
using System ;
using System.Collections.Generic ;
using UnityEngine ;
using HeavenStudio.Util ;
2023-10-29 19:44:47 +00:00
using HeavenStudio.InputSystem ;
2023-03-03 04:24:02 +00:00
namespace HeavenStudio.Games.Loaders
{
using static Minigames ;
public static class NtrDazzlesLoader
{
public static Minigame AddGame ( EventCaller eventCaller )
{
2023-04-02 02:28:23 +00:00
return new Minigame ( "theDazzles" , "The Dazzles" , "9cfff7" , false , false , new List < GameAction > ( )
2023-03-03 04:24:02 +00:00
{
2024-01-15 02:04:10 +00:00
new GameAction ( "bop" , "Bop" )
{
function = delegate { var e = eventCaller . currentEntity ; TheDazzles . instance . Bop ( e . beat , e . length , e [ "toggle2" ] , e [ "toggle" ] ) ; } ,
resizable = true ,
parameters = new List < Param > ( )
{
new Param ( "toggle2" , true , "Bop" , "Toggle if the dazzles should bop for the duration of this event." ) ,
new Param ( "toggle" , false , "Bop (Auto)" , "Toggle if the dazzles should automatically bop until another Bop event is reached." )
}
} ,
2023-03-03 04:24:02 +00:00
new GameAction ( "crouch" , "Crouch" )
{
preFunction = delegate { var e = eventCaller . currentEntity ; TheDazzles . PreCrouch ( e . beat , e . length , e [ "countIn" ] ) ; } ,
defaultLength = 3f ,
parameters = new List < Param > ( )
{
2024-01-15 02:04:10 +00:00
new Param ( "countIn" , TheDazzles . CountInType . DS , "Count In Type" , "Set if the count-in should be from Megamix, DS or random." )
2023-03-03 04:24:02 +00:00
}
} ,
new GameAction ( "crouchStretch" , "Crouch (Stretchable)" )
{
preFunction = delegate { var e = eventCaller . currentEntity ; TheDazzles . PreCrouch ( e . beat , e . length , e [ "countIn" ] ) ; } ,
defaultLength = 3f ,
resizable = true ,
parameters = new List < Param > ( )
{
2024-01-15 02:04:10 +00:00
new Param ( "countIn" , TheDazzles . CountInType . DS , "Count In Type" , "Set if the count-in should be from Megamix, DS or random." )
2023-03-03 04:24:02 +00:00
}
} ,
new GameAction ( "poseThree" , "Pose Horizontal" )
{
2023-08-12 03:31:59 +00:00
preFunction = delegate { var e = eventCaller . currentEntity ; TheDazzles . PrePose ( e . beat , e . length , 0f , 1f , 2f , 0f , 1f , 2f , e [ "toggle" ] , e [ "toggle2" ] ) ; } ,
2023-03-03 04:24:02 +00:00
defaultLength = 3f ,
parameters = new List < Param > ( )
{
2024-01-15 02:04:10 +00:00
new Param ( "toggle" , false , "Stars" , "Toggle if stars should appear when successfully posing." ) ,
new Param ( "toggle2" , true , "Cheer Sounds" , "Toggle if cheering sounds should be played when successfully posing." )
2023-03-03 04:24:02 +00:00
}
} ,
new GameAction ( "poseTwo" , "Pose Vertical" )
{
2023-08-12 03:31:59 +00:00
preFunction = delegate { var e = eventCaller . currentEntity ; TheDazzles . PrePose ( e . beat , e . length , 0f , 0f , 0f , 2f , 2f , 2f , e [ "toggle" ] , e [ "toggle2" ] ) ; } ,
2023-03-03 04:24:02 +00:00
defaultLength = 4f ,
parameters = new List < Param > ( )
{
2024-01-15 02:04:10 +00:00
new Param ( "toggle" , true , "Stars" , "Toggle if stars should appear when successfully posing." ) ,
new Param ( "toggle2" , true , "Cheer Sounds" , "Toggle if cheering sounds should be played when successfully posing." )
2023-03-03 04:24:02 +00:00
}
} ,
new GameAction ( "poseSixDiagonal" , "Pose Diagonal" )
{
2023-08-12 03:31:59 +00:00
preFunction = delegate { var e = eventCaller . currentEntity ; TheDazzles . PrePose ( e . beat , e . length , 0f , 2.75f , 1.5f , 2f , 0.75f , 3.5f , e [ "toggle" ] , e [ "toggle2" ] ) ; } ,
2023-03-03 04:24:02 +00:00
defaultLength = 4.5f ,
parameters = new List < Param > ( )
{
2024-01-15 02:04:10 +00:00
new Param ( "toggle" , false , "Stars" , "Toggle if stars should appear when successfully posing." ) ,
new Param ( "toggle2" , true , "Cheer Sounds" , "Toggle if cheering sounds should be played when successfully posing." )
2023-03-03 04:24:02 +00:00
}
} ,
new GameAction ( "poseSixColumns" , "Pose Rows" )
{
2023-08-12 03:31:59 +00:00
preFunction = delegate { var e = eventCaller . currentEntity ; TheDazzles . PrePose ( e . beat , e . length , 0f , 0.5f , 1f , 2f , 2.5f , 3f , e [ "toggle" ] , e [ "toggle2" ] ) ; } ,
2023-03-03 04:24:02 +00:00
defaultLength = 4f ,
parameters = new List < Param > ( )
{
2024-01-15 02:04:10 +00:00
new Param ( "toggle" , false , "Stars" , "Toggle if stars should appear when successfully posing." ) ,
new Param ( "toggle2" , true , "Cheer Sounds" , "Toggle if cheering sounds should be played when successfully posing." )
2023-03-03 04:24:02 +00:00
}
} ,
new GameAction ( "poseSix" , "Pose Six" )
{
2023-08-12 03:31:59 +00:00
preFunction = delegate { var e = eventCaller . currentEntity ; TheDazzles . PrePose ( e . beat , e . length , 0f , 0.5f , 1f , 1.5f , 2f , 2.5f , e [ "toggle" ] , e [ "toggle2" ] ) ; } ,
2023-03-03 04:24:02 +00:00
defaultLength = 4.5f ,
parameters = new List < Param > ( )
{
2024-01-15 02:04:10 +00:00
new Param ( "toggle" , true , "Stars" , "Toggle if stars should appear when successfully posing." ) ,
new Param ( "toggle2" , true , "Cheer Sounds" , "Toggle if cheering sounds should be played when successfully posing." )
2023-03-03 04:24:02 +00:00
}
} ,
new GameAction ( "customPose" , "Custom Pose" )
{
2023-08-12 03:31:59 +00:00
preFunction = delegate { var e = eventCaller . currentEntity ; TheDazzles . PrePose ( e . beat , e . length , e [ "upLeft" ] , e [ "upMiddle" ] , e [ "upRight" ] , e [ "downLeft" ] , e [ "downMiddle" ] , e [ "player" ] , e [ "toggle" ] , e [ "toggle2" ] ) ; } ,
2023-03-03 04:24:02 +00:00
defaultLength = 3f ,
resizable = true ,
parameters = new List < Param > ( )
{
2024-01-15 02:04:10 +00:00
new Param ( "upLeft" , new EntityTypes . Float ( 0 , 30f , 0f ) , "Up Left Girl Pose Beat" , "Set how many beats after the event has started this girl will pose." ) ,
new Param ( "upMiddle" , new EntityTypes . Float ( 0 , 30f , 1f ) , "Up Middle Girl Pose Beat" , "Set how many beats after the event has started this girl will pose." ) ,
new Param ( "upRight" , new EntityTypes . Float ( 0 , 30f , 2f ) , "Up Right Girl Pose Beat" , "Set how many beats after the event has started this girl will pose." ) ,
new Param ( "downLeft" , new EntityTypes . Float ( 0 , 30f , 0f ) , "Down Left Girl Pose Beat" , "Set how many beats after the event has started this girl will pose." ) ,
new Param ( "downMiddle" , new EntityTypes . Float ( 0 , 30f , 1f ) , "Down Middle Girl Pose Beat" , "Set how many beats after the event has started this girl will pose." ) ,
new Param ( "player" , new EntityTypes . Float ( 0 , 30f , 2f ) , "Player Pose Beat" , "Set how many beats after the event has started the player will pose." ) ,
new Param ( "toggle" , false , "Stars" , "Toggle if stars should appear when successfully posing." ) ,
new Param ( "toggle2" , true , "Cheer Sounds" , "Toggle if cheering sounds should be played when successfully posing." )
2023-03-03 04:24:02 +00:00
}
} ,
new GameAction ( "forceHold" , "Force Hold" )
{
function = delegate { TheDazzles . instance . ForceHold ( ) ; } ,
defaultLength = 0.5f
2024-05-19 21:14:39 +00:00
} ,
new GameAction ( "boxColor" , "Background Colors" )
{
function = delegate { var e = eventCaller . currentEntity ; TheDazzles . instance . ChangeBoxColor ( e . beat , e . length , e [ "extStart" ] , e [ "extEnd" ] , e [ "intStart" ] , e [ "intEnd" ] , e [ "wallStart" ] , e [ "wallEnd" ] , e [ "roofStart" ] , e [ "roofEnd" ] , e [ "ease" ] ) ; } ,
defaultLength = 1f ,
resizable = true ,
parameters = new List < Param > ( )
{
new Param ( "extStart" , TheDazzles . defaultExteriorColor , "Exterior Start" , "Set the color of the boxes' exterior at the start of the event." ) ,
new Param ( "extEnd" , TheDazzles . defaultExteriorColor , "Exterior End" , "Set the color of the boxes' exterior at the end of the event." ) ,
new Param ( "intStart" , TheDazzles . defaultInteriorColor , "Interior Start" , "Set the color of the boxes' interiors at the start of the event." ) ,
new Param ( "intEnd" , TheDazzles . defaultInteriorColor , "Interior End" , "Set the color of the boxes' interiors at the end of the event." ) ,
new Param ( "wallStart" , TheDazzles . defaultWallColor , "Walls Start" , "Set the color of the boxes' walls at the start of the event." ) ,
new Param ( "wallEnd" , TheDazzles . defaultWallColor , "Walls End" , "Set the color of the boxes' walls at the end of the event." ) ,
new Param ( "roofStart" , TheDazzles . defaultRoofColor , "Roof Start" , "Set the color of the boxes' roofs at the start of the event." ) ,
new Param ( "roofEnd" , TheDazzles . defaultRoofColor , "Roof End" , "Set the color of the boxes' roofs at the end of the event." ) ,
new Param ( "ease" , Util . EasingFunction . Ease . Linear , "Ease" , "Set the easing of the action." )
} ,
2023-03-03 04:24:02 +00:00
} ,
2023-05-28 17:34:44 +00:00
} ,
new List < string > ( ) { "ntr" , "normal" } ,
"ntrboxshow" , "en" ,
2024-03-29 02:35:07 +00:00
new List < string > ( ) { "en" } ,
chronologicalSortKey : 14
2023-05-28 17:34:44 +00:00
) ;
2023-03-03 04:24:02 +00:00
}
}
}
namespace HeavenStudio.Games
{
using Scripts_TheDazzles ;
public class TheDazzles : Minigame
{
2024-05-19 21:14:39 +00:00
2023-03-03 04:24:02 +00:00
public struct PosesToPerform : IComparable < PosesToPerform >
{
2023-06-10 19:13:29 +00:00
// override object.Equals
public override bool Equals ( object obj )
{
//
// See the full list of guidelines at
// http://go.microsoft.com/fwlink/?LinkID=85237
// and also the guidance for operator== at
// http://go.microsoft.com/fwlink/?LinkId=85238
//
if ( obj = = null | | GetType ( ) ! = obj . GetType ( ) )
{
return false ;
}
// TODO: write your implementation of Equals() here
throw new System . NotImplementedException ( ) ;
}
// override object.GetHashCode
public override int GetHashCode ( )
{
// TODO: write your implementation of GetHashCode() here
throw new System . NotImplementedException ( ) ;
}
2023-03-03 04:24:02 +00:00
public int CompareTo ( PosesToPerform other )
{
if ( other = = null ) return 1 ;
return beat . CompareTo ( other . beat ) ;
}
public static bool operator > ( PosesToPerform operand1 , PosesToPerform operand2 )
{
return operand1 . CompareTo ( operand2 ) > 0 ;
}
public static bool operator < ( PosesToPerform operand1 , PosesToPerform operand2 )
{
return operand1 . CompareTo ( operand2 ) < 0 ;
}
public static bool operator > = ( PosesToPerform operand1 , PosesToPerform operand2 )
{
return operand1 . CompareTo ( operand2 ) > = 0 ;
}
public static bool operator < = ( PosesToPerform operand1 , PosesToPerform operand2 )
{
return operand1 . CompareTo ( operand2 ) < = 0 ;
}
public static bool operator = = ( PosesToPerform operand1 , PosesToPerform operand2 )
{
return operand1 . CompareTo ( operand2 ) = = 0 ;
}
public static bool operator ! = ( PosesToPerform operand1 , PosesToPerform operand2 )
{
return operand1 . CompareTo ( operand2 ) ! = 0 ;
}
public int girlIndex ;
public float beat ;
}
public struct QueuedPose
{
2023-06-10 19:13:29 +00:00
public double beat ;
2023-03-03 04:24:02 +00:00
public float length ;
public float upLeftBeat ;
public float upMiddleBeat ;
public float upRightBeat ;
public float downLeftBeat ;
public float downMiddleBeat ;
public float playerBeat ;
public bool stars ;
2023-08-12 03:31:59 +00:00
public bool cheer ;
2023-03-03 04:24:02 +00:00
}
public struct QueuedCrouch
{
2023-06-10 19:13:29 +00:00
public double beat ;
2023-03-03 04:24:02 +00:00
public float length ;
public int countInType ;
}
public enum CountInType
{
DS = 0 ,
Megamix = 1 ,
Random = 2 ,
}
2024-05-19 21:14:39 +00:00
public static Color defaultExteriorColor = new ( 156 / 255f , 254 / 255f , 246 / 255f ) ;
public static Color defaultInteriorColor = new ( 66 / 255f , 255 / 255f , 239 / 255f ) ;
public static Color defaultWallColor = new ( 0f , 222 / 255f , 197 / 255f ) ;
public static Color defaultRoofColor = new ( 0f , 189 / 255f , 172 / 255f ) ;
private ColorEase extColorEase = new ( defaultExteriorColor ) ;
private ColorEase intColorEase = new ( defaultInteriorColor ) ;
private ColorEase wallColorEase = new ( defaultWallColor ) ;
private ColorEase roofColorEase = new ( defaultRoofColor ) ;
2023-03-03 04:24:02 +00:00
public static TheDazzles instance ;
[Header("Variables")]
2024-04-07 21:25:54 +00:00
//bool canBop = true;
2023-03-03 04:24:02 +00:00
bool doingPoses = false ;
bool shouldHold = false ;
2023-06-10 19:13:29 +00:00
double crouchEndBeat ;
2023-03-03 04:24:02 +00:00
static List < QueuedPose > queuedPoses = new List < QueuedPose > ( ) ;
static List < QueuedCrouch > queuedCrouches = new List < QueuedCrouch > ( ) ;
[Header("Components")]
[SerializeField] List < TheDazzlesGirl > npcGirls = new List < TheDazzlesGirl > ( ) ;
[SerializeField] TheDazzlesGirl player ;
[SerializeField] ParticleSystem poseEffect ;
[SerializeField] ParticleSystem starsEffect ;
2024-05-19 21:14:39 +00:00
[Header("RecolorMaterials")]
public Material interiorMat ;
public Material exteriorMat ;
2023-03-03 04:24:02 +00:00
2023-10-29 19:44:47 +00:00
public static PlayerInput . InputAction InputAction_TouchRelease =
new ( "NtrBoxshowTouchRelease" , new int [ ] { IAEmptyCat , IAReleaseCat , IAEmptyCat } ,
IA_Empty , IA_TouchBasicRelease , IA_Empty ) ;
2023-03-03 04:24:02 +00:00
void OnDestroy ( )
{
if ( queuedPoses . Count > 0 ) queuedPoses . Clear ( ) ;
if ( queuedCrouches . Count > 0 ) queuedCrouches . Clear ( ) ;
2023-06-03 23:30:17 +00:00
foreach ( var evt in scheduledInputs )
{
evt . Disable ( ) ;
}
2023-03-03 04:24:02 +00:00
}
void Awake ( )
{
instance = this ;
2023-12-05 22:38:52 +00:00
SetupBopRegion ( "theDazzles" , "bop" , "toggle" ) ;
2024-05-19 21:14:39 +00:00
interiorMat . SetColor ( "_ColorAlpha" , defaultRoofColor ) ;
interiorMat . SetColor ( "_ColorBravo" , defaultInteriorColor ) ;
interiorMat . SetColor ( "_ColorDelta" , defaultWallColor ) ;
exteriorMat . SetColor ( "_AddColor" , defaultExteriorColor ) ;
2023-03-03 04:24:02 +00:00
}
2023-11-23 16:19:39 +00:00
public override void OnBeatPulse ( double beat )
{
2023-12-05 22:38:52 +00:00
if ( BeatIsInBopRegion ( beat ) )
2023-11-23 16:19:39 +00:00
{
foreach ( var girl in npcGirls )
{
girl . Bop ( ) ;
}
player . Bop ( ) ;
}
}
2024-01-20 02:46:21 +00:00
public override void OnPlay ( double beat )
2023-03-03 04:24:02 +00:00
{
2024-01-20 02:46:21 +00:00
if ( queuedPoses . Count > 0 ) queuedPoses . Clear ( ) ;
if ( queuedCrouches . Count > 0 ) queuedCrouches . Clear ( ) ;
2024-05-19 21:14:39 +00:00
PersistColor ( beat ) ;
2024-01-20 02:46:21 +00:00
}
2023-03-03 04:24:02 +00:00
2024-01-20 02:46:21 +00:00
void Update ( )
{
2024-05-19 21:14:39 +00:00
BoxColorUpdate ( ) ;
2024-01-20 02:46:21 +00:00
if ( conductor . isPlaying & & ! conductor . isPaused )
2023-03-03 04:24:02 +00:00
{
if ( queuedPoses . Count > 0 )
{
foreach ( var pose in queuedPoses )
{
2023-08-12 03:31:59 +00:00
Pose ( pose . beat , pose . length , pose . upLeftBeat , pose . upMiddleBeat , pose . upRightBeat , pose . downLeftBeat , pose . downMiddleBeat , pose . playerBeat , pose . stars , pose . cheer ) ;
2023-03-03 04:24:02 +00:00
}
queuedPoses . Clear ( ) ;
}
if ( queuedCrouches . Count > 0 )
{
foreach ( var crouch in queuedCrouches )
{
CrouchStretchable ( crouch . beat , crouch . length , crouch . countInType ) ;
}
queuedCrouches . Clear ( ) ;
}
2023-10-29 19:44:47 +00:00
if ( PlayerInput . GetIsAction ( InputAction_BasicPress ) & & ! IsExpectingInputNow ( InputAction_BasicPress ) )
2023-03-03 04:24:02 +00:00
{
player . Prepare ( false ) ;
2023-06-10 19:13:29 +00:00
SoundByte . PlayOneShotGame ( "theDazzles/miss" ) ;
2023-03-03 04:24:02 +00:00
foreach ( var girl in npcGirls )
{
if ( girl . currentEmotion ! = TheDazzlesGirl . Emotion . Ouch ) girl . currentEmotion = TheDazzlesGirl . Emotion . Angry ;
}
}
2023-10-29 19:44:47 +00:00
if ( PlayerInput . GetIsAction ( InputAction_FlickRelease ) & & ! IsExpectingInputNow ( InputAction_FlickRelease ) )
2023-03-03 04:24:02 +00:00
{
2023-10-29 19:44:47 +00:00
if ( doingPoses | | PlayerInput . CurrentControlStyle = = InputController . ControlStyles . Touch )
2023-03-03 04:24:02 +00:00
{
2023-10-29 19:44:47 +00:00
player . Pose ( false , doingPoses ) ;
2023-06-10 19:13:29 +00:00
SoundByte . PlayOneShotGame ( "theDazzles/miss" ) ;
2023-10-29 19:44:47 +00:00
if ( doingPoses )
2023-03-03 04:24:02 +00:00
{
2023-10-29 19:44:47 +00:00
foreach ( var girl in npcGirls )
{
girl . Ouch ( ) ;
}
2023-03-03 04:24:02 +00:00
}
}
else
{
player . UnPrepare ( ) ;
}
shouldHold = false ;
}
2024-01-20 02:46:21 +00:00
if ( PlayerInput . CurrentControlStyle = = InputController . ControlStyles . Touch )
2023-10-29 19:44:47 +00:00
{
2024-01-20 02:46:21 +00:00
if ( PlayerInput . GetIsAction ( InputAction_TouchRelease ) & & ! gameManager . autoplay )
{
player . UnPrepare ( ) ;
shouldHold = false ;
}
2023-10-29 19:44:47 +00:00
}
2024-01-20 02:46:21 +00:00
else
2023-03-03 04:24:02 +00:00
{
2024-01-20 02:46:21 +00:00
if ( PlayerInput . GetIsAction ( InputAction_BasicRelease ) & & shouldHold & & ( ! gameManager . autoplay ) & & ! IsExpectingInputNow ( InputAction_FlickRelease ) )
2023-03-03 04:24:02 +00:00
{
2024-01-20 02:46:21 +00:00
if ( doingPoses )
2023-03-03 04:24:02 +00:00
{
2024-01-20 02:46:21 +00:00
player . Pose ( false ) ;
SoundByte . PlayOneShotGame ( "theDazzles/miss" ) ;
foreach ( var girl in npcGirls )
{
girl . Ouch ( ) ;
}
2023-03-03 04:24:02 +00:00
}
2024-01-20 02:46:21 +00:00
else
{
player . UnPrepare ( ) ;
}
shouldHold = false ;
2023-03-03 04:24:02 +00:00
}
}
}
}
2023-06-10 19:13:29 +00:00
public void Bop ( double beat , float length , bool goBop , bool autoBop )
2023-03-07 17:22:32 +00:00
{
if ( goBop )
{
for ( int i = 0 ; i < length ; i + + )
{
2023-09-11 22:28:04 +00:00
BeatAction . New ( instance , new List < BeatAction . Action > ( )
2023-03-07 17:22:32 +00:00
{
new BeatAction . Action ( beat + i , delegate
{
foreach ( var girl in npcGirls )
{
girl . Bop ( ) ;
}
player . Bop ( ) ;
} )
} ) ;
}
}
}
2023-03-03 04:24:02 +00:00
public void ForceHold ( )
{
shouldHold = true ;
foreach ( var girl in npcGirls )
{
girl . Prepare ( ) ;
}
player . Prepare ( ) ;
}
2023-06-10 19:13:29 +00:00
public static void PreCrouch ( double beat , float length , int countInType )
2023-03-03 04:24:02 +00:00
{
float actualLength = length / 3 ;
int realCountInType = countInType ;
if ( countInType = = ( int ) CountInType . Random ) realCountInType = UnityEngine . Random . Range ( 0 , 2 ) ;
List < MultiSound . Sound > soundsToPlay = new List < MultiSound . Sound > ( ) ;
switch ( realCountInType )
{
case ( int ) CountInType . DS :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "theDazzles/holdDS3" , beat , 1 , 0.75f , false , 0.212f ) ,
new MultiSound . Sound ( "theDazzles/holdDS2" , beat + 1f * actualLength , 1 , 0.75f , false , 0.242f ) ,
new MultiSound . Sound ( "theDazzles/hold1" , beat + 2f * actualLength , 1 , 1 , false , 0.019f ) ,
} ) ;
break ;
case ( int ) CountInType . Megamix :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "theDazzles/hold3" , beat , 1 , 1 , false , 0.267f ) ,
new MultiSound . Sound ( "theDazzles/hold2" , beat + 1f * actualLength , 1 , 1 , false , 0.266f ) ,
new MultiSound . Sound ( "theDazzles/hold1" , beat + 2f * actualLength , 1 , 1 , false , 0.019f ) ,
} ) ;
break ;
default :
break ;
}
MultiSound . Play ( soundsToPlay . ToArray ( ) , forcePlay : true ) ;
if ( GameManager . instance . currentGame = = "theDazzles" )
{
instance . CrouchStretchable ( beat , length , countInType ) ;
}
else
{
queuedCrouches . Add ( new QueuedCrouch { beat = beat , length = length , countInType = countInType } ) ;
}
}
2023-06-10 19:13:29 +00:00
public void CrouchStretchable ( double beat , float length , int countInType )
2023-03-03 04:24:02 +00:00
{
float actualLength = length / 3 ;
crouchEndBeat = beat + length ;
2023-10-29 19:44:47 +00:00
ScheduleInput ( beat , 2f * actualLength , InputAction_BasicPress , JustCrouch , Nothing , Nothing ) ;
2023-03-03 04:24:02 +00:00
2023-09-11 22:28:04 +00:00
BeatAction . New ( instance , new List < BeatAction . Action > ( )
2023-03-03 04:24:02 +00:00
{
new BeatAction . Action ( beat , delegate
{
2024-04-07 21:25:54 +00:00
//npcGirls[1].canBop = false; Unused value - Marc
//npcGirls[4].canBop = false; Unused value - Marc
2023-03-03 04:24:02 +00:00
npcGirls [ 1 ] . Prepare ( ) ;
npcGirls [ 4 ] . Prepare ( ) ;
} ) ,
new BeatAction . Action ( beat + 1f * actualLength , delegate
{
2024-04-07 21:25:54 +00:00
//npcGirls[0].canBop = false; Unused value - Marc
//npcGirls[3].canBop = false; Unused value - Marc
2023-03-03 04:24:02 +00:00
npcGirls [ 0 ] . Prepare ( ) ;
npcGirls [ 3 ] . Prepare ( ) ;
} ) ,
new BeatAction . Action ( beat + 2f * actualLength , delegate
{
2024-04-07 21:25:54 +00:00
//npcGirls[2].canBop = false; Unused value - Marc
2023-03-03 04:24:02 +00:00
npcGirls [ 2 ] . Prepare ( ) ;
} ) ,
} ) ;
}
2023-08-12 03:31:59 +00:00
public static void PrePose ( double beat , float length , float upLeftBeat , float upMiddleBeat , float upRightBeat , float downLeftBeat , float downMiddleBeat , float playerBeat , bool stars , bool cheer )
2023-03-03 04:24:02 +00:00
{
if ( GameManager . instance . currentGame = = "theDazzles" )
{
2023-08-12 03:31:59 +00:00
instance . Pose ( beat , length , upLeftBeat , upMiddleBeat , upRightBeat , downLeftBeat , downMiddleBeat , playerBeat , stars , cheer ) ;
2023-03-03 04:24:02 +00:00
}
else
{
queuedPoses . Add ( new QueuedPose { beat = beat , upLeftBeat = upLeftBeat , stars = stars , length = length ,
2023-08-12 03:31:59 +00:00
downLeftBeat = downLeftBeat , playerBeat = playerBeat , upMiddleBeat = upMiddleBeat , downMiddleBeat = downMiddleBeat , upRightBeat = upRightBeat , cheer = cheer } ) ;
2023-03-03 04:24:02 +00:00
}
}
2023-08-12 03:31:59 +00:00
public void Pose ( double beat , float length , float upLeftBeat , float upMiddleBeat , float upRightBeat , float downLeftBeat , float downMiddleBeat , float playerBeat , bool stars , bool cheer )
2023-03-03 04:24:02 +00:00
{
if ( stars )
{
2023-10-29 19:44:47 +00:00
ScheduleInput ( beat , playerBeat , InputAction_FlickRelease , cheer ? JustPoseStars : JustPoseStarsNoCheer , MissPose , Nothing ) ;
2023-03-03 04:24:02 +00:00
}
else
{
2023-10-29 19:44:47 +00:00
ScheduleInput ( beat , playerBeat , InputAction_FlickRelease , cheer ? JustPose : JustPoseNoCheer , MissPose , Nothing ) ;
2023-03-03 04:24:02 +00:00
}
2023-06-10 19:13:29 +00:00
double crouchBeat = beat - 1f ;
2023-03-03 04:24:02 +00:00
if ( crouchBeat < crouchEndBeat )
{
crouchBeat = crouchEndBeat - 1f ;
}
MultiSound . Play ( new MultiSound . Sound [ ]
{
new MultiSound . Sound ( "theDazzles/crouch" , crouchBeat ) ,
} , forcePlay : true ) ;
List < float > soundBeats = new List < float > ( )
{
upLeftBeat ,
upMiddleBeat ,
upRightBeat ,
downLeftBeat ,
downMiddleBeat ,
} ;
List < float > soundsToRemove = new List < float > ( ) ;
foreach ( var sound in soundBeats )
{
if ( sound = = playerBeat ) soundsToRemove . Add ( sound ) ;
}
if ( soundsToRemove . Count > 0 )
{
foreach ( var sound in soundsToRemove )
{
soundBeats . Remove ( sound ) ;
}
}
soundBeats = soundBeats . Distinct ( ) . ToList ( ) ;
List < MultiSound . Sound > soundsToPlay = new List < MultiSound . Sound > ( ) ;
foreach ( var sound in soundBeats )
{
soundsToPlay . Add ( new MultiSound . Sound ( "theDazzles/pose" , beat + sound ) ) ;
}
MultiSound . Play ( soundsToPlay . ToArray ( ) , forcePlay : true ) ;
List < PosesToPerform > posesToPerform = new List < PosesToPerform > ( )
{
new PosesToPerform { beat = upLeftBeat , girlIndex = 4 } ,
new PosesToPerform { beat = upMiddleBeat , girlIndex = 3 } ,
new PosesToPerform { beat = upRightBeat , girlIndex = 2 } ,
new PosesToPerform { beat = downLeftBeat , girlIndex = 1 } ,
new PosesToPerform { beat = downMiddleBeat , girlIndex = 0 } ,
} ;
posesToPerform . Sort ( ) ;
foreach ( var pose in posesToPerform )
{
npcGirls [ pose . girlIndex ] . StartReleaseBox ( beat + pose . beat ) ;
}
player . StartReleaseBox ( beat + playerBeat ) ;
List < BeatAction . Action > posesToDo = new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat - 1f , delegate
{
foreach ( var girl in npcGirls )
{
2024-04-07 21:25:54 +00:00
//girl.canBop = false; Unused value - Marc
2023-03-03 04:24:02 +00:00
girl . Hold ( ) ;
}
2024-04-07 21:25:54 +00:00
//player.canBop = false; Unused value - Marc
2023-03-03 04:24:02 +00:00
player . Hold ( ) ;
} ) ,
new BeatAction . Action ( beat , delegate
{
doingPoses = true ;
} ) ,
} ;
for ( int i = 0 ; i < posesToPerform . Count ; i + + )
{
int index = posesToPerform [ i ] . girlIndex ;
posesToDo . Add ( new BeatAction . Action ( beat + posesToPerform [ i ] . beat , delegate
{
npcGirls [ index ] . Pose ( ) ;
} ) ) ;
}
posesToDo . Add ( new BeatAction . Action ( beat + playerBeat , delegate
{
doingPoses = false ;
} ) ) ;
posesToDo . Add ( new BeatAction . Action ( beat + length , delegate
{
foreach ( var girl in npcGirls )
{
girl . EndPose ( ) ;
}
player . EndPose ( ) ;
} ) ) ;
posesToDo . Add ( new BeatAction . Action ( beat + length + 0.1f , delegate
{
foreach ( var girl in npcGirls )
{
2024-04-07 21:25:54 +00:00
//girl.canBop = true; Unused value - Marc
2023-03-03 04:24:02 +00:00
}
2024-04-07 21:25:54 +00:00
//player.canBop = true; Unused value - Marc
2023-03-03 04:24:02 +00:00
} ) ) ;
2023-09-11 22:28:04 +00:00
BeatAction . New ( instance , posesToDo ) ;
2023-03-03 04:24:02 +00:00
}
void JustCrouch ( PlayerActionEvent caller , float state )
{
2024-04-07 21:25:54 +00:00
//player.canBop = false; Unused value - Marc
2023-03-03 04:24:02 +00:00
if ( state > = 1f | | state < = - 1f )
{
player . Prepare ( ) ;
return ;
}
SuccessCrouch ( ) ;
}
void SuccessCrouch ( )
{
player . Prepare ( ) ;
}
void JustPose ( PlayerActionEvent caller , float state )
{
shouldHold = false ;
2023-06-10 19:13:29 +00:00
SoundByte . PlayOneShotGame ( "theDazzles/pose" ) ;
SoundByte . PlayOneShotGame ( "theDazzles/posePlayer" ) ;
2023-03-03 04:24:02 +00:00
if ( state > = 1f | | state < = - 1f )
{
player . Pose ( ) ;
return ;
}
2023-08-12 03:31:59 +00:00
SuccessPose ( false , true ) ;
2023-03-03 04:24:02 +00:00
}
void JustPoseStars ( PlayerActionEvent caller , float state )
{
shouldHold = false ;
2023-06-10 19:13:29 +00:00
SoundByte . PlayOneShotGame ( "theDazzles/pose" ) ;
SoundByte . PlayOneShotGame ( "theDazzles/posePlayer" ) ;
2023-03-03 04:24:02 +00:00
if ( state > = 1f | | state < = - 1f )
{
player . Pose ( ) ;
return ;
}
2023-08-12 03:31:59 +00:00
SuccessPose ( true , true ) ;
2023-03-03 04:24:02 +00:00
}
2023-08-12 03:31:59 +00:00
void JustPoseNoCheer ( PlayerActionEvent caller , float state )
{
shouldHold = false ;
SoundByte . PlayOneShotGame ( "theDazzles/pose" ) ;
SoundByte . PlayOneShotGame ( "theDazzles/posePlayer" ) ;
if ( state > = 1f | | state < = - 1f )
{
player . Pose ( ) ;
return ;
}
SuccessPose ( false , false ) ;
}
void JustPoseStarsNoCheer ( PlayerActionEvent caller , float state )
{
shouldHold = false ;
SoundByte . PlayOneShotGame ( "theDazzles/pose" ) ;
SoundByte . PlayOneShotGame ( "theDazzles/posePlayer" ) ;
if ( state > = 1f | | state < = - 1f )
{
player . Pose ( ) ;
return ;
}
SuccessPose ( true , false ) ;
}
void SuccessPose ( bool stars , bool cheer )
2023-03-03 04:24:02 +00:00
{
player . Pose ( ) ;
2023-08-12 03:31:59 +00:00
if ( cheer ) SoundByte . PlayOneShotGame ( "theDazzles/applause" ) ;
2023-03-03 04:24:02 +00:00
foreach ( var girl in npcGirls )
{
girl . currentEmotion = TheDazzlesGirl . Emotion . Happy ;
}
player . currentEmotion = TheDazzlesGirl . Emotion . Happy ;
if ( stars )
{
starsEffect . Play ( ) ;
2023-06-10 19:13:29 +00:00
SoundByte . PlayOneShotGame ( $"theDazzles/stars{UnityEngine.Random.Range(1, 6)}" ) ;
2023-03-03 04:24:02 +00:00
}
else poseEffect . Play ( ) ;
}
void MissPose ( PlayerActionEvent caller )
{
foreach ( var girl in npcGirls )
{
if ( girl . currentEmotion ! = TheDazzlesGirl . Emotion . Ouch ) girl . currentEmotion = TheDazzlesGirl . Emotion . Angry ;
}
player . hasOuched = true ;
}
void Nothing ( PlayerActionEvent caller ) { }
2024-05-19 21:14:39 +00:00
private void BoxColorUpdate ( )
{
interiorMat . SetColor ( "_ColorAlpha" , roofColorEase . GetColor ( ) ) ;
interiorMat . SetColor ( "_ColorBravo" , intColorEase . GetColor ( ) ) ;
interiorMat . SetColor ( "_ColorDelta" , wallColorEase . GetColor ( ) ) ;
exteriorMat . SetColor ( "_AddColor" , extColorEase . GetColor ( ) ) ;
}
public void ChangeBoxColor ( double beat , float length , Color exteriorStart , Color exteriorEnd , Color interiorStart , Color interiorEnd , Color wallsStart , Color wallsEnd , Color roofStart , Color roofEnd , int ease )
{
extColorEase = new ColorEase ( beat , length , exteriorStart , exteriorEnd , ease ) ;
intColorEase = new ColorEase ( beat , length , interiorStart , interiorEnd , ease ) ;
wallColorEase = new ColorEase ( beat , length , wallsStart , wallsEnd , ease ) ;
roofColorEase = new ColorEase ( beat , length , roofStart , roofEnd , ease ) ;
}
private void PersistColor ( double beat )
{
var allEventsBeforeBeat = EventCaller . GetAllInGameManagerList ( "theDazzles" , new string [ ] { "boxColor" } ) . FindAll ( x = > x . beat < beat ) ;
if ( allEventsBeforeBeat . Count > 0 )
{
allEventsBeforeBeat . Sort ( ( x , y ) = > x . beat . CompareTo ( y . beat ) ) ; //just in case
var lastEvent = allEventsBeforeBeat [ ^ 1 ] ;
ChangeBoxColor ( lastEvent . beat , lastEvent . length , lastEvent [ "extStart" ] , lastEvent [ "extEnd" ] , lastEvent [ "intStart" ] , lastEvent [ "intEnd" ] , lastEvent [ "wallStart" ] , lastEvent [ "wallEnd" ] , lastEvent [ "roofStart" ] , lastEvent [ "roofEnd" ] , lastEvent [ "ease" ] ) ;
}
}
public override void OnGameSwitch ( double beat )
{
PersistColor ( beat ) ;
}
2023-03-03 04:24:02 +00:00
}
2024-05-19 21:14:39 +00:00
}