Пример #1
0
 public void SetupCamera(TeamColor team)
 {
     if (team == TeamColor.Black)
     {
         FlipCamera();
     }
 }
Пример #2
0
        public void GetScore_AfterMovementBlack_BottomLeftPawnTwoFieldUp_WhiteTeam_ShouldBe_Minus1()
        {
            // arrange
            var       startingBoard     = new OrdinaryChessBoard();
            TeamColor team              = TeamColor.White;
            var       startPawnPosition = new Position(1, 0);
            var       endPawnPosition   = new Position(3, 0);

            var pawn = startingBoard.RemoveFigure(startPawnPosition);

            startingBoard.SetFigure(pawn, endPawnPosition);
            pawn.Move(endPawnPosition);
            var validator  = new OrdinaryBoardMoveValidator(startingBoard);
            var verifier   = new OrdinaryBoardCheckVerifier(startingBoard, validator);
            var lastMoveVm = new LastMoveViewModel(pawn, startPawnPosition, endPawnPosition, null);
            var moveResult =
                new ValidMoveResult(startingBoard, verifier, null, lastMoveVm, null);

            int expectedScore = -1;
            // act
            var result = moveResult.GetScore(team);

            // assert
            Assert.AreEqual(expectedScore, result);
        }
Пример #3
0
 /// <summary>
 /// Moves the rook in castle.
 /// </summary>
 /// <param name="team">team the rook belongs to</param>
 /// <param name="cellKingMovedTo">Cell king moved to.</param>
 public void MoveRookInCastle(TeamColor team, Cell cellKingMovedTo)
 {
     if (team == TeamColor.White)
     {
         //if the king is moved to F8
         if (cellKingMovedTo == _board.Cells [2, 0])
         {
             _board.MoveWithoutChecking(new Move(this, _board.Cells [0, 0].Piece, null, _board.Cells[0, 0], _board.Cells[3, 0]), true);
         }
         if (cellKingMovedTo == _board.Cells [6, 0])
         {
             _board.MoveWithoutChecking(new Move(this, _board.Cells [7, 0].Piece, null, _board.Cells [7, 0], _board.Cells [5, 0]), true);
         }
     }
     if (team == TeamColor.Black)
     {
         if (cellKingMovedTo == _board.Cells [2, 7])
         {
             _board.MoveWithoutChecking(new Move(this, _board.Cells [0, 7].Piece, null, _board.Cells [0, 7], _board.Cells [3, 7]), true);
         }
         if (cellKingMovedTo == _board.Cells [6, 7])
         {
             _board.MoveWithoutChecking(new Move(this, _board.Cells [0, 0].Piece, null, _board.Cells [0, 0], _board.Cells [3, 0]), true);
         }
     }
 }
Пример #4
0
 public ChessPlayer(IInputHandler inputHandler, TeamColor teamColor)
 {
     AllPossibleMoves = new List <Move>();
     ActivePieces     = new List <Piece>();
     InputHandler     = inputHandler;
     TeamColor        = teamColor;
 }
Пример #5
0
        /// Callback when the game is started and player display names are set.
        void Init(Player[] players)
        {
            this.players = players;
            var i = 0;

            while (i < players.Length)
            {
                if (players[i].eTeam == -1)
                {
                    panels[i].GetComponent <Image>().color = Color.black.WithAlpha(0.4f);
                }
                else
                {
                    panels[i].GetComponent <Image>().color = TeamColor.FromIndex(players[i].eTeam, true).WithAlpha(0.4f);
                }
                labels[i].text = players[i].eDisplayName;
                i++;
            }
            while (i < panels.Length)
            {
                Destroy(panels[i].gameObject);
                Destroy(labels[i].gameObject);
                i++;
            }
        }
Пример #6
0
 private void Dialog_TeamChosen(object sender, TeamColor teamColor)
 {
     //// After tapping a color, the logo appears on the backgound and the others are dimmed. A confirmation button appears.
     ViewModel.ChosenTeam = teamColor;
     teamChooseDialog.AskForConfirmation(teamColor);
     teamChooseDialog.Confirmed += Dialog_Confirmed;
 }
Пример #7
0
 private void GameManagerViewModelOnPlayerTeamSet(object sender, TeamColor teamColor)
 {
     // Then, a message is displayed, showing 'Welcom to Team <Color>!
     teamChooseDialog.SetTeamChoiceComplete(teamColor);
     teamChooseDialog.Closed += TeamChooseDialog_Closed;
     teamChooseDialog.Show();
 }
Пример #8
0
 public ComputerPlayer(TeamColor teamColor, int searchDepth, int breadthSearch)
 {
     MyTeamColor        = teamColor;
     _opponentTeamColor = teamColor == TeamColor.White ? TeamColor.Black : TeamColor.White;
     _searchDepth       = Math.Max(searchDepth, 1);
     _breadthSearch     = Math.Max(breadthSearch, 1);
 }
