2014-06-28 21:22:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX
|
|
|
|
|
{
|
|
|
|
|
public partial class SAV_BoxLayout : Form
|
|
|
|
|
{
|
2015-09-21 03:34:09 +00:00
|
|
|
|
public SAV_BoxLayout(int box)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2015-09-21 03:34:09 +00:00
|
|
|
|
Util.TranslateInterface(this, Main.curlanguage);
|
2015-10-24 03:13:32 +00:00
|
|
|
|
sav = (byte[])Main.SAV.Data.Clone();
|
2014-07-27 03:21:31 +00:00
|
|
|
|
editing = true;
|
2015-12-15 06:14:57 +00:00
|
|
|
|
|
2014-08-02 06:03:14 +00:00
|
|
|
|
// Repopulate Wallpaper names
|
|
|
|
|
CB_BG.Items.Clear();
|
2015-09-21 03:34:09 +00:00
|
|
|
|
foreach (string wallpaper in Main.wallpapernames)
|
2015-03-11 01:44:51 +00:00
|
|
|
|
CB_BG.Items.Add(wallpaper);
|
2015-12-15 06:14:57 +00:00
|
|
|
|
|
2014-08-02 06:03:14 +00:00
|
|
|
|
// Go
|
2015-12-15 06:14:57 +00:00
|
|
|
|
MT_BG1.Text = sav[Main.SAV.PCFlags + 0].ToString();
|
|
|
|
|
CB_Unlocked.SelectedIndex = sav[Main.SAV.PCFlags + 1] - 1;
|
|
|
|
|
MT_BG2.Text = sav[Main.SAV.PCFlags + 2].ToString();
|
2015-09-21 03:34:09 +00:00
|
|
|
|
LB_BoxSelect.SelectedIndex = box;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
2015-09-21 03:34:09 +00:00
|
|
|
|
public byte[] sav;
|
2015-03-12 04:44:12 +00:00
|
|
|
|
public bool editing;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
|
|
|
|
private void changeBox(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
editing = true;
|
|
|
|
|
|
2015-12-15 06:14:57 +00:00
|
|
|
|
int bgoff = Main.SAV.PCBackgrounds + LB_BoxSelect.SelectedIndex;
|
2015-09-21 03:34:09 +00:00
|
|
|
|
CB_BG.SelectedIndex = sav[bgoff];
|
2015-12-15 06:14:57 +00:00
|
|
|
|
TB_BoxName.Text = Encoding.Unicode.GetString(sav, Main.SAV.PCLayout + 0x22 * LB_BoxSelect.SelectedIndex, 0x22).Trim();
|
2014-07-27 03:21:31 +00:00
|
|
|
|
|
2014-06-28 21:22:05 +00:00
|
|
|
|
editing = false;
|
|
|
|
|
}
|
|
|
|
|
private void changeBoxDetails(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-12-15 06:14:57 +00:00
|
|
|
|
if (!editing)
|
|
|
|
|
Encoding.Unicode.GetBytes(TB_BoxName.Text.PadRight(17))
|
|
|
|
|
.CopyTo(sav, Main.SAV.PCLayout + 0x22 * LB_BoxSelect.SelectedIndex);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
private void B_Cancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
private void B_Save_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-12-15 06:14:57 +00:00
|
|
|
|
sav[Main.SAV.PCFlags + 0] = (byte)Util.ToUInt32(MT_BG1.Text);
|
|
|
|
|
sav[Main.SAV.PCFlags + 1] = (byte)Util.ToUInt32(CB_Unlocked.Text);
|
|
|
|
|
sav[Main.SAV.PCFlags + 2] = (byte)Util.ToUInt32(MT_BG2.Text);
|
|
|
|
|
|
2015-10-24 03:13:32 +00:00
|
|
|
|
Array.Copy(sav, Main.SAV.Data, sav.Length);
|
2015-10-24 23:33:44 +00:00
|
|
|
|
Main.SAV.Edited = true;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
Close();
|
|
|
|
|
}
|
2014-08-02 06:03:14 +00:00
|
|
|
|
|
|
|
|
|
private void changeBoxBG(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-12-15 06:14:57 +00:00
|
|
|
|
if (!editing)
|
|
|
|
|
sav[Main.SAV.PCBackgrounds + LB_BoxSelect.SelectedIndex] = (byte)CB_BG.SelectedIndex;
|
2014-11-22 03:26:16 +00:00
|
|
|
|
|
2016-01-18 01:07:19 +00:00
|
|
|
|
string imagename = "box_wp" + (CB_BG.SelectedIndex + 1).ToString("00"); if (Main.SAV.ORAS && CB_BG.SelectedIndex + 1 > 16) imagename += "o";
|
2014-11-22 03:26:16 +00:00
|
|
|
|
PAN_BG.BackgroundImage = (Image)Properties.Resources.ResourceManager.GetObject(imagename);
|
2014-08-02 06:03:14 +00:00
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|