示例#1
0
        public MapControlFrame(MapFrame Map, OutputFrame Output)
        {
            this.Map      = Map;
            this.Output   = Output;
            MapGrid       = Map.MapSpaceGrid;
            MapButtonGrid = Map.ButtonGrid;

            Markets      = new List <Market>();
            MarketFrames = new List <MarketUI>();

            // Setting columns and rows in the grid.

            this.ColumnDefinitions.Add(new ColumnDefinition());
            this.ColumnDefinitions.Add(new ColumnDefinition());
            this.ColumnDefinitions.Add(new ColumnDefinition());
            this.ColumnDefinitions.Add(new ColumnDefinition());
            this.RowDefinitions.Add(new RowDefinition());
            this.RowDefinitions.Add(new RowDefinition());
            this.RowDefinitions.Add(new RowDefinition());
            //this.RowDefinitions.Add(new RowDefinition());
            //this.RowDefinitions.Add(new RowDefinition());
            this.ColumnDefinitions.Add(new ColumnDefinition());
            this.RowDefinitions.Add(new RowDefinition());

            // Creating the map zoom scroll bar.

            MapZoom             = new ScrollBar();
            MapZoom.Minimum     = 0.1;
            MapZoom.Maximum     = 1;
            MapZoom.Scroll     += ScrollEvent;
            MapZoom.Orientation = Orientation.Horizontal;
            MapZoom.Value       = 1;


            // Creating the buttons.

            ShowInfrastructure        = new Button();
            ShowInfrastructure.Click += InfraClick;

            ShowAgencies        = new Button();
            ShowAgencies.Click += AgencyClick;

            ShowCoords         = new Button();
            ShowCoords.Click  += CoordClick;
            ShowCoords.Content = "Coords";

            ShowGov          = new Button();
            ShowGov.Click   += GovClick;
            GovernmentScreen = new GovtScreen();

            // Creating the Markets.

            MarketSelector = new ComboBox();

            for (int i = 0; i < Enum.GetNames(typeof(ItemTypes)).Length; i++)
            {
                MarketSelector.Items.Add(((ItemTypes)i).ToString());
                Debug.WriteLine(((ItemTypes)i).ToString());
                Market    market = new Market((ItemTypes)i, CurrencyTypes.USD, ((ItemTypes)i).ToString() + " USA");
                ItemTypes type   = (ItemTypes)i;
                MarketFrames.Add(new MarketUI(market, (ItemTypes)i));
                Markets.Add(market);
                MarketFrames[i].Hide();
            }

            MarketSelector.SelectionChanged += ItemMarketEvent;

            // Adding items for testing

            MarketUser user = new MarketUser("Campbell Soup");

            Classes.MarketItems.CannedFood cannedFood = new Classes.MarketItems.CannedFood();
            cannedFood.User = user;

            GetProperMarket(ItemTypes.Consumable).ListItem(user, cannedFood);

            // Setting the positions of the UI elements.

            Grid.SetRow(MapZoom, 0);
            Grid.SetColumn(MapZoom, 0);

            Grid.SetRow(ShowInfrastructure, 1);
            Grid.SetColumn(ShowInfrastructure, 0);

            Grid.SetRow(ShowAgencies, 1);
            Grid.SetColumn(ShowAgencies, 1);

            Grid.SetRow(ShowGov, 1);
            Grid.SetColumn(ShowGov, 2);

            Grid.SetRow(ShowCoords, 1);
            Grid.SetColumn(ShowCoords, 3);

            Grid.SetRow(MarketSelector, 1);
            Grid.SetColumn(MarketSelector, 4);

            // Adding the UI elements to the grid.

            this.Children.Add(MapZoom);
            this.Children.Add(ShowInfrastructure);
            this.Children.Add(ShowAgencies);
            this.Children.Add(ShowGov);
            this.Children.Add(MarketSelector);
            this.Children.Add(ShowCoords);

            Button button = (Button)VisualTreeHelper.GetChild(this, 1);

            SetButtonImage(1, TextureFolderLocation + "\\InfrastructureIcon.png");

            button = (Button)VisualTreeHelper.GetChild(this, 2);
            SetButtonImage(2, TextureFolderLocation + "\\EmptyClipboard.png");

            button = (Button)VisualTreeHelper.GetChild(this, 3);
            SetButtonImage(3, TextureFolderLocation + "\\govt.png");
        }
示例#2
0
 public ViewControl(MapFrame map, MapControlFrame mapControl)
 {
 }