public static TaskDialogAbstract GetTask(TaskDialog taskDialog, int taskScore, Player player) { switch (taskDialog) { case TaskDialog.Bear: return new BearTask(player.Name, player.Score); case TaskDialog.Make: return new MakeTask(taskScore,player.Name,player.Score); case TaskDialog.Refuse: return new RefuseTask(taskScore); case TaskDialog.RefuseAndMove: return new RefuseAndMoveTask(player.Name, player.Score); default: throw new NotImplementedException(); } }
public void ShowDialogOnButtonClick(TaskDialog taskDialog, Player currentPlayer) { var task = ShowDialogTask (taskDialog, currentPlayer); task.RunSynchronously(); }
private Task ShowDialogTask(TaskDialog taskDialog, Player currentPlayer) { var fragmentTransaction = FragmentManager.BeginTransaction(); var prev = FragmentManager.FindFragmentByTag("answer"); if (prev != null) fragmentTransaction.Remove(prev); int taskScore = Rep.Instance.Tasks.Current.Score; var dialog = new TaskProgressDialog (taskDialog, currentPlayer, taskScore) { ShowsDialog = true }; dialog.Show (fragmentTransaction, "answer"); _isRefusing = taskDialog == TaskDialog.Refuse; return !_isRefusing && !_taskEnumerator.MoveNext () ? new Task (EndOfGame) : new Task (MoveNextStep); }
public GameFragment(Player player) { _player = player; }
public TaskProgressDialog(TaskDialog taskDialog, Player currentPlayer, int taskScore) { _taskDialog = taskDialog; _currentPlayer = currentPlayer; _taskScore = taskScore; }