예제 #1
0
 public static void Show(Manager manager, Era era, string title)
 {
     NewEraWindow msgBox = new NewEraWindow(manager, era);
     msgBox.Text = title;
     msgBox.Resizable = false;
     msgBox.ShowModal();
 }
예제 #2
0
        private NewEraWindow(Manager manager, Era era)
            : base(manager)
        {
            Init();

            Width = 950;
            Height = 550;

            _lblEraImage = new ImageBox(manager);
            _lblEraImage.Init();
            _lblEraImage.Left = 4;
            _lblEraImage.Top = 10;          
            _lblEraImage.Width = 924;
            _lblEraImage.Height = 472;
            _lblEraImage.Image = era.Image;
            Add(_lblEraImage);

            _lblDescription = new Label(manager);
            _lblDescription.Init();
            _lblDescription.Left = 4;
            _lblDescription.Top = 482;
            _lblDescription.Width = 924;
            _lblDescription.Height = 16;
            _lblDescription.Text = string.Format(Strings.TXT_KEY_UI_NEWERA_WELCOME, era.Title);
            Add(_lblDescription);

            Manager.Add(this);
        }
        public virtual void Init()
        {
            _era = Provider.GetEra("Ancient");
            Assert.NotNull(_era, "There must be at least the 'Ancient' era present");

            _eras.Add(_era);
            Assert.AreEqual(1, _eras.Count, "There must be exacly one era (Ancient)");

            foreach (Tech tech in _civilization.StartingTechs)
                DiscoverTechnology(tech);
        }
        public void DiscoverTechnology(Tech tech)
        {
            if (tech.Era > _era)
            {
                _era = tech.Era;
                _eras.Add(tech.Era);

                GameFacade.getInstance().SendNotification(GameNotification.StartEra, this, _era);

                bool needToUpdateResources = false;
                // reveal resources for all players
                foreach (MapCell cell in Map.Tiles)
                {
                    if (!cell.RessourceRevealed && cell.Ressource != null && cell.Ressource.RequiredTechName == tech.Name)
                    {
                        cell.RessourceRevealed = true;
                        needToUpdateResources = true;
                    }
                }

                if (needToUpdateResources)
                    GameFacade.getInstance().SendNotification(GameNotification.UpdateResources, this);

                // evtl. enable policies
            }
        }