Skip to content

Commit

Permalink
Update tic-tac-toe to sails (gear-foundation#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
MedovTimur authored Sep 9, 2024
1 parent ab75078 commit 556f1c9
Show file tree
Hide file tree
Showing 26 changed files with 1,844 additions and 261 deletions.
693 changes: 434 additions & 259 deletions contracts/Cargo.lock

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ members = [
"tamagotchi-battle",
"tamagotchi-battle/state",
"tequila-train",
"tic-tac-toe",
"tic-tac-toe/gstd",
"tic-tac-toe/sails/wasm",
"vara-man",
"varatube",
"w3bstreaming",
Expand Down Expand Up @@ -206,7 +207,7 @@ syndote-player-io.path = "syndote/player/io"
tamagotchi-io.path = "tamagotchi/io"
tamagotchi-battle-io.path = "tamagotchi-battle/io"
tequila-train-io.path = "tequila-train/io"
tic-tac-toe-io.path = "tic-tac-toe/io"
tic-tac-toe-io.path = "tic-tac-toe/gstd/io"
vara-man-io.path = "vara-man/io"
varatube-io.path = "varatube/io"
w3bstreaming-io.path = "w3bstreaming/io"
Expand All @@ -230,6 +231,8 @@ gtest = "1.5.0"
gear-core = "1.5.0"
sails-idl-gen = "0.3.0"
sails-rs = "0.3.0"
sails-client-gen = "0.3.0"


# External

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions contracts/tic-tac-toe/sails/app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "tic-tac-toe-app"
version.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
gstd = { workspace = true, features = ["debug"] }
sails-rs.workspace = true
schnorrkel.workspace = true

[dev-dependencies]
gtest.workspace = true
gear-core.workspace = true
gclient.workspace = true
tic-tac-toe-wasm = { path = "../wasm" }
tokio = "1"
26 changes: 26 additions & 0 deletions contracts/tic-tac-toe/sails/app/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#![no_std]
#![allow(clippy::new_without_default)]

use sails_rs::prelude::*;
mod services;
use crate::services::game::utils::Config;
use services::game::GameService;
use services::session::SessionService;
pub struct Program(());

#[program]
impl Program {
pub async fn new(config: Config, dns_id_and_name: Option<(ActorId, String)>) -> Self {
GameService::init(config, dns_id_and_name).await;
SessionService::init();
Self(())
}

pub fn tic_tac_toe(&self) -> GameService {
GameService::new()
}

pub fn session(&self) -> SessionService {
SessionService::new()
}
}
Loading

0 comments on commit 556f1c9

Please sign in to comment.