public CL_Object(CL_Object clobj)
 {
     this.Name              = clobj.Name;
     this.Model             = clobj.Model;
     this.ModelSize         = clobj.ModelSize;
     this.Operations        = new List <Operation>(clobj.Operations);
     this.Type              = clobj.Type;
     this.Liquidvolume      = clobj.Liquidvolume;
     this.LiquidTemperature = clobj.LiquidTemperature;
     this.LiquidColor       = clobj.LiquidColor;
     this.Id         = clobj.Id;
     this.Position   = clobj.Position;
     this.EulerAngle = clobj.EulerAngle;
 }
Example #2
0
 public GI_ContentButton(GameInterface gameInterface, int width, int height, int x, int y, CL_ObjType objType)
     : base(gameInterface, objType.Texture, width, height, x, y, objType.Texture.Name)
 {
 }
        private void LoadInterface(Texture2D texture)
        {
            GI_DropdownMenu mainmenu = new GI_DropdownMenu(this, texture);
            _objs.Add(mainmenu);

            // ---------- File submenu ----------
            GI_DropdownSubmenu file = new GI_DropdownSubmenu(this, texture);
            _objs.Add(file);

            file.AddButton(() => { Console.WriteLine("New level placeholder button"); }, "New");
            file.AddButton(() => { _screen.GameLevel.SaveLevel("poopies"); }, "Save");
            file.AddButton(() => { Console.WriteLine("save as button"); }, "Save As");
            file.AddButton(() => { Console.WriteLine("Open file placeholder button"); }, "Open");

            mainmenu.AddSubMenu(file, "File");

            // ---------- Tools submenu ----------
            GI_DropdownSubmenu tools = new GI_DropdownSubmenu(this, texture);
            _objs.Add(tools);

            tools.AddButton(() => { _screen.GameLevel.MainLayer.TileSystem.CurrentTool = TileSystem.Tool.elevate; }, "Elevate");
            tools.AddButton(() => { _screen.GameLevel.MainLayer.TileSystem.CurrentTool = TileSystem.Tool.smooth; }, "Smooth");
            tools.AddButton(() => { _screen.GameLevel.MainLayer.TileSystem.CurrentTool = TileSystem.Tool.zeroelevation; }, "Zero Elevation");

            mainmenu.AddSubMenu(tools, "Tools");

            // ========== WINDOWS SUBMENU START ==========
            GI_DropdownSubmenu windows = new GI_DropdownSubmenu(this, texture);
            _objs.Add(windows);

            // ----- Content Browser -----
            GI_Window contentBrowser = new GI_Window(this, texture, _initialWindowWidth, _initialWindowHeight, 200, 200, "Content Browser");
            windows.AddButtonForObj(contentBrowser, "Content Browser");
            _objs.Add(contentBrowser);

            contentBrowser.MainCell.Split(true, 0.6f);
            contentBrowser.MainCell.Child2.Split(false, 0.7f);

            GI_WindowCell contentCell   = contentBrowser.MainCell.Child1;
            GI_WindowCell infoCell      = contentBrowser.MainCell.Child2.Child1;
            GI_WindowCell fileCell      = contentBrowser.MainCell.Child2.Child2;

            // Info cell
            Vector2 selectorSize = new Vector2(100, 140);
            Vector2 selectorPosition;
            selectorPosition.X = (infoCell.Left + (infoCell.Width / 2)) - (selectorSize.X / 2);
            selectorPosition.Y = infoCell.Top + 10;
            GI_WindowCellObj selectionIndicator = new GI_WindowCellObj(this, texture, (int)selectorSize.X, (int)selectorSize.Y, (int)selectorPosition.X, (int)selectorPosition.Y, infoCell);

            Vector2 textFieldSize = new Vector2(120, 16);
            GI_TextField textfieldRefernceID = new GI_TextField(this, texture, (int)textFieldSize.X, (int)textFieldSize.Y, infoCell.Left + (infoCell.Width / 2), infoCell.Bottom - 100, infoCell, "Reference ID:");
            GI_TextField textfieldTextureName = new GI_TextField(this, texture, (int)textFieldSize.X, (int)textFieldSize.Y, infoCell.Left + (infoCell.Width / 2), textfieldRefernceID.Bottom + 10, infoCell, "Texture Name:");

            // Content cell
            Dictionary<short, CL_ObjType> content = _screen.ContentLib.GetLoadedFile("tiletypes");
            int i = 0;
            foreach (KeyValuePair<short, CL_ObjType> element in content)
            {
                CL_ObjType tile = new CL_ObjType(element.Value.ReferenceID, element.Value.Texture);
                GI_ContentButton button = new GI_ContentButton(this, 50, 70, contentCell.Left + (i * 60), contentCell.Top, tile);
                contentCell.AddObject(button);
                button.Clicked += delegate()
                {
                    _screen.GameLevel.MainLayer.TileSystem.CurrentTileReference = tile.ReferenceID;
                    selectionIndicator.Texture = tile.Texture;
                    textfieldRefernceID.Text = "" + tile.ReferenceID;
                    textfieldTextureName.Text = tile.Texture.ToString();
                };
                i++;
            }

            // ----- Another Window -----

            mainmenu.AddSubMenu(windows, "Windows");
            // ========== WINDOWS SUBMENU END ==========
        }