public override int HandleSelection(int currentMenu, int selectedIndex, EventOperator handler) { switch (selectedIndex) { case 0: handler.GameMode.ChangeDifficulty(Difficulty.EASY); pressedIndex = selectedIndex; break; case 1: if (!isLocked[selectedIndex]) { handler.GameMode.ChangeDifficulty(Difficulty.NORMAL); pressedIndex = selectedIndex; } break; case 2: if (!isLocked[selectedIndex]) { handler.GameMode.ChangeDifficulty(Difficulty.HARD); pressedIndex = selectedIndex; } break; case 3: GameMode.StartingLevel = 0; //as long as #wave comes after this one return(MenuConstants.WAVE); } return(-1); }
public void Update(GameTime gameTime, EventOperator handler) { menues[CurrentMenu].UpdateUnlocks(handler); int selection = -1; for (int i = 0; i < MenuConstants.MENUITEMS[CurrentMenu].Length; i++) { Vector2 measuredString = menues[CurrentMenu].Font.MeasureString(MenuConstants.MENUITEMS[CurrentMenu][i]); Point indexPosition = new Point((int)(menues[CurrentMenu].Position.X), (int)(menues[CurrentMenu].Position.Y + i * measuredString.Y)); //Might be inprecise for a large number of menuitems DUNNO Point origin = new Point((int)measuredString.X / 2, (int)measuredString.Y / 2); Rectangle boundBox = new Rectangle((int)menues[CurrentMenu].Position.X - origin.X, indexPosition.Y - origin.Y, (int)measuredString.X, (int)measuredString.Y); if (boundBox.Contains(InputHandler.mPosition)) { selection = i; } } selectedIndex = selection; if (InputHandler.isJustPressed(MouseButton.LEFT)) { if (selection != -1) { SoundHandler.PlaySoundEffect((int)IDs.MENUCLICK); } int changedMenu = menues[CurrentMenu].HandleSelection(CurrentMenu, selectedIndex, handler); if (changedMenu >= 0) { selectedIndex = 0; CurrentMenu = changedMenu; } } }
public override int HandleSelection(int currentMenu, int selectedIndex, EventOperator handler) { switch (selectedIndex) { case 0: GameMode.StartingLevel = 0; pressedIndex = selectedIndex; break; case 1: if (!isLocked[selectedIndex]) { GameMode.StartingLevel = 10; pressedIndex = selectedIndex; } break; case 2: if (!isLocked[selectedIndex]) { GameMode.StartingLevel = 20; pressedIndex = selectedIndex; } break; case 3: if (!isLocked[selectedIndex]) { GameMode.StartingLevel = 30; pressedIndex = selectedIndex; } break; case 4: if (!isLocked[selectedIndex]) { GameMode.StartingLevel = 40; pressedIndex = selectedIndex; } break; case 5: if (!isLocked[selectedIndex]) { GameMode.StartingLevel = 50; pressedIndex = selectedIndex; } break; case 6: handler.NewGameState = EventOperator.UPGRADE_STATE; handler.ResetGame(true); break; } return(-1); }
public override void UpdateUnlocks(EventOperator handler) { if (handler.achControl.Achievements[Traits.NORMAL_DIFFICULTY].Unlocked) { isLocked[1] = false; } if (handler.achControl.Achievements[Traits.HARD_DIFFICULTY].Unlocked) { isLocked[2] = false; } }
public override void UpdateUnlocks(EventOperator handler) { if (handler.UpgradeView.IsModified) { isLocked[0] = false; isLocked[1] = false; } else { SetLockedItems(); } }
public AnimatedEventHandler(Game1 game, EventOperator op, GameMode gameMode) { this.gameMode = gameMode; this.game = game; this.op = op; this.font = DrawHelper.BIGFONT; boss = new BossAppearance(); eventTimer = new Timer(COUNTDOWNTIME); logo = SpriteHandler.GetSprite((int)IDs.LOGO); logo.Position = new Vector2(WindowSize.Width / 2, WindowSize.Height / 2); logo.Origin = new Vector2(logo.SpriteRect.Width / 2, logo.SpriteRect.Height / 2); }
public override int HandleSelection(int currentMenu, int selectedIndex, EventOperator handler) { switch (selectedIndex) { case 0: return(MenuConstants.DIFFICULTY); case 1: handler.NewGameState = EventOperator.EXIT; break; } return(-1); }
public override int HandleSelection(int currentMenu, int selectedIndex, EventOperator handler) { switch (selectedIndex) { case 0: handler.NewGameState = EventOperator.UPGRADE_STATE; handler.ResetGame(true); break; case 1: handler.NewGameState = EventOperator.MENU_STATE; handler.ResetGame(false); break; } return(-1); }
private void btnGetSqlRegex_Click(object sender, EventArgs e) { this.txtSqlRegex.Text = String.Empty; string sqlRegex = "SELECT * FROM {Table} WHERE 1=1"; string dataEntityId = this.ParameterSetPlanCollection.General.DataEntityId; if (dataEntityId == String.Empty) { return; } string tableName = DataEntityOperator.GetDataEntity(dataEntityId).Code; sqlRegex = sqlRegex.Replace("{Table}", "[" + tableName + "]"); if (this.ParameterSetPlanCollection.Where.Where == null || this.ParameterSetPlanCollection.Where.Where.Rows.Count == 0) { this.txtSqlRegex.Text = sqlRegex.Replace("WHERE 1=1", String.Empty); return; } sqlRegex += Environment.NewLine; string dataItemName = String.Empty; string valueName = String.Empty; foreach (DataRow dr in this.ParameterSetPlanCollection.Where.Where.Rows) { dataItemName = DataEntityOperator.GetDataItemEntity(dr["DataItem"].ToString()).Code; if (dr["DataSource"].ToString().Split('.')[0] == "FormElement") { valueName = "{FormElement." + this.FormEntity.GetFormElement(dr["DataSource"].ToString().Split('.')[1]).Code + "}"; } else { valueName = "{System." + ((EnumSystemDataSource)Convert.ToInt32(dr["DataSource"].ToString().Split('.')[1])).ToString() + "}"; } sqlRegex += Environment.NewLine + " AND " + EventOperator.CombineFieldAndValue( dataItemName, valueName, (EnumMatchType)Convert.ToInt32(dr["MatchType"].ToString())); } this.txtSqlRegex.Text = sqlRegex.Replace("1=1" + Environment.NewLine + Environment.NewLine + " AND ", Environment.NewLine); }
public override int HandleSelection(int currentMenu, int selectedIndex, EventOperator handler) { switch (selectedIndex) { case 0: if (!isLocked[0]) { handler.NewGameState = EventOperator.GAME_STATE; handler.UpgradeView.UpgradeBar.RemoveSelection(); } break; case 1: if (!isLocked[1]) { handler.UpgradeView.Reset(); } break; } return(-1); }
public override void UpdateUnlocks(EventOperator handler) { if (handler.achControl.Achievements[Traits.WAVE11].Unlocked) { isLocked[1] = false; } if (handler.achControl.Achievements[Traits.WAVE21].Unlocked) { isLocked[2] = false; } if (handler.achControl.Achievements[Traits.WAVE31].Unlocked) { isLocked[3] = false; } if (handler.achControl.Achievements[Traits.WAVE41].Unlocked) { isLocked[4] = false; } if (handler.achControl.Achievements[Traits.WAVE51].Unlocked) { isLocked[5] = false; } }
public override void UpdateUnlocks(EventOperator handler) { }
public abstract int HandleSelection(int currentMenu, int selectedIndex, EventOperator handler);
public abstract void UpdateUnlocks(EventOperator handler);