Example #1
0
        /// <summary>
        /// Установка дефолтных значений
        /// </summary>
        public PlayerHelper(ILog _log, string _playerName, IArcoServer server = null)
        {
            if (server == null)
            {
                host = new ArcoServerClient(new BasicHttpBinding(), new EndpointAddress(url));
            }
            else
            {
                host = server;
            }

            playerName = _playerName;

            log = _log;

            MaxCard   = 5;
            CountCard = 0;

            playerStatistic = GenerateDefault();     // new Dictionary<Specifications, int>();

            LoseParams = new Dictionary <Specifications, int>();
            LoseParams.Add(Specifications.PlayerTower, 0);

            WinParams = new Dictionary <Specifications, int>();
            WinParams.Add(Specifications.PlayerTower, 50);
            WinParams.Add(Specifications.PlayerAnimals, 150);
            WinParams.Add(Specifications.PlayerRocks, 150);
            WinParams.Add(Specifications.PlayerDiamonds, 150);
        }
Example #2
0
        public GameController(ILog _log, IArcoServer server = null)
        {
            MaxCard    = 6;
            Status     = CurrentAction.None;
            log        = _log;
            LoseParams = GameControllerHelper.GetLoseParams();
            WinParams  = GameControllerHelper.GetWinParams();
            players    = new List <Player>();

            if (server == null)
            {
                host = new ArcoServerClient(new BasicHttpBinding(), new EndpointAddress(url));
            }
            else
            {
                host = server;
            }

            //Устанавливаем соответствие между методом и статусом
            eventHandlers = new Dictionary <CurrentAction, EventMethod>();
            eventHandlers.Add(CurrentAction.None, None);
            eventHandlers.Add(CurrentAction.StartGame, StartGame);
            eventHandlers.Add(CurrentAction.GetPlayerCard, GetPlayerCard);
            eventHandlers.Add(CurrentAction.WaitHumanMove, WaitHumanMove);
            eventHandlers.Add(CurrentAction.PassStroke, PassStroke);
            eventHandlers.Add(CurrentAction.HumanUseCard, HumanUseCard);
            eventHandlers.Add(CurrentAction.UpdateStatHuman, UpdateStat);
            eventHandlers.Add(CurrentAction.UpdateStatAI, UpdateStat);
            eventHandlers.Add(CurrentAction.EndHumanMove, EndHumanMove);
            eventHandlers.Add(CurrentAction.AIMoveIsAnimated, AIMoveIsAnimated);
            eventHandlers.Add(CurrentAction.AIUseCardAnimation, AIUseCardAnimation);
            eventHandlers.Add(CurrentAction.EndAIMove, EndAIMove);
            eventHandlers.Add(CurrentAction.EndGame, EndGame);
            eventHandlers.Add(CurrentAction.PlayerMustDropCard, PlayerMustDropCard);

            specialCardHandlers = new Dictionary <int, Card>();
            specialCardHandlers.Add(5, new Card5());
            specialCardHandlers.Add(8, new Card8());
            specialCardHandlers.Add(12, new Card12());
            specialCardHandlers.Add(31, new Card31());
            specialCardHandlers.Add(32, new Card32());
            specialCardHandlers.Add(34, new Card34());
            specialCardHandlers.Add(39, new Card39());
            specialCardHandlers.Add(48, new Card48());
            specialCardHandlers.Add(64, new Card64());
            specialCardHandlers.Add(67, new Card67());
            specialCardHandlers.Add(73, new Card73());
            specialCardHandlers.Add(87, new Card87());
            specialCardHandlers.Add(89, new Card89());
            specialCardHandlers.Add(90, new Card90());
            specialCardHandlers.Add(91, new Card91());
            specialCardHandlers.Add(98, new Card98());
        }