public override void Import(Replay replay, ByteBuffer reader) { int count = reader.ReadInt32(); this.data.Clear(); this.data.Capacity = count; for (int i = 0; i < count; i++) { TouchModuleEditor.TouchesState state = new TouchModuleEditor.TouchesState(); state.time = reader.ReadSingle(); int touchesCount = reader.ReadInt32(); state.touches = new TouchModuleEditor.TouchesState.Touch[touchesCount]; for (int j = 0; j < touchesCount; j++) { state.touches[j].x = reader.ReadSingle(); state.touches[j].y = reader.ReadSingle(); state.touches[j].fingerID = reader.ReadInt32(); } this.data.Add(state); } }
public override void OnGUIReplay(Rect r) { float w = r.width; TouchModuleEditor.TouchesState state = this.data[this.index] as TouchModuleEditor.TouchesState; for (int i = 0; i < state.touches.Length; i++) { r.x += state.touches[i].x; r.width = 2F; r.y += state.touches[i].y - 5F; r.height = 11F; EditorGUI.DrawRect(r, Color.black); r.x -= 5F; r.width = 11F; r.y += 5F; r.height = 2F; EditorGUI.DrawRect(r, Color.black); r.x += 5F; r.y += 5F; r.width = w; r.height = 16F; EditorGUI.LabelField(r, state.touches[i].fingerID.ToString()); r.x -= state.touches[i].x; r.y -= state.touches[i].y - 5F; } }