コード例 #1
0
ファイル: Team.cs プロジェクト: kevinbyrom/FootballGame
        public void Load(string name, bool isHome)
        {
            // Load the gamefile

            GameFile file = new GameFile(Path.Combine($"TEAMS\\{name}.txt"));


            // Load details

            this.Name  = file.ReadLine();
            this.City  = file.ReadLine();
            this.State = file.ReadLine();


            // Load texture names

            this.PlayerTextureName = String.Format("{0}_{1}", name, isHome ? "home" : "away");
            this.FieldTextureName  = $"{name}_field";


            // Load playbooks, roster and depth charts

            this.Playbooks[OFFENSE] = new Playbook();
            this.Playbooks[OFFENSE].Load("Offensive\\" + name);

            this.Playbooks[DEFENSE] = new Playbook();
            this.Playbooks[DEFENSE].Load("Defensive\\" + name);

            this.Roster = new Roster();
            this.Roster.Load(name);

            this.DepthChart = new DepthChart();
            this.DepthChart.Load(name);
        }
コード例 #2
0
        public void Load(string name)
        {
            var file = new GameFile($"Rosters\\{name}.txt");

            // Read the number of players

            this.NumPlayers = int.Parse(file.ReadLine());


            // Load each player

            for (int i = 0; i < this.NumPlayers; i++)
            {
                var playerName = file.ReadLine();

                this.PlayerInfo[i].Load(playerName);
            }
        }
コード例 #3
0
ファイル: DepthChart.cs プロジェクト: kevinbyrom/FootballGame
        public void Load(string team)
        {
            var file = new GameFile($"Depth\\{team}.txt");

            for (int i = 0; i < NUM_DEPTH_TYPES; i++)
            {
                // Read the number of slots filled

                this.NumSlotsFilled[i] = int.Parse(file.ReadLine());

                for (int ii = 0; ii < this.NumSlotsFilled[i]; ii++)
                {
                    // Read type roster pos

                    this.RosterPos[i, ii] = int.Parse(file.ReadLine());
                }
            }
        }
コード例 #4
0
ファイル: Formation.cs プロジェクト: kevinbyrom/FootballGame
        public void Load(string name)
        {
            var file = new GameFile($"Formations\\{name}.txt");


            // Read the formation name and graphic file

            Name            = file.ReadLine();
            GraphicFilename = file.ReadLine();


            // Read the SpecialTeams and Kickoff flag

            IsSpecialTeams = int.Parse(file.ReadLine()) == 1;
            IsKickoff      = int.Parse(file.ReadLine()) == 1;


            // Read each player type and offset

            for (int i = 0; i < MAX_SIDE_PLAYERS; i++)
            {
                var p = file.ReadParams();

                if (p.Count() < 2)
                {
                    throw new Exception("ERROR::NOT ENOUGH PARAMS FOR OFFSETS IN FORMATION FILE");
                }

                this.DepthType[i] = int.Parse(p[0]);
                this.DepthPos[i]  = int.Parse(p[1]);


                p = file.ReadParams();

                if (p.Count() < 2)
                {
                    throw new Exception("ERROR::NOT ENOUGH PARAMS FOR OFFSETS IN FORMATION FILE");
                }
                this.OffsetWX[i] = float.Parse(p[0]);
                this.OffsetWY[i] = float.Parse(p[1]);
            }
        }
コード例 #5
0
        public void Load(string name)
        {
            var file = new GameFile($"Players\\{name}.txt");

            this.FirstName = file.ReadLine();
            this.LastName  = file.ReadLine();
            this.Age       = int.Parse(file.ReadLine());
            this.Position  = int.Parse(file.ReadLine());
            this.Number    = int.Parse(file.ReadLine());
            this.SkinColor = int.Parse(file.ReadLine());

            this.Attrib.Aware.Load(file);
            this.Attrib.Strength.Load(file);
            this.Attrib.ThrowPow.Load(file);
            this.Attrib.ThrowAcc.Load(file);
            this.Attrib.Catch.Load(file);
            this.Attrib.Accel.Load(file);
            this.Attrib.Speed.Load(file);
            this.Attrib.BreakTak.Load(file);
            this.Attrib.Tackle.Load(file);
            this.Attrib.Block.Load(file);
            this.Attrib.BreakBlock.Load(file);
            this.Attrib.KickPow.Load(file);
            this.Attrib.KickAcc.Load(file);
        }
