Esempio n. 1
0
        private void Action_Click(object Sender, RoutedEventArgs E)
        {
            if (Participant == null)
            {
                Group.Participants[GroupIndex] = App.CurrentUser;
                this.Join(App.CurrentUser);
                JoinSyncAction?.Invoke(App.CurrentUser);
            }
            else
            {
                if (Participant.Id != App.CurrentUser.Id)
                {
                    var Result = MessageBox.Show("确实要把角色:" + Participant.Name + "踢出房间么?\n" +
                                                 "选是,则将" + Participant.Name + "踢出房间;\n" +
                                                 "选否,则仅将" + Participant.Name + "移出当前角色槽;\n" +
                                                 "选取消,则返回不作任何操作。", "踢翻友谊的小船?",
                                                 MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                    switch (Result)
                    {
                    default:
                        return;

                    case MessageBoxResult.Yes:
                        Group.Participants[GroupIndex] = null;
                        this.Join(null);
                        QuitSyncAction?.Invoke();
                        break;

                    case MessageBoxResult.No:
                        Group.Participants[GroupIndex] = null;
                        this.Join(null);
                        QuitSyncAction?.Invoke();
                        break;
                    }
                }
                else
                {
                    if (MessageBox.Show("确实要将自己移出当前角色槽么?", "移出角色槽",
                                        MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                    {
                        return;
                    }
                    Group.Participants[GroupIndex] = null;
                    this.Join(null);
                    QuitSyncAction?.Invoke();
                }
            }
        }
Esempio n. 2
0
        private void LocalAction_Click(object Sender, RoutedEventArgs E)
        {
            if (Participant == null)
            {
                AiWindow AiWindow = new AiWindow
                {
                    SelfChoosable = !Group.Room.HasParticipated(App.CurrentUser.Id),
                    ChosenAi      = Group.Room.Groups
                                    .SelectMany(O => O.Participants).OfType <AI>().ToList()
                };
                AiWindow.ShowDialog();
                if (AiWindow.Canceled)
                {
                    return;
                }

                if (!AiWindow.IsSelectingAi)
                {
                    Group.Participants[GroupIndex] = App.CurrentUser;
                    this.Join(App.CurrentUser, false);
                    JoinSyncAction?.Invoke(App.CurrentUser);
                }
                else
                {
                    Group.Participants[GroupIndex] = AiWindow.SelectedAi;
                    this.Join(AiWindow.SelectedAi, false);
                    JoinSyncAction?.Invoke(AiWindow.SelectedAi);
                    SkillSelector.Select(AiWindow.SelectedAi.ChooseSkill());
                    //this.Ready();
                }
            }
            else
            {
                if (MessageBox.Show("确实要将" + (Participant.Id == App.CurrentUser.Id ? "自己" : "AI:" + Participant.Name) + "移出当前角色槽么?",
                                    "移出角色槽", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                {
                    return;
                }
                Group.Participants[GroupIndex] = null;
                this.Join(null, false);
                QuitSyncAction?.Invoke();
            }
        }