Ejemplo n.º 1
0
 public PlayerBase(Map _map)
 {
     map = _map;
     BuildCapabilitiesBuildings = new Dictionary<string, bool>();
     BuildCapabilitiesUnits = new Dictionary<string, bool>();
     CountBuildings = new Dictionary<string, int>();
     CountUnits = new Dictionary<string, int>();
     UIBLC xml = new UIBLC();
     xml = XMLWork.XMLDeserialization();
     Buildings = new List<AbstractBuilding>();
     Units = new List<IUnit>();
     Resources = XMLWork.XMLStarting().resources;
     foreach (string item in xml.BuildingTypes)
     {
         BuildCapabilitiesBuildings.Add(item, false);
         CountBuildings.Add(item, 0);
     }
     foreach (string item in xml.UnitTypes)
     {
         BuildCapabilitiesUnits.Add(item, false);
         CountUnits.Add(item, 0);
     }
     BuildCapabilitiesBuildings["Farm"] = true;
     factory = new BuildingFactory();
     unitFactory = new UnitFactory();
     newOptions = new AddNewOptions();
 }
Ejemplo n.º 2
0
 //[XmlInclude(typeof(BuildFarmCapability)), XmlInclude(typeof(BuildBarrackCapability)), XmlInclude(typeof(BuildBowWorkshopCapability)), XmlInclude(typeof(BuildTowerCapability)), XmlInclude(typeof(BuildPeasantCapability)), XmlInclude(typeof(BuildArcherCapability))]
 public static void Main(string[] args)
 {
     var buildingTypes = new string[5] {"Farm", "Barrack","BowWorkshop","Tower","Blacksmith" };
     var unitTypes = new string[4] { "Peasant", "Archer", "Clubman", "SwordFighter" };
     UIBLC uW = new UIBLC();
     uW.BuildingTypes = buildingTypes;
     uW.UnitTypes = unitTypes;
     Serialize(uW);
     Starting s = new Starting();
     s.Resources = 200;
     Serialize(s);
     NewOptions options = new NewOptions();
     options.FarmBuildings = new string[1] { "Barrack" };
     options.FarmUnits = new string[1] { "Peasant" };
     options.BarrackBuildings = new string[1] { "BowWorkshop" };
     //options.BarrackUnits = new string[1] { "Clubman" };
     options.BowWorkshopBuildings = new string[1] { "Tower" };
     options.BowWorkshopUnits = new string[1] { "Archer" };
     //options.TowerBuildings = new string[1] { "Blacksmith" };
     //options.BlacksmithUnits = new string[1] { "SwordFighter" };
     Serialize(options);
     //var map = new Map();
     //map = map.Run(16, 16);
     //SerialMap(map);
 }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();
            log.Trace("MainWindow initialized");
            denumiri = new Uwarcraft.Units.UIBLC();
            denumiri = XMLWork.XMLDeserialization();
            g = new Game(new PlayState());
            st = (PlayState)g.CurrentState;
            st.Run();
            BuildCommand += st.OnBuildCommand;
            TrainCommand += st.OnTrainCommand;
            st.NewUpdate += OnNewUpdate;
            st.UIMessage += OnMsgUpdate;
            st.PlayerBase.UIMessage += OnMsgUpdate;
            Console.ReadLine();

            ShowBuildMenu();
            ShowTrainMenu();

            for (int i = 0; i < st.PlayerBase.Buildings.Count; i++)
            {
                TextBlock item = new TextBlock();
                item.Name = i.ToString();
                item.Text = string.Format("{0} {1} {2} {3} {4}", st.PlayerBase.Buildings[i].Type, st.PlayerBase.Buildings[i].Life, st.PlayerBase.Buildings[i].DamageTaken, st.PlayerBase.Buildings[i].Location.ToString(), st.PlayerBase.Buildings[i].Complete.ToString());
                stack3.Children.Add(item);
                log.Trace("showing Building Options");
            }
        }
Ejemplo n.º 4
0
 public static void Serialize(UIBLC uW)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(UIBLC));
     // WARNING !!! You might need to change this link in order to make this project work
     using (TextWriter writer = new StreamWriter(@"C:/Users/Andrei/Source/Repos/uWarcraft/Uwarcraft/Serialization/UIBLC.xml"))
     {
         serializer.Serialize(writer, uW);
     }
 }