Пример #9
0
        public bool ParseMessage(string msg)
        {
            string[] args = msg.Split(',');
            int      msgTest;

            if (int.TryParse(args[0], out msgTest))
            {
                MsgType msgType = (MsgType)msgTest;
                switch (msgType)
                {
                case MsgType.NoAction:
                    QueueAction(msgType, "no");
                    break;

                case MsgType.PlayCard:
                    QueueAction(msgType, args[1]);
                    break;

                case MsgType.QueueCard:
                    QueueAction(msgType, args[1]);
                    break;

                case MsgType.GameStart:
                    teamColor = (TeamColor)int.Parse(args[1]);
                    return(true);

                default:
                    return(false);
                }
            }
            return(false);
        }
Пример #10
0
    public Unit(string _type, TeamColor _color, int _road) : this(_color, _road - 1)
    {
        type = _type;

        size = new Vector2(1.5f, 1.5f) * Settings.FhdToHD;

        if (UnitsSettings.Buffs(type).Contains("Boss"))
        {
            size = new Vector2(3f, 3f) * Settings.FhdToHD;
        }
        healthBarDeltaPosition = UnitsSettings.HealthBarPosition(_type) / 4f * Settings.FhdToHD;    //new Vector2 (0, 0.7f);
        shadowDeltaPosition    = UnitsSettings.ShadowPosition(_type) / 4f * Settings.FhdToHD;       //new Vector2 (0.1f, -0.575f);;

        try {
            healthMax  = BalanceSettings.health [_type];
            speed      = BalanceSettings.speed [_type];
            damage     = BalanceSettings.damage [_type];
            goldReward = BalanceSettings.price [_type];
            defence    = BalanceSettings.defence [_type];
        } catch (System.Exception e) {
            Debug.LogError("Wrong" + type);
        }

        objectAnimation.Load(_type + "Walk", -0.6f);
        objectAnimation.Play(-2);
    }
