Пример #1
0
 public static void FinishAnim(TweenScript tweenData)
 {
     tweenData.currentTime = tweenData.totalTime;
     tweenData.executeUpdate();
     tweenData.executeCallBack();
     GetInstance().animList.Remove(tweenData);
     StackObjectPool <TweenScript> .PutObject(tweenData);
 }
Пример #2
0
 /*
  * public static TweenScript ValueTo(AnimParamHash l_animHash)
  * {
  *  TweenScript l_tmp = l_animHash.GetAnimData();
  *  l_tmp.Init();
  *  GetInstance().animList.Add(l_tmp);
  *  return l_tmp;
  * }
  * public class AnimParamHash : Dictionary<AnimParamType, object>
  * {
  *  public AnimParamHash(params object[] l_params)
  *  {
  *      for (int i = 0; i < l_params.Length; i += 2)
  *      {
  *          this[(AnimParamType)l_params[i]] = l_params[i + 1];
  *      }
  *  }
  *  public AnimParamHash SetData(params object[] l_params)
  *  {
  *      Clear();
  *      for (int i = 0; i < l_params.Length; i += 2)
  *      {
  *          this[(AnimParamType)l_params[i]] = l_params[i + 1];
  *      }
  *      return this;
  *  }
  *  public TweenScript GetAnimData()
  *  {
  *      TweenScript DataTmp = StackObjectPool<TweenScript>.GetObject();
  *      foreach (var hash in this)
  *      {
  *          AnimParamType l_ParamType = hash.Key;
  *          switch (l_ParamType)
  *          {
  *              //基础参数
  *              case AnimParamType.GameObj:
  *                  DataTmp.animGameObject = (GameObject)hash.Value;
  *                  break;
  *              case AnimParamType.AnimType:
  *                  DataTmp.animType = (AnimType)hash.Value;
  *                  break;
  *              case AnimParamType.Time:
  *                  DataTmp.totalTime = (float)hash.Value;
  *                  break;
  *              case AnimParamType.InteType:
  *                  DataTmp.m_easeType = (Ease)hash.Value;
  *                  break;
  *              case AnimParamType.RepeatType:
  *                  DataTmp.repeatType = (RepeatType)hash.Value;
  *                  break;
  *              case AnimParamType.RepeatCount:
  *                  DataTmp.repeatCount = (int)hash.Value;
  *                  break;
  *              case AnimParamType.DelayTime:
  *                  DataTmp.delayTime = (float)hash.Value;
  *                  break;
  *              //From
  *              case AnimParamType.FromV3:
  *                  DataTmp.fromV3 = (Vector3)hash.Value;
  *                  break;
  *              case AnimParamType.FromV2:
  *                  DataTmp.fromV2 = (Vector2)hash.Value;
  *                  break;
  *              case AnimParamType.FromColor:
  *                  DataTmp.fromColor = (Color)hash.Value;
  *                  break;
  *              case AnimParamType.FromFloat:
  *                  DataTmp.fromFloat = (float)hash.Value;
  *                  break;
  *              //To
  *              case AnimParamType.ToV3:
  *                  DataTmp.toV3 = (Vector3)hash.Value;
  *                  break;
  *              case AnimParamType.ToV2:
  *                  DataTmp.toV2 = (Vector2)hash.Value;
  *                  break;
  *              case AnimParamType.ToColor:
  *                  DataTmp.toColor = (Color)hash.Value;
  *                  break;
  *              case AnimParamType.ToFloat:
  *                  DataTmp.toFloat = (float)hash.Value;
  *                  break;
  *              //动画回调
  *              case AnimParamType.CallBack:
  *                  DataTmp.animCallBack = (AnimCallBack)hash.Value;
  *                  break;
  *              case AnimParamType.CallBackParams:
  *                  DataTmp.animParameter = (object[])hash.Value;
  *                  break;
  *              //定制函数
  *              case AnimParamType.CustomMethodV3:
  *                  DataTmp.customMethodV3 = (AnimCustomMethodVector3)hash.Value;
  *                  break;
  *              case AnimParamType.CustomMethodV2:
  *                  DataTmp.customMethodV2 = (AnimCustomMethodVector2)hash.Value;
  *                  break;
  *              case AnimParamType.CustomMethodFloat:
  *                  DataTmp.customMethodFloat = (AnimCustomMethodFloat)hash.Value;
  *                  break;
  *              //闪烁
  *              case AnimParamType.Space:
  *                  DataTmp.blinkTime = (float)hash.Value;
  *                  break;
  *              //路径运动
  *              case AnimParamType.PathType:
  *                  DataTmp.m_pathType = (PathType)hash.Value;
  *                  break;
  *              case AnimParamType.PathData:
  *                  DataTmp.pathPoints = (Vector3[])hash.Value;
  *                  break;
  *              //其他设置
  *              case AnimParamType.IsIncludeChild:
  *                  DataTmp.isChild = (bool)hash.Value;
  *                  break;
  *              case AnimParamType.IsLocal:
  *                  DataTmp.isLocal = (bool)hash.Value;
  *                  break;
  *              case AnimParamType.IsIgnoreTimeScale:
  *                  DataTmp.isIgnoreTimeScale = (bool)hash.Value;
  *                  break;
  *          }
  *      }
  *      return DataTmp;
  *  }
  * }
  */
 #endregion
 #region 功能函数
 /// <summary>
 /// 停止一个动画
 /// </summary>
 /// <param name="animGameObject">要停止的动画</param>
 /// <param name="isCallBack">是否触发回调</param>
 public static void StopAnim(TweenScript tweenData, bool isCallBack = false)
 {
     if (isCallBack)
     {
         tweenData.executeCallBack();
     }
     GetInstance().animList.Remove(tweenData);
     StackObjectPool <TweenScript> .PutObject(tweenData);
 }
Пример #3
0
 /// <summary>
 /// 停止一个对象身上的所有动画
 /// </summary>
 /// <param name="trans">要停止动画的对象</param>
 /// <param name="isCallBack">是否触发回调</param>
 public static void TnStop(this Transform trans, bool isCallBack = false)
 {
     for (int i = 0; i < TweenUtil.GetInstance().animList.Count; i++)
     {
         if (TweenUtil.GetInstance().animList[i].animGameObject == trans.gameObject)
         {
             if (isCallBack)
             {
                 TweenScript dataTmp = TweenUtil.GetInstance().animList[i];
                 dataTmp.executeCallBack();
             }
             TweenScript tweenData = TweenUtil.GetInstance().animList[i];
             TweenUtil.GetInstance().animList.RemoveAt(i);
             i--;
             StackObjectPool <TweenScript> .PutObject(tweenData);
         }
     }
 }
Пример #4
0
 public void Update()
 {
     for (int i = 0; i < animList.Count; i++)
     {
         animList[i].executeUpdate();
         if (animList[i].isDone == true)
         {
             TweenScript tweenTmp = animList[i];
             if (!tweenTmp.AnimReplayLogic())
             {
                 animList.Remove(tweenTmp);
                 i--;
                 StackObjectPool <TweenScript> .PutObject(tweenTmp);
             }
             tweenTmp.executeCallBack();
         }
     }
 }
Пример #5
0
 public static void PutSODict(Dictionary <string, object> dict)
 {
     dict.Clear();
     StackObjectPool <Dictionary <string, object> > .PutObject(dict);
 }