コード例 #1
0
        public DAL.Party GameToDAO(CharacterClassLibrary.Party party)
        {
            var list = new List <DAL.Player>();

            foreach (var player in party.Players)
            {
                var DAOPlayer = new DAL.Player();
                DAOPlayer.Name       = player.Name;
                DAOPlayer.Health     = player.Health;
                DAOPlayer.Strength   = player.Strength;
                DAOPlayer.SpellPower = player.SpellPower;
                DAOPlayer.Crit       = player.Crit;
                DAOPlayer.Armor      = player.Armor;
                DAOPlayer.Level      = player.Level;
                DAOPlayer.Xp         = player.Xp;
                DAOPlayer.Items      = convertItems(player.Items);
                DAOPlayer.ItemTypes  = convertItemTypes(player.ItemTypes);
                DAOPlayer.ClassName  = Convert.ToInt32(player.ClassName);
                list.Add(DAOPlayer);
            }
            var DALParty = new DAL.Party(list);

            DALParty.Money = party.Money;
            DALParty.Map   = party.Map;
            DALParty.Side  = party.Side;
            return(DALParty);
        }
コード例 #2
0
        public CharacterClassLibrary.Party DAOToGame(DAL.Party DAOParty)
        {
            var players = new List <CharacterClassLibrary.Player>();

            foreach (var player in DAOParty.Players)
            {
                var newPlayer = generatePlayer(player);
                players.Add(newPlayer);
            }
            var money = DAOParty.Money;
            var map   = DAOParty.Map;
            var side  = DAOParty.Side;

            return(new CharacterClassLibrary.Party(players, money, map, side));
        }