Ejemplo n.º 1
0
        public PanelAreaType SelectPanelArea(PlayerEntity player, PanelAreaType panelAreaType)
        {
            var turnType = player.Equals(_1stPlayer) ? TurnType._1stPlayer : TurnType._2ndPlayer;
            var panel    = PanelAreaList.FirstOrDefault(x => x.PanelAreaType == panelAreaType);

            panel.SetTurnType(turnType);

            return(panelAreaType);
        }
Ejemplo n.º 2
0
        public void SelectPanelArea(PanelAreaType panelAreaType)
        {
            AppSignalRLogger.LogVerbose("[Called '{0}'] {1}", MethodBase.GetCurrentMethod().Name, panelAreaType);
            var result  = appService.SelectPanelArea(Context.ConnectionId, panelAreaType);
            var message = SignalRClientMessage.Create(result.ConnectionIds, MethodBase.GetCurrentMethod().Name, panelAreaType, result.Room._1stPlayerResult, result.Room._2ndPlayerResult, result.Room.NowTurnType
                                                      , result.Room._1stPlayerReachPanelAreaTypeList, result.Room._2ndPlayerReachPanelAreaTypeList);

            CallClientMethod(message);

            if (result.Room.CanPlayAI)
            {
                Thread.Sleep(1000);
                var aiResult  = appService.SelectPanelAreaByAI(result.Room);
                var aiMessage = SignalRClientMessage.Create(Context.ConnectionId, MethodBase.GetCurrentMethod().Name, aiResult.SelectedPanelAreaType, aiResult.Room._1stPlayerResult, aiResult.Room._2ndPlayerResult, aiResult.Room.NowTurnType
                                                            , aiResult.Room._1stPlayerReachPanelAreaTypeList, aiResult.Room._2ndPlayerReachPanelAreaTypeList);
                CallClientMethod(aiMessage);
            }
        }
Ejemplo n.º 3
0
        public (List <string> ConnectionIds, RoomEntity Room) SelectPanelArea(string connectionId, PanelAreaType panelAreaType)
        {
            var player = playerRepository.GetByConnectionId(connectionId);
            var room   = roomRepository.GetByRoomId(player.RoomId);

            room.SelectPanelArea(player, panelAreaType);
            room.NextTurn();
            roomRepository.Save(room);

            List <string> connectionIds = new List <string>()
            {
                room._1stPlayer.ConnectionId
            };

            if (room.IsMulti && room.Exsists2ndPlayer)
            {
                connectionIds.Add(room._2ndPlayer.ConnectionId);
            }

            return(connectionIds, room);
        }
 public PanelAreaEntity(PanelAreaType panelAreaType)
 {
     PanelAreaType = panelAreaType;
 }