Esempio n. 1
0
        /// <summary>
        /// Create the side folder
        /// Create side folder buttons from each building in the building catalog
        /// </summary>
        public SideFolder(CampusCatalog catalog) : base(Constants.GUI_DEPTH)
        {
            this.Clickable      = true;
            this.Type           = ElementType.GUI;
            this.folderPosition = -WIDTH;

            this.buildTab = new BuildTab(this);
            this.AddChild(this.buildTab);

            this.buildScrollBar = new ScrollBar(new Pair <int>(5 - WIDTH, 20), new Pair <int>(155, 440), int.MaxValue - 2);
            this.AddChild(this.buildScrollBar);

            foreach (var element in catalog.GetCatalog())
            {
                if (element.InToolbox)
                {
                    this.buildScrollBar.AddElement(
                        new SideFolderButton(
                            element,
                            new Pair <int>(155, 80),
                            this.buildScrollBar,
                            this.Depth + 1));
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Set up the game room.
        /// </summary>
        public override void Initialize()
        {
            int startX = this.roomConfig.GetIntValue("CameraStartX", 0);
            int startY = this.roomConfig.GetIntValue("CameraStartY", 0);

            GameWidth  = this.roomConfig.GetIntValue("RoomWidth", Constants.WINDOW_WIDTH);
            GameHeight = this.roomConfig.GetIntValue("RoomHeight", Constants.WINDOW_HEIGHT);

            // set up the singleton camera
            Camera.Setup(startX, startY, GameWidth, GameHeight);

            // Initialize Building stuff
            campusCatalog = new CampusCatalog();

            // Initialize the Building manager
            CampusManager.Instance.Initialize(GameWidth, GameHeight);

            // Initialize GUI
            folder = new SideFolder(campusCatalog);
            hud    = new HUD();
            status = new StatusBar();
        }