Ejemplo n.º 1
0
        public PlayerHumanLogic(ViewerData data, ViewerActions viewerActions, ILocalizer localizer)
            : base(data, viewerActions, localizer)
        {
            TInfo.QuestionSelected += PlayerClient_QuestionSelected;
            TInfo.ThemeSelected    += PlayerClient_ThemeSelected;

            TInfo.SelectQuestion.CanBeExecuted = false;
            TInfo.SelectTheme.CanBeExecuted    = false;
        }
        public PlayerHumanLogic(Player client, ViewerData data)
            : base(client, data)
        {
            TInfo.QuestionSelected += PlayerClient_QuestionSelected;
            TInfo.ThemeSelected    += PlayerClient_ThemeSelected;

            TInfo.SelectQuestion.CanBeExecuted = false;
            TInfo.SelectTheme.CanBeExecuted    = false;
        }
Ejemplo n.º 3
0
        public ViewerHumanLogic(P client, ViewerData data)
            : base(client, data)
        {
            TInfo = new TableInfoViewModel(_data.TInfo, _data.BackLink.GetSettings())
            {
                AnimateText = true, Enabled = true
            };

            TInfo.PropertyChanged += TInfo_PropertyChanged;
            TInfo.Ready           += TInfo_Ready;

            TInfo.MediaLoadError += TInfo_MediaLoadError;
        }
Ejemplo n.º 4
0
        //private readonly ViewerActions _viewerActions;
        //private readonly ViewerData _data;
        //private readonly ILocalizer _localizer;

        //public TableInfoViewModel TInfo { get; }

        public ShowmanHumanLogic(
            ViewerData data,
            TableInfoViewModel tableInfoViewModel,
            ViewerActions viewerActions,
            ILocalizer localizer)
            : base(data, viewerActions, localizer)
        {
            //_viewerActions = viewerActions;
            //_data = data;
            //_localizer = localizer;
            //TInfo = tableInfoViewModel;

            TInfo.QuestionSelected += PlayerClient_QuestionSelected;
            TInfo.ThemeSelected    += PlayerClient_ThemeSelected;

            TInfo.SelectQuestion.CanBeExecuted = false;
            TInfo.SelectTheme.CanBeExecuted    = false;
        }
Ejemplo n.º 5
0
        public Showman(Client client, Account personData, bool isHost, ILocalizer localizer, ViewerData data)
            : base(client, personData, isHost, localizer, data)
        {
            ClientData.PersonDataExtensions.IsRight = new CustomCommand(arg => { _viewerActions.SendMessage(Messages.IsRight, "+"); ClearSelections(); });
            ClientData.PersonDataExtensions.IsWrong = new CustomCommand(arg => { _viewerActions.SendMessage(Messages.IsRight, "-"); ClearSelections(); });

            ClientData.ShowmanDataExtensions.ChangeSums = new CustomCommand(arg =>
            {
                for (int i = 0; i < ClientData.Players.Count; i++)
                {
                    ClientData.Players[i].CanBeSelected = true;
                    int num = i;
                    ClientData.Players[i].SelectionCallback = player =>
                    {
                        ClientData.ShowmanDataExtensions.SelectedPlayer = new Pair {
                            First = num + 1, Second = player.Sum
                        };
                        ClientData.DialogMode = DialogModes.ChangeSum;
                        for (int j = 0; j < ClientData.Players.Count; j++)
                        {
                            ClientData.Players[j].CanBeSelected = false;
                        }
                        ClientData.Hint = LO[nameof(R.HintChangeSum)];
                    };
                }

                ClientData.Hint = LO[nameof(R.HintSelectPlayerForSumChange)];
            });

            ClientData.ShowmanDataExtensions.ChangeSums2 = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Change, ClientData.ShowmanDataExtensions.SelectedPlayer.First, ClientData.ShowmanDataExtensions.SelectedPlayer.Second);
                ClearSelections();
            });

            ClientData.ShowmanDataExtensions.Manage = new CustomCommand(Manage_Executed);

            ClientData.AutoReadyChanged += ClientData_AutoReadyChanged;

            ClientData.PersonDataExtensions.AreAnswersShown = data.BackLink.AreAnswersShown;
            ClientData.PropertyChanged += ClientData_PropertyChanged;

            ClientData.PersonDataExtensions.SendCatCost = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.CatCost, ClientData.PersonDataExtensions.StakeInfo.Stake);
                ClearSelections();
            });

            ClientData.PersonDataExtensions.SendNominal = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Stake, 0);
                ClearSelections();
            });

            ClientData.PersonDataExtensions.SendStake = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Stake, 1, ClientData.PersonDataExtensions.StakeInfo.Stake);
                ClearSelections();
            });

            ClientData.PersonDataExtensions.SendPass = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Stake, 2);
                ClearSelections();
            });

            ClientData.PersonDataExtensions.SendVabank = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Stake, 3);
                ClearSelections();
            });
        }
Ejemplo n.º 6
0
 public ViewerActions(Client client, ViewerData viewerData, ILocalizer localizer)
 {
     Client      = client;
     _viewerData = viewerData;
     LO          = localizer;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Создание клиента
        /// </summary>
        /// <param name="personData">Данные игрока</param>
        /// <param name="isHost">Является ли владельцем игры</param>
        /// <param name="form">Имеет ли форму для вывода</param>
        public Player(Client client, Account personData, bool isHost, ILocalizer localizer, ViewerData data)
            : base(client, personData, isHost, localizer, data)
        {
            ClientData.PlayerDataExtensions.PressGameButton = new CustomCommand(arg =>
            {
                _viewerActions.SendMessage(Messages.I);
                DisableGameButton(false);
                ReleaseGameButtonAsync();
            })
            {
                CanBeExecuted = true
            };

            ClientData.PlayerDataExtensions.SendAnswer  = new CustomCommand(arg => { _viewerActions.SendMessage(Messages.Answer, ClientData.PersonDataExtensions.Answer); Clear(); });
            ClientData.PersonDataExtensions.SendCatCost = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.CatCost, ClientData.PersonDataExtensions.StakeInfo.Stake);
                Clear();
            });

            ClientData.PersonDataExtensions.SendNominal = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Stake, 0);
                Clear();
            });

            ClientData.PersonDataExtensions.SendStake = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Stake, 1, ClientData.PersonDataExtensions.StakeInfo.Stake);
                Clear();
            });

            ClientData.PersonDataExtensions.SendPass = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Stake, 2);
                Clear();
            });

            ClientData.PersonDataExtensions.SendVabank = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.Stake, 3);
                Clear();
            });

            ClientData.PersonDataExtensions.SendFinalStake = new CustomCommand(arg =>
            {
                _viewerActions.SendMessageWithArgs(Messages.FinalStake, ClientData.PersonDataExtensions.StakeInfo.Stake);
                Clear();
            });

            ClientData.PlayerDataExtensions.Apellate = new CustomCommand(arg =>
            {
                ClientData.PlayerDataExtensions.NumApps--;
                _viewerActions.SendMessage(Messages.Apellate, arg.ToString());
            })
            {
                CanBeExecuted = false
            };

            ClientData.PlayerDataExtensions.Pass = new CustomCommand(arg =>
            {
                _viewerActions.SendMessage(Messages.Pass);
            })
            {
                CanBeExecuted = false
            };

            ClientData.PersonDataExtensions.IsRight = new CustomCommand(arg => { _viewerActions.SendMessage(Messages.IsRight, "+"); Clear(); });
            ClientData.PersonDataExtensions.IsWrong = new CustomCommand(arg => { _viewerActions.SendMessage(Messages.IsRight, "-"); Clear(); });

            ClientData.PlayerDataExtensions.Report.Title    = LO[nameof(R.ReportTitle)];
            ClientData.PlayerDataExtensions.Report.Subtitle = LO[nameof(R.ReportTip)];

            ClientData.PlayerDataExtensions.Report.SendReport   = new CustomCommand(arg => { _viewerActions.SendMessage(Messages.Report, "ACCEPT", ClientData.SystemLog.ToString() + ClientData.PlayerDataExtensions.Report.Comment); Clear(); });
            ClientData.PlayerDataExtensions.Report.SendNoReport = new CustomCommand(arg => { _viewerActions.SendMessage(Messages.Report, "DECLINE"); Clear(); });

            ClientData.AutoReadyChanged += ClientData_AutoReadyChanged;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Запуск клиента
 /// </summary>
 /// <param name="name">Имя</param>
 /// <param name="password">Пароль (необязателен)</param>
 /// <param name="isHuman">Человек ли</param>
 /// <param name="isHost">Является ли владельцем сервера</param>
 /// <param name="form">Форма для интерфейса (если не человек, то null)</param>
 public SimpleViewer(Client client, Account personData, bool isHost, IGameManager backLink, ILocalizer localizer, ViewerData data = null)
     : base(client, personData, isHost, backLink, localizer, data)
 {
 }
Ejemplo n.º 9
0
 public ShowmanComputerLogic(Showman client, ViewerData data)
     : base(client, data)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Запуск клиента
 /// </summary>
 public SimpleViewer(Client client, Account personData, bool isHost, ILocalizer localizer, ViewerData data)
     : base(client, personData, isHost, localizer, data)
 {
 }
Ejemplo n.º 11
0
        //private readonly ViewerActions _viewerActions;
        //private readonly ViewerData _data;

        public ShowmanComputerLogic(ViewerData data, ViewerActions viewerActions, ComputerAccount computerAccount)
            : base(data, viewerActions, computerAccount)
        {
            //_viewerActions = viewerActions;
            //_data = data;
        }
Ejemplo n.º 12
0
 internal ViewerComputerLogic(C client, ViewerData data)
     : base(client, data)
 {
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Собственный счёт
 /// </summary>
 public static int MySum(this ViewerData viewerData) => ((PlayerAccount)viewerData.Me).Sum;
Ejemplo n.º 14
0
 /// <summary>
 /// Сумма дальнего преследователя
 /// </summary>
 public static int SmallSum(this ViewerData viewerData, Client client) => viewerData.Players.Where(player => player.Name != client.Name).Min(player => player.Sum);
Ejemplo n.º 15
0
 public ShowmanComputerLogic(ViewerData data, ViewerActions viewerActions)
     : base(data, viewerActions)
 {
 }