private void UpdateResource() { var index = 0; foreach (var item in _itemui.Data.Inventorys.Resource.Resources) { if (item.Value.numver > 0) { if (PanelGrid.GetChild(index).ChildPanel.Count == 0) { var currentpanel = new ImagePanel(PanelGrid.GetChild(index), GetItemPath(item.Key)) { Position = PanelGrid.GetChild(index).Bounds.Center.ToVector2(), Origin = new Vector2(17, 15), Scale = 11, PanelCode = item.Key, }; currentpanel.UpdateEvent += Currentpanel_UpdateEvent; new TextPanel(PanelGrid.GetChild(index).GetChild(item.Key), _itemui.ParantMenu.StandardFont, item.Value.numver.ToString(), TextSortMode.MIDDLE) { Position = PanelGrid.GetChild(index).Bounds.Center.ToVector2() + new Vector2(25, 25), Color = Color.White }; } else { PanelExt.GetPanel <TextPanel>(PanelGrid.GetChild(index).GetChild(item.Key).GetChild(0)).Text = item.Value.numver.ToString(); } index++; } } }
public ItemInventory(ItemScreen ui, UiSkinComponent skin, Texture2D texture, int x, int y, int width, int height, float sourceScale) : base(texture, x, y, width, height, sourceScale) { _itemui = ui; TopRect = new UiRectangle(this, skin.GetSkin("test"), PanelExt.SizeToBounds(Bounds, 0f, 0f, 1f, 0.1f), 0.5f); TopRect.Color = Microsoft.Xna.Framework.Color.Silver; _itemText = new TextPanel(this, ui.ParantMenu.StandardFont, "Item", TextSortMode.LEFT) { Color = Color.Black, Position = PanelExt.PositionToBounds(TopRect.Bounds, 0.05f, 0.5f) }; PanelGrid = new GridPanel(this, 4, 4, PanelExt.SizeToBounds(Bounds, 0f, 0.1f, 1f, 0.9f), 10, 10); for (int i = 0; i < 16; i++) { PanelGrid.AddGridChilde(new UiRectangle(skin.GetSkin("item"), new Rectangle(0, 0, 100, 100), 2) { PanelCode = i }); } _exit = new ImagePanel(this, "UI\\exit"); _exit.SetPosition(PanelExt.PositionToBounds(Bounds, 0.95f, 0.05f)); _exit.Scale = 1.5f; _exit.Recalculate(); SelectOnEvent += ItemPanel_SelectOnEvent; }
public override void Update() { UpdateResource(); MovementPanel(); if (PanelExt.OnePressedSprite(_itemui.ParantMenu.UICamera, _exit)) { Select = false; _itemui.ItemOn = false; _oldMousePoint = Vector2.Zero; } base.Update(); }
private void MovementPanel() { if (PanelExt.PressedSprite(_itemui.ParantMenu.UICamera, TopRect) && _oldMousePoint != Vector2.Zero) { TopRect.Select = true; } if (TopRect.Select) { if (InputExt.Released(MouseButtons.Left)) { TopRect.Select = false; } AmoundPostion(_itemui.ParantMenu.UICamera.ScreenToWorldMouse() - _oldMousePoint); } _oldMousePoint = _itemui.ParantMenu.UICamera.ScreenToWorldMouse(); }
public StatusScreen(Data data, PlayUI parant) : base(data, parant) { HpBar = new BarHp(data, this); AirBar = new BarAir(data, this); MentalBar = new BarMental(data, this); ExtBar = new BarExp(data, this); _Uiclass = new UiRectangle(ParantMenu.UISkin.GetSkin("test"), new Rectangle(ExtBar.Bounds.Left - 200, ExtBar.Bounds.Bottom - 100, 200, 100), 0.5f); AddSprite(_Uiclass); ClassName = new TextPanel(_Uiclass, parant.StandardFont, "Class", TextSortMode.MIDDLE) { Position = PanelExt.PositionToBounds(_Uiclass.Bounds, 0.5f, 0.5f), }; _CraftMode = new UiRectangle(ParantMenu.UISkin.GetSkin("test"), new Rectangle(ExtBar.Bounds.Right, ExtBar.Bounds.Bottom - 100, 200, 100), 0.5f); AddSprite(_CraftMode); new TextPanel(_CraftMode, parant.StandardFont, "CraftMode", TextSortMode.MIDDLE) { Position = PanelExt.PositionToBounds(_CraftMode.Bounds, 0.5f, 0.5f), }; }
public ToolUiScreen(Data data, PlayUI parant) : base(data, parant) { _ScrollPanel = new ScrollPanel(null, PanelExt.SizeToBounds(GraphicsExt.GetDeviceViewport, 0.8f, 0, 0.2f, 1f)); }