using System;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public class AMAnimationKey : AMKey
{
	public bool setWrapMode(WrapMode wrapMode)
	{
		if (this.wrapMode != wrapMode)
		{
			this.wrapMode = wrapMode;
			return true;
		}
		return false;
	}

	public bool setAmClip(AnimationClip clip)
	{
		if (this.amClip != clip)
		{
			this.amClip = clip;
			return true;
		}
		return false;
	}

	public bool setCrossFade(bool crossfade)
	{
		if (this.crossfade != crossfade)
		{
			this.crossfade = crossfade;
			return true;
		}
		return false;
	}

	public bool setCrossfadeTime(float crossfadeTime)
	{
		if (this.crossfadeTime != crossfadeTime)
		{
			this.crossfadeTime = crossfadeTime;
			return true;
		}
		return false;
	}

	public override AMKey CreateClone()
	{
		AMAnimationKey amanimationKey = ScriptableObject.CreateInstance<AMAnimationKey>();
		amanimationKey.frame = this.frame;
		amanimationKey.wrapMode = this.wrapMode;
		amanimationKey.amClip = this.amClip;
		amanimationKey.crossfade = this.crossfade;
		return amanimationKey;
	}

	public override void CreateFromStringData(string data_text)
	{
		string[] array = data_text.Split(new char[]
		{
			':'
		});
		if (array.Length == 0 || array[0] != "Animation")
		{
			return;
		}
		NDebug.Assert(this.obj != null, "AMAnimationKey::CreateFromStringData\nobjがnullです");
		this.amClip = null;
		int num = 1;
		this.frame = int.Parse(array[num++]);
		this.wrapMode = (WrapMode)Enum.Parse(typeof(WrapMode), array[num++]);
		bool flag = bool.Parse(array[num++]);
		if (flag)
		{
			Animation[] components = this.obj.GetComponents<Animation>();
			NDebug.Assert(components.Length != 0, "Animation取得失敗");
			string str = array[num++];
			NDebug.Assert(this.amClip != null, "AnimationClip[" + str + "]の取得に失敗しました");
		}
		this.crossfade = bool.Parse(array[num++]);
	}

	public override string ToStringData()
	{
		List<string> list = new List<string>();
		list.Add("Animation");
		list.Add(this.frame.ToString());
		list.Add(this.wrapMode.ToString());
		list.Add((this.amClip != null).ToString());
		string text = list[0];
		for (int i = 1; i < list.Count; i++)
		{
			text = text + ":" + list[i];
		}
		return text;
	}

	public WrapMode wrapMode;

	public GameObject obj;

	public AnimationClip amClip;

	public bool crossfade = true;

	public float crossfadeTime = 0.3f;
}
