public MenuItem AddMenuItem(MenuItem parent, OtherKeyType key, String text, RhythmGame.GameStateType nextState) { VerticalTextItem newItem = new VerticalTextItem(Game, this); newItem.LargeFont = true; newItem.ItemText = text; newItem.NextState = nextState; MenuItem inside = (MenuItem)newItem; if (parent != null) { if (!parent.AddLink(ref inside, key)) { parent = null; } } if (parent == null) { newItem.ItemSetup(); Selected = newItem; } Items.Add(newItem); Shift += new Action <int, int>(newItem.Shift); return(newItem); }
void BuySkill(RhythmGame.GameStateType state) { List <Player> players = ((RhythmGame)Game).CurrentBand.BandMembers; foreach (RPGPlayer player in players) { SkillInformation info = skillInformation[Selected.ChildId]; if (player.XpManager.SkillPoints >= info.CostToNext) { // Consider it bought. string name = skillInformation[Selected.ChildId].Title; Dictionary <string, Skill> skills = player.SkillManager.Skills; Dictionary <string, Skill> allSkills = player.SkillManager.AllSkills; if (!skills.ContainsKey(name)) { player.SkillManager.gainSkill(name); } if (allSkills[name].AdvanceSkillLevel()) { info.Level = allSkills[name].Level; skillInformation[Selected.ChildId] = info; player.XpManager.SkillPoints -= info.CostToNext; } } else { // Play the failed sound. } } }
public MenuItem AddMenuItem(RhythmGame.GameStateType nextState) { InvisibleMenuItem newItem = new InvisibleMenuItem(Game, this); Items.Add(newItem); newItem.NextState = nextState; newItem.PreSelected += new Action <RhythmGame.GameStateType>(LeavingMenu); return(newItem); }
public MenuItem AddMenuItem(MenuItem parent, OtherKeyType key, String text, RhythmGame.GameStateType nextState, int childId, SkillInformation info) { VerticalTextItem newItem = new VerticalTextItem(Game, this); bool owns = (info.Level <= 0); if (owns) { newItem.FontColor = Color.Gray; } newItem.ChildId = childId; newItem.ItemText = text; if (owns) { newItem.NextState = nextState; } else { newItem.NextState = RhythmGame.GameStateType.None; } //newItem.DriftRateX = -2.0f; //newItem.DriftRateY = -0.25f; //newItem.ScaleRate = 0.9f; newItem.DefaultX = 120; newItem.StartY = 175; MenuItem.ScreenInfo screenInfo = newItem.CurrentInfo; //info.pos.Y -= 220; //info.pos.X += 30; newItem.CurrentInfo = screenInfo; newItem.LargeFont = true; MenuItem inside = (MenuItem)newItem; if (parent != null) { if (!parent.AddLink(ref inside, key)) { parent = null; } } if (parent == null) { newItem.ItemSetup(); Selected = newItem; } skillInformation.Add(childId, info); Items.Add(newItem); Shift += new Action <int, int>(newItem.Shift); newItem.PreSelected += new Action <RhythmGame.GameStateType>(BuySkill); //newItem.PreSelected += new Action<RhythmGame.GameStateType>(LeavingMenu); return(newItem); }
public void LeavingMenu(RhythmGame.GameStateType type) { if (tasks == false) { tasks = true; } else { if (!dispImage) { dispImage = true; } else { ((RhythmGame)Game).CancelMenu(); } } }
public MenuItem AddMenuItem(MenuItem parent, OtherKeyType key, String text, RhythmGame.GameStateType nextState, int childId, TaskInformation info) { VerticalTextItem newItem = new VerticalTextItem(Game, this); newItem.ChildId = childId; newItem.ItemText = text; newItem.NextState = RhythmGame.GameStateType.None; //newItem.DriftRateX = -2.0f; //newItem.DriftRateY = -0.25f; //newItem.ScaleRate = 0.9f; newItem.DefaultX = 120; newItem.StartY = 175; MenuItem.ScreenInfo screenInfo = newItem.CurrentInfo; //info.pos.Y -= 220; //info.pos.X += 30; newItem.CurrentInfo = screenInfo; newItem.LargeFont = true; MenuItem inside = (MenuItem)newItem; if (parent != null) { if (!parent.AddLink(ref inside, key)) { parent = null; } } if (parent == null) { newItem.ItemSetup(); Selected = newItem; } taskInformation.Add(childId, info); Items.Add(newItem); Shift += new Action <int, int>(newItem.Shift); return(newItem); }
public override void Update(GameTime gameTime) { oldState = state; state = ((RhythmGame)Game).State; if (state == RhythmGame.GameStateType.Running) { if (testing) { ((ASDFGInput)Input).fake = testing; if (Notes.IsInNotePadding(Notes.CurrentNoteSet)) { int index = 0; Keys[] k = new Keys[7]; if ((Notes.CurrentNoteSet.type & 1) > 0) { k[index++] = Keys.A; } if ((Notes.CurrentNoteSet.type & 2) > 0) { k[index++] = Keys.S; } if ((Notes.CurrentNoteSet.type & 4) > 0) { k[index++] = Keys.D; } if ((Notes.CurrentNoteSet.type & 8) > 0) { k[index++] = Keys.F; } if ((Notes.CurrentNoteSet.type & 16) > 0) { k[index++] = Keys.G; } if (random.Next() > 0.5) { k[index++] = Keys.R; } k[index++] = Keys.Up; ((ASDFGInput)Input).UpdateFakeKeys(k); } } } base.Update(gameTime); if (Input.OtherKeyPressed(OtherKeyType.Power)) { ActivateSkill(); } if (NotesHit % 25 == 24 && lastNotesHit != NotesHit) { lastNotesHit = NotesHit; ReadyRandomSkill(); } Dictionary <string, Skill> skills = skillManager.Skills; foreach (KeyValuePair <string, Skill> pair in skills) { if (!pair.Value.Active && !pair.Value.OnGoing) { skillManager.getSkillEnd(pair.Key)(); } else if (pair.Value.Active && !pair.Value.OnGoing) { // Another hack. pair.Value.UpdateSkill(gameTime); } } skillManager.UpdateOngoingSkills(gameTime); // endTasks(); // Tasks if (state == RhythmGame.GameStateType.Running) { if (!tasksActive) { taskManager.StartTasks(); tasksActive = true; } taskManager.Update(); } if (state != oldState) { if (state == RhythmGame.GameStateType.SongSuccess) { taskManager.EndTasks(); tasksActive = false; } /* Don't award complete if song failed or canceled */ else if (state == RhythmGame.GameStateType.SongFail || state == RhythmGame.GameStateType.SongCancel) { taskManager.CancelTasks(); tasksActive = false; } } }