public override void Click(UIMouseEvent evt) { if (SelectedImage == this) { this.isSelect = false; SelectedImage = null; if (ToolBox.SelectedTool == ToolType.Image) { ToolShape.shape = null; } } else { if (SelectedImage != null) { SelectedImage.isSelect = false; } this.isSelect = true; SelectedImage = this; if (ToolBox.SelectedTool == ToolType.Image) { ToolShape.shape = new ShapeImage(this); } } }
public new UISlotImage Clone() { UISlotImage result = new UISlotImage(image, sortOrder, tooltip); result.position = position; result.mode = mode; return(result); }
private void LoadImage() { if (File.Exists(imageFilePath)) { grid.Clear(); foreach (var path in File.ReadAllLines(imageFilePath, Encoding.UTF8)) { try { using (var fs = new FileStream(path, FileMode.Open)) { var fileInfo = new FileInfo(fs.Name); var slot = new UISlotImage(Texture2D.FromStream(Main.graphics.GraphicsDevice, fs), grid.Count, fileInfo.Name.Replace(fileInfo.Extension, "")); grid._items.Add(slot); grid._innerList.Append(slot); } } catch { } } grid.UpdateOrder(); grid._innerList.Recalculate(); } }