forked from StrafesNET/strafe-project
lol idk #1
@ -46,6 +46,7 @@ pub enum SessionControlInstruction{
|
||||
CopyRecordingIntoReplayAndSpectate,
|
||||
StopSpectate,
|
||||
SaveReplay,
|
||||
LoadIntoReplayState,
|
||||
}
|
||||
pub enum SessionPlaybackInstruction{
|
||||
SkipForward,
|
||||
@ -299,6 +300,18 @@ impl InstructionConsumer<Instruction<'_>> for Session{
|
||||
}
|
||||
_=self.simulation.timer.set_paused(ins.time,false);
|
||||
},
|
||||
Instruction::Control(SessionControlInstruction::LoadIntoReplayState)=>{
|
||||
// Bind: J
|
||||
let view_state=core::mem::replace(&mut self.view_state,ViewState::Play);
|
||||
match view_state{
|
||||
ViewState::Play=>(),
|
||||
ViewState::Replay(bot_id)=>if let Some(replay)=self.replays.remove(&bot_id){
|
||||
self.recording.instructions=replay.recording.instructions.into_iter().take(replay.next_instruction_id).collect();
|
||||
self.simulation=replay.simulation;
|
||||
},
|
||||
}
|
||||
_=self.simulation.timer.set_paused(ins.time,false);
|
||||
},
|
||||
Instruction::Playback(SessionPlaybackInstruction::IncreaseTimescale)=>{
|
||||
match &self.view_state{
|
||||
ViewState::Play=>{
|
||||
|
@ -156,6 +156,7 @@ impl WindowContext<'_>{
|
||||
"B"|"b"=>session_ctrl!(CopyRecordingIntoReplayAndSpectate,s),
|
||||
"X"|"x"=>session_ctrl!(StopSpectate,s),
|
||||
"N"|"n"=>session_ctrl!(SaveReplay,s),
|
||||
"J"|"j"=>session_ctrl!(LoadIntoReplayState,s),
|
||||
_=>None,
|
||||
},
|
||||
_=>None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user