示例#1
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");
            }
        }
示例#2
0
 public void TestBuildings1()
 {
     Game g = new Game(new PlayState());
     var st = (PlayState)g.CurrentState;
     var buildings = st.PlayerBase.Buildings;
     var units = st.PlayerBase.Units;
     BuildCommand += st.OnBuildCommand;
     OnBuildCommand("Farm", new Point(11, 16));
     Assert.AreEqual(st.PlayerBase.Buildings.Count, 1);
     OnBuildCommand("Tower", new Point(18, 9));
     Assert.AreEqual(st.PlayerBase.Buildings.Count, 1);
     OnBuildCommand("BowWorkshop", new Point(14, 13));
     Assert.AreEqual(st.PlayerBase.CountBuildings["Farm"], 1);
     Assert.AreEqual(st.PlayerBase.CountBuildings["BowWorkshop"], 0);
     OnBuildCommand("Barrack", new Point(10, 17));
     Assert.AreEqual(st.PlayerBase.CountBuildings["Barrack"], 1);
     Assert.AreEqual(st.PlayerBase.Buildings.Count, 2);
     Assert.AreEqual(st.PlayerBase.Buildings[1].Location.y,17);
 }