Пример #11
0
        public void AskForConfirmation(TeamColor teamColor)
        {
            switch (teamColor)
            {
            case TeamColor.Yellow:
                TeamLogo.Source = new BitmapImage(new Uri("ms-appx:///Assets/Teams/instinct.png"));
                TeamLogo.HorizontalAlignment = HorizontalAlignment.Left;
                RenderImage(YellowBack, new Uri("ms-appx:///Assets/Teams/team_leader_yellow.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.Yellow);
                RenderImage(BlueBack, new Uri("ms-appx:///Assets/Teams/team_leader_blue.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.LightBlue);
                RenderImage(RedBack, new Uri("ms-appx:///Assets/Teams/team_leader_red.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.Salmon);
                break;

            case TeamColor.Blue:
                TeamLogo.HorizontalAlignment = HorizontalAlignment.Center;
                TeamLogo.Source = new BitmapImage(new Uri("ms-appx:///Assets/Teams/mystic.png"));
                RenderImage(YellowBack, new Uri("ms-appx:///Assets/Teams/team_leader_yellow.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.LightYellow);
                RenderImage(BlueBack, new Uri("ms-appx:///Assets/Teams/team_leader_blue.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.Blue);
                RenderImage(RedBack, new Uri("ms-appx:///Assets/Teams/team_leader_red.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.Salmon);
                break;

            case TeamColor.Red:
                TeamLogo.Source = new BitmapImage(new Uri("ms-appx:///Assets/Teams/valor.png"));
                TeamLogo.HorizontalAlignment = HorizontalAlignment.Right;
                RenderImage(YellowBack, new Uri("ms-appx:///Assets/Teams/team_leader_yellow.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.LightYellow);
                RenderImage(BlueBack, new Uri("ms-appx:///Assets/Teams/team_leader_blue.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.LightBlue);
                RenderImage(RedBack, new Uri("ms-appx:///Assets/Teams/team_leader_red.png"), new Vector2(240, 320), new Vector3(-100, -60, 0), Colors.Red);
                break;
            }

            TeamLogo.Visibility           = Visibility.Visible;
            ConfirmationButton.Visibility = Visibility.Visible;
        }
Пример #12
0
        /// <summary>
        /// Waits for a move to appear in the game stream.
        /// </summary>
        /// <param name="player">The color of the move to wait for.</param>
        /// <returns>Move in UCI-notation.</returns>
        private string ReceiveMove(TeamColor player)
        {
            // wait for move
            while (true)
            {
                // update latest game info.
                string line;
                while ((line = this.localGameStream.ReadLine()) != string.Empty)
                {
                    this.ParseGameStreamObject(line);
                }

                // if divisible by 2, then it's white's turn
                TeamColor waitingFor = this.lichessMoves.Length % 2 != 0 ? TeamColor.White : TeamColor.Black;

                // should be waiting for this player
                if (waitingFor == player && this.receivedMove)
                {
                    this.receivedMove = false;
                    return this.lichessMoves[this.lichessMoves.Length - 1];
                }
                else
                {
                    // wait before checking again.
                    Thread.Sleep(100);
                }
            }
        }
Пример #13
0
        /// <summary>
        /// Gets the image for team.
        /// </summary>
        /// <param name="team">The team.</param>
        /// <returns></returns>
        private Image getImageForTeam(TeamColor team)
        {
            switch (team)
            {
            case TeamColor.Neutral:
                return(null);

                break;

            case TeamColor.Blue:
                return(Properties.Resources.team_mystic);

                break;

            case TeamColor.Red:
                return(Properties.Resources.team_valor);

                break;

            case TeamColor.Yellow:
                return(Properties.Resources.team_instinct);

                break;

            default:
                return(null);

                break;
            }
        }
        private void SetActiveChannelGUI(BattleChatGUINode battleChatGUINode, TeamColor teamColor)
        {
            ChatUIComponent chatUI = battleChatGUINode.chatUI;
            BattleChatLocalizedStringsComponent battleChatLocalizedStrings = battleChatGUINode.battleChatLocalizedStrings;
            string teamChatInputHint     = string.Empty;
            Color  commonTextColor       = new Color();
            Color  blueTeamNicknameColor = new Color();

            if (teamColor == TeamColor.BLUE)
            {
                blueTeamNicknameColor = chatUI.BlueTeamNicknameColor;
                commonTextColor       = chatUI.BlueTeamNicknameColor;
                teamChatInputHint     = battleChatLocalizedStrings.TeamChatInputHint;
            }
            else if (teamColor != TeamColor.RED)
            {
                blueTeamNicknameColor = chatUI.CommonTextColor;
                commonTextColor       = chatUI.CommonTextColor;
                teamChatInputHint     = battleChatLocalizedStrings.GeneralChatInputHint;
            }
            else
            {
                blueTeamNicknameColor = chatUI.RedTeamNicknameColor;
                commonTextColor       = chatUI.RedTeamNicknameColor;
                teamChatInputHint     = battleChatLocalizedStrings.TeamChatInputHint;
            }
            chatUI.InputHintText   = $"{teamChatInputHint}: ";
            chatUI.InputHintColor  = new Color(commonTextColor.r, commonTextColor.g, commonTextColor.b, chatUI.InputHintColor.a);
            chatUI.InputTextColor  = chatUI.InputHintColor;
            chatUI.BottomLineColor = blueTeamNicknameColor;
            chatUI.SetHintSize((teamColor == TeamColor.BLUE) || (teamColor == TeamColor.RED));
        }
Пример #15
0
	    public void Reset( TeamColor playerTeamColor )
	    {
		    _playerTeamColor = playerTeamColor;

		    if( _currentDraft != null )
		    {
				_previousDrafts.Add( _currentDraft );
		    }

		    if( CurrentRound >= RoundCount )
		    {
				var heroes = _heroPool.Values;
			    foreach( var draft in _previousDrafts )
			    {
					draft.Reset( heroes );
				    _draftDataPool.Push( draft );
			    }

				_previousDrafts.Clear();   
		    }

			_currentDraft = _draftDataPool.Pop();

			PlayCpuTurn();
	    }
Пример #16
0
        public Team(TeamColor teamColor)
        {
            this.teamColor = teamColor;
            combatants     = new List <Combatant>();
            projectiles    = new List <Projectile>();

            if (GodClass.online)
            {
                if (teamColor == GodClass.clientRef.teamColor)
                {
                    cardManager = new CardManager(teamColor);
                    GodClass.cardHUD.AddChild(cardManager);
                }
            }
            else
            {
                cardManager = new CardManager(teamColor);
                GodClass.cardHUD.AddChild(cardManager);
            }
            CreateCombatantSpawner();
            string className = teamColor == TeamColor.RED ? GodClass.playerOneClass : GodClass.playerTwoClass;

            InitFromJson(GodClass.ClassConfigs[className]);
            InitBuildingManager();
            this.combatantSpawner.IsSpawning = true;
        }
 public async Task <SetPlayerTeamResponse> SetPlayerTeam(TeamColor teamColor)
 {
     return(await PostProtoPayload <Request, SetPlayerTeamResponse>(RequestType.SetPlayerTeam, new SetPlayerTeamMessage()
     {
         Team = teamColor
     }));
 }
Пример #18
0
 public SetPlayerTeamResponse SetPlayerTeam(TeamColor teamColor)
 {
     return(PostProtoPayloadCommonR <Request, SetPlayerTeamResponse>(RequestType.SetPlayerTeam, new SetPlayerTeamMessage()
     {
         Team = teamColor
     }).Result);
 }
Пример #19
0
        /// <summary>
        /// Returns whether the king of a team is in check.
        /// </summary>
        /// <param name="color"></param>
        /// <returns></returns>
        public bool IsKingInCheck(TeamColor color)
        {
            Piece      king     = null;
            Coordinate position = new Coordinate();

            // Get first king, with this color, and it's position.
            (king, position) = (from piece in this.GetPieces <King>()
                                where piece.Item1.Color == color
                                select piece).FirstOrDefault();

            // No king of this color was found, thus the king can't be in check.
            if (king is null)
            {
                return(false);
            }

            // Get list of pieces aiming on the square the king sits on.
            if (this.Dangerzone.TryGetValue(position, out List <Piece> pieces))
            {
                // Returns true if any of the pieces are of opposite color.
                return(pieces.Any(p => p.Color != color));
            }
            else
            {
                // No pieces of opposite color aiming on this square, king not in check.
                return(false);
            }
        }
Пример #20
0
 public void SetData(Vector2Int coords, TeamColor team, Board board)
 {
     this.team          = team;
     occupiedSquare     = coords;
     this.board         = board;
     transform.position = board.CalculatePositionFromCoords(coords);
 }
Пример #21
0
        private void MoveAgents()
        {
            List <int> ActionableAgentsId = GetActionableAgentsId();

            // Erase Agent Location's data from cells.
            foreach (var a in data.Agents)
            {
                data.CellData[a.Point.X, a.Point.Y].AgentState = TeamColor.Free;
            }

            for (int i = 0; i < ActionableAgentsId.Count; i++)
            {
                int id    = ActionableAgentsId[i];
                var agent = data.Agents[id];
                var nextP = agent.GetNextPoint();

                TeamColor nextAreaState = data.CellData[nextP.X, nextP.Y].AreaState_;
                ActionAgentToNextP(id, agent, nextP, nextAreaState);
                viewModel.IsRemoveMode[id] = false;
            }
            viewModel.Agents = data.Agents;

            // Reset Agent Location's data to cells.
            for (int id = 0; id < data.Agents.Length; ++id)
            {
                var a = data.Agents[id].Point;
                data.CellData[a.X, a.Y].AgentState = id / Constants.PlayersNum == 0 ? TeamColor.Area1P : TeamColor.Area2P;
            }
        }
Пример #22
0
        public void GameControllerReady(GameController gameController, IInputManager inputManager)
        {
            // This is called twice on a host - once when the client game
            // starts and once when the server game starts.
            if (pInputManager != null)
            {
                return;
            }

            if (eTeam != -1)
            {
                GetComponent <SpriteOverlay>().SetColor(TeamColor.FromIndex(eTeam));
            }

            pInputManager = inputManager;
            pJoystick     = new JoystickControl(inputManager);

            if (isLocalPlayer)
            {
                var leftButton = GameObject.Find("LeftButton");
                if (leftButton != null)
                {
                    pTouchButtons = leftButton.GetComponent <TouchButtons>();
                }
            }

            if (lRb != null)
            {
                Initialize();
                lInitialized = true;
            }
        }
Пример #23
0
        private static taskResponse SelectTeam(TeamColor teamColor)
        {
            var resp1 = new taskResponse(false, string.Empty);

            try
            {
                var client = Logic.Logic.objClient;
                var resp2  = client.Player.SetPlayerTeam(teamColor);

                if (resp2.Status == SetPlayerTeamResponse.Types.Status.Success)
                {
                    resp1.Status = true;
                }
                else
                {
                    resp1.Message = teamColor.ToString();
                }
            }
            catch (Exception e)
            {
                Logger.ColoredConsoleWrite(ConsoleColor.Red, "Error SelectTeam: " + e.Message);
                SelectTeam(teamColor);
            }
            return(resp1);
        }
Пример #24
0
        private void AddUserAddedMessage(NotSelfUserNode userNode, TeamColor userTeamColor, CombatEventLogNode combatEventLogNode)
        {
            Color  teamColor   = CombatEventLogUtil.GetTeamColor(userTeamColor, combatEventLogNode.combatEventLog);
            string messageText = CombatEventLogUtil.ApplyPlaceholder(combatEventLogNode.combatLogCommonMessages.UserJoinBattleMessage, "{user}", userNode.userRank.Rank, userNode.userUid.Uid, teamColor);

            combatEventLogNode.uiLog.UILog.AddMessage(messageText);
        }
Пример #25
0
    private void SetColor(TeamColor newColor)
    {
        if (newColor == TeamColor.None)
        {
            Debug.LogError("Cannot set the player's team color to TeamColor.None");
            return;
        }
        Debug.Log($"SetColor will set the player's team color to {newColor.ToString()}");

        m_Color = newColor == TeamColor.Blue ? Color.blue : Color.red;
        GameObject m_TankRenderers = transform.Find("TankRenderers").gameObject;

        Renderer[] renderers = m_TankRenderers.GetComponentsInChildren <Renderer>();
        for (int i = 0; i < renderers.Length; i++)
        {
            renderers[i].material.color = m_Color;
        }

        if (m_TankRenderers)
        {
            m_TankRenderers.SetActive(true);
        }

        m_NameText.GetComponent <Text>().color           = m_Color;
        m_SpeakingIndicator.GetComponent <Image>().color = m_Color;
    }
Пример #26
0
 public Streamliner(GameScreen Screen, TeamColor TeamColor, float Weight) : base(Screen, TeamColor, Weight)
 {
     // Simplest Constructor
     ZoomFactor        = .85f;
     Screen.ZoomFactor = ZoomFactor;
     Speed             = MinSpeed;
 }
Пример #27
0
        //public AnalyzerQualifierResult CreateQualifierStatistics(HistoryJson.History history, int matchId)
        //{
        //    AnalyzerQualifierResult result = null;
        //    string matchName = history.Events.FirstOrDefault(ob => ob.Detail.Type == "other").Detail.MatchName;
        //    HistoryJson.Game[] games = GetData.GetMatches(history);
        //    //beatmapid, score
        //    List<QualifierTeam> teams = new List<QualifierTeam>();

        //    //List<Team> dbTeams = new List<Team>();
        //    //List<DBPlayer> dbPlayers = new List<DBPlayer>();
        //    //List<TeamPlayerList> dbTeamPlayerList = new List<TeamPlayerList>();

        //    using (GAFContext context = new GAFContext())
        //    {
        //        foreach (var game in games)
        //        {
        //            foreach (var score in game.scores)
        //            {
        //                if (!score.user_id.HasValue)
        //                    continue;

        //                DBPlayer dbPlayer = dbPlayers.FirstOrDefault(p => p.OsuId.Value == score.user_id.Value);

        //                if (dbPlayer == null)
        //                {
        //                    dbPlayer = context.Player.FirstOrDefault(p => p.OsuId.HasValue && p.OsuId.Value == score.user_id.Value);
        //                    dbPlayers.Add(dbPlayer);
        //                }

        //                TeamPlayerList dbTeamPlayer = dbTeamPlayerList.FirstOrDefault(tp => tp.PlayerListId.Value == dbPlayer.Id);

        //                if (dbTeamPlayer == null)
        //                {
        //                    dbTeamPlayer = context.TeamPlayerList.FirstOrDefault(tp => tp.PlayerListId.HasValue && tp.PlayerListId.Value == dbPlayer.Id);

        //                    dbTeamPlayerList.Add(dbTeamPlayer);
        //                }

        //                Team dbTeam = dbTeams.FirstOrDefault(t => t.Id == dbTeamPlayer.TeamId);

        //                if (dbTeam == null)
        //                {
        //                    dbTeam = context.Team.FirstOrDefault(t => t.Id == dbTeamPlayer.TeamId.Value);
        //                    dbTeams.Add(dbTeam);
        //                }

        //                QualifierTeam team = teams.FirstOrDefault(t => t.TeamName.Equals(dbTeam.Name));

        //                if (team == null)
        //                {
        //                    team = new QualifierTeam(dbTeam.Name, new QualifierPlayer[]
        //                    {
        //                        new QualifierPlayer(dbPlayer.OsuId.Value, dbPlayer.Nickname, new (long, HistoryJson.Score)[]
        //                        {
        //                            (game.beatmap.id.Value, score)
        //                        })
        //                    });

        //                    teams.Add(team);
        //                }
        //                else
        //                {
        //                    QualifierPlayer player = team.Players.FirstOrDefault(p => p.UserId == dbPlayer.OsuId.Value);

        //                    if (player == null)
        //                    {
        //                        List<QualifierPlayer> players = team.Players.ToList();
        //                        players.Add(new QualifierPlayer(dbPlayer.OsuId.Value, dbPlayer.Nickname, new (long, HistoryJson.Score)[]
        //                        {
        //                            (game.beatmap.id.Value, score)
        //                        }));

        //                        team.Players = players.ToArray();
        //                    }
        //                    else
        //                    {
        //                        List<(long, HistoryJson.Score)> scores = player.Scores.ToList();
        //                        scores.Add((game.beatmap.id.Value, score));

        //                        player.Scores = scores.ToArray();
        //                    }
        //                }
        //            }
        //        }
        //    }

        //    result = new AnalyzerQualifierResult(matchId, "stage", matchName, teams.ToArray());
        //    result.TimeStamp = history.Events.Last().TimeStamp;

        //    return result;
        //}
        #endregion

        /// <summary>
        /// Creates a statistic for a osu mp match
        /// </summary>
        public AnalyzerResult CreateStatistic(HistoryJson.History history, int matchId)
        {
            AnalyzerResult result = null;

            try
            {
                string             matchName = history.Events.FirstOrDefault(ob => ob.Detail.Type == "other").Detail.MatchName;
                HistoryJson.Game[] games     = GetData.GetMatches(history);
                //beatmapid, score
                List <(long, HistoryJson.Score)> scores = new List <(long, HistoryJson.Score)>();

                foreach (var game in games)
                {
                    foreach (var score in game.scores)
                    {
                        scores.Add((game.beatmap.id ?? -1, score));
                    }
                }

                var HighestScoreRankingResult = CalculateHighestRankingAndPlayCount(games, history, true);

                (string, string)teamNames = GetVersusTeamNames(matchName);
                Tuple <int, int> wins        = GetWins(games);
                TeamColor        winningTeam = wins.Item1 > wins.Item2 ? TeamColor.Blue : TeamColor.Red;
                TeamColor        losingTeam  = wins.Item1 > wins.Item2 ? TeamColor.Red : TeamColor.Blue;

                result = new AnalyzerResult()
                {
                    MatchId              = matchId,
                    MatchName            = matchName,
                    HighestScore         = HighestScoreRankingResult.Item1[0].Item1,
                    HighestScoreBeatmap  = HighestScoreRankingResult.Item1[0].Item2,
                    HighestScoresRanking = HighestScoreRankingResult.Item1[0].Item3,

                    HighestAccuracyScore          = HighestScoreRankingResult.Item1[1].Item1,
                    HighestAccuracyBeatmap        = HighestScoreRankingResult.Item1[1].Item2,
                    HighestAverageAccuracyRanking = HighestScoreRankingResult.Item1[1].Item3,

                    WinningTeam      = winningTeam == TeamColor.Red ? teamNames.Item2 : teamNames.Item1,
                    WinningTeamColor = winningTeam,
                    WinningTeamWins  = winningTeam == TeamColor.Red ? wins.Item2 : wins.Item1,

                    LosingTeam     = losingTeam == TeamColor.Red ? teamNames.Item2 : teamNames.Item1,
                    LosingTeamWins = losingTeam == TeamColor.Red ? wins.Item2 : wins.Item1,
                    Scores         = scores.ToArray(),

                    TimeStamp = history.Events.Last().TimeStamp
                };
                result.HighestScoreUser    = HighestScoreRankingResult.Item1[0].Item3.FirstOrDefault(r => r.Player.UserId == result.HighestScore.user_id).Player;
                result.HighestAccuracyUser = HighestScoreRankingResult.Item1[1].Item3.FirstOrDefault(r => r.Player.UserId == result.HighestAccuracyScore.user_id).Player;
                result.Ranks    = HighestScoreRankingResult.Item1[0].Item3;
                result.Beatmaps = HighestScoreRankingResult.Item2.Select(b => b.BeatMap).ToArray();
            }
            catch (Exception ex)
            {
                Logger.Log("Analyzer: " + ex.ToString());
            }
            return(result);
        }
Пример #28
0
    public void NewTurn()
    {
        /*if(threatPieces != null)
         * {
         *  foreach (ChessPiece piece in threatPieces)
         *  {
         *      // Revert all shaders
         *  }
         *  threatPieces.Clear();
         * }*/

        if (whoseTurn == TeamColor.White)
        {
            whoseTurn = TeamColor.Black;
            //defaultShader = blackTeam[0].GetComponent<Renderer>().material.shader;

            #region King in Check - IN-PROGRESS

            /* foreach (ChessPiece piece in whiteTeam)
             * {
             *  //Debug.Log("Blep");
             *  movesCheck = piece.CheckMovement(true);
             *  //Debug.Log(movesCheck.Count);
             *  for(int i=0; i < movesCheck.Count;i++)
             *  {
             *      //Debug.Log("Hekkin ");
             *      if (tiles[movesCheck[i].x, movesCheck[i].z].occupied && tiles[movesCheck[i].x, movesCheck[i].z].occupiedBy == kingBlack)
             *      {
             *          Debug.Log("Bloop");
             *          if (tiles[movesCheck[i].x, movesCheck[i].z].occupiedBy.isKing )
             *          {
             *              Debug.Log("Bliiip");
             *              threatPieces.Add(tiles[movesCheck[i].x, movesCheck[i].z].occupiedBy);
             *              movesCheck.RemoveAt(i);
             *              i = 0;
             *              break;
             *          }
             *      }
             *  }
             *  movesCheck.Clear();
             * }
             *
             * if (threatPieces != null)
             * {
             *  foreach (ChessPiece piece in threatPieces)
             *  {
             *
             *      Debug.Log(piece.name);
             *      // Change Shader to Outline
             *      piece.GetComponent<Renderer>().material.shader = outline;
             *  }
             * } */
            #endregion
        }
        else
        {
            whoseTurn = TeamColor.White;
        }
    }
Пример #29
0
 public Team(TeamColor teamColor, Vector2 enemyBasePosition, Vector2 areaPosition, Vector2 halfScale)
 {
     TeamColor         = teamColor;
     EnemyBasePosition = enemyBasePosition;
     AreaPosition      = areaPosition;
     HalfScale         = halfScale;
     Energy            = Globals.MAX_ENERGY;
 }
Пример #30
0
    public void SpawnAScoreBall(ScoreBall ball)
    {
        int       selector    = Random.Range(0, 3);
        TeamColor randomColor = (TeamColor)selector;

        ball.ChangeColor(randomColor);
        SpawnABall(ball, (int)randomColor);
    }
Пример #31
0
 public Player(string connectionId, string name, TeamColor team, bool isManager, bool isLeader)
 {
     ConnectionId = connectionId;
     Name         = name;
     Team         = team;
     IsManager    = isManager;
     IsLeader     = isLeader;
 }
Пример #32
0
    protected void BasicInit(Weapon weapon = null , Damage dmg = null, Transform target = null )
    {
        gameObject.tag = Global.BULLET_TAG;
        _damage = dmg;
        _teamColor = weapon.robot.teamColor;

        if ( _rigidbody == null )
            _rigidbody = GetComponent<Rigidbody>();
    }
Пример #33
0
    void JoinTeam(TeamColor color)
    {
        _selectingTeam = false;

        GameObject player = (GameObject)Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);

        player.SendMessage("SetTeam", color);
        player.SendMessage("Respawn");
    }
Пример #34
0
    public Quaternion GetRotation(TeamColor color)
    {
        if ( color.Equals(TeamColor.Blue))
            return Quaternion.EulerAngles(0, 90f, 0);
        if ( color.Equals(TeamColor.Red))
            return Quaternion.EulerAngles(0, -90f , 0);

        return Quaternion.EulerAngles(0, 0, 0);
    }
Пример #35
0
    public static Vector3 SpawnPointForTeam(TeamColor color)
    {
        Vector3 chunkPos = World.SAFE_CHUNKS[(int)color];

        Vector3 pos = Vector3.Scale(chunkPos, Chunk.SIZE);
        pos += Chunk.HALF;
        pos.y += Chunk.HALF_HEIGHT;
        pos.y += (World.SAFE_PLATFORM_HEIGHT + 1) * Block.HEIGHT;

        return pos;
    }
Пример #36
0
		public void SetOptions( TeamColor playerTeam, int roundNum, bool enableAI )
		{
			if( roundNum < 1 || roundNum > 5 )
			{
				return;
			}

			_playerTeamColor = playerTeam;

			_draftManager.RoundCount = roundNum;
			_draftManager.CpuEnabled = enableAI;

			this.ResetDraft();
		}
Пример #37
0
    public static BlockType BlockTypeForTeam(TeamColor color)
    {
        switch (color)
        {
        case TeamColor.WHITE:
            return BlockType.WHITE;
        case TeamColor.BROWN:
            return BlockType.BROWN;
        case TeamColor.PINK:
            return BlockType.PINK;
        case TeamColor.TEAL:
            return BlockType.TEAL;
        }

        return BlockType.BLUE;
    }
Пример #38
0
		public DraftAction( TeamColor owner, DraftActionType actionType, Hero hero )
		{
			ActionType = actionType;
			Hero = hero;
			Owner = owner;
		}
Пример #39
0
Файл: Gen.cs Проект: Robien/OW
 private Units getUnits(TeamColor color)
 {
     if (color == TeamColor.BLUE)
     {
         return unitsBlue;
     }
     else if (color == TeamColor.RED)
     {
         return unitsRed;
     }
     else
     {
         return null;
     }
 }
Пример #40
0
 /// <summary>
 /// Checks and initializes piece color. Applies appropriate starting materials.
 /// </summary>
 private void InitPieceColor()
 {
     //On Start, check and update piece color and position
         if ((currentSpace.spaceRow == '1') || (currentSpace.spaceRow == '2'))
         {
             PieceColor = TeamColor.White;
             this.GetComponent<Renderer>().material = GameManager.currentInstance.materialLibrary.materialWhite;
         }
         else if ((currentSpace.spaceRow == '7') || (currentSpace.spaceRow == '8'))
         {
             PieceColor = TeamColor.Black;
             this.GetComponent<Renderer>().material = GameManager.currentInstance.materialLibrary.materialBlack;
         }
         else
         {
             PieceColor = TeamColor.None;
         }
         return;
 }
Пример #41
0
 public static Color ConvertColor(TeamColor c)
 {
     return Color.FromArgb(c.A, c.R, c.G, c.B);
 }
Пример #42
0
 public void init(chessPieceType type, TeamColor color)
 {
     _pieceType = type;
     _color = color;
 }
Пример #43
0
 public void ChangeTurn()
 {
     checkForWin();
     switch (turnTeamColor){
         case (TeamColor.Black):
             turnTeamColor = TeamColor.White;
             if ((WhiteKing.isKingChecked()) && (WhiteKing.GetAvailableSpaces().Length == 0))
             {
                 Win(TeamColor.Black);
             }
             break;
         case (TeamColor.White):
             turnTeamColor = TeamColor.Black;
             BlackKing.isChecked = BlackKing.isKingChecked();
             Debug.Log(BlackKing.isKingChecked());
             if ((BlackKing.isKingChecked()) && (BlackKing.GetAvailableSpaces().Length == 0))
             {
                 Win(TeamColor.White);
             }
             break;
     }
 }
Пример #44
0
 public Knight(TeamColor Color)
     : base(Color)
 {
 }
Пример #45
0
        private Boolean PieceCanBlock(int[,] openSpaces, TeamColor color)
        {
            int[,] temp;
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    if(squares[x,y] != null && squares[x,y].Color == color)
                    {
                        switch(squares[x,y].GetType().ToString())
                        {
                            case "Backend.Pawn":
                                temp = GetValidPawnMoves(x, y);
                                break;
                            case "Backend.Rook":
                                temp = GetValidRookMoves(x, y);
                                break;
                            case "Backend.Bishop":
                                temp = GetValidBishopMoves(x, y);
                                break;
                            case "Backend.Knight":
                                temp = GetValidKnightMoves(x, y);
                                break;
                            case "Backend.Queen":
                                temp = GetValidQueenMoves(x, y);
                                break;
                            default:
                                continue;
                        }

                        for(int i = 0; i < openSpaces.GetLength(0); i++)
                        {
                            for(int j = 0; j < temp.GetLength(0); j++)
                            {
                                if(openSpaces[i, 0] == temp[j, 0] && openSpaces[i, 1] == temp[j, 1])
                                {
                                    return true;
                                }
                            }
                        }
                    }
                }
            }
            return false;
        }
Пример #46
0
 public ChessPiece(TeamColor Color)
 {
     this.Color = Color;
 }
Пример #47
0
 public King(TeamColor Color)
     : base(Color)
 {
     hasMoved = false;
 }
Пример #48
0
 public Bishop(TeamColor Color)
     : base(Color)
 {
 }
Пример #49
0
 public Rook(TeamColor Color)
     : base(Color)
 {
     hasMoved = false;
 }
Пример #50
0
 public void SetTeam(TeamColor team)
 {
     networkView.RPC("NetworkSetTeam", RPCMode.OthersBuffered, (int)team);
 }
Пример #51
0
Файл: Gen.cs Проект: Robien/OW
 private GameObject instantiateUnit(int i, int j, UnitType type, TeamColor color)
 {
     GameObject tile = Instantiate<GameObject> (getUnits(color).getUnit(UnitType.ARCHER));
     tile.transform.SetParent (getTile(i, j).transform);
     getTile (i, j).GetComponent<Case> ().setUnit (tile.GetComponent<Unit> ());
     tile.GetComponent<Unit> ().setCase (getTile (i, j).GetComponent<Case> ());
     tile.transform.localPosition = new Vector3 (0, 0, LAYER_UNIT);
     return tile;
 }
Пример #52
0
 public Pawn(TeamColor Color)
     : base(Color)
 {
 }
Пример #53
0
 public async Task<SetPlayerTeamResponse> SetPlayerTeam(TeamColor teamColor)
 {
     return await PostProtoPayload<Request, SetPlayerTeamResponse>(RequestType.SetPlayerTeam, new SetPlayerTeamMessage()
     {
         Team = teamColor
     });
 }
Пример #54
0
 public Queen(TeamColor Color)
     : base(Color)
 {
 }
Пример #55
0
 public chessPiece(chessPieceType type, TeamColor color)
 {
     _pieceType = type;
     _color = color;
 }
Пример #56
0
 public void Win(TeamColor Winner)
 {
     switch(Winner){
         case TeamColor.Black:
             Debug.Log("Black Wins!");
             break;
         case TeamColor.White:
             Debug.Log("White Wins!");
             break;
         default:
             break;
     }
 }
Пример #57
0
 public Boolean Checkmate(TeamColor team)
 {
     for (int x = 0; x < 8; x++)
     {
         for (int y = 0; y < 8; y++)
         {
             if (squares[x,y] != null && squares[x, y].Color == team && squares[x, y].GetType().ToString().Equals("Backend.King"))
             {
                 return !CheckmateMovementCheck(x, y) || !CheckmateCaptureCheck(x, y) || !CheckmateBlockCheck(x, y);
             }
         }
     }
     throw new MissingFieldException("I'm not sure how you pulled it off, but there isn't a king for " + team);
 }
Пример #58
0
 /// <summary>
 /// Checks whether or not a Castle Move occured and moves the appropriate Rook if so.
 /// </summary>
 /// <param name="king"></param>
 /// <param name="destination"></param>
 private void castleMove(ChessPiece king, BoardSpace destination)
 {
     ChessPiece rook;
     BoardSpace rookSpace;
     Debug.Log("Running castleMove()");
     switch (king.PieceColor)
     {
         case (TeamColor.Black):
             if (destination.name == "C8")
             {
                 rook = GameObject.Find("A8").GetComponent<BoardSpace>().OccupyingPiece;
                 rookSpace = GameObject.Find("D8").GetComponent<BoardSpace>();
                 MovePiece(rook, rookSpace);
                 turnTeamColor = king.PieceColor;
             }
             else if (destination.name == "G8")
             {
                 rook = GameObject.Find("H8").GetComponent<BoardSpace>().OccupyingPiece;
                 rookSpace = GameObject.Find("F8").GetComponent<BoardSpace>();
                 MovePiece(rook, rookSpace);
                 turnTeamColor = king.PieceColor;
             }
             break;
         case (TeamColor.White):
             if (destination.name == "C1")
             {
                 rook = GameObject.Find("A1").GetComponent<BoardSpace>().OccupyingPiece;
                 rookSpace = GameObject.Find("D1").GetComponent<BoardSpace>();
                 MovePiece(rook, rookSpace);
                 turnTeamColor = king.PieceColor;
             }
             else if (destination.name == "G1")
             {
                 rook = GameObject.Find("H1").GetComponent<BoardSpace>().OccupyingPiece;
                 rookSpace = GameObject.Find("F1").GetComponent<BoardSpace>();
                 MovePiece(rook, rookSpace);
                 turnTeamColor = king.PieceColor;
             }
             break;
     }
 }
Пример #59
0
 public Boolean Check(TeamColor team)
 {
     for(int x = 0; x < 8; x++)
     {
         for(int y = 0; y < 8; y++)
         {
             if(squares[x,y] != null && squares[x,y].Color == team && squares[x,y].GetType().ToString().Equals("Backend.King"))
             {
                 return CheckLineOfSightThreats(x, y).GetLength(0) > 0 || CheckKnightThreats(x, y).GetLength(0) > 0 || CheckPawnThreats(x, y).GetLength(0) > 0;
             }
         }
     }
     throw new MissingFieldException("I'm not sure how you pulled it off, but there isn't a king for " + team);
 }
Пример #60
0
 public TeamObject()
 {
     PrimaryColor = new TeamColor(255, 255, 255, 255);
     SecondaryColor = new TeamColor(255, 255, 255, 255);
     points = new MapComponentCollection<MapPoint>();
 }