コード例 #1
0
        public override void OnCardSelected(BoardUnit unit)
        {
            if (unit.CurrentHp <= 0)
            {
                return;
            }

            if (PossibleTargets.Contains(Enumerators.AbilityTargetType.PLAYER_CARD) &&
                unit.GameObject.CompareTag(SRTags.PlayerOwned) ||
                PossibleTargets.Contains(Enumerators.AbilityTargetType.OPPONENT_CARD) &&
                unit.GameObject.CompareTag(SRTags.OpponentOwned) ||
                PossibleTargets.Contains(Enumerators.AbilityTargetType.ALL))
            {
                if (TargetUnitType == Enumerators.CardType.NONE || unit.InitialUnitType == TargetUnitType)
                {
                    if (TargetUnitStatusType == Enumerators.UnitStatusType.NONE ||
                        unit.UnitStatus == TargetUnitStatusType)
                    {
                        if (SelfBoardCreature != unit)
                        {
                            SelectedCard?.SetSelectedUnit(false);

                            SelectedCard = unit;
                            SelectedPlayer?.SetGlowStatus(false);

                            SelectedPlayer = null;
                            SelectedCard.SetSelectedUnit(true);

                            CardSelected?.Invoke(unit);
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Player2.cs プロジェクト: aPisC/MuzsikaTS3
 private void btnDeletePlayer_Click(object sender, EventArgs e)
 {
     if (ltbPlayers.SelectedIndices.Count == 0 || ltbPlayers.Items.Count <= 1)
     {
         return;
     }
     SelectedPlayer.Dispose();
     ltbPlayers.Items.Remove(SelectedPlayer);
 }
コード例 #3
0
 public override void OnPlayerUnselected(Player player)
 {
     if (SelectedPlayer == player)
     {
         SelectedCard?.SetSelectedUnit(false);
         SelectedCard = null;
         SelectedPlayer.SetGlowStatus(false);
         SelectedPlayer = null;
     }
 }
コード例 #4
0
ファイル: ChooseASymbol.cs プロジェクト: oahugrown/TicTacToe
    private void SetNewGame()
    {
        GameObject cameraObject = GameObject.FindWithTag("MainCamera");

        cameraObject.transform.position = new Vector3(0, 0, -10);
        cameraObject.GetComponent <CameraTransitions>().TransitionCamera(0);
        for (int i = 0; i < playerSelectObjects.Length; ++i)
        {
            // Assigning a default value
            playerSymbols[i] = PlayerSymbol.unassigned;
        }
        GetComponent <Canvas>().enabled = true;
        selectedPlayer = SelectedPlayer.playerOne;
    }
コード例 #5
0
ファイル: ChooseASymbol.cs プロジェクト: oahugrown/TicTacToe
    private void ChangeSelectedPlayer(int playerIndex)
    {
        // if the player was already selected than bail
        if (playerIndex == (int)selectedPlayer)
        {
            return;
        }

        // Show which player is currently selected.
        for (int i = 0; i < (int)SelectedPlayer.length; ++i)
        {
            playerSelectObjects[i].GetComponent <Outline>().enabled = false;
        }
        playerSelectObjects[playerIndex].GetComponent <Outline>().enabled = true;
        selectedPlayer = (SelectedPlayer)playerIndex;
    }
コード例 #6
0
        private async void SetGodmode(DamageFlag flag)
        {
            bool[] canExecuteFunction = await CanExecuteFunction();

            if (!canExecuteFunction[0])
            {
                return;
            }
            if (ImHost())
            {
                SelectedPlayer.SetGodmode(flag);
            }
            else
            {
                SelectedPlayer.RCE.SetGodmode(flag);
            }
        }
コード例 #7
0
        private async void SetInfiniteAmmo(bool state)
        {
            bool[] canExecuteFunction = await CanExecuteFunction();

            if (!canExecuteFunction[0])
            {
                return;
            }
            if (canExecuteFunction[1])
            {
                SelectedPlayer.SetInfiniteAmmo(state);
            }
            else
            {
                SelectedPlayer.RCE.SetInfiniteAmmo(state);
            }
        }
コード例 #8
0
        private async void Suicide()
        {
            bool[] canExecuteFunction = await CanExecuteFunction();

            if (!canExecuteFunction[0])
            {
                return;
            }
            if (canExecuteFunction[1])
            {
                SelectedPlayer.Suicide();
            }
            else
            {
                SelectedPlayer.RCE.Suicide();
            }
        }
コード例 #9
0
        private async void GiveSpawnKill(bool state)
        {
            bool[] canExecuteFunction = await CanExecuteFunction();

            if (!canExecuteFunction[0])
            {
                return;
            }
            if (canExecuteFunction[1])
            {
                SelectedPlayer.GiveSpawnKill(state);
            }
            else
            {
                SelectedPlayer.RCE.GiveSpawnKill(state);
            }
        }
コード例 #10
0
        private async void SetMovement(MovementType movement)
        {
            bool[] canExecuteFunction = await CanExecuteFunction();

            if (!canExecuteFunction[0])
            {
                return;
            }
            if (canExecuteFunction[1])
            {
                SelectedPlayer.SetMovement(movement);
            }
            else
            {
                SelectedPlayer.RCE.SetMovement(movement);
            }
        }
コード例 #11
0
ファイル: MainVM.cs プロジェクト: Thujed/Quiz
        private void ChangePointsVM_OnPlayerPointsChanged(double obj)
        {
            double newPoints = SelectedPlayer.PlayerPoints + obj;

            if (newPoints > MAX_POINT_VALUE)
            {
                SelectedPlayer.SetPlayerPoints(MAX_POINT_VALUE);
            }
            else if (newPoints < 0)
            {
                SelectedPlayer.SetPlayerPoints(0);
            }
            else
            {
                SelectedPlayer.SetPlayerPoints(newPoints);
            }
        }
コード例 #12
0
    public void OnKlickPlayer1()
    {
        if (state != BattleState.PLAYERTURN)
        {
            return;
        }

        player = SelectedPlayer.KIM;

        arrows[0].SetActive(true);
        arrows[1].SetActive(false);
        arrows[2].SetActive(false);

        ActionWindow.SetActive(true);

        ActionButtons[0].GetComponentInChildren <TextMeshProUGUI>().text = "Bedeutsame BCG-Backpfeife";
        ActionButtons[1].GetComponentInChildren <TextMeshProUGUI>().text = "Atemberaubende ABC-Analyse-Attacke";
    }
コード例 #13
0
    public void OnKlickPlayer2()
    {
        if (state != BattleState.PLAYERTURN)
        {
            return;
        }

        player = SelectedPlayer.BEKE;

        arrows[0].SetActive(false);
        arrows[1].SetActive(true);
        arrows[2].SetActive(false);

        ActionButtons[0].GetComponentInChildren <TextMeshProUGUI>().text = "Kampf *Kunst*";
        ActionButtons[1].GetComponentInChildren <TextMeshProUGUI>().text = "Hexadezimale Herxerei";

        ActionWindow.SetActive(true);
    }
コード例 #14
0
    public void OnKlickPlayer3()
    {
        if (state != BattleState.PLAYERTURN)
        {
            return;
        }

        player = SelectedPlayer.MARTIN;


        arrows[0].SetActive(false);
        arrows[1].SetActive(false);
        arrows[2].SetActive(true);

        ActionButtons[0].GetComponentInChildren <TextMeshProUGUI>().text = "Krasser Kampf-Code";
        ActionButtons[1].GetComponentInChildren <TextMeshProUGUI>().text = "Perfekt Perfektionistischer Programm Punch";

        ActionWindow.SetActive(true);
    }
コード例 #15
0
        public override void OnCardSelected(BoardUnit unit)
        {
            if (TutorialManager.IsTutorial && TutorialManager.CurrentTutorialDataStep.BoardArrowCantUsableOnUnit)
            {
                return;
            }

            if (IgnoreBoardObjectsList != null && IgnoreBoardObjectsList.Contains(unit))
            {
                return;
            }

            if (unit.CurrentHp <= 0)
            {
                return;
            }

            if (ElementType.Count > 0 && !ElementType.Contains(unit.Card.LibraryCard.CardSetType))
            {
                return;
            }

            if (TargetsType.Contains(Enumerators.SkillTargetType.ALL_CARDS) ||
                TargetsType.Contains(Enumerators.SkillTargetType.PLAYER_CARD) &&
                unit.Transform.CompareTag("PlayerOwned") ||
                TargetsType.Contains(Enumerators.SkillTargetType.OPPONENT_CARD) &&
                unit.Transform.CompareTag("OpponentOwned"))
            {
                bool opponentHasProvoke = OpponentBoardContainsProvokingCreatures();
                if (!opponentHasProvoke || opponentHasProvoke && unit.IsHeavyUnit() || IgnoreHeavy)
                {
                    SelectedCard?.SetSelectedUnit(false);

                    SelectedCard = unit;
                    SelectedPlayer?.SetGlowStatus(false);

                    SelectedPlayer = null;
                    SelectedCard.SetSelectedUnit(true);
                }
            }
        }
コード例 #16
0
        protected override async Task OnInitializedAsync()
        {
            var uri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);

            if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("spc", out var showPlayedCards))
            {
                if (showPlayedCards.ToString().ToLower() == "no")
                {
                    _showPlayedCards = false;
                }
                else
                {
                    _showPlayedCards = true;
                }
            }

            settings       = GameSettings.Value;
            _hubConnection = new HubConnectionBuilder()
                             .WithUrl(settings.GameHubUrl, options =>
            {
                options.AccessTokenProvider = GetAccessToken;
            })
                             .WithAutomaticReconnect()
                             .Build();

            _hubConnection.On <Game, List <GameScore> >("JoinedGame", (game, topScores) =>
            {
                if (SelectedPlayer.ToLower() == "view")
                {
                    return;
                }

                _inprogress  = false;
                _game        = game;
                _topScores   = topScores.OrderByDescending(g => g.Score).Take(10).ToList();
                _gameResults = topScores;
                _cardsWidth  = 482 + (game.Players[GameUtils.GetPlayerId(SelectedPlayer)].Cards.Count() > 4 ? (_cardIncrease * (game.Players[GameUtils.GetPlayerId(SelectedPlayer)].Cards.Count() - 4)) : 0);
                if (game != null)
                {
                    if (!string.IsNullOrEmpty(SelectedPlayer))
                    {
                        _cards = _game.Players[GameUtils.GetPlayerId(SelectedPlayer)].Cards;
                    }
                    _inputSeries = new string[_game.Players.Length][];
                    for (int p = 0; p < _game.Players.Length; p++)
                    {
                        _inputSeries[p] = new string[_game.Rounds.Length + 1];
                        Array.Fill(_inputSeries[p], "0");
                    }
                }
                StateHasChanged();
            });

            _hubConnection.On <Game, List <GameScore> >("ViewedGame", (game, topScores) =>
            {
                _inprogress  = false;
                _game        = game;
                _topScores   = topScores.OrderByDescending(g => g.Score).Take(10).ToList();
                _gameResults = topScores;

                StateHasChanged();
            });

            _hubConnection.On <Game>("GameStarted", (game) =>
            {
                _inprogress = false;
                _game       = game;

                StateHasChanged();
            });

            _hubConnection.On <Game>("GameResetted", (game) =>
            {
                _game = game;
                if (SelectedPlayer != "view")
                {
                    _cards = _game.Players[GameUtils.GetPlayerId(SelectedPlayer)].Cards;
                }
                StateHasChanged();
            });

            _hubConnection.On <Game>("NewGameSet", (game) =>
            {
                _game  = game;
                _cards = new List <Card>();
                StateHasChanged();
            });

            _hubConnection.On <Game, string>("PlayerSelected", (game, signedInPlayerID) =>
            {
                _inprogress = false;
                _game       = game;
                var index   = _playerSelections.FindIndex(p => p.Id == signedInPlayerID);
                if (index > 0)
                {
                    _playerSelections.RemoveAt(index);
                }

                if (SelectedPlayer == signedInPlayerID)
                {
                    _cards = _game.Players[GameUtils.GetPlayerId(signedInPlayerID)].Cards;
                }

                StateHasChanged();
            });

            _hubConnection.On <List <Card>, Game>("Shuffled", (cards, game) =>
            {
                _inprogress   = false;
                _game         = game;
                _cards        = cards;
                _game.Playing = true;
                _cardsWidth   = 482 + (cards.Count() > 4 ? (_cardIncrease * (cards.Count() - 4)) : 0);
                StateHasChanged();
            });

            _hubConnection.On <List <Card>, Game>("PlayedCard", (cards, game) =>
            {
                _inprogress = false;
                _game       = game;
                _cards      = cards;
                _cardsWidth = 482 + (cards.Count() > 4 ? (_cardIncrease * (cards.Count() - 4)) : 0);

                StateHasChanged();
            });

            _hubConnection.On <string[]>("ReturnAvailablePlayers", (rap) =>
            {
                _inprogress       = false;
                _playerSelections = new List <PlayerSelection>();
                foreach (var p in rap)
                {
                    _playerSelections.Add(new PlayerSelection {
                        Id = p, Name = p
                    });
                }
                StateHasChanged();
            });

            _hubConnection.On <Game>("WinnerRegistered", (game) =>
            {
                _inprogress = false;
                _game       = game;
                StateHasChanged();
            });

            _hubConnection.On <Game>("StartNextRound", (game) =>
            {
                _inprogress = false;
                _game       = game;
                StateHasChanged();
            });

            _hubConnection.On <Game>("CleanedTable", (game) =>
            {
                _inprogress = false;
                _game       = game;
                StateHasChanged();
            });

            _hubConnection.On <Game>("BetPlaced", (game) =>
            {
                _inprogress = false;
                _game       = game;
                StateHasChanged();
            });

            _hubConnection.On <Game>("GameSettingsResetted", (game) =>
            {
                _inprogress = false;
                _game       = game;
                StateHasChanged();
            });

            var authState = await AuthenticationStateTask;

            if (authState.User.Identity.IsAuthenticated)
            {
                await _hubConnection.StartAsync();

                if (SelectedPlayer.ToLower() == "view")
                {
                    await ViewGame();
                }
                else
                {
                    await JoinGame();
                }
            }
        }
コード例 #17
0
 protected void BatsmanSelection(SelectedPlayer selectedPlayer)
 {
     btnSelectPlayer1.CommandArgument = Enum.GetName(typeof(SelectedPlayer), (int)selectedPlayer);
     GeneratePlayerList(southAfrica, typeof(Batsman));
     ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
 }
コード例 #18
0
        /*
         * private void LoadHistoricalStats()
         *
         * NAME:
         *  LoadHistoricalStats
         * SYNOPSIS:
         *
         *  private void LoadHistoricalStats();
         *
         * DESCRIPTION:
         *
         *  Used to load the selected players historical stats
         *  and the players photo
         *
         * RETURNS:
         *  None
         * AUTHOR:
         *  Gabriel Uy
         * DATE:
         *  07/08/2020
         */
        private void LoadHistoricalStats()
        {
            string Name;
            string Pos;
            string Age;
            string Team;
            string GamesPlayed;
            string GamesStarted;
            string FG;
            string FGA;
            string ThreePointers;
            string TwoPointers;
            string FT;
            string FTA;
            string ORB;
            string DRB;
            string AST;
            string STL;
            string BLK;
            string TOV;
            string PF;
            string PTS;
            string FullPath;
            int    ActiveSeasons = 1;
            bool   IsInSeason    = false;
            bool   FileFound     = false;
            bool   NoMoreSeasons = false;
            int    HistoricalSeason;
            string IndexSeason;
            string SelectedPlayer;
            string ForPicture = " ";

            string[] seasons;
            string[] name;
            //this is the last season available
            if (_showGame.__season == "1985-1986")
            {
                NoMoreSeasons = true;
            }
            seasons          = _showGame.__season.Split('-');
            HistoricalSeason = Int32.Parse(seasons[0]);
            IndexSeason      = (HistoricalSeason - ActiveSeasons).ToString() + "-" + HistoricalSeason.ToString();
            HistoricalStatsBox.Items.Add("Season" + " POS" + " Age" + " TM" + " GP" + " GS" + " FG" + " FGA" + " 3PT" + " 2PT" + " FT" + " FTA" + " ORB" + " DRB" + " AST" + " STL" + " BLK" + " TOV" + " PF" + " PTS");
            HistoricalStatsBox.Items.Add(" ");
            //this is getting all the stats from past years
            do
            {
                FileFound  = false;
                IsInSeason = false;
                //found how to find the file location of the program using a method from this website 7/27/20
                //https://www.delftstack.com/howto/csharp/how-to-get-current-folder-path-in-csharp/
                System.IO.DirectoryInfo path = System.IO.Directory.GetParent(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
                path     = System.IO.Directory.GetParent(path.FullName);
                FullPath = path.FullName + @"\Seasons\" + IndexSeason + ".csv";
                //had to use this to see if a season file exists 7/28/20
                //https://www.techiedelight.com/determine-file-exists-csharp/
                DirectoryInfo directory = new DirectoryInfo(path.FullName + @"\Seasons\");
                FileInfo[]    files     = directory.GetFiles();
                //changing to the oldest season to just get player photo
                if (NoMoreSeasons == true)
                {
                    IndexSeason = _showGame.__season;
                    FullPath    = path.FullName + @"\Seasons\" + IndexSeason + ".csv";
                }
                StreamReader reader = new StreamReader(File.OpenRead(FullPath));
                while (!reader.EndOfStream)
                {
                    string line = reader.ReadLine();
                    if (!String.IsNullOrWhiteSpace(line))
                    {
                        //splitting the csv
                        string[] values = line.Split(',');
                        //splitting the player name and id
                        if (values[1].Contains("\\") && values[1].Contains(__game._PlayerName[__player1.team[TeamList.SelectedIndex]]))
                        {
                            name           = values[1].Split('\\');
                            SelectedPlayer = name[0];
                            ForPicture     = name[1];
                        }
                        else
                        {
                            SelectedPlayer = values[1];
                            if (SelectedPlayer == __game._PlayerName[__player1.team[TeamList.SelectedIndex]])
                            {
                                ForPicture = __game._PlayerPhoto[__player1.team[TeamList.SelectedIndex]];
                            }
                        }
                        //break out if no more seasons to show
                        if (NoMoreSeasons != true)
                        {
                            //getting the players stats for current indexSeason
                            //removing a * that the stat website has attatched to player names
                            if (SelectedPlayer.Contains("*"))
                            {
                                SelectedPlayer = SelectedPlayer.Replace("*", string.Empty);
                            }
                            if (values.Length >= 4 && SelectedPlayer == __game._PlayerName[__player1.team[TeamList.SelectedIndex]])
                            {
                                Name          = SelectedPlayer;
                                Pos           = values[2];
                                Age           = values[3];
                                Team          = values[4];
                                GamesPlayed   = values[5];
                                GamesStarted  = values[6];
                                FG            = values[8];
                                FGA           = values[9];
                                ThreePointers = values[11];
                                TwoPointers   = values[14];
                                FT            = values[18];
                                FTA           = values[19];
                                ORB           = values[21];
                                DRB           = values[22];
                                AST           = values[24];
                                STL           = values[25];
                                BLK           = values[26];
                                TOV           = values[27];
                                PF            = values[28];
                                PTS           = values[29];
                                IsInSeason    = true;
                                HistoricalStatsBox.Items.Add(IndexSeason + ":" + Pos + " " + Age + " " + Team + " " + GamesPlayed + " " + GamesStarted + " " + FG + " " + FGA
                                                             + " " + ThreePointers + " " + TwoPointers + " " + FT + " " + FTA + " " + ORB + " " + DRB + " " + AST + " " + STL + " " + BLK + " " + TOV
                                                             + " " + PF + " " + PTS);
                                break;
                            }
                        }
                    }
                }
                ActiveSeasons++;
                IndexSeason = (HistoricalSeason - ActiveSeasons).ToString() + "-" + (HistoricalSeason - (ActiveSeasons - 1)).ToString();

                foreach (FileInfo file in files)
                {
                    if (string.Compare(file.Name, IndexSeason + ".csv") == 0)
                    {
                        FileFound  = true;
                        IsInSeason = true;
                        break;
                    }
                }
                if (FileFound == false)
                {
                    break;
                }
            } while (IsInSeason == true);
            try
            {
                pictureBox1.Load("https://d2cwpp38twqe55.cloudfront.net/req/202006192/images/players/" + ForPicture + ".jpg");
            }
            catch
            {
                System.IO.DirectoryInfo path = System.IO.Directory.GetParent(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
                path = System.IO.Directory.GetParent(path.FullName);
                //this is when the players photo cannot be found
                pictureBox1.Load(path.FullName + @"\Photos\missing.jpg");
            }
            PlayerInfo.Items.Add("Name: " + __game._PlayerName[__player1.team[TeamList.SelectedIndex]]);
            PlayerInfo.Items.Add("Age: " + __game.GetPlayerAge(__player1.team[TeamList.SelectedIndex]));
            PlayerInfo.Items.Add("Current Team: " + __game.GetPlayerTeam(__player1.team[TeamList.SelectedIndex]));
            for (int i = 0; i < __game.CurrentWeek; i++)
            {
                FantasyScore.Items.Add("Week " + (i + 1) + " Stats:" + __player1.WeeklyStatLines[TeamList.SelectedIndex][i].ToString() + " Total:" + __player1.WeeklyScores[TeamList.SelectedIndex][i].ToString());
            }
        }