Example #1
0
        private void AddPlanetToGrid(PlanetProfile p, HexagonGrid grid)
        {
            HexButton b = new HexButton(p);

            //b.clic += B_MouseDown;
            b.Click += B_Click;
            _profiles.Add(p);
            grid.Children.Add(b);
            Grid.SetRow(b, p.Column);
            Grid.SetColumn(b, p.Row);
        }
Example #2
0
        public HexButton(PlanetProfile p)
        {
            InitializeComponent();
            Planet   = p;
            SectorId = p.SectorId;
            if (p.hasPlanet)
            {
                var s = p.Profile;
                Profile       = s;
                TradeCodes    = p.TradeCodes;
                SubSectorName = p.Name;
                if (p.isAmber)
                {
                    SetAmber();
                }
                if (p.isRed)
                {
                    SetRed();
                }
                if (p.HasGasGiant)
                {
                    SetGasGiant();
                }
                if (p.Hydrographics > 3)
                {
                    SetWaterPlanet();
                }
                else
                {
                    SetDryPlanet();
                }

                if (p.HasScoutBase)
                {
                    SetScoutBase();
                }
                if (p.HasTas)
                {
                    SetTas();
                }
                if (p.HasNavalBase)
                {
                    SetNavalBase();
                }
            }
        }
Example #3
0
        public void CreateGrid(WorldFrequency freq)
        {
            HexGrid.Children.Clear();
            _profiles.Clear();
            _lastUsed = freq;
            int    columns = 10;
            int    rows    = 8;
            Random r       = new Random();

            for (int x = 0; x < columns; x++)
            {
                for (int y = 0; y < rows; y++)
                {
                    PlanetProfile p = new PlanetProfile(r, freq);
                    p.Column = x;
                    p.Row    = y;
                    AddPlanetToGrid(p, HexGrid);
                }
            }
        }