コード例 #6
0
        public void Load(string name)
        {
            var file = new GameFile($"Playbooks\\{name}.txt");

            // Read the number of formations

            this.NumFormations = int.Parse(file.ReadLine());


            // For each formation

            for (int i = 0; i < this.NumFormations; i++)
            {
                // Read the formation name and load the formation

                var text = file.ReadLine();

                this.Formations[i] = new Formation();
                this.Formations[i].Load(text);



                // Read the number of plays

                this.NumPlays[i] = int.Parse(file.ReadLine());



                // Read each play and load the play

                for (int ii = 0; ii < NumPlays[i]; ii++)
                {
                    var playFile = file.ReadLine().Trim();

                    this.Plays[i, ii] = new Play();
                    this.Plays[i, ii].Load(playFile);
                }
            }
        }
コード例 #7
0
        public void Load(string name)
        {
            var file = new GameFile($"Plays\\{name}.txt");


            // Read the play name & graphic file

            this.Name            = file.ReadLine();
            this.GraphicFilename = file.ReadLine();


            // Load each player data

            for (int i = 0; i < MAX_SIDE_PLAYERS; i++)
            {
                // Read the player type

                var p = file.ReadParams();

                if (p.Count() < 9)
                {
                    throw new Exception("ERROR :: NOT ENOUGH PARAMS FOR PLAYER TYPE IN PLAY FILE");
                }

                this.PlayerFlags[i]                 = new PlayerObjFlags();
                this.PlayerFlags[i].Passer          = bool.Parse(p[0]);
                this.PlayerFlags[i].Receiver        = bool.Parse(p[1]);
                this.PlayerFlags[i].IsDefReceiver   = bool.Parse(p[2]);
                this.PlayerFlags[i].Blocker         = bool.Parse(p[3]);
                this.PlayerFlags[i].Rusher          = bool.Parse(p[4]);
                this.PlayerFlags[i].Kicker          = bool.Parse(p[5]);
                this.PlayerFlags[i].Punter          = bool.Parse(p[6]);
                this.PlayerFlags[i].Placeholder     = bool.Parse(p[7]);
                this.PlayerFlags[i].IsDefBallHolder = bool.Parse(p[8]);


                // Read each prehike action

                this.PreHikeActions[i] = new GameActions();

                var numActions = int.Parse(file.ReadLine());

                for (int ii = 0; ii < numActions; ii++)
                {
                    var actionParams = file.ReadParams();

                    if (actionParams.Count() < 5)
                    {
                        throw new Exception("ERROR :: NOT ENOUGH PARAMS FOR PRE HIKE ACTION IN PLAY FILE");
                    }

                    this.PreHikeActions[i].PushEnd(
                        int.Parse(actionParams[0]),
                        int.Parse(actionParams[1]),
                        float.Parse(actionParams[2]),
                        float.Parse(actionParams[3]),
                        float.Parse(actionParams[4]));
                }

                // Read each post action

                this.PostHikeActions[i] = new GameActions();

                numActions = int.Parse(file.ReadLine());

                for (int ii = 0; ii < numActions; ii++)
                {
                    var actionParams = file.ReadParams();

                    if (actionParams.Count() < 5)
                    {
                        throw new Exception("ERROR :: NOT ENOUGH PARAMS FOR POST HIKE ACTION IN PLAY FILE");
                    }

                    this.PostHikeActions[i].PushEnd(
                        int.Parse(actionParams[0]),
                        int.Parse(actionParams[1]),
                        float.Parse(actionParams[2]),
                        float.Parse(actionParams[3]),
                        float.Parse(actionParams[4]));
                }
            }
        }