public void Update(FrameUser frameUser) { _context.FrameUser.Update(frameUser.ID, frameUser); }
// Update is called once per frame void Update() { onReadFrame(); if (!isAvatar) { return; } FP dis = TSVector.Distance(Position, destPosition); FP currSpeed = DestDuration <= 0 ? Speed : (Speed * playTime / DestDuration); if (dis <= currSpeed * Time.deltaTime) { Position = destPosition; // Debug.LogError("----------diff time------------------:" + (playTime - FrameDuration)); } else { TSVector tempDirection = destPosition - Position; Position += tempDirection.normalized * currSpeed * Time.deltaTime; } FrameDuration += Time.deltaTime; if (FrameDuration >= DestDuration) { Position = destPosition; if (framePool.Count > 0) { DestDuration = playTime / (framePool.Count <= ThresholdFrame ? 1: framePool.Count / ThresholdFrame); // if(framePool.Count > 8) // Debug.LogError("framePool.Count too big:" + +framePool.Count); var framedata = framePool.Dequeue(); emptyFramesTime = 0.0f; // ThresholdFrame -= 1; // Debug.Log("frame.id:"+ framedata.Key + " framePool.Count" + framePool.Count ); TSVector movement = TSVector.zero; foreach (var item in framedata.Value.operation) { if (item.cmd_type != (UInt32)CMD.USER) { continue; } FrameUser msg = FrameProto.decode(item) as FrameUser; movement = msg.movement; } // Debug.Log("d_point:" + point); destPosition += Speed * movement * playTime; FrameDuration = 0.0f; } else if (lastFrameData != null) { // Debug.Log("emptyFramesTime," + emptyFramesTime); emptyFramesTime += Time.deltaTime; if (emptyFramesTime >= playTime) { // ThresholdFrame = (int)(emptyFramesTime / playTime); // Debug.LogError("one frame time out,emptyFramesTime:" + emptyFramesTime + ",ThresholdFrame:"+ ThresholdFrame); } } } }
public long Add(FrameUser frameUser) { return(_context.FrameUser.Insert(frameUser)); }