public override void Import(Replay settings, ByteBuffer reader) { int count = reader.ReadInt32(); this.data.Clear(); this.data.Capacity = count; for (int i = 0; i < count; i++) { KeyboardModuleEditor.KeyInput input = new KeyboardModuleEditor.KeyInput(); input.time = reader.ReadSingle(); input.keys = new KeyCode[(UInt16)reader.ReadUInt16()]; for (int j = 0; j < input.keys.Length; j++) { input.keys[j] = (KeyCode)reader.ReadUInt16(); } this.data.Add(input); } }
public override void OnGUIReplay(Rect r) { if (this.index == -1) { return; } KeyboardModuleEditor.KeyInput data = this.data[this.index] as KeyboardModuleEditor.KeyInput; if (data.keys.Length == 0) { return; } r.x = 0F; r.width = 0F; r.height = data.keys.Length * 16F; for (int i = 0; i < data.keys.Length; i++) { Utility.content.text = keyNames[(int)data.keys[i]]; float w = EditorStyles.label.CalcSize(Utility.content).x; if (r.width < w) { r.width = w; } } EditorGUI.DrawRect(r, KeyboardReplayModule.BackgroundColor); r.height = 16F; for (int i = 0; i < data.keys.Length; i++) { EditorGUI.LabelField(r, keyNames[(int)data.keys[i]]); r.y += r.height; } }