mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-07 16:33:08 +00:00
chore: initial comment for bumb v0.36.0 and resolve error while running example.
This commit is contained in:
parent
57505a1c06
commit
18af595534
@ -51,6 +51,7 @@ impl TicTacToeApp<Initialized> {
|
|||||||
|
|
||||||
async fn start(self) -> TicTacToeApp<Running> {
|
async fn start(self) -> TicTacToeApp<Running> {
|
||||||
let tx_clone = self.tx.clone();
|
let tx_clone = self.tx.clone();
|
||||||
|
let game_content_topic = WakuContentTopic::new("waku", "2", "tictactoegame", Encoding::Proto);
|
||||||
|
|
||||||
let my_closure = move |response| {
|
let my_closure = move |response| {
|
||||||
if let LibwakuResponse::Success(v) = response {
|
if let LibwakuResponse::Success(v) = response {
|
||||||
@ -59,8 +60,11 @@ impl TicTacToeApp<Initialized> {
|
|||||||
|
|
||||||
match event {
|
match event {
|
||||||
WakuEvent::WakuMessage(evt) => {
|
WakuEvent::WakuMessage(evt) => {
|
||||||
// println!("WakuMessage event received: {:?}", evt.waku_message);
|
|
||||||
let message = evt.waku_message;
|
let message = evt.waku_message;
|
||||||
|
// Filter: only process messages for our game content topic
|
||||||
|
if message.content_topic != game_content_topic {
|
||||||
|
return; // Skip messages from other apps
|
||||||
|
}
|
||||||
let payload = message.payload.to_vec();
|
let payload = message.payload.to_vec();
|
||||||
match from_utf8(&payload) {
|
match from_utf8(&payload) {
|
||||||
Ok(msg) => {
|
Ok(msg) => {
|
||||||
@ -254,9 +258,8 @@ impl eframe::App for TicTacToeApp<Running> {
|
|||||||
|
|
||||||
if ui.button("Play as O").clicked() {
|
if ui.button("Play as O").clicked() {
|
||||||
self.player_role = Some(Player::O);
|
self.player_role = Some(Player::O);
|
||||||
if let Ok(mut game_state) = self.game_state.try_lock() {
|
// Player O waits for Player X to make the first move
|
||||||
game_state.current_turn = Player::X; // player X should start
|
// No need to change current_turn as it's already X
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return; // Exit early until a role is selected
|
return; // Exit early until a role is selected
|
||||||
|
|||||||
@ -31,25 +31,25 @@ pub struct PagingOptions {
|
|||||||
pub struct StoreQueryRequest {
|
pub struct StoreQueryRequest {
|
||||||
/// if true, the store-response will include the full message content. If false,
|
/// if true, the store-response will include the full message content. If false,
|
||||||
/// the store-response will only include a list of message hashes.
|
/// the store-response will only include a list of message hashes.
|
||||||
#[serde(rename = "requestId")]
|
#[serde(rename = "request_id")]
|
||||||
request_id: String,
|
request_id: String,
|
||||||
#[serde(rename = "includeData")]
|
#[serde(rename = "include_data")]
|
||||||
include_data: bool,
|
include_data: bool,
|
||||||
#[serde(rename = "pubsubTopic", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "pubsub_topic", skip_serializing_if = "Option::is_none")]
|
||||||
pubsub_topic: Option<PubsubTopic>,
|
pubsub_topic: Option<PubsubTopic>,
|
||||||
#[serde(rename = "contentTopics")]
|
#[serde(rename = "content_topics")]
|
||||||
content_topics: Vec<WakuContentTopic>,
|
content_topics: Vec<WakuContentTopic>,
|
||||||
#[serde(rename = "timeStart", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "time_start", skip_serializing_if = "Option::is_none")]
|
||||||
time_start: Option<u64>,
|
time_start: Option<u64>,
|
||||||
#[serde(rename = "timeEnd", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "time_end", skip_serializing_if = "Option::is_none")]
|
||||||
time_end: Option<u64>,
|
time_end: Option<u64>,
|
||||||
#[serde(rename = "messageHashes", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "message_hashes", skip_serializing_if = "Option::is_none")]
|
||||||
message_hashes: Option<Vec<MessageHash>>,
|
message_hashes: Option<Vec<MessageHash>>,
|
||||||
#[serde(rename = "paginationCursor", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "pagination_cursor", skip_serializing_if = "Option::is_none")]
|
||||||
pagination_cursor: Option<MessageHash>, // Message hash (key) from where to start query (exclusive)
|
pagination_cursor: Option<MessageHash>, // Message hash (key) from where to start query (exclusive)
|
||||||
#[serde(rename = "paginationForward")]
|
#[serde(rename = "pagination_forward")]
|
||||||
pagination_forward: bool,
|
pagination_forward: bool,
|
||||||
#[serde(rename = "paginationLimit", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "pagination_limit", skip_serializing_if = "Option::is_none")]
|
||||||
pagination_limit: Option<u64>,
|
pagination_limit: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user