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); }
/// <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); }
/// <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); }
/// <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); }
public void PostAction(SFAction <ActionType, ParamType> action) { throw new NotImplementedException(); }
//IEnumerator ISFActionSyncMachine<ActionType, ParamType>.DispatchActions() //{ // yield return null; //} void ISFActionSyncMachine <ActionType, ParamType> .PostAction(SFAction <ActionType, ParamType> action) { }