From 005c35761c4ac5a27c5569a0df16683a44366091 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Tue, 19 Sep 2017 13:10:36 -0500 Subject: [PATCH] make a ValuesDifferFromData function --- SpriteLibrary/SpriteEntryForm.cs | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/SpriteLibrary/SpriteEntryForm.cs b/SpriteLibrary/SpriteEntryForm.cs index 3b14c2d..8f306fe 100644 --- a/SpriteLibrary/SpriteEntryForm.cs +++ b/SpriteLibrary/SpriteEntryForm.cs @@ -291,6 +291,51 @@ namespace SpriteLibrary } } + /// + /// Take the values stored in TempInformation and push it out to our form + /// + private bool ValuesDifferFromData() + { + if (TempInformation == null) return true; + //For the main sprite information + int tValue; + + if(TempInformation.SpriteName != tbSpriteName.Text) return true; + int.TryParse(tbDefaultSize.Text, out tValue); + if(tValue != TempInformation.ViewPercent)return true; + + //From the current animation + AnimationInfo AI = null; + if (CurrentSIAnimation < 0) CurrentSIAnimation = 0; + if (CurrentSIAnimation >= TempInformation.Animations.Count) CurrentSIAnimation = TempInformation.Animations.Count - 1; + if (CurrentSIAnimation < TempInformation.Animations.Count) + { + AI = TempInformation.Animations[CurrentSIAnimation]; + + int.TryParse(tbAmimationSpeed.Text, out tValue); + if (tValue != AI.AnimSpeed) return true; + if(AI.ImageName != cbStartingImage.Text) return true; + + if(AI.MirrorHorizontally != cbMirrorH.Checked) return true; + if(AI.MirrorVertically != cbMirrorV.Checked) return true; + + int.TryParse(cbAnimation.Text, out tValue); + if (tValue != AI.AnimationToUse) return true; + + int.TryParse(tbNumFrames.Text, out tValue); + if(tValue != AI.NumFrames) return true; + + if(AI.StartPoint != ChosenArea.Location) return true; + if(AI.Width != ChosenArea.Width) return true; + if(AI.Height != ChosenArea.Height) return true; + + if (rbFromImage.Checked && AI.FieldsToUse != AnimationType.SpriteDefinition) return true; + if (rbMirror.Checked && AI.FieldsToUse != AnimationType.Mirror) return true; + if (rbRotation.Checked && AI.FieldsToUse != AnimationType.Rotation) return true; + } + return false; + } + /// /// Given two locations that we have clicked on, find the area we have selected ///