예제 #1
0
 public void copy_actors_to(Game_Actors target, Battalion battalion = null)
 {
     foreach (var pair in battalion == null ? actors : actors.Where(x => battalion.actors.Contains(x.Key)))
     {
         target.actors[pair.Key] = pair.Value;
     }
 }
예제 #2
0
        public static Battalion read(BinaryReader reader)
        {
            Battalion result = new Battalion();

            result.Actors.read(reader);
            if (!Global.LOADED_VERSION.older_than(0, 4, 6, 6))
            {
                result.Deployed_Actors.read(reader);
            }
            result.Convoy_Id = reader.ReadInt32();
            result.Gold      = reader.ReadInt32();

            return(result);
        }
예제 #3
0
        public void read(BinaryReader reader)
        {
            Current_Battalion = reader.ReadInt32();
            int count = reader.ReadInt32();

            if (Global.LOADED_VERSION.older_than(0, 4, 4, 1))
            {
                List <Battalion> data = new List <Battalion>();
                for (int i = 0; i < count; i++)
                {
                    data.Add(Battalion.read(reader));
                }
                Data = Enumerable.Range(0, data.Count).Select(x => new KeyValuePair <int, Battalion>(x, data[x]))
                       .ToDictionary(p => p.Key, p => p.Value);
            }
            else
            {
                Data.read(reader);
            }
            Individual_Animations.read(reader);
            if (Global.LOADED_VERSION.older_than(0, 4, 6, 0))
            {
                Dictionary <int, List <Item_Data> > convoys = new Dictionary <int, List <Item_Data> >();
                convoys.read(reader);
                Convoys = new Dictionary <int, Game_Convoy>(convoys.Select(p =>
                {
                    Game_Convoy convoy = new Game_Convoy();
                    convoy.Data        = p.Value;
                    return(new KeyValuePair <int, Game_Convoy>(p.Key, convoy));
                }).ToDictionary(p => p.Key, p => p.Value));
            }
            else
            {
                Convoys.read(reader);
            }
        }
예제 #4
0
 public Battalion(Battalion source)
 {
     Actors    = new List <int>(source.Actors);
     Convoy_Id = source.Convoy_Id;
     Gold      = source.Gold;
 }