Пример #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="playerName">Human player name.</param>
        /// <param name="pointRule">Indicates the initial points count for every players.</param>
        /// <param name="endOfGameRule">The ruel to end a game.</param>
        /// <param name="save">Player save file.</param>
        /// <param name="useRedDoras">Indicates if red doras should be used.</param>
        /// <param name="useNagashiMangan"><c>True</c> to use the yaku 'Nagashi Mangan'.</param>
        /// <param name="useRenhou"><c>True</c> to use the yakuman 'Renhou'.</param>
        public MainWindow(string playerName, InitialPointsRulePivot pointRule, EndOfGameRulePivot endOfGameRule, PlayerSavePivot save, bool useRedDoras, bool useNagashiMangan, bool useRenhou)
        {
            InitializeComponent();

            LblHumanPlayer.Content = playerName;

            _game      = new GamePivot(playerName, pointRule, endOfGameRule, save, useRedDoras, useNagashiMangan, useRenhou);
            _tickSound = new System.Media.SoundPlayer(Properties.Resources.tick);

            _overlayStoryboard = FindResource("StbHideOverlay") as Storyboard;
            Storyboard.SetTarget(_overlayStoryboard, GrdOverlayCall);

            ApplyConfigurationToOverlayStoryboard();

            SetChronoTime();

            FixWindowDimensions();

            NewRoundRefresh();

            InitializeAutoPlayWorker();

            BindConfiguration();

            ContentRendered += delegate(object sender, EventArgs evt)
            {
                RunAutoPlay();
            };
        }
Пример #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="humanPlayerName">The name of the human player; other players will be <see cref="PlayerPivot.IsCpu"/>.</param>
        /// <param name="initialPointsRule">The <see cref="InitialPointsRule"/> value.</param>
        /// <param name="endOfGameRule">The <see cref="EndOfGameRule"/> value.</param>
        /// <param name="save">Player save stats.</param>
        /// <param name="withRedDoras">Optionnal; the <see cref="WithRedDoras"/> value; default value is <c>False</c>.</param>
        /// <param name="useNagashiMangan">Optionnal; the <see cref="UseNagashiMangan"/> value; default value is <c>False</c>.</param>
        /// <param name="useRenhou">Optionnal; the <see cref="UseRenhou"/> value; default value is <c>False</c>.</param>
        public GamePivot(string humanPlayerName,
                         InitialPointsRulePivot initialPointsRule,
                         EndOfGameRulePivot endOfGameRule,
                         PlayerSavePivot save,
                         bool withRedDoras     = false,
                         bool useNagashiMangan = false,
                         bool useRenhou        = false)
        {
            _save = save;

            InitialPointsRule  = initialPointsRule;
            EndOfGameRule      = endOfGameRule;
            _players           = PlayerPivot.GetFourPlayers(humanPlayerName, InitialPointsRule);
            DominantWind       = WindPivot.East;
            EastIndexTurnCount = 1;
            EastIndex          = FirstEastIndex;
            EastRank           = 1;
            WithRedDoras       = withRedDoras;
            UseNagashiMangan   = useNagashiMangan;
            UseRenhou          = useRenhou;

            Round = new RoundPivot(this, EastIndex);
        }
Пример #3
0
 /// <summary>
 /// Extension; checks if a <see cref="EndOfGameRulePivot"/> applies "Enchousen" or not.
 /// </summary>
 /// <param name="endOfGameRule">The <see cref="EndOfGameRulePivot"/> to check.</param>
 /// <returns><c>True</c> if applies rule; <c>False</c> otherwise.</returns>
 internal static bool EnchousenRuleApply(this EndOfGameRulePivot endOfGameRule)
 {
     return(endOfGameRule == EndOfGameRulePivot.Enchousen || endOfGameRule == EndOfGameRulePivot.EnchousenAndTobi);
 }