示例#1
0
        public static SFActionJson <ActionType, ParamType> CreateActionJson(SFAction <ActionType, ParamType> action)
        {
            SFActionJson <ActionType, ParamType> json = new SFActionJson <ActionType, ParamType>();

            json.ActionID = action.ActionID;
            json.FrameID  = action.FrameID;
            json.Param    = action.Param;
            return(json);
        }
示例#2
0
        /// <summary>
        /// 缓存Action
        /// </summary>
        /// <param name="action"></param>
        public void CacheAction(SFAction <ActionType, ParamType> action)
        {
            SFAction <ActionType, ParamType> curAction = null;

            if (TryGetCachedAction(action, out curAction))
            {
                cachedActions.Remove(curAction);
            }

            cachedActions.Add(action);
        }
示例#3
0
        /// <summary>
        /// Tries the get cached action.
        /// </summary>
        /// <returns><c>true</c>, if get cached action was tryed, <c>false</c> otherwise.</returns>
        /// <param name="action">Action.</param>
        /// <param name="retAction">Ret action.</param>
        public bool TryGetCachedAction(SFAction <ActionType, ParamType> action, out SFAction <ActionType, ParamType> retAction)
        {
            var actionFind = cachedActions.Find((a) => a.ActionID.CompareTo(action.ActionID) == 0);

            if (action != null)
            {
                retAction = actionFind;
                return(true);
            }

            retAction = null;
            return(false);
        }
示例#4
0
 /// <summary>
 /// 追加Action,会在下一帧进行同步处理
 /// </summary>
 /// <param name="action"></param>
 public SFAction <ActionType, ParamType> PostAction(SFAction <ActionType, ParamType> action)
 {
     action.FrameID = curFrameID + 1;
     tempActions.Add(action);
     return(action);
 }
示例#5
0
 public void PostAction(SFAction <ActionType, ParamType> action)
 {
     throw new NotImplementedException();
 }
示例#6
0
        //IEnumerator ISFActionSyncMachine<ActionType, ParamType>.DispatchActions()
        //{
        //    yield return null;
        //}

        void ISFActionSyncMachine <ActionType, ParamType> .PostAction(SFAction <ActionType, ParamType> action)
        {
        }