Created
August 24, 2021 02:15
-
-
Save jonatino/5aa8e3ed2e8e38c7c3b21660cefa02cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::player::Player; | |
#[derive(PartialEq, Eq, Hash)] | |
pub enum InterfaceLocation { | |
None, | |
Main = 1 | |
} | |
#[derive(PartialEq, Eq, Hash)] | |
pub enum Interfaces { | |
None, | |
Bank = 1000, | |
Tasks = 1001, | |
} | |
impl Interfaces { | |
pub fn open(player: &mut Player, inter: Interfaces, location: InterfaceLocation) { | |
Interfaces::close(player, &location); | |
// TODO make interface scripts register themselves on startup, so we can trigger the "open" event here | |
player.open_interfaces.insert(location, inter); | |
} | |
pub fn close(player: &mut Player, location: &InterfaceLocation) { | |
let inter = player.open_interfaces.get(location); | |
//if inter != None { | |
// inter.closeInterface(); | |
// } | |
} | |
} | |
pub trait GameInterface { | |
fn open(location: InterfaceLocation) { | |
// TODO make interface scripts register themselves on startup, so we can trigger the "open" event here | |
} | |
fn close() { | |
// TODO make interface scripts register themselves on startup, so we can trigger the "close" event here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment