private void ChangeFrame(int newFrame) { if (curPak == -1 || curSprite == -1 || Paks[curPak].sprites[curSprite].frames.Count == 0) { SetFrameControls(false); curFrame = -1; return; } SetFrameControls(true); Pak.FrameInfo frameInf = Paks[curPak].sprites[curSprite].frames[newFrame]; int width = Paks[curPak].sprites[curSprite].image.Width; int height = Paks[curPak].sprites[curSprite].image.Height; TxtTBarLink.SetValue(tbarX, frameInf.X, 0, width); TxtTBarLink.SetValue(tbarY, frameInf.Y, 0, height); TxtTBarLink.SetValue(tbarWidth, frameInf.Width, 0, width); TxtTBarLink.SetValue(tbarHeight, frameInf.Height, 0, height); TxtTBarLink.SetValue(tbarFixX, frameInf.fixX, minFixX, maxFixX); TxtTBarLink.SetValue(tbarFixY, frameInf.fixY, minFixY, maxFixY); curFrame = newFrame; }
public static void SetValue(object o, int value, int lowerb = int.MaxValue, int upperb = int.MaxValue) { TxtTBarLink TTData = GetTTLink(o); if (TTData == null) { return; } if (lowerb != int.MaxValue && upperb != int.MaxValue) { TTData.lowerBound = lowerb; TTData.upperBound = upperb; TTData.trackBar.SetRange(lowerb, upperb); } TTData.txtBox.Text = value.ToString(); if (value > TTData.trackBar.Maximum) { TTData.trackBar.Maximum = value; } if (value < TTData.trackBar.Minimum) { TTData.trackBar.Minimum = value; } TTData.trackBar.Value = value; }
private void SetFrameAttrib(object sender, int value) { TxtTBarLink.SetValue(sender, value); System.Reflection.MethodInfo MI = Type.GetType("Pak_Editor.Pak+FrameInfo").GetMethod(TxtTBarLink.GetSetMethod(sender)); MI.Invoke(Paks[curPak].sprites[curSprite].frames[curFrame], new object[1] { (object)((Int16)value) }); picBox.Refresh(); }
public static string GetSetMethod(object o) { TxtTBarLink TTData = GetTTLink(o); if (TTData == null) { return(""); } return(TTData.setMethod); }
public static void GetBounds(object o, out int lower, out int upper) { lower = 0; upper = 0; TxtTBarLink TTData = GetTTLink(o); if (TTData == null) { return; } lower = TTData.lowerBound; upper = TTData.upperBound; }
private void Form1_Load(object sender, EventArgs e) { TxtTBarLink.SetupLink(txtX, tbarX, "setX"); TxtTBarLink.SetupLink(txtY, tbarY, "setY"); TxtTBarLink.SetupLink(txtWidth, tbarWidth, "setWidth"); TxtTBarLink.SetupLink(txtHeight, tbarHeight, "setHeight"); TxtTBarLink.SetupLink(txtFixX, tbarFixX, "setFixX"); TxtTBarLink.SetupLink(txtFixY, tbarFixY, "setFixY"); for (int i = 1; i < 31; i++) { fpsSelection.Items.Add(i + " fps"); } fpsSelection.SelectedIndex = 11; Reset(); }
private void SetFrameControls(bool enable) { if (enable == false) { TxtTBarLink.SetValue(tbarX, 0, 0, 0); TxtTBarLink.SetValue(tbarY, 0, 0, 0); TxtTBarLink.SetValue(tbarHeight, 0, 0, 0); TxtTBarLink.SetValue(tbarWidth, 0, 0, 0); TxtTBarLink.SetValue(tbarFixX, 0, 0, 0); TxtTBarLink.SetValue(tbarFixY, 0, 0, 0); } foreach (Control ctrl in frameCtrls.Controls) { ctrl.Enabled = enable; } }
private void txt_ValidateAdjust(object sender, System.ComponentModel.CancelEventArgs e) { int lowerbound, upperbound, textValue; TxtTBarLink.GetBounds(sender, out lowerbound, out upperbound); if (!int.TryParse(((TextBox)sender).Text, out textValue)) { e.Cancel = true; return; } if (textValue < lowerbound) { TxtTBarLink.SetValue(sender, textValue, textValue); } else if (textValue > upperbound) { TxtTBarLink.SetValue(sender, textValue, lowerbound, textValue); } SetFrameAttrib(sender, textValue); }