-
Notifications
You must be signed in to change notification settings - Fork 1
/
CFGTabControl.cs
73 lines (63 loc) · 2.26 KB
/
CFGTabControl.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KAGIDE
{
public partial class CFGTabControl : UserControl
{
private BlobCFG Data;
private SpriteDrawer InventoryIconSprite = new SpriteDrawer();
public CFGTabControl(BlobCFG data)
{
Data = data;
InitializeComponent();
PopulateFields();
UpdatePreviews();
}
private void SpriteFactory_CheckedChanged(object sender, EventArgs e)
{
CheckBox cb = (CheckBox)sender;
SpriteBox.Enabled = cb.Checked;
}
private void button1_Click(object sender, EventArgs e)
{
}
private void PopulateFields() {
///General
NameBox.Text = Data.InventoryName;
CFGNameBox.Text = Data.Name;
InventoryIconLabel.Text = Data.InventoryIcon;
FrameBox.Value = Data.InventoryIconFrame;
IconSizeW.Text = "" + Data.InventoryIconFrameWidth;
IconSizeH.Text = "" + Data.InventoryIconFrameHeight;
SlotSizeW.Text = "" + Data.InventoryUsedWidth;
SlotSizeH.Text = "" + Data.InventoryUsedHeight;
MaxStacksBox.Value = Data.InventoryMaxStacks;
}
private void UpdatePreviews() {
InventoryIconSprite.LoadSprite(FileTree.GetImagePath(Data.InventoryIcon));
InventoryIconSprite.FrameWidth = Data.InventoryIconFrameWidth;
InventoryIconSprite.FrameHeight = Data.InventoryIconFrameHeight;
InventoryIconSprite.Frame = Data.InventoryIconFrame;
IconSpriteBox.Image = InventoryIconSprite.Draw();
IconSpriteBox.SizeMode = PictureBoxSizeMode.CenterImage;
}
private void IconSizeW_TextChanged(object sender, EventArgs e) {
int size = 1;
try {
size = int.Parse(IconSizeW.Text);
}
catch (FormatException) {
(sender as TextBox).Text = "1";
}
Data.SetValue("u8 inventory_icon_frame_width", size);
UpdatePreviews();
}
}
}