示例#1
0
        private List <PlayerUnits> ResetPlayerstruct()
        {
            if (Players == null ||
                Players.Count <= 0 ||
                Units == null ||
                Units.Count <= 0)
            {
                return(new List <PlayerUnits>());
            }

            List <PlayerUnits> lPlayers = new List <PlayerUnits>();

            #region convert old Playerdata to new Playerdata

            for (var i = 0; i < Players.Count; i++)
            {
                var tmpPlayer = new PlayerUnits();
                tmpPlayer.AccountId        = Players[i].AccountId;
                tmpPlayer.Apm              = Players[i].Apm;
                tmpPlayer.ApmAverage       = Players[i].ApmAverage;
                tmpPlayer.ArmySupply       = Players[i].ArmySupply;
                tmpPlayer.CameraAngle      = Players[i].CameraAngle;
                tmpPlayer.CameraDistance   = Players[i].CameraDistance;
                tmpPlayer.CameraPositionX  = Players[i].CameraPositionX;
                tmpPlayer.CameraPositionY  = Players[i].CameraPositionY;
                tmpPlayer.CameraRotation   = Players[i].CameraRotation;
                tmpPlayer.ClanTag          = Players[i].ClanTag;
                tmpPlayer.Color            = Players[i].Color;
                tmpPlayer.CurrentBuildings = Players[i].CurrentBuildings;
                tmpPlayer.Difficulty       = Players[i].Difficulty;
                tmpPlayer.Epm              = Players[i].Epm;
                tmpPlayer.EpmAverage       = Players[i].EpmAverage;
                tmpPlayer.Gas              = Players[i].Gas;
                tmpPlayer.GasArmy          = Players[i].GasArmy;
                tmpPlayer.GasIncome        = Players[i].GasIncome;
                tmpPlayer.IsLocalplayer    = Players[i].IsLocalplayer;
                tmpPlayer.Localplayer      = Players[i].Localplayer;
                tmpPlayer.Minerals         = Players[i].Minerals;
                tmpPlayer.MineralsArmy     = Players[i].MineralsArmy;
                tmpPlayer.MineralsIncome   = Players[i].MineralsIncome;
                tmpPlayer.Name             = Players[i].Name;
                tmpPlayer.NameLength       = Players[i].NameLength;
                tmpPlayer.PlayerRace       = Players[i].PlayerRace;
                tmpPlayer.Status           = Players[i].Status;
                tmpPlayer.SupplyMax        = Players[i].SupplyMax;
                tmpPlayer.SupplyMaxRaw     = Players[i].SupplyMaxRaw;
                tmpPlayer.SupplyMin        = Players[i].SupplyMin;
                tmpPlayer.SupplyMinRaw     = Players[i].SupplyMinRaw;
                tmpPlayer.Team             = Players[i].Team;
                tmpPlayer.Type             = Players[i].Type;
                tmpPlayer.ValidSize        = Players[i].ValidSize;
                tmpPlayer.Worker           = Players[i].Worker;
                tmpPlayer.Units            = new List <PredefinedTypes.Unit>();

                lPlayers.Add(tmpPlayer);
            }

            #endregion

            #region Add Units to the Playerdata


            foreach (var tmpUnit in Units)
            {
                if (tmpUnit.Owner >= 0 &&
                    tmpUnit.Owner < 16)
                {
                    lPlayers[tmpUnit.Owner].Units.Add(tmpUnit);
                }
            }


            #endregion

            return(lPlayers);
        }
示例#2
0
        private List<PlayerUnits> ResetPlayerstruct()
        {
            if (Players == null ||
                Players.Count <= 0 ||
                Units == null ||
                Units.Count <= 0)
            {
                return new List<PlayerUnits>();
            }

            List<PlayerUnits> lPlayers = new List<PlayerUnits>();

            #region convert old Playerdata to new Playerdata

            for (var i = 0; i < Players.Count; i++)
            {
                var tmpPlayer = new PlayerUnits();
                tmpPlayer.AccountId = Players[i].AccountId;
                tmpPlayer.Apm = Players[i].Apm;
                tmpPlayer.ApmAverage = Players[i].ApmAverage;
                tmpPlayer.ArmySupply = Players[i].ArmySupply;
                tmpPlayer.CameraAngle = Players[i].CameraAngle;
                tmpPlayer.CameraDistance = Players[i].CameraDistance;
                tmpPlayer.CameraPositionX = Players[i].CameraPositionX;
                tmpPlayer.CameraPositionY = Players[i].CameraPositionY;
                tmpPlayer.CameraRotation = Players[i].CameraRotation;
                tmpPlayer.ClanTag = Players[i].ClanTag;
                tmpPlayer.Color = Players[i].Color;
                tmpPlayer.CurrentBuildings = Players[i].CurrentBuildings;
                tmpPlayer.Difficulty = Players[i].Difficulty;
                tmpPlayer.Epm = Players[i].Epm;
                tmpPlayer.EpmAverage = Players[i].EpmAverage;
                tmpPlayer.Gas = Players[i].Gas;
                tmpPlayer.GasArmy = Players[i].GasArmy;
                tmpPlayer.GasIncome = Players[i].GasIncome;
                tmpPlayer.IsLocalplayer = Players[i].IsLocalplayer;
                tmpPlayer.Localplayer = Players[i].Localplayer;
                tmpPlayer.Minerals = Players[i].Minerals;
                tmpPlayer.MineralsArmy = Players[i].MineralsArmy;
                tmpPlayer.MineralsIncome = Players[i].MineralsIncome;
                tmpPlayer.Name = Players[i].Name;
                tmpPlayer.NameLength = Players[i].NameLength;
                tmpPlayer.PlayerRace = Players[i].PlayerRace;
                tmpPlayer.Status = Players[i].Status;
                tmpPlayer.SupplyMax = Players[i].SupplyMax;
                tmpPlayer.SupplyMaxRaw = Players[i].SupplyMaxRaw;
                tmpPlayer.SupplyMin = Players[i].SupplyMin;
                tmpPlayer.SupplyMinRaw = Players[i].SupplyMinRaw;
                tmpPlayer.Team = Players[i].Team;
                tmpPlayer.Type = Players[i].Type;
                tmpPlayer.ValidSize = Players[i].ValidSize;
                tmpPlayer.Worker = Players[i].Worker;
                tmpPlayer.Units = new List<PredefinedTypes.Unit>();

                lPlayers.Add(tmpPlayer);
            }

            #endregion

            #region Add Units to the Playerdata

                foreach (var tmpUnit in Units)
                {
                    if (tmpUnit.Owner >= 0 &&
                        tmpUnit.Owner < 16)
                    {
                        lPlayers[tmpUnit.Owner].Units.Add(tmpUnit);
                    }
                }

            #endregion

            return lPlayers;
        }