private void initRecipeTable() { recipeTable = new Table(); var back = new SubtextureDrawable(new Nez.Textures.Subtexture(windowFrame)); back.setPadding(0, 620, 0, 540); recipeTable.setBackground(back); recipeTable.setSize(540, 620); allContain.add(recipeTable).top().left().pad(25); recipeTable.add(new Label("配方")); recipeContentTable = new Table(); ButtonGroup buttonGroup = new ButtonGroup(); foreach (var recipe in player.recipes) { var button = new TextButton(recipe.name, Skin.createDefaultSkin()); buttonGroup.add(button); recipeContentTable.add(button).width(50).height(20); button.onClicked += obj => { allContain.clear(); initRecipeTable(); //allContain.removeElement(recipeDetailTable); initRecipeDetailTable(recipe); }; } recipeScrollPane = new ScrollPane(recipeContentTable, Skin.createDefaultSkin()); recipeTable.addElement(recipeScrollPane).setPosition(30, 30); recipeScrollPane.setSize(500, 540); }
void prepCanvas() { _skin = Skin.createDefaultSkin(); // modify some of the default styles to better suit our needs var tfs = _skin.get <TextFieldStyle>(); tfs.background.leftWidth = tfs.background.rightWidth = 4; tfs.background.bottomHeight = 0; tfs.background.topHeight = 3; var checkbox = _skin.get <CheckBoxStyle>(); checkbox.checkboxOn.minWidth = checkbox.checkboxOn.minHeight = 15; checkbox.checkboxOff.minWidth = checkbox.checkboxOff.minHeight = 15; checkbox.checkboxOver.minWidth = checkbox.checkboxOver.minHeight = 15; // since we arent using this as a Component on an Entity we'll fake it here ui = new UICanvas(); ui.onAddedToEntity(); ui.stage.isFullScreen = true; _table = new Table(); _table.top().left(); _table.defaults().setPadTop(4).setPadLeft(4).setPadRight(0).setAlign(Align.left); _table.setBackground(new PrimitiveDrawable(new Color(40, 40, 40))); // wrap up the table in a ScrollPane _scrollPane = ui.stage.addElement(new ScrollPane(_table, _skin)); // force a validate which will layout the ScrollPane and populate the proper scrollBarWidth _scrollPane.validate(); _scrollPane.setSize(400 + _scrollPane.getScrollBarWidth(), Screen.height); }
private void initializeItemTable() { itemTable = new Table(); var windowFrame = Core.content.Load <Texture2D>("UI/window_frame_grey"); var buttonFrame = Core.content.Load <Texture2D>("UI/frame_grey"); var back = new SubtextureDrawable(new Nez.Textures.Subtexture(windowFrame)); back.setPadding(0, 620, 0, 540); itemTable.setBackground(back); allContain.add(itemTable).right().top().pad(25); itemDetailTable = new Table(); itemDetailTable.setFillParent(true).top().left(); itemScrollPane = new ScrollPane(itemDetailTable, Skin.createDefaultSkin()); itemTable.addElement(itemScrollPane).setPosition(30, 30); itemScrollPane.setSize(500, 540); ButtonGroup buttonGroup = new ButtonGroup(); int counts = 0; var itemlist = player.items.Keys.Where(m => m.types == ItemComponent.ItemTypes.Equitment).ToList(); foreach (var item in itemlist) { var imageUp = new SubtextureDrawable(item.itemIcon); var imageDown = new SubtextureDrawable(item.itemIcon); imageDown.tintColor = Color.DarkGray; var imageChecked = new SubtextureDrawable(item.itemIcon); imageChecked.tintColor = Color.DarkKhaki; var button = new ItemIconButton(imageUp, imageDown, imageChecked); button.setBackground(new SubtextureDrawable(buttonFrame)); button.item = item; button.OnMouseEntry += Button_OnMouseEntry; button.OnMouseExit += Button_OnMouseExit; button.onClicked += Button_onClicked; buttonGroup.add(button); counts++; itemDetailTable.add(button).minSize(64); if (counts > rowcount) { counts = 0; itemDetailTable.row(); } } allContain.addElement(new Label("摁Q:关闭")).setPosition(1200, 710); }
private void initPropsDetailTable() { propsTable = new Table(); var back = new SubtextureDrawable(new Nez.Textures.Subtexture(windowFrame)); back.setPadding(0, 620, 0, 540); propsTable.setBackground(back); allContain.add(propsTable).right().top().pad(25); propsDeatilTable = new Table(); propsDeatilTable.setFillParent(true).top().left(); ButtonGroup buttonGroup = new ButtonGroup(); int counts = 0; var ItemList = player.items.Keys.Where(m => m.types == ItemComponent.ItemTypes.ExecuteableProp).ToList(); if (player.AProps != null) { var item = ItemList.Where(m => m.id == player.AProps.id).First(); ItemList.Remove(item); } if (player.SProps != null) { var item = ItemList.Where(m => m.id == player.SProps.id).First(); ItemList.Remove(item); } if (player.DProps != null) { var item = ItemList.Where(m => m.id == player.DProps.id).First(); ItemList.Remove(item); } if (player.FProps != null) { var item = ItemList.Where(m => m.id == player.FProps.id).First(); ItemList.Remove(item); } if (player.GProps != null) { var item = ItemList.Where(m => m.id == player.GProps.id).First(); ItemList.Remove(item); } foreach (var item in ItemList) { var imageUp = new SubtextureDrawable(item.itemIcon); var imageDown = new SubtextureDrawable(item.itemIcon); imageDown.tintColor = Color.DarkGray; var imageChecked = new SubtextureDrawable(item.itemIcon); imageChecked.tintColor = Color.DarkKhaki; var button = new ItemIconButton(imageUp, imageDown, imageChecked); button.setBackground(new SubtextureDrawable(buttonFrame)); button.item = item; button.OnMouseEntry += Button_OnMouseEntry; button.OnMouseExit += Button_OnMouseExit; button.onClicked += Button_onClicked; buttonGroup.add(button); counts++; propsDeatilTable.add(button).size(64); if (counts > rowcount) { counts = 0; propsDeatilTable.row(); } } propsScrollPane = new ScrollPane(propsDeatilTable, Skin.createDefaultSkin()); propsTable.addElement(propsScrollPane).setPosition(30, 30); propsScrollPane.setSize(500, 540); }