public static EaseType GetType(EaseClass ec, EaseDir dir) { switch (ec) { case EaseClass.Linear: case EaseClass.Spring: dir = EaseDir.In; //No dir break; } return((EaseType)((int)ec << Const.DirCount | (int)dir)); }
public void PlayTween(EaseDir type, bool forward = true, EventDelegate.Callback callback = null) { if (tweenAnimations != null) { UITweenCtrl uITweenCtrl = Array.Find(tweenAnimations, (UITweenCtrl t) => t.id == (int)type); if (uITweenCtrl != null) { uITweenCtrl.Reset(); uITweenCtrl.Play(forward, callback); } } }
/// <summary> /// Use Common UCL_Ease if you don't need to modified Ease /// </summary> /// <param name="ease"></param> /// <returns></returns> public static Ease.UCL_Ease Get(EaseClass ease, EaseDir dir = EaseDir.In) { lock (m_EaseDic) { if (!m_EaseDic.ContainsKey(ease)) { Dictionary <EaseDir, Ease.UCL_Ease> ease_dic = new Dictionary <EaseDir, Ease.UCL_Ease>(); foreach (EaseDir e_dir in Enum.GetValues(typeof(EaseDir))) { ease_dic.Add(e_dir, Create(ease).SetDir(e_dir)); } m_EaseDic[ease] = ease_dic;//Create(ease); } } return(m_EaseDic[ease][dir]); }
private void Update() { if (f_LoopDir) { m_LoopTimer++; if (m_LoopTimer > m_LoopTime) { m_LoopTimer = 0; int val = (int)m_Dir; val++; if (val >= Enum.GetNames(typeof(EaseDir)).Length) { val = 0; } m_Dir = (EaseDir)val; } } m_Ease = EaseCreator.Get(m_Type, m_Dir); /* * if(!f_SetByEaseType) { * m_EaseType = EaseCreator.GetType(m_Type, m_Dir); * } else { * m_Type = EaseCreator.GetClass(m_EaseType); * m_Dir = EaseCreator.GetDir(m_EaseType); * } */ //m_Ease.SetDir(m_Dir); m_Texture.SetEase(m_Ease); Core.DebugLib.UCL_DebugOnGUI.Instance.CreateData().AddOnGUIAct(() => { GUILayout.BeginVertical(); //string target_name = this.GetType().UnderlyingSystemType.Name.Replace("UCL_", ""); GUILayout.Box("Min:" + m_Texture.m_Min.ToString("N2") + ",Max:" + m_Texture.m_Max.ToString("N2"), GUILayout.Width(m_TextureSize.x + 4)); GUILayout.Box(m_Type.ToString() + " " + m_Ease.m_Dir.ToString(), GUILayout.Width(m_TextureSize.x + 4)); //GUILayout.Box("Range:" + m_Texture.m_Range, GUILayout.Width(m_TextureSize.x + 4)); //GUILayout.Box(name, GUILayout.Width(m_TextureSize.x + 4)); GUILayout.Box(m_Texture.texture); GUILayout.EndVertical(); }); }
virtual public UCL_Tweener SetEase(EaseClass ease, EaseDir dir) { return(SetEase(EaseCreator.Get(ease, dir))); }
virtual public UCL_Ease SetDir(EaseDir dir) { m_Dir = dir; return(this); }