//----------------------------------------------------------------------------- // EditCurveState.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; namespace Xna.Tools { /// /// This class contians curve states which are name, PreLoop, and PostLoop. /// public class EditCurveState : IEquatable { #region Properties /// /// Gets/Sets Name /// public string Name { get { return name; } set { name = value; } } /// /// Gets/Sets PreLoop /// public CurveLoopType PreLoop { get { return preLoop; } set { preLoop = value; } } /// /// Gets/Sets PostLoop /// public CurveLoopType PostLoop { get { return postLoop; } set { postLoop = value; } } #endregion #region Equatable related override methods. public override int GetHashCode() { return String.IsNullOrEmpty(Name) ? 0 : Name.GetHashCode() + PreLoop.GetHashCode() + +PostLoop.GetHashCode(); } public override bool Equals(object obj) { EditCurveState other = obj as EditCurveState; bool isSame = false; if (other != null) isSame = Equals(other); return isSame; } public bool Equals(EditCurveState other) { if (other == null) return false; return (Name == other.Name && PreLoop == other.PreLoop && PostLoop == other.PostLoop); } #endregion /// /// Create close of this state. /// /// public EditCurveState Clone() { EditCurveState newState = new EditCurveState(); newState.Name = Name; newState.PreLoop = PreLoop; newState.PostLoop = PostLoop; return newState; } #region Operator override public static bool operator ==(EditCurveState value1, EditCurveState value2) { return Object.Equals(value1, value2); } public static bool operator !=(EditCurveState value1, EditCurveState value2) { return !Object.Equals(value1, value2); } #endregion #region Private property members private string name; private CurveLoopType preLoop; private CurveLoopType postLoop; #endregion } }