private void GetInput(int index, string input, ref ControlsQB cQB) { #if INPUTREQUIRED if (input.Contains(',')) { string[] splitInput = input.Split(','); unpauseInput[index] = new InputAction[splitInput.Length]; for (int i = 0; i < splitInput.Length; i++) { unpauseInput[index][i] = cQB.GetInputAction(splitInput[i]); } } else { unpauseInput[index] = new InputAction[1]; unpauseInput[index][0] = cQB.GetInputAction(input); } #endif }
public override void Initialize(Stage stage) { guitarCont = Stage.Content.Load<Texture2D>("UI/Tutorial/guitarContinueTut"); guitarContDim = new Rectangle((int)(Renderer.ScreenWidth * .5f) - 150, (int)(Renderer.ScreenHeight * .7f), 300, 100); controllerCont = Stage.Content.Load<Texture2D>("UI/Tutorial/controllerContinueTut"); controllerContDim = new Rectangle((int)(Renderer.ScreenWidth * .5f) - 150, (int)(Renderer.ScreenHeight * .7f), 300, 100); stage.GetQB<TriggerQB>().RegisterDrawFunction(Draw); numTuts = actor.Parm.GetInt("Num"); #if INPUTREQUIRED unpauseInput = new InputAction[numTuts][]; allInputsRequired = new bool[numTuts]; #endif killEnemies = new bool[numTuts]; spawnEnemy = new bool[numTuts]; triggerDelay = new float[numTuts]; tutImgs = new Microsoft.Xna.Framework.Graphics.Texture2D[numTuts]; imgDim = new Rectangle[numTuts]; //get the control scheme cQB = stage.GetQB<ControlsQB>(); #if !INPUTREQUIRED Red = cQB.GetInputAction("B"); strum = cQB.GetInputAction("Strum"); #endif gp = cQB.GetGamePadType(); Vector2 pos, size; switch (gp) { case Microsoft.Xna.Framework.Input.GamePadType.Guitar: case Microsoft.Xna.Framework.Input.GamePadType.AlternateGuitar: for (int j = 0; j < numTuts; j++) { #if INPUTREQUIRED GetInput(j,actor.Parm.GetString("GuitarInput" + j), ref cQB); #endif tutImgs[j] = Stage.Content.Load<Texture2D>("UI/Tutorial/" + actor.Parm.GetString("GuitarImage" + j)); pos = actor.Parm.GetVector2("GuitarImagePos" + j); size = actor.Parm.GetVector2("GuitarImageSize" + j); imgDim[j] = new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y); } break; default: for (int j = 0; j < numTuts; j++) { #if INPUTREQUIRED GetInput(j, actor.Parm.GetString("ControllerInput" + j), ref cQB); #endif tutImgs[j] = Stage.Content.Load<Texture2D>("UI/Tutorial/" + actor.Parm.GetString("ControllerImage" + j)); pos = actor.Parm.GetVector2("ControllerImagePos" + j); size = actor.Parm.GetVector2("ControllerImageSize" + j); imgDim[j] = new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y); } break; } for (int i = 0; i < numTuts; i++) { #if INPUTREQUIRED if (actor.Parm.HasParm("AllInputsRequired" + i)) allInputsRequired[i] = actor.Parm.GetBool("AllInputsRequired" + i); else allInputsRequired[i] = false; #endif if (actor.Parm.HasParm("SpawnEnemy" + i)) spawnEnemy[i] = actor.Parm.GetBool("SpawnEnemy" + i); else spawnEnemy[i] = false; if (actor.Parm.HasParm("KillEnemies" + i)) killEnemies[i] = actor.Parm.GetBool("KillEnemies" + i); else killEnemies[i] = false; if (actor.Parm.HasParm("TriggerDelay" + i)) triggerDelay[i] = actor.Parm.GetFloat("TriggerDelay" + i); else triggerDelay[i] = 0; } if (actor.Parm.HasParm("EndLevel")) returnToMenu = actor.Parm.GetBool("EndLevel"); actor.RegisterUpdateFunction(Update); UsingOnTriggerEnter = true; UsingOnTriggerStay = false; UsingOnTriggerExit = false; base.Initialize(stage); }