void FrameStreamGUI() { int start = m_aimWorld.FrameCount - ShowCount; if (start < 0) { start = 0; } showTexture = new Texture2D(ShowCount * 20, 20); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); SyncDebugData data = GetSyncData(start); data.isConflict = true; for (int i = start; i < m_aimWorld.FrameCount; i++) { ShowFrameDataGUI(showTexture, i, i - start); } showTexture.Apply(); GUILayout.Box(showTexture); GUILayout.Label(m_aimWorld.FrameCount.ToString()); GUILayout.EndHorizontal(); }
Texture2D ChangeShowTexture(Texture2D tex, int index, SyncDebugData data) { if (data.AffirmMsgCount > 0) { SetColor(tex, index, 1, Color.grey); } else { SetColor(tex, index, 1, Color.green); } if (data.isAllMessage) { SetColor(tex, index, 2, Color.green); } else { SetColor(tex, index, 2, Color.grey); } //3位置给重计算 if (data.RecalcCount == 0) { SetColor(tex, index, 3, Color.grey); } else if (data.RecalcCount == 0) { SetColor(tex, index, 3, Color.blue); } else { SetColor(tex, index, 3, Color.red); } //4 位置 给特殊位置 if (data.PursueCount > 0) { SetColor(tex, index, 4, Color.yellow); } else { SetColor(tex, index, 4, Color.green); } //冲突提示位 if (data.isConflict) { SetColor(tex, index, 4, Color.red); } //SetColor(tex, 1, Color.grey); //SetColor(tex, 2, Color.green); //SetColor(tex, 3, Color.red); //SetColor(tex, 4, Color.blue); tex.Apply(); return(tex); }
public SyncDebugData GetSyncData(int frame) { if (m_dataDict.ContainsKey(frame)) { return(m_dataDict[frame]); } else { SyncDebugData data = new SyncDebugData(); m_dataDict.Add(frame, data); return(data); } }
void ReceviceRecalc(params object[] objs) { SyncDebugData data = GetSyncData((int)objs[0]); data.RecalcCount++; }
void ReceviceConflict(params object[] objs) { SyncDebugData data = GetSyncData((int)objs[0]); data.isConflict = true; }
void ReceviceAllMsg(params object[] objs) { SyncDebugData data = GetSyncData((int)objs[0]); data.isAllMessage = true; }
void ReceviceCommandMsg(CommandComponent cmd, params object[] objs) { SyncDebugData data = GetSyncData(cmd.frame); data.CommandList.Add(cmd); }
void ReceviceSyncEntity(SyncEntityMsg msg, params object[] objs) { SyncDebugData data = GetSyncData(msg.frame); data.SyncEntityCount++; }
void ReceviceAffirmMsg(AffirmMsg msg, params object[] objs) { SyncDebugData data = GetSyncData(msg.index); data.AffirmMsgCount++; }
void ReceviceChangeSingletonCompMsg(ChangeSingletonComponentMsg msg, params object[] objs) { SyncDebugData data = GetSyncData(msg.frame); data.ChangeSingletonCompCount++; }
void RecevicePursueMsg(PursueMsg msg, params object[] objs) { SyncDebugData data = GetSyncData(msg.frame); data.PursueCount++; }
void ReceviceStartSyncMsg(StartSyncMsg msg, params object[] objs) { SyncDebugData data = GetSyncData(msg.frame); data.StartSyncMsgCount++; }
void ShowFrameDataGUI(Texture2D tex, int frame, int index) { SyncDebugData data = GetSyncData(frame); ChangeShowTexture(tex, index, data); }