示例#1
0
        public GameTable MakeTable(GameInfo gameInfo)
        {
            GameTable table = null;

            switch (gameInfo.Source)
            {
            case GameSource.Sicbo:
                table = new SicboTable(gameInfo.GameId);
                break;

            case GameSource.Dice:
                table = new DiceTable(gameInfo.GameId);
                break;

            case GameSource.DzCard:
                table = new DzCardTable(gameInfo.GameId);
                break;

            case GameSource.Horse:
                table = new HorseTable(gameInfo.GameId);
                break;

            case GameSource.BumperCar:
                table = new BumperCarTable(gameInfo.GameId);
                break;

            case GameSource.Fish:
                table = new FishTable(gameInfo.GameId);
                break;
            }

            if (table == null)
            {
                SetError(ErrorType.Invalid_GameSource, "게임원천이 없습니다.");
                return(null);
            }

            table._GameInfo = gameInfo;

            _Tables.Add(table);

            return(table);
        }
示例#2
0
        public override void NotifyGameTimer(GameTimer gameTimer)
        {
            if (gameTimer.timerId != TimerID.Custom || gameTimer.autoInfo == null)
            {
                return;
            }

            DzCardInfo dzCardInfo = (DzCardInfo)_GameTable._TableInfo;

            DzCardTable dzCardTable = (DzCardTable)_GameTable;
            int         seaterIndex = dzCardTable.GetSeatterIndex(gameTimer.autoInfo);

            if (seaterIndex < 0 || seaterIndex >= DzCardDefine.GAME_PLAYER)
            {
                return;
            }

            int[] bestCardData  = new int[DzCardDefine.MAX_CENTERCOUNT];
            int   cbEndCardKind = DzCardTable.m_GameLogic.FiveFromSeven(dzCardInfo.m_cbHandCardData[seaterIndex], DzCardDefine.MAX_COUNT, dzCardInfo.m_cbCenterCardData, DzCardDefine.MAX_CENTERCOUNT, bestCardData, DzCardDefine.MAX_CENTERCOUNT);

            int actionType = _random.Next() % 4;

            if (cbEndCardKind >= 3)
            {
                actionType = _random.Next() % 4;
            }
            else
            {
                actionType = _random.Next() % 4 + 1;
            }

            switch (actionType)
            {
            case 0:         // add
            {
                AddScoreInfo AddScore = new AddScoreInfo();
                //AddScore.lAddLessScore = dzCardInfo.m_lTurnMaxScore;
                AddScore.lAddLessScore = dzCardInfo.m_lAddLessScore;

                Action(NotifyType.Request_AddScore, AddScore, gameTimer.autoInfo);
            }
            break;

            case 1:         // follow
            case 2:
            case 3:
            {
                //发送消息
                AddScoreInfo AddScore = new AddScoreInfo();
                AddScore.lAddLessScore = dzCardInfo.m_lTurnLessScore;

                Action(NotifyType.Request_AddScore, AddScore, gameTimer.autoInfo);
            }
            break;

            case 4:
            {
                AddScoreInfo AddScore = new AddScoreInfo();

                Action(NotifyType.Request_GiveUp, AddScore, gameTimer.autoInfo);
            }
            break;
            }
        }