/// <summary> /// 从收到的玩家数据合并到帧行为 /// 主线程调用 /// </summary> internal void HandleFrameAction(ulong gcNID, Protos.GC2BS_FrameAction action) { lock (this._gcNIDToAction) { FrameAction frameAction = this._gcNIDToAction[gcNID]; frameAction.AddAction(action); } }
/// <summary> /// 把帧行为保存到历史列表 /// 填充后会清空当前帧的帧行为 /// 战场线程调用 /// </summary> internal void Save(int frame) { this._frameBuffer.Write(( byte )0); byte count = 0; lock (this._gcNIDToAction) { foreach (KeyValuePair <ulong, FrameAction> kv in this._gcNIDToAction) { FrameAction frameAction = kv.Value; frameAction.Serialize(this._frameBuffer); frameAction.Clear(); ++count; } } this._frameBuffer.Write(0, count); Google.Protobuf.ByteString data = Google.Protobuf.ByteString.CopyFrom(this._frameBuffer.GetBuffer(), 0, this._frameBuffer.length); this._frameBuffer.Clear(); this._histroy[frame] = data; }