Exemple #1
0
        public GalaxyGridView([NotNull] IUnityContainer container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            _container          = container;
            _appContext         = _container.Resolve <IAppContext>();
            _navigationCommands = _container.Resolve <INavigationCommandsProxy>();

            InitializeComponent();

            Loaded += delegate
            {
                GalaxyGrid.Update();
                GalaxyGrid.SelectedSector = _appContext.LocalPlayerEmpire.SeatOfGovernment.Sector;
                GalaxyGrid.CenterOnSelectedSector();
            };
            Unloaded += OnUnloaded;

            GalaxyGrid.SectorDoubleClicked += OnSectorDoubleClicked;

            PropertyChangedEventManager.AddListener(_appContext, this, "LocalPlayerEmpire");

            _revealMapCommand      = new DelegateCommand <object>(ExecuteRevealMapCommand);
            _cheatMenuCommand      = new DelegateCommand <object>(ExecuteCheatMenuCommand);
            _gameInfoScreenCommand = new DelegateCommand <object>(ExecuteGameInfoScreenCommand);

            DebugCommands.RevealMap.RegisterCommand(_revealMapCommand);
            DebugCommands.CheatMenu.RegisterCommand(_cheatMenuCommand);
            DebugCommands.GameInfoScreen.RegisterCommand(_gameInfoScreenCommand);
        }
Exemple #2
0
        private void ExecuteRevealMapCommand(object t)
        {
            if (!_appContext.IsSinglePlayerGame)
            {
                return;
            }

            var map       = _appContext.CurrentGame.Universe.Map;
            var playerCiv = _appContext.LocalPlayer.Empire;
            var mapData   = _appContext.LocalPlayerEmpire.MapData;

            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    MapLocation loc = new MapLocation(x, y);
                    mapData.SetExplored(loc, true);
                    mapData.SetScanStrength(loc, 99);
                }
            }

            var diplomat = Diplomat.Get(playerCiv);

            foreach (var civ in GameContext.Current.Civilizations)
            {
                if (civ == playerCiv)
                {
                    continue;
                }
                if (diplomat.GetForeignPower(civ).DiplomacyData.Status == ForeignPowerStatus.NoContact)
                {
                    diplomat.GetForeignPower(civ).DiplomacyData.Status = ForeignPowerStatus.Neutral;
                }
            }
            GalaxyGrid.Update();
        }