public GameEditViewModel() { LateTapCommand = new RelayCommand(edit_Tap); EditTapCommand = new RelayCommand(late_Tap); _navigationService = GetService<INavigationService>(); _frezoutGame = (FrezoutGame) _navigationService.GetLastNavigationData(); if (_frezoutGame.IsLateRegExist) IsVisibleRegButton = !_frezoutGame.IsEndedRegistration; if (!_frezoutGame.IsBigCurrentLevel()) IsEnablesBlindButton = true; }
public PlayersInLandViewModel(ContextMenu playerMenu) { PlayerTapCommand = new RelayCommand<int>(player_Tap); _gameMain = (FrezoutGame) GetService<INavigationService>().GetLastNavigationData(); Players = _gameMain.Players; NamePage = _gameMain.Name; SetGameMain(_gameMain); PlayerMenu = playerMenu; InitializeHeadTable(); }
/// <summary> /// Устанавливает игру (перед использованием меню, нужно вызвать метод SetGameMain (1 раз)) /// </summary> /// <param name="frezoutGameMain"></param> protected void SetGameMain(FrezoutGame frezoutGameMain) { _gameMain = frezoutGameMain; }
public FrezoutGame(ITournament tour) { _disPrizes = new DistributionPrizesGame(); _settings = new Settings(); Players = new ObservableCollection<PlayerGame>(); FrezoutGameMain = this; _isSound = _settings.SoundSetting; IsPause = true; Name = tour.Name; Type = tour.TypeToString; AllChips = tour.BuyInChips*tour.Players; BuyInCost = tour.BuyInCost; StartStack = tour.StartStack; // начальный стек _buyInChips = tour.BuyInChips; if (tour.Commission != 0) // проверяем случай наличия комисии (уменьшаем цену на бай-ин) BuyInCost -= BuyInCost*(tour.Commission/100); /* заполняем времена продолжительности: игры, уровня, времени до след. перерыва, ребай-периода */ //_levelSeconds = 2; //_breakDurationSeconds = 2 * 3; //_breakInSeconds = _levelSeconds * 0; //_lateRegistration = 2; // selectTour.LateRegistration; _levelSeconds = tour.LevelDuration*Sixty; _breakDurationSeconds = tour.BreakDuration*Sixty; _breakInSeconds = _levelSeconds*tour.BreakFrequency; _lateRegistration = tour.LateRegistration; // если==0 - послед. рег отсутствует _gameSeconds = tour.GameDuration*Sixty; _isGameUnlimited = tour.IsGameUnlimited; LateRegistrationDec = _levelSeconds*_lateRegistration; // делаем их копии с целью изменения в таймере LevelDec = _levelSeconds; BreakDec = _breakInSeconds; //если==0 - перерывы отсутствуют GameInc = _gameSeconds; IsBreakExist = _breakInSeconds != 0; IsLateRegExist = _lateRegistration != 0; // за 30/60 секунд до окончания - звуковое уведомление if (_levelDec >= 600 && _levelDec < 1800) // 10-30 минут { _secondEndLevel = 30; _isSoundEndLevel = true; } else if (_levelDec >= 1800) // больше 30 минут { _secondEndLevel = 60; _isSoundEndLevel = true; } /* инициализируем игроков и блайнды */ AddPlayers(tour.GetPlayersOfTour()); Blinds = new GameBlindCollection(MyDataContextBase.Blinds.Where(x => x.BlindTour == tour)); CalcChips(); /* Таймеры игры и уровня */ _timerGame = new DispatcherTimer {Interval = _interval}; _timerGame.Tick += timerGame_Tick; _timerLevel = new DispatcherTimer {Interval = _interval}; _timerLevel.Tick += timerLevel_Tick; }
public ProportionViewModel() { OrientationChangeCommand = new RelayCommand(PhoneApplicationPage_OrientationChanged); _frezoutGame = (FrezoutGame) _navigationService.GetLastNavigationData(); if (_frezoutGame == null) return; ChipsPresent.ProportionView = this; AllChips = NotDisChips = _frezoutGame.Chips; Chips = new List<ChipsPresent>(); foreach (var p in _frezoutGame.Players) { if (p.Status == 0) Chips.Add(new ChipsPresent(p.Name)); else break; } }