// parsing state data push to state deque. public void ParsingStateData(int timePos, string parsingData) { TinyReplayObjectState newState = this.GetUnUsedState(); newState.ParsingProperties(this.entityIndex, timePos, parsingData); this.mReadyToReplayData.Enqueue(newState); // Debug.Log(" first time?"); }
private TinyReplayObjectState GetUnUsedState() { TinyReplayObjectState objectStateData = null; if (this.mActiveReplayDataStackPool.Count > 0) { objectStateData = this.mActiveReplayDataStackPool.Pop(); } else { objectStateData = new TinyReplayObjectState(); } return(objectStateData); }
protected virtual void SaveReplayEntityState(int timePos) { this.mCacheState.ResetState(); int saveType = this.GetChangePropertiesType(); string saveStateData = TinyReplayObjectState.SaveCurStateProperties(this.entityIndex, timePos, mTrs, null, saveType); if (saveType != 0) { TinyReplayRecordController.instance.SaveDataToLocalFile(saveStateData); } }
// synchronize entity state with local save file. public void SynchronizeEntity(int timePosition) { if (this.mReadyToReplayData.Count <= 0) { return; } TinyReplayObjectState curState = this.mReadyToReplayData.Peek(); // if state in the deque's data timePosition is equal to timePosition just synchronize entity. if (curState.TimePos == timePosition) { curState = this.mReadyToReplayData.Dequeue(); this.RealSynchronizeEntity(curState); this.mActiveReplayDataStackPool.Push(curState); } }
protected override void SaveReplayEntityState(int timePos) { this.mCacheState.ResetState(); int saveType = this.GetChangePropertiesType(); if (!this.mTexture.color.Equals(this.mCacheColor)) { this.mCacheColor = this.mTexture.color; saveType |= (1 << (int)SaveTargetPropertiesType.Color); } string saveStateData = TinyReplayObjectState.SaveCurStateProperties(this.entityIndex, timePos, mTrs, this.mTexture, saveType); if (saveType != 0) { TinyReplayRecordController.instance.SaveDataToLocalFile(saveStateData); } }
protected override void RealSynchronizeEntity(TinyReplayObjectState newState) { base.RealSynchronizeEntity(newState); newState.SynchronizeColorProperties(this.mTexture, this.mCacheColor); }
protected virtual void RealSynchronizeEntity(TinyReplayObjectState newState) { newState.SynchronizeProperties(this.mTrs); }