protected virtual void SelectCharacter(CharacterViewModel character) { HideAll(); if (!IsMove) { if (this.Frontline.Contains(character)) { this.IsFrontlineSkillVisible = true; } else { this.IsBacklineSkillVisible = true; } SelectedCharacter = character; } else { //Can not select frontline character to move if (this.Frontline.Contains(character)) { return; } //If move target is already select frontline then you can't swap with this character if (character.CurrentAction == CharacterAction.FrontLine) { return; } character.CurrentAction = CharacterAction.DefaultSkill; var backlineIndex = this.Backline.IndexOf(character); this.SelectedCharacter.MoveIndex = backlineIndex + this.Frontline.Count; //check if the move character from last select is the same, if not set that character skill to defautl if (this.SelectedCharacter.MoveCharacter != null && !this.SelectedCharacter.MoveCharacter.CharacterIMG.Equals(character.CharacterIMG)) { this.SelectedCharacter.MoveCharacter.CurrentAction = CharacterAction.DefaultSkill; } CheckIfPreviousActionIsReverseThenIncreaseCount(); this.SelectedCharacter.MoveCharacter = character; this.SelectedCharacter.CurrentAction = CharacterAction.Move; character.CurrentAction = CharacterAction.Move; this.IsMove = false; this.ClearScreen(); } }
protected virtual void MoveCharacterLeft() { if (SelectedCharacter == null) { return; } var index = 0; if (this.Frontline.Contains(SelectedCharacter)) { index = SelectedFrontlineCharacterIndex; //First char do nothing if (index < 1) { return; } SelectedCharacter.IsSelected = true; this.Frontline.MoveSelectedElement(-1); SelectedCharacter.IsSelected = false; } else { index = SelectedBacklineCharacterIndex; //not first char in backline if (index > 0) { SelectedCharacter.IsSelected = true; this.Backline.MoveSelectedElement(-1); SelectedCharacter.IsSelected = false; } else //first char in back line, move to the end of frontline { var newfrontChar = new CharacterViewModel { CharacterIMG = SelectedCharacter.CharacterIMG }; this.Backline.Remove(SelectedCharacter); this.Frontline.Add(newfrontChar); SelectedCharacter = newfrontChar; this.FrontlineTempCount += 1; } } }