Example #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));
                }
            }
        }
Example #2
0
 public ScrollElement(Pair<int> size, ScrollBar parent, int depth)
     : base(depth)
 {
     this.Position = new Pair<int>(1337, 1337); // this will be overwritten by the ScrollBar once it's added to the list.
     this.Size = size;
     this.parent = parent;
     this.Clickable = true;
     this.Type = ElementType.GUI;
 }
Example #3
0
        /// <summary>
        /// Create a build button. All this information should be stored in a configuration file for easy testing.
        /// The specs is a comma separated list of specs. Up to 4 can be displayed... any more and we will have to do a quick redesign.
        /// </summary>
        /// <param name="data">The data this side-button is based on</param>
        /// <param name="parent">The parent scroll bar</param>
        /// <param name="depth">Depth of the button</param>
        public SideFolderButton(Data data, Pair<int> size, ScrollBar parent, int depth)
            : base(size, parent, depth)
        {
            this.parent = parent;
            this.data = data;

            var specsStringList = new List<string>();

            BuildingData buildingData = data as BuildingData;
            if (buildingData != null)
            {
                foreach (var pair in buildingData.Specs)
                {
                    string key = pair.Key.ToString();
                    int value = pair.Value;
                    specsStringList.Add(string.Format("{0} {1}{2}", key, (value < 0 ? "" : "+"), value));
                }
            }

            this.specsString = specsStringList;
            this.dirtyImageBit = true;
        }
Example #4
0
            /// <summary>
            /// The actual scroll bar on the right hand side of the bar
            /// </summary>
            /// <param name="parent"></param>
            /// <param name="depth"></param>
            public Scroll(ScrollBar parent, int depth)
                : base(depth)
            {
                this.Clickable = true;
                this.Type = ElementType.GUI;

                this.parent = parent;
                this.UpdateDestRectangles();
            }