private void webBrowser_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { toggle = !toggle; if (toggle) { return; } if (e.KeyCode == Keys.ShiftKey) { switch (selectionState) { case SelectionState.IDLE: selectionState = SelectionState.INPROGRESS; break; case SelectionState.INPROGRESS: selectionState = SelectionState.SELECTED; analyzeElement(currentElement); break; case SelectionState.SELECTED: selectionState = SelectionState.INPROGRESS; break; } } else { selectionState = SelectionState.IDLE; } statusStrip1.Items[1].Text = selectionState.ToString(); }
protected override void DoStateTransition(SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (!(base.gameObject.activeInHierarchy)) { return; } foreach (var info in betterTransitions) { if (state != SelectionState.Disabled && isOn) { var tglTr = betterToggleTransitions.FirstOrDefault( (o) => o.TransitionStates != null && info.TransitionStates != null && o.TransitionStates.Target == info.TransitionStates.Target && o.Mode == info.Mode); if (tglTr != null) { continue; } } info.SetState(state.ToString(), instant); } }
protected override void DoStateTransition(SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (!(base.gameObject.activeInHierarchy)) { return; } foreach (var info in betterTransitions) { info.SetState(state.ToString(), instant); } }
public void Draw(SpriteBatch spriteBatch, SpriteFont font) { const int leftPos = 15; const int rightPos = 600; const int height = 500; const int lifeOffset = 20; const int staminaOffset = 40; const int offset = 20; Character[] lpCharacters = leftParty.characters; Character[] rpCharacters = rightParty.characters; for (int numberOfCharacter = 0; numberOfCharacter < lpCharacters.Length; numberOfCharacter++) { Character chr = lpCharacters[numberOfCharacter]; if (chr == null) { break; } Vector2 namePosition = new Vector2(leftPos, (height / (lpCharacters.Length)) * numberOfCharacter + offset); Vector2 lifePosition = new Vector2(leftPos, (height / (lpCharacters.Length)) * numberOfCharacter + lifeOffset + offset); Vector2 staminaPosition = new Vector2(leftPos, (height / (lpCharacters.Length)) * numberOfCharacter + staminaOffset + offset); if (chr == selectedUser) { spriteBatch.DrawString(font, chr.name, namePosition, CHARACTER_SELECTED); } else { spriteBatch.DrawString(font, chr.name, namePosition, CHARACTER_UNSELECTED); } spriteBatch.DrawString(font, String.Format("Life: {0}/{1}", chr.currentLife, chr.maxLife), lifePosition, Color.Red); spriteBatch.DrawString(font, String.Format("Stamina: {0}/{1}", chr.currentStamina, chr.maxStamina), staminaPosition, Color.Yellow); } for (int numberOfCharacter = 0; numberOfCharacter < rpCharacters.Length; numberOfCharacter++) { Character chr = rpCharacters[numberOfCharacter]; if (chr == null) { break; } Vector2 namePosition = new Vector2(rightPos, (height / rpCharacters.Length + 1) * numberOfCharacter + offset); Vector2 lifePosition = new Vector2(rightPos, (height / rpCharacters.Length + 1) * numberOfCharacter + lifeOffset + offset); Vector2 staminaPosition = new Vector2(rightPos, (height / rpCharacters.Length + 1) * numberOfCharacter + staminaOffset + offset); spriteBatch.DrawString(font, chr.name, namePosition, Color.White); spriteBatch.DrawString(font, String.Format("Life: {0}/{1}", chr.currentLife, chr.maxLife), lifePosition, Color.Red); spriteBatch.DrawString(font, String.Format("Stamina: {0}/{1}", chr.currentStamina, chr.maxStamina), staminaPosition, Color.Yellow); } // Debug Draw Vector2 DebugPos = new Vector2(340, 300); Vector2 DebugPos2 = new Vector2(340, 320); spriteBatch.DrawString(font, selectState.ToString(), DebugPos, Color.AliceBlue); for (int skillNum = 0; skillNum < skills.Length; skillNum++) { if (skills[skillNum] == null) { break; } spriteBatch.DrawString(font, skills[skillNum].name, new Vector2(DebugPos2.X, DebugPos2.Y + (20 * (skillNum + 1))), Color.AliceBlue); } } // Draw