Compare commits
15 Commits
backend-ax
...
15b585df02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15b585df02 | ||
|
|
f6347feff1 | ||
|
|
c7f0e747b1 | ||
|
|
1d28a75529 | ||
|
|
ecbf7a5b34 | ||
|
|
46660bd921 | ||
| ee415c3d8b | |||
| e77fb7cb1e | |||
| 4c1a439319 | |||
| 999d27936a | |||
| b509c9f4c3 | |||
| 26cdc99701 | |||
| 554d44cebb | |||
|
|
3ad5811566 | ||
|
|
a8a0f54cb7 |
36
README.md
36
README.md
@@ -1,19 +1,31 @@
|
|||||||
Règles :
|
Règles :
|
||||||
Un rayon laser constant
|
|
||||||
Un ou plusieurs laser
|
- Un rayon laser constant
|
||||||
Laser non movibles, on/off
|
|
||||||
Mirroirs orientables
|
- Un ou plusieurs laser
|
||||||
Prisme (dédouble le laser ou le renvoi selon l'angle)
|
|
||||||
Vitre colorée fixe ou placable par le joueur (r,j,b)
|
- Laser non movibles, peut-être allumé/éteins
|
||||||
Bouton allumable par clique souris (interaction porte, mirroir, etc)
|
|
||||||
Bouton allumable par laser spécifique (interaction porte, mirroir, etc)
|
- Mirroirs orientables
|
||||||
|
|
||||||
|
- Prisme (dédouble le laser ou le renvoi selon l'angle)
|
||||||
|
|
||||||
|
- Vitre colorée fixe ou placable par le joueur (r,j,b)
|
||||||
|
|
||||||
|
- Bouton allumable par clique souris (interaction porte, mirroir, etc)
|
||||||
|
|
||||||
|
- Bouton allumable par laser spécifique (interaction porte, mirroir, etc)
|
||||||
|
|
||||||
|
|
||||||
Rayon :
|
Rayon :
|
||||||
Blanc -> rebondis seulement sur les mirroirs et s'arrête contre les murs
|
|
||||||
Rouge -> Allumage boutons
|
- Blanc -> Rebondis seulement sur les mirroirs et s'arrête contre les murs
|
||||||
Bleu -> Rebondis sur toutes les surfaces
|
|
||||||
Jaune -> Traverse tout (mirroir compris)
|
- Rouge -> Allumage des récepteurs
|
||||||
|
|
||||||
|
- Bleu -> Rebondis sur toutes les surfaces (murs compris)
|
||||||
|
|
||||||
|
- Jaune -> Traverse tout (mirroir compris)
|
||||||
|
|
||||||
|
|
||||||
Systeme de placement d'objet par grille
|
Systeme de placement d'objet par grille
|
||||||
|
|||||||
64
backend/user.rs
Normal file
64
backend/user.rs
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
use sqlite::Connection;
|
||||||
|
use sqlite::State;
|
||||||
|
|
||||||
|
pub struct User {
|
||||||
|
name: String,
|
||||||
|
level: u32,
|
||||||
|
password: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl User {
|
||||||
|
pub fn open(name: String, level: u32, password: String) -> User {
|
||||||
|
User {name, level, password}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub struct DataBase {
|
||||||
|
connection: Connection,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DataBase {
|
||||||
|
pub fn open(name: String) -> DataBase {
|
||||||
|
let connection = sqlite::open(name + ".db").unwrap();
|
||||||
|
DataBase { connection }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn execute(&self, arg: String){
|
||||||
|
match self.connection.execute(arg){
|
||||||
|
_ => (),
|
||||||
|
Err(e) => panic!("Error : {}",e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn create_table(&self, table: &str, var: &str){
|
||||||
|
self.execute("CREATE TABLE ".to_owned() + &table.to_string() + "(" + &var.to_string() + ");");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_column(&self, table: &str, arg: &str){
|
||||||
|
self.execute("ALTER TABLE ".to_owned() + &table.to_string() + " ADD " + &arg.to_string() + ";");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn insert(&self, table: &str, arg: &str){
|
||||||
|
self.execute("INSERT INTO ".to_owned() + &table.to_string() + " VALUES (" + &arg.to_string() + ")" + ";");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn check(&self, table: &str, arg: &str) -> bool {
|
||||||
|
let mut end = false;
|
||||||
|
self.connection.iterate("Select name FROM ".to_owned() + &table.to_string() + " WHERE name = " + &arg.to_string(), |pairs| {
|
||||||
|
for &(name, value) in pairs.iter() {
|
||||||
|
println!("{} = {}", name, value.unwrap());
|
||||||
|
if name == "name" {
|
||||||
|
println!("True");
|
||||||
|
end = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return end;
|
||||||
|
});
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn update(&self, table: &str, arg: &str, where_is: &str, arg2: &str){
|
||||||
|
self.execute("UPDATE ".to_owned() + &table.to_string() + " SET " + &arg.to_string() + " WHERE " + &where_is.to_string() + " = " + &arg2.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user