diff --git a/protobuf/common.proto b/protobuf/common.proto index f24ffcc..e860e26 100644 --- a/protobuf/common.proto +++ b/protobuf/common.proto @@ -1,5 +1,14 @@ syntax = "proto3"; +import "google/protobuf/timestamp.proto"; + package common; -message Name { string name = 1; } \ No newline at end of file +message Name { string name = 1; } + +message LastStatusTimestamp { + google.protobuf.Timestamp time = 1; + uint32 lobby = 2; +} + +message HasNewStatus { bool value = 1; } \ No newline at end of file diff --git a/protobuf/game.proto b/protobuf/game.proto index d5267fc..c491e3d 100644 --- a/protobuf/game.proto +++ b/protobuf/game.proto @@ -10,6 +10,7 @@ service Game { rpc getCardImage(CardKind) returns(Image); rpc onClick(CardId) returns(google.protobuf.Empty); rpc status(google.protobuf.Empty) returns(MessageStatus); + rpc pollStatus(common.LastStatusTimestamp) returns(common.HasNewStatus); } message CardKind { diff --git a/protobuf/lobby.proto b/protobuf/lobby.proto index c91c5bc..8588661 100644 --- a/protobuf/lobby.proto +++ b/protobuf/lobby.proto @@ -1,6 +1,5 @@ syntax = "proto3"; -import "google/protobuf/timestamp.proto"; import "google/protobuf/empty.proto"; import "common.proto"; @@ -11,18 +10,11 @@ service Lobby { rpc users(google.protobuf.Empty) returns(stream common.Name); rpc vote(SingleVote) returns(google.protobuf.Empty); rpc ready(google.protobuf.Empty) returns(google.protobuf.Empty); - rpc hasNewStatus(LastStatusTimestamp) returns(HasNewStatus); + rpc pollStatus(common.LastStatusTimestamp) returns(common.HasNewStatus); rpc getStatus(google.protobuf.Empty) returns(LobbyStatus); rpc leave(google.protobuf.Empty) returns(google.protobuf.Empty); } -message HasNewStatus { bool value = 1; } - -message LastStatusTimestamp { - google.protobuf.Timestamp time = 1; - uint32 lobby = 2; -} - message Vote { string player = 1; uint32 game = 2; diff --git a/server/.gitignore b/server/.gitignore index d4e2763..22ca2c2 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -3,4 +3,6 @@ Cargo.lock db.sqlite* /games output.log -properties.json \ No newline at end of file +properties.json +flamegraph.svg +perf.data \ No newline at end of file diff --git a/server/src/db.rs b/server/src/db.rs index 720d32f..9d2c47f 100644 --- a/server/src/db.rs +++ b/server/src/db.rs @@ -98,12 +98,13 @@ impl Db { // FIXME: return Results intead of crashing pub fn get_name_for_uuid(&mut self, uuid: Uuid) -> String { - let mut prepared = self.conn.prepare_cached("SELECT Name FROM Users WHERE UUID = ?").unwrap(); + let mut prepared = self + .conn + .prepare_cached("SELECT Name FROM Users WHERE UUID = ?") + .unwrap(); prepared .query(params![uuid.as_bytes().to_vec()]) - .and_then(|mut r| { - r.next().and_then(|r| r.unwrap().get::<_, String>(0)) - }) + .and_then(|mut r| r.next().and_then(|r| r.unwrap().get::<_, String>(0))) .unwrap() } diff --git a/server/src/server.rs b/server/src/server.rs index 830cbec..3ca6745 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -24,7 +24,7 @@ pub async fn start( let properties = Arc::new(properties); let games = Arc::new(games); let voting = votes::VotingSystem::new(pool.clone().await); - let running_games: Arc>>> = Default::default(); + let running_games: Arc>)>>>> = Default::default(); let connection = ConnectionService { conn: RwLock::new(pool.clone().await), properties: properties.clone(), diff --git a/server/src/server/connection.rs b/server/src/server/connection.rs index 203b3ac..efd6219 100644 --- a/server/src/server/connection.rs +++ b/server/src/server/connection.rs @@ -22,7 +22,7 @@ pub struct ConnectionService { pub conn: RwLock, pub properties: Arc, pub games: Arc>, - pub running_games: Arc>>>, + pub running_games: Arc>)>>>>, pub voting: votes::VotingSystem, } diff --git a/server/src/server/game.rs b/server/src/server/game.rs index 7c4c2aa..c95f1b0 100644 --- a/server/src/server/game.rs +++ b/server/src/server/game.rs @@ -3,11 +3,11 @@ use crate::{db, games::Game}; use super::{ client_id, - grpc::game::{ - game_server, - message_status::Piles, - CardKind, Image, MessageStatus, + grpc::{ + common::{HasNewStatus, LastStatusTimestamp}, + game::{game_server, message_status::Piles, CardKind, Image, MessageStatus}, }, + votes::Modifiable, }; pub use game_server::GameServer; use tonic::{Response, Status}; @@ -20,14 +20,17 @@ use tokio::sync::RwLock; pub struct GameService { conn: RwLock, games: Arc>, - running_games: Arc>>>, + running_games: + Arc>)>>>>, } impl GameService { pub fn new( conn: db::DbClient, games: Arc>, - running_games: Arc>>>, + running_games: Arc< + RwLock>)>>>, + >, ) -> Self { Self { conn: RwLock::new(conn), @@ -37,6 +40,135 @@ impl GameService { } } +impl GameService { + async fn get_status(&self, uuid: uuid::Uuid) -> Result { + let mut conn = self.conn.write().await; + let lobby: u32 = match conn.get_lobby_for_user(uuid).await { + Some(l) => l, + None => return Err(Status::failed_precondition("User isn't in a lobby")), + }; + let games_lock = self.running_games.read().await; + let game_lock = match games_lock.get(&lobby) { + Some(x) => x.read().await, + None => { + return Err(Status::failed_precondition( + "User isn't in a lobby with a running game", + )) + } + }; + let game = &game_lock.1; + let mut names = vec![]; + for (uuid, id) in &game.players { + names.push((conn.get_name_for_uuid(uuid.clone()).await, *id)) + } + names.sort_by(|(_, a), (_, b)| a.cmp(b)); + let names = names + .into_iter() + .map(|(x, _)| super::grpc::common::Name { name: x }) + .collect(); + let status = MessageStatus { + current_turn: game.get_current_player(), + common_piles: Some(Piles { + piles: game + .piles + .iter() + .map(|(k, v)| (k.clone(), v.clone())) + .map(|(k, v): (String, Pile)| { + ( + k, + super::grpc::game::message_status::Pile { + cards: v + .cards + .into_iter() + .map(|c| super::grpc::game::message_status::Card { + kind: Some(CardKind { kind: c }), + visible: true, + }) + .collect(), + }, + ) + }) + .collect(), + }), + player_piles: game + .player_piles + .clone() + .into_iter() + .map(|piles| Piles { + piles: piles + .into_iter() + .map(|(k, v)| { + ( + k, + super::grpc::game::message_status::Pile { + cards: v + .cards + .into_iter() + .map(|x| super::grpc::game::message_status::Card { + kind: Some(CardKind { kind: x }), + visible: true, + }) + .collect(), + }, + ) + }) + .collect(), + }) + .collect(), + names, + }; + Ok(status) + } + + async fn update_status(&self, uuid: uuid::Uuid) -> Result<(), Status> { + let lobby = { + let mut conn = self.conn.write().await; + let lobby: u32 = match conn.get_lobby_for_user(uuid).await { + Some(l) => l, + None => return Err(Status::failed_precondition("User isn't in a lobby")), + }; + lobby + }; + + self.running_games + .read() + .await + .get(&lobby) + .ok_or(Status::failed_precondition( + "User is not in a lobby thats playing a game", + ))? + .write() + .await + .2 + .set(Some(self.get_status(uuid).await?)); + Ok(()) + } + + async fn get_default_status(&self, uuid: uuid::Uuid) -> Result, Status> { + let lobby = { + let mut conn = self.conn.write().await; + let lobby: u32 = match conn.get_lobby_for_user(uuid).await { + Some(l) => l, + None => return Err(Status::failed_precondition("User isn't in a lobby")), + }; + lobby + }; + Ok(self + .running_games + .read() + .await + .get(&lobby) + .ok_or(Status::failed_precondition( + "User is not in a lobby thats playing a game", + ))? + .read() + .await + .2 + .get() + .clone()) + } +} + #[tonic::async_trait] impl game_server::Game for GameService { async fn get_card_image( @@ -117,6 +249,7 @@ impl game_server::Game for GameService { pile_name: card.pile_name, }; game.on_click(card, game.get_player_for_uuid(&uuid).unwrap()); + self.update_status(uuid).await?; Ok(Response::new(())) } @@ -128,80 +261,49 @@ impl game_server::Game for GameService { client_id::Error::NotSet => Status::failed_precondition("client_id must be set"), client_id::Error::MalformedUuid => Status::failed_precondition("malformed client_id"), })?; - let mut conn = self.conn.write().await; - let lobby: u32 = match conn.get_lobby_for_user(uuid).await { - Some(l) => l, - None => return Err(Status::failed_precondition("User isn't in a lobby")), - }; - let games_lock = self.running_games.read().await; - let game_lock = match games_lock.get(&lobby) { - Some(x) => x.read().await, - None => { - return Err(Status::failed_precondition( - "User isn't in a lobby with a running game", - )) - } - }; - let game = &game_lock.1; - let mut names = vec![]; - for (uuid, id) in &game.players { - names.push((conn.get_name_for_uuid(uuid.clone()).await, *id)) - } - names.sort_by(|(_, a), (_, b)| a.cmp(b)); - let names = names - .into_iter() - .map(|(x, _)| super::grpc::common::Name { name: x }) - .collect(); - let status = MessageStatus { - current_turn: game.get_current_player(), - common_piles: Some(Piles { - piles: game - .piles - .iter() - .map(|(k, v)| (k.clone(), v.clone())) - .map(|(k, v): (String, Pile)| { - ( - k, - super::grpc::game::message_status::Pile { - cards: v - .cards - .into_iter() - .map(|c| super::grpc::game::message_status::Card { - kind: Some(CardKind { kind: c }), - visible: true, - }) - .collect(), - }, - ) - }) - .collect(), - }), - player_piles: game - .player_piles.clone() - .into_iter() - .map(|piles| Piles { - piles: piles - .into_iter() - .map(|(k, v)| { - ( - k, - super::grpc::game::message_status::Pile { - cards: v - .cards - .into_iter() - .map(|x| super::grpc::game::message_status::Card { - kind: Some(CardKind {kind: x}), - visible: true, - }) - .collect(), - }, - ) - }) - .collect(), - }) - .collect(), - names, + + Ok(Response::new( + self.get_default_status(uuid) + .await? + .ok_or(Status::internal("No status has been set"))?, + )) + } + + async fn poll_status( + &self, + request: tonic::Request, + ) -> Result, Status> { + let uuid = client_id::get(request.metadata()).map_err(|x| match x { + client_id::Error::NotSet => Status::failed_precondition("client_id must be set"), + client_id::Error::MalformedUuid => Status::failed_precondition("malformed client_id"), + })?; + let lobby = { + let mut conn = self.conn.write().await; + let lobby: u32 = match conn.get_lobby_for_user(uuid).await { + Some(l) => l, + None => return Err(Status::failed_precondition("User isn't in a lobby")), + }; + lobby }; - Ok(Response::new(status)) + use std::convert::TryInto; + let has_changed = self.running_games + .read() + .await + .get(&lobby) + .ok_or(Status::failed_precondition( + "User is not in a lobby thats playing a game", + ))? + .read() + .await + .2 + .has_changed( + request + .into_inner() + .time + .ok_or(Status::failed_precondition("timestamp musn't be null"))? + .try_into() + .unwrap(), + ); + Ok(Response::new(HasNewStatus {value: has_changed})) } } diff --git a/server/src/server/grpc/common.rs b/server/src/server/grpc/common.rs index 389accd..7ca269e 100644 --- a/server/src/server/grpc/common.rs +++ b/server/src/server/grpc/common.rs @@ -3,3 +3,15 @@ pub struct Name { #[prost(string, tag = "1")] pub name: std::string::String, } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LastStatusTimestamp { + #[prost(message, optional, tag = "1")] + pub time: ::std::option::Option<::prost_types::Timestamp>, + #[prost(uint32, tag = "2")] + pub lobby: u32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HasNewStatus { + #[prost(bool, tag = "1")] + pub value: bool, +} diff --git a/server/src/server/grpc/game.rs b/server/src/server/grpc/game.rs index d8b53c7..930abd9 100644 --- a/server/src/server/grpc/game.rs +++ b/server/src/server/grpc/game.rs @@ -100,6 +100,10 @@ pub mod game_server { &self, request: tonic::Request<()>, ) -> Result, tonic::Status>; + async fn poll_status( + &self, + request: tonic::Request, + ) -> Result, tonic::Status>; } #[doc = " Service to use when user's in a running game"] #[derive(Debug)] @@ -221,6 +225,39 @@ pub mod game_server { }; Box::pin(fut) } + "/game.Game/pollStatus" => { + #[allow(non_camel_case_types)] + struct pollStatusSvc(pub Arc); + impl + tonic::server::UnaryService for pollStatusSvc + { + type Response = super::super::common::HasNewStatus; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = self.0.clone(); + let fut = async move { (*inner).poll_status(request).await }; + Box::pin(fut) + } + } + let inner = self.inner.clone(); + let fut = async move { + let interceptor = inner.1.clone(); + let inner = inner.0; + let method = pollStatusSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = if let Some(interceptor) = interceptor { + tonic::server::Grpc::with_interceptor(codec, interceptor) + } else { + tonic::server::Grpc::new(codec) + }; + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } _ => Box::pin(async move { Ok(http::Response::builder() .status(200) diff --git a/server/src/server/grpc/lobby.rs b/server/src/server/grpc/lobby.rs index 33cd854..58ff065 100644 --- a/server/src/server/grpc/lobby.rs +++ b/server/src/server/grpc/lobby.rs @@ -1,16 +1,4 @@ #[derive(Clone, PartialEq, ::prost::Message)] -pub struct HasNewStatus { - #[prost(bool, tag = "1")] - pub value: bool, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct LastStatusTimestamp { - #[prost(message, optional, tag = "1")] - pub time: ::std::option::Option<::prost_types::Timestamp>, - #[prost(uint32, tag = "2")] - pub lobby: u32, -} -#[derive(Clone, PartialEq, ::prost::Message)] pub struct Vote { #[prost(string, tag = "1")] pub player: std::string::String, @@ -57,10 +45,10 @@ pub mod lobby_server { &self, request: tonic::Request<()>, ) -> Result, tonic::Status>; - async fn has_new_status( + async fn poll_status( &self, - request: tonic::Request, - ) -> Result, tonic::Status>; + request: tonic::Request, + ) -> Result, tonic::Status>; async fn get_status( &self, request: tonic::Request<()>, @@ -192,18 +180,20 @@ pub mod lobby_server { }; Box::pin(fut) } - "/lobby.Lobby/hasNewStatus" => { + "/lobby.Lobby/pollStatus" => { #[allow(non_camel_case_types)] - struct hasNewStatusSvc(pub Arc); - impl tonic::server::UnaryService for hasNewStatusSvc { - type Response = super::HasNewStatus; + struct pollStatusSvc(pub Arc); + impl + tonic::server::UnaryService for pollStatusSvc + { + type Response = super::super::common::HasNewStatus; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = async move { (*inner).has_new_status(request).await }; + let fut = async move { (*inner).poll_status(request).await }; Box::pin(fut) } } @@ -211,7 +201,7 @@ pub mod lobby_server { let fut = async move { let interceptor = inner.1.clone(); let inner = inner.0; - let method = hasNewStatusSvc(inner); + let method = pollStatusSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = if let Some(interceptor) = interceptor { tonic::server::Grpc::with_interceptor(codec, interceptor) diff --git a/server/src/server/lobby.rs b/server/src/server/lobby.rs index d18d734..30748d7 100644 --- a/server/src/server/lobby.rs +++ b/server/src/server/lobby.rs @@ -4,13 +4,14 @@ use tokio::sync::{mpsc, RwLock}; use std::{collections::HashMap, convert::TryInto, sync::Arc}; -use super::grpc::common::Name; +use super::grpc::common::{HasNewStatus, LastStatusTimestamp, Name}; use super::grpc::lobby::lobby_server::Lobby; -use super::grpc::lobby::{HasNewStatus, LastStatusTimestamp, LobbyStatus, SingleVote, Vote}; +use super::grpc::lobby::{LobbyStatus, SingleVote, Vote}; +use super::grpc::game::MessageStatus; pub use super::grpc::lobby::lobby_server::LobbyServer; -use super::votes; +use super::votes::{self, Modifiable}; use super::client_id; @@ -20,7 +21,7 @@ pub struct LobbyService { conn: RwLock, games: Arc>, voting: votes::VotingSystem, - running_games: Arc>>>, + running_games: Arc>)>>>>, } impl LobbyService { @@ -28,7 +29,7 @@ impl LobbyService { conn: db::DbClient, voting: votes::VotingSystem, games: Arc>, - running_games: Arc>>>, + running_games: Arc>)>>>>, ) -> Self { Self { conn: RwLock::new(conn), @@ -65,12 +66,12 @@ impl Lobby for LobbyService { self.running_games .write() .await - .insert(lobby, RwLock::new((winner, game))); + .insert(lobby, RwLock::new((winner, game, Modifiable::new(None)))); } Ok(Response::new(())) } - async fn has_new_status( + async fn poll_status( &self, request: Request, ) -> Result, Status> { diff --git a/server/src/server/votes.rs b/server/src/server/votes.rs index e1e466d..b999591 100644 --- a/server/src/server/votes.rs +++ b/server/src/server/votes.rs @@ -10,7 +10,7 @@ use crate::db; type Message = (Vec<(String, u32, bool)>, bool); #[derive(Debug)] -struct Modifiable { +pub struct Modifiable { value: T, last_modified: SystemTime, } diff --git a/unity/Assets/Scripts/Client.cs b/unity/Assets/Scripts/Client.cs index 5d3b34d..5ef961b 100644 --- a/unity/Assets/Scripts/Client.cs +++ b/unity/Assets/Scripts/Client.cs @@ -93,8 +93,8 @@ public static class Client public Lobby.LobbyStatus GetLobbyStatus() { if (lobby != null) { if (lobby_status != null) { - var hasNew = lobby_client.hasNewStatus( - new Lobby.LastStatusTimestamp { + var hasNew = lobby_client.pollStatus( + new Common.LastStatusTimestamp { Time = Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(lobby_status.GetLastModfication()), Lobby = (uint)lobby, }, diff --git a/unity/Assets/Scripts/grpc/Common.cs b/unity/Assets/Scripts/grpc/Common.cs index 5928c6e..3edd29c 100644 --- a/unity/Assets/Scripts/grpc/Common.cs +++ b/unity/Assets/Scripts/grpc/Common.cs @@ -24,12 +24,17 @@ namespace Common { static CommonReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cgxjb21tb24ucHJvdG8SBmNvbW1vbiIUCgROYW1lEgwKBG5hbWUYASABKAli", - "BnByb3RvMw==")); + "Cgxjb21tb24ucHJvdG8SBmNvbW1vbhofZ29vZ2xlL3Byb3RvYnVmL3RpbWVz", + "dGFtcC5wcm90byIUCgROYW1lEgwKBG5hbWUYASABKAkiTgoTTGFzdFN0YXR1", + "c1RpbWVzdGFtcBIoCgR0aW1lGAEgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRp", + "bWVzdGFtcBINCgVsb2JieRgCIAEoDSIdCgxIYXNOZXdTdGF0dXMSDQoFdmFs", + "dWUYASABKAhiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Common.Name), global::Common.Name.Parser, new[]{ "Name_" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Common.Name), global::Common.Name.Parser, new[]{ "Name_" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Common.LastStatusTimestamp), global::Common.LastStatusTimestamp.Parser, new[]{ "Time", "Lobby" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Common.HasNewStatus), global::Common.HasNewStatus.Parser, new[]{ "Value" }, null, null, null, null) })); } #endregion @@ -208,6 +213,395 @@ namespace Common { } + public sealed partial class LastStatusTimestamp : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LastStatusTimestamp()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Common.CommonReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public LastStatusTimestamp() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public LastStatusTimestamp(LastStatusTimestamp other) : this() { + time_ = other.time_ != null ? other.time_.Clone() : null; + lobby_ = other.lobby_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public LastStatusTimestamp Clone() { + return new LastStatusTimestamp(this); + } + + /// Field number for the "time" field. + public const int TimeFieldNumber = 1; + private global::Google.Protobuf.WellKnownTypes.Timestamp time_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp Time { + get { return time_; } + set { + time_ = value; + } + } + + /// Field number for the "lobby" field. + public const int LobbyFieldNumber = 2; + private uint lobby_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint Lobby { + get { return lobby_; } + set { + lobby_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as LastStatusTimestamp); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(LastStatusTimestamp other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Time, other.Time)) return false; + if (Lobby != other.Lobby) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (time_ != null) hash ^= Time.GetHashCode(); + if (Lobby != 0) hash ^= Lobby.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (time_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Time); + } + if (Lobby != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Lobby); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (time_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Time); + } + if (Lobby != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Lobby); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (time_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Time); + } + if (Lobby != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Lobby); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(LastStatusTimestamp other) { + if (other == null) { + return; + } + if (other.time_ != null) { + if (time_ == null) { + Time = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + Time.MergeFrom(other.Time); + } + if (other.Lobby != 0) { + Lobby = other.Lobby; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (time_ == null) { + Time = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(Time); + break; + } + case 16: { + Lobby = input.ReadUInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (time_ == null) { + Time = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(Time); + break; + } + case 16: { + Lobby = input.ReadUInt32(); + break; + } + } + } + } + #endif + + } + + public sealed partial class HasNewStatus : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HasNewStatus()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Common.CommonReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HasNewStatus() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HasNewStatus(HasNewStatus other) : this() { + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public HasNewStatus Clone() { + return new HasNewStatus(this); + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 1; + private bool value_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as HasNewStatus); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(HasNewStatus other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Value != other.Value) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Value != false) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Value != false) { + output.WriteRawTag(8); + output.WriteBool(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Value != false) { + output.WriteRawTag(8); + output.WriteBool(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Value != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(HasNewStatus other) { + if (other == null) { + return; + } + if (other.Value != false) { + Value = other.Value; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Value = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Value = input.ReadBool(); + break; + } + } + } + } + #endif + + } + #endregion } diff --git a/unity/Assets/Scripts/grpc/Game.cs b/unity/Assets/Scripts/grpc/Game.cs index b1a4f2a..f409244 100644 --- a/unity/Assets/Scripts/grpc/Game.cs +++ b/unity/Assets/Scripts/grpc/Game.cs @@ -25,35 +25,38 @@ namespace Game { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CgpnYW1lLnByb3RvEgRnYW1lGhtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJv", - "dG8iGAoIQ2FyZEtpbmQSDAoEa2luZBgBIAEoCSIjCgVJbWFnZRIMCgRmYWNl", - "GAEgASgMEgwKBGJhY2sYAiABKAwidAoJQ2FyZEluZGV4Eg8KBWluZGV4GAEg", - "ASgNSAASJQoDdG9wGAIgASgLMhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5SAAS", - "KAoGYm90dG9tGAMgASgLMhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5SABCBQoD", - "cG9zIk0KCFBpbGVLaW5kEg8KBW93bmVkGAEgASgNSAASKAoGY29tbW9uGAIg", - "ASgLMhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5SABCBgoEa2luZCJgCgZDYXJk", - "SWQSIAoIcGlsZUtpbmQYASABKAsyDi5nYW1lLlBpbGVLaW5kEhAKCHBpbGVO", - "YW1lGAIgASgJEiIKCWNhcmRJbmRleBgDIAEoCzIPLmdhbWUuQ2FyZEluZGV4", - "IvMCCg1NZXNzYWdlU3RhdHVzEi4KC2NvbW1vblBpbGVzGAEgASgLMhkuZ2Ft", - "ZS5NZXNzYWdlU3RhdHVzLlBpbGVzEi4KC3BsYXllclBpbGVzGAIgAygLMhku", - "Z2FtZS5NZXNzYWdlU3RhdHVzLlBpbGVzEhMKC2N1cnJlbnRUdXJuGAMgASgN", - "GjUKBENhcmQSHAoEa2luZBgBIAEoCzIOLmdhbWUuQ2FyZEtpbmQSDwoHdmlz", - "aWJsZRgCIAEoCBovCgRQaWxlEicKBWNhcmRzGAEgAygLMhguZ2FtZS5NZXNz", - "YWdlU3RhdHVzLkNhcmQahAEKBVBpbGVzEjMKBXBpbGVzGAEgAygLMiQuZ2Ft", - "ZS5NZXNzYWdlU3RhdHVzLlBpbGVzLlBpbGVzRW50cnkaRgoKUGlsZXNFbnRy", - "eRILCgNrZXkYASABKAkSJwoFdmFsdWUYAiABKAsyGC5nYW1lLk1lc3NhZ2VT", - "dGF0dXMuUGlsZToCOAEymwEKBEdhbWUSKwoMZ2V0Q2FyZEltYWdlEg4uZ2Ft", - "ZS5DYXJkS2luZBoLLmdhbWUuSW1hZ2USLwoHb25DbGljaxIMLmdhbWUuQ2Fy", - "ZElkGhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5EjUKBnN0YXR1cxIWLmdvb2ds", - "ZS5wcm90b2J1Zi5FbXB0eRoTLmdhbWUuTWVzc2FnZVN0YXR1c2IGcHJvdG8z")); + "dG8aDGNvbW1vbi5wcm90byIYCghDYXJkS2luZBIMCgRraW5kGAEgASgJIiMK", + "BUltYWdlEgwKBGZhY2UYASABKAwSDAoEYmFjaxgCIAEoDCJ0CglDYXJkSW5k", + "ZXgSDwoFaW5kZXgYASABKA1IABIlCgN0b3AYAiABKAsyFi5nb29nbGUucHJv", + "dG9idWYuRW1wdHlIABIoCgZib3R0b20YAyABKAsyFi5nb29nbGUucHJvdG9i", + "dWYuRW1wdHlIAEIFCgNwb3MiTQoIUGlsZUtpbmQSDwoFb3duZWQYASABKA1I", + "ABIoCgZjb21tb24YAiABKAsyFi5nb29nbGUucHJvdG9idWYuRW1wdHlIAEIG", + "CgRraW5kImAKBkNhcmRJZBIgCghwaWxlS2luZBgBIAEoCzIOLmdhbWUuUGls", + "ZUtpbmQSEAoIcGlsZU5hbWUYAiABKAkSIgoJY2FyZEluZGV4GAMgASgLMg8u", + "Z2FtZS5DYXJkSW5kZXgikAMKDU1lc3NhZ2VTdGF0dXMSLgoLY29tbW9uUGls", + "ZXMYASABKAsyGS5nYW1lLk1lc3NhZ2VTdGF0dXMuUGlsZXMSLgoLcGxheWVy", + "UGlsZXMYAiADKAsyGS5nYW1lLk1lc3NhZ2VTdGF0dXMuUGlsZXMSGwoFbmFt", + "ZXMYAyADKAsyDC5jb21tb24uTmFtZRITCgtjdXJyZW50VHVybhgEIAEoDRo1", + "CgRDYXJkEhwKBGtpbmQYASABKAsyDi5nYW1lLkNhcmRLaW5kEg8KB3Zpc2li", + "bGUYAiABKAgaLwoEUGlsZRInCgVjYXJkcxgBIAMoCzIYLmdhbWUuTWVzc2Fn", + "ZVN0YXR1cy5DYXJkGoQBCgVQaWxlcxIzCgVwaWxlcxgBIAMoCzIkLmdhbWUu", + "TWVzc2FnZVN0YXR1cy5QaWxlcy5QaWxlc0VudHJ5GkYKClBpbGVzRW50cnkS", + "CwoDa2V5GAEgASgJEicKBXZhbHVlGAIgASgLMhguZ2FtZS5NZXNzYWdlU3Rh", + "dHVzLlBpbGU6AjgBMtwBCgRHYW1lEisKDGdldENhcmRJbWFnZRIOLmdhbWUu", + "Q2FyZEtpbmQaCy5nYW1lLkltYWdlEi8KB29uQ2xpY2sSDC5nYW1lLkNhcmRJ", + "ZBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRI1CgZzdGF0dXMSFi5nb29nbGUu", + "cHJvdG9idWYuRW1wdHkaEy5nYW1lLk1lc3NhZ2VTdGF0dXMSPwoKcG9sbFN0", + "YXR1cxIbLmNvbW1vbi5MYXN0U3RhdHVzVGltZXN0YW1wGhQuY29tbW9uLkhh", + "c05ld1N0YXR1c2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Common.CommonReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Game.CardKind), global::Game.CardKind.Parser, new[]{ "Kind" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Game.Image), global::Game.Image.Parser, new[]{ "Face", "Back" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Game.CardIndex), global::Game.CardIndex.Parser, new[]{ "Index", "Top", "Bottom" }, new[]{ "Pos" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Game.PileKind), global::Game.PileKind.Parser, new[]{ "Owned", "Common" }, new[]{ "Kind" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Game.CardId), global::Game.CardId.Parser, new[]{ "PileKind", "PileName", "CardIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Game.MessageStatus), global::Game.MessageStatus.Parser, new[]{ "CommonPiles", "PlayerPiles", "CurrentTurn" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Game.MessageStatus.Types.Card), global::Game.MessageStatus.Types.Card.Parser, new[]{ "Kind", "Visible" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Game.MessageStatus), global::Game.MessageStatus.Parser, new[]{ "CommonPiles", "PlayerPiles", "Names", "CurrentTurn" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Game.MessageStatus.Types.Card), global::Game.MessageStatus.Types.Card.Parser, new[]{ "Kind", "Visible" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Game.MessageStatus.Types.Pile), global::Game.MessageStatus.Types.Pile.Parser, new[]{ "Cards" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Game.MessageStatus.Types.Piles), global::Game.MessageStatus.Types.Piles.Parser, new[]{ "Piles_" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, })}) })); @@ -1291,6 +1294,7 @@ namespace Game { public MessageStatus(MessageStatus other) : this() { commonPiles_ = other.commonPiles_ != null ? other.commonPiles_.Clone() : null; playerPiles_ = other.playerPiles_.Clone(); + names_ = other.names_.Clone(); currentTurn_ = other.currentTurn_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1303,6 +1307,9 @@ namespace Game { /// Field number for the "commonPiles" field. public const int CommonPilesFieldNumber = 1; private global::Game.MessageStatus.Types.Piles commonPiles_; + /// + /// {a: [""], b:[""]} + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Game.MessageStatus.Types.Piles CommonPiles { get { return commonPiles_; } @@ -1316,13 +1323,26 @@ namespace Game { private static readonly pb::FieldCodec _repeated_playerPiles_codec = pb::FieldCodec.ForMessage(18, global::Game.MessageStatus.Types.Piles.Parser); private readonly pbc::RepeatedField playerPiles_ = new pbc::RepeatedField(); + /// + /// [{...}, {...}] + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PlayerPiles { get { return playerPiles_; } } + /// Field number for the "names" field. + public const int NamesFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_names_codec + = pb::FieldCodec.ForMessage(26, global::Common.Name.Parser); + private readonly pbc::RepeatedField names_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Names { + get { return names_; } + } + /// Field number for the "currentTurn" field. - public const int CurrentTurnFieldNumber = 3; + public const int CurrentTurnFieldNumber = 4; private uint currentTurn_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint CurrentTurn { @@ -1347,6 +1367,7 @@ namespace Game { } if (!object.Equals(CommonPiles, other.CommonPiles)) return false; if(!playerPiles_.Equals(other.playerPiles_)) return false; + if(!names_.Equals(other.names_)) return false; if (CurrentTurn != other.CurrentTurn) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1356,6 +1377,7 @@ namespace Game { int hash = 1; if (commonPiles_ != null) hash ^= CommonPiles.GetHashCode(); hash ^= playerPiles_.GetHashCode(); + hash ^= names_.GetHashCode(); if (CurrentTurn != 0) hash ^= CurrentTurn.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -1378,8 +1400,9 @@ namespace Game { output.WriteMessage(CommonPiles); } playerPiles_.WriteTo(output, _repeated_playerPiles_codec); + names_.WriteTo(output, _repeated_names_codec); if (CurrentTurn != 0) { - output.WriteRawTag(24); + output.WriteRawTag(32); output.WriteUInt32(CurrentTurn); } if (_unknownFields != null) { @@ -1396,8 +1419,9 @@ namespace Game { output.WriteMessage(CommonPiles); } playerPiles_.WriteTo(ref output, _repeated_playerPiles_codec); + names_.WriteTo(ref output, _repeated_names_codec); if (CurrentTurn != 0) { - output.WriteRawTag(24); + output.WriteRawTag(32); output.WriteUInt32(CurrentTurn); } if (_unknownFields != null) { @@ -1413,6 +1437,7 @@ namespace Game { size += 1 + pb::CodedOutputStream.ComputeMessageSize(CommonPiles); } size += playerPiles_.CalculateSize(_repeated_playerPiles_codec); + size += names_.CalculateSize(_repeated_names_codec); if (CurrentTurn != 0) { size += 1 + pb::CodedOutputStream.ComputeUInt32Size(CurrentTurn); } @@ -1434,6 +1459,7 @@ namespace Game { CommonPiles.MergeFrom(other.CommonPiles); } playerPiles_.Add(other.playerPiles_); + names_.Add(other.names_); if (other.CurrentTurn != 0) { CurrentTurn = other.CurrentTurn; } @@ -1462,7 +1488,11 @@ namespace Game { playerPiles_.AddEntriesFrom(input, _repeated_playerPiles_codec); break; } - case 24: { + case 26: { + names_.AddEntriesFrom(input, _repeated_names_codec); + break; + } + case 32: { CurrentTurn = input.ReadUInt32(); break; } @@ -1491,7 +1521,11 @@ namespace Game { playerPiles_.AddEntriesFrom(ref input, _repeated_playerPiles_codec); break; } - case 24: { + case 26: { + names_.AddEntriesFrom(ref input, _repeated_names_codec); + break; + } + case 32: { CurrentTurn = input.ReadUInt32(); break; } diff --git a/unity/Assets/Scripts/grpc/GameGrpc.cs b/unity/Assets/Scripts/grpc/GameGrpc.cs index ffed118..39c8790 100644 --- a/unity/Assets/Scripts/grpc/GameGrpc.cs +++ b/unity/Assets/Scripts/grpc/GameGrpc.cs @@ -50,6 +50,8 @@ namespace Game { static readonly grpc::Marshaller __Marshaller_game_CardId = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Game.CardId.Parser)); static readonly grpc::Marshaller __Marshaller_google_protobuf_Empty = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Google.Protobuf.WellKnownTypes.Empty.Parser)); static readonly grpc::Marshaller __Marshaller_game_MessageStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Game.MessageStatus.Parser)); + static readonly grpc::Marshaller __Marshaller_common_LastStatusTimestamp = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Common.LastStatusTimestamp.Parser)); + static readonly grpc::Marshaller __Marshaller_common_HasNewStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Common.HasNewStatus.Parser)); static readonly grpc::Method __Method_getCardImage = new grpc::Method( grpc::MethodType.Unary, @@ -72,6 +74,13 @@ namespace Game { __Marshaller_google_protobuf_Empty, __Marshaller_game_MessageStatus); + static readonly grpc::Method __Method_pollStatus = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "pollStatus", + __Marshaller_common_LastStatusTimestamp, + __Marshaller_common_HasNewStatus); + /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { @@ -97,6 +106,11 @@ namespace Game { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } + public virtual global::System.Threading.Tasks.Task pollStatus(global::Common.LastStatusTimestamp request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + } /// Client for Game @@ -170,6 +184,22 @@ namespace Game { { return CallInvoker.AsyncUnaryCall(__Method_status, null, options, request); } + public virtual global::Common.HasNewStatus pollStatus(global::Common.LastStatusTimestamp request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return pollStatus(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::Common.HasNewStatus pollStatus(global::Common.LastStatusTimestamp request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_pollStatus, null, options, request); + } + public virtual grpc::AsyncUnaryCall pollStatusAsync(global::Common.LastStatusTimestamp request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return pollStatusAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall pollStatusAsync(global::Common.LastStatusTimestamp request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_pollStatus, null, options, request); + } /// Creates a new instance of client from given ClientBaseConfiguration. protected override GameClient NewInstance(ClientBaseConfiguration configuration) { @@ -184,7 +214,8 @@ namespace Game { return grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_getCardImage, serviceImpl.getCardImage) .AddMethod(__Method_onClick, serviceImpl.onClick) - .AddMethod(__Method_status, serviceImpl.status).Build(); + .AddMethod(__Method_status, serviceImpl.status) + .AddMethod(__Method_pollStatus, serviceImpl.pollStatus).Build(); } /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. @@ -196,6 +227,7 @@ namespace Game { serviceBinder.AddMethod(__Method_getCardImage, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.getCardImage)); serviceBinder.AddMethod(__Method_onClick, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.onClick)); serviceBinder.AddMethod(__Method_status, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.status)); + serviceBinder.AddMethod(__Method_pollStatus, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.pollStatus)); } } diff --git a/unity/Assets/Scripts/grpc/Lobby.cs b/unity/Assets/Scripts/grpc/Lobby.cs index 670cd7b..1fa0916 100644 --- a/unity/Assets/Scripts/grpc/Lobby.cs +++ b/unity/Assets/Scripts/grpc/Lobby.cs @@ -24,28 +24,23 @@ namespace Lobby { static LobbyReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cgtsb2JieS5wcm90bxIFbG9iYnkaH2dvb2dsZS9wcm90b2J1Zi90aW1lc3Rh", - "bXAucHJvdG8aG2dvb2dsZS9wcm90b2J1Zi9lbXB0eS5wcm90bxoMY29tbW9u", - "LnByb3RvIh0KDEhhc05ld1N0YXR1cxINCgV2YWx1ZRgBIAEoCCJOChNMYXN0", - "U3RhdHVzVGltZXN0YW1wEigKBHRpbWUYASABKAsyGi5nb29nbGUucHJvdG9i", - "dWYuVGltZXN0YW1wEg0KBWxvYmJ5GAIgASgNIjMKBFZvdGUSDgoGcGxheWVy", - "GAEgASgJEgwKBGdhbWUYAiABKA0SDQoFcmVhZHkYAyABKAgiGgoKU2luZ2xl", - "Vm90ZRIMCgRnYW1lGAIgASgNIloKC0xvYmJ5U3RhdHVzEhsKBW5hbWVzGAEg", - "AygLMgwuY29tbW9uLk5hbWUSGgoFdm90ZXMYAiADKAsyCy5sb2JieS5Wb3Rl", - "EhIKCmlzU3RhcnRpbmcYAyABKAgy1wIKBUxvYmJ5Ei8KBXVzZXJzEhYuZ29v", - "Z2xlLnByb3RvYnVmLkVtcHR5GgwuY29tbW9uLk5hbWUwARIxCgR2b3RlEhEu", - "bG9iYnkuU2luZ2xlVm90ZRoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRI3CgVy", - "ZWFkeRIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRoWLmdvb2dsZS5wcm90b2J1", - "Zi5FbXB0eRI/CgxoYXNOZXdTdGF0dXMSGi5sb2JieS5MYXN0U3RhdHVzVGlt", - "ZXN0YW1wGhMubG9iYnkuSGFzTmV3U3RhdHVzEjcKCWdldFN0YXR1cxIWLmdv", - "b2dsZS5wcm90b2J1Zi5FbXB0eRoSLmxvYmJ5LkxvYmJ5U3RhdHVzEjcKBWxl", - "YXZlEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GhYuZ29vZ2xlLnByb3RvYnVm", - "LkVtcHR5YgZwcm90bzM=")); + "Cgtsb2JieS5wcm90bxIFbG9iYnkaG2dvb2dsZS9wcm90b2J1Zi9lbXB0eS5w", + "cm90bxoMY29tbW9uLnByb3RvIjMKBFZvdGUSDgoGcGxheWVyGAEgASgJEgwK", + "BGdhbWUYAiABKA0SDQoFcmVhZHkYAyABKAgiGgoKU2luZ2xlVm90ZRIMCgRn", + "YW1lGAIgASgNIloKC0xvYmJ5U3RhdHVzEhsKBW5hbWVzGAEgAygLMgwuY29t", + "bW9uLk5hbWUSGgoFdm90ZXMYAiADKAsyCy5sb2JieS5Wb3RlEhIKCmlzU3Rh", + "cnRpbmcYAyABKAgy1wIKBUxvYmJ5Ei8KBXVzZXJzEhYuZ29vZ2xlLnByb3Rv", + "YnVmLkVtcHR5GgwuY29tbW9uLk5hbWUwARIxCgR2b3RlEhEubG9iYnkuU2lu", + "Z2xlVm90ZRoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRI3CgVyZWFkeRIWLmdv", + "b2dsZS5wcm90b2J1Zi5FbXB0eRoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRI/", + "Cgpwb2xsU3RhdHVzEhsuY29tbW9uLkxhc3RTdGF0dXNUaW1lc3RhbXAaFC5j", + "b21tb24uSGFzTmV3U3RhdHVzEjcKCWdldFN0YXR1cxIWLmdvb2dsZS5wcm90", + "b2J1Zi5FbXB0eRoSLmxvYmJ5LkxvYmJ5U3RhdHVzEjcKBWxlYXZlEhYuZ29v", + "Z2xlLnByb3RvYnVmLkVtcHR5GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5YgZw", + "cm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Common.CommonReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Common.CommonReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Lobby.HasNewStatus), global::Lobby.HasNewStatus.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Lobby.LastStatusTimestamp), global::Lobby.LastStatusTimestamp.Parser, new[]{ "Time", "Lobby" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Lobby.Vote), global::Lobby.Vote.Parser, new[]{ "Player", "Game", "Ready" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Lobby.SingleVote), global::Lobby.SingleVote.Parser, new[]{ "Game" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Lobby.LobbyStatus), global::Lobby.LobbyStatus.Parser, new[]{ "Names", "Votes", "IsStarting" }, null, null, null, null) @@ -55,395 +50,6 @@ namespace Lobby { } #region Messages - public sealed partial class HasNewStatus : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HasNewStatus()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Lobby.LobbyReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HasNewStatus() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HasNewStatus(HasNewStatus other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HasNewStatus Clone() { - return new HasNewStatus(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as HasNewStatus); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HasNewStatus other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HasNewStatus other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - public sealed partial class LastStatusTimestamp : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LastStatusTimestamp()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Lobby.LobbyReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LastStatusTimestamp() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LastStatusTimestamp(LastStatusTimestamp other) : this() { - time_ = other.time_ != null ? other.time_.Clone() : null; - lobby_ = other.lobby_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LastStatusTimestamp Clone() { - return new LastStatusTimestamp(this); - } - - /// Field number for the "time" field. - public const int TimeFieldNumber = 1; - private global::Google.Protobuf.WellKnownTypes.Timestamp time_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp Time { - get { return time_; } - set { - time_ = value; - } - } - - /// Field number for the "lobby" field. - public const int LobbyFieldNumber = 2; - private uint lobby_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Lobby { - get { return lobby_; } - set { - lobby_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as LastStatusTimestamp); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(LastStatusTimestamp other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Time, other.Time)) return false; - if (Lobby != other.Lobby) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (time_ != null) hash ^= Time.GetHashCode(); - if (Lobby != 0) hash ^= Lobby.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (time_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Time); - } - if (Lobby != 0) { - output.WriteRawTag(16); - output.WriteUInt32(Lobby); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (time_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Time); - } - if (Lobby != 0) { - output.WriteRawTag(16); - output.WriteUInt32(Lobby); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (time_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Time); - } - if (Lobby != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Lobby); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(LastStatusTimestamp other) { - if (other == null) { - return; - } - if (other.time_ != null) { - if (time_ == null) { - Time = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - Time.MergeFrom(other.Time); - } - if (other.Lobby != 0) { - Lobby = other.Lobby; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (time_ == null) { - Time = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Time); - break; - } - case 16: { - Lobby = input.ReadUInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (time_ == null) { - Time = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Time); - break; - } - case 16: { - Lobby = input.ReadUInt32(); - break; - } - } - } - } - #endif - - } - public sealed partial class Vote : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage @@ -456,7 +62,7 @@ namespace Lobby { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Lobby.LobbyReflection.Descriptor.MessageTypes[2]; } + get { return global::Lobby.LobbyReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -700,7 +306,7 @@ namespace Lobby { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Lobby.LobbyReflection.Descriptor.MessageTypes[3]; } + get { return global::Lobby.LobbyReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -872,7 +478,7 @@ namespace Lobby { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Lobby.LobbyReflection.Descriptor.MessageTypes[4]; } + get { return global::Lobby.LobbyReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/unity/Assets/Scripts/grpc/LobbyGrpc.cs b/unity/Assets/Scripts/grpc/LobbyGrpc.cs index f85246d..4db466b 100644 --- a/unity/Assets/Scripts/grpc/LobbyGrpc.cs +++ b/unity/Assets/Scripts/grpc/LobbyGrpc.cs @@ -48,8 +48,8 @@ namespace Lobby { static readonly grpc::Marshaller __Marshaller_google_protobuf_Empty = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Google.Protobuf.WellKnownTypes.Empty.Parser)); static readonly grpc::Marshaller __Marshaller_common_Name = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Common.Name.Parser)); static readonly grpc::Marshaller __Marshaller_lobby_SingleVote = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Lobby.SingleVote.Parser)); - static readonly grpc::Marshaller __Marshaller_lobby_LastStatusTimestamp = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Lobby.LastStatusTimestamp.Parser)); - static readonly grpc::Marshaller __Marshaller_lobby_HasNewStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Lobby.HasNewStatus.Parser)); + static readonly grpc::Marshaller __Marshaller_common_LastStatusTimestamp = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Common.LastStatusTimestamp.Parser)); + static readonly grpc::Marshaller __Marshaller_common_HasNewStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Common.HasNewStatus.Parser)); static readonly grpc::Marshaller __Marshaller_lobby_LobbyStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Lobby.LobbyStatus.Parser)); static readonly grpc::Method __Method_users = new grpc::Method( @@ -73,12 +73,12 @@ namespace Lobby { __Marshaller_google_protobuf_Empty, __Marshaller_google_protobuf_Empty); - static readonly grpc::Method __Method_hasNewStatus = new grpc::Method( + static readonly grpc::Method __Method_pollStatus = new grpc::Method( grpc::MethodType.Unary, __ServiceName, - "hasNewStatus", - __Marshaller_lobby_LastStatusTimestamp, - __Marshaller_lobby_HasNewStatus); + "pollStatus", + __Marshaller_common_LastStatusTimestamp, + __Marshaller_common_HasNewStatus); static readonly grpc::Method __Method_getStatus = new grpc::Method( grpc::MethodType.Unary, @@ -119,7 +119,7 @@ namespace Lobby { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } - public virtual global::System.Threading.Tasks.Task hasNewStatus(global::Lobby.LastStatusTimestamp request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task pollStatus(global::Common.LastStatusTimestamp request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -199,21 +199,21 @@ namespace Lobby { { return CallInvoker.AsyncUnaryCall(__Method_ready, null, options, request); } - public virtual global::Lobby.HasNewStatus hasNewStatus(global::Lobby.LastStatusTimestamp request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Common.HasNewStatus pollStatus(global::Common.LastStatusTimestamp request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return hasNewStatus(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return pollStatus(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } - public virtual global::Lobby.HasNewStatus hasNewStatus(global::Lobby.LastStatusTimestamp request, grpc::CallOptions options) + public virtual global::Common.HasNewStatus pollStatus(global::Common.LastStatusTimestamp request, grpc::CallOptions options) { - return CallInvoker.BlockingUnaryCall(__Method_hasNewStatus, null, options, request); + return CallInvoker.BlockingUnaryCall(__Method_pollStatus, null, options, request); } - public virtual grpc::AsyncUnaryCall hasNewStatusAsync(global::Lobby.LastStatusTimestamp request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall pollStatusAsync(global::Common.LastStatusTimestamp request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { - return hasNewStatusAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + return pollStatusAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } - public virtual grpc::AsyncUnaryCall hasNewStatusAsync(global::Lobby.LastStatusTimestamp request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall pollStatusAsync(global::Common.LastStatusTimestamp request, grpc::CallOptions options) { - return CallInvoker.AsyncUnaryCall(__Method_hasNewStatus, null, options, request); + return CallInvoker.AsyncUnaryCall(__Method_pollStatus, null, options, request); } public virtual global::Lobby.LobbyStatus getStatus(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { @@ -262,7 +262,7 @@ namespace Lobby { .AddMethod(__Method_users, serviceImpl.users) .AddMethod(__Method_vote, serviceImpl.vote) .AddMethod(__Method_ready, serviceImpl.ready) - .AddMethod(__Method_hasNewStatus, serviceImpl.hasNewStatus) + .AddMethod(__Method_pollStatus, serviceImpl.pollStatus) .AddMethod(__Method_getStatus, serviceImpl.getStatus) .AddMethod(__Method_leave, serviceImpl.leave).Build(); } @@ -276,7 +276,7 @@ namespace Lobby { serviceBinder.AddMethod(__Method_users, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.users)); serviceBinder.AddMethod(__Method_vote, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.vote)); serviceBinder.AddMethod(__Method_ready, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.ready)); - serviceBinder.AddMethod(__Method_hasNewStatus, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.hasNewStatus)); + serviceBinder.AddMethod(__Method_pollStatus, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.pollStatus)); serviceBinder.AddMethod(__Method_getStatus, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.getStatus)); serviceBinder.AddMethod(__Method_leave, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.leave)); }