Browse Source

Add card loading logic to client

new_protocol
KeyKoder 5 years ago
parent
commit
4bc5bac26e
  1. 994
      unity/Assets/Scenes/SampleScene.unity
  2. 96
      unity/Assets/Scripts/Card.cs
  3. 58
      unity/Assets/Scripts/Client.cs
  4. 37
      unity/Assets/Scripts/MainMenuController.cs
  5. 18
      unity/Assets/Scripts/Scrollable.cs
  6. 86
      unity/Assets/Scripts/grpc/Game.cs
  7. 8
      unity/ProjectSettings/EditorBuildSettings.asset
  8. 3
      unity/ProjectSettings/TagManager.asset

994
unity/Assets/Scenes/SampleScene.unity

File diff suppressed because it is too large

96
unity/Assets/Scripts/Card.cs

@ -6,7 +6,7 @@ using TMPro;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
public class Card : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler{ public class Card : MonoBehaviour {//, IPointerEnterHandler, IPointerExitHandler{
public GameObject cardCanvas; public GameObject cardCanvas;
private GameObject cardPreview; private GameObject cardPreview;
public static bool preparingCard = false; public static bool preparingCard = false;
@ -16,25 +16,39 @@ public class Card : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler{
public bool thrown = false; public bool thrown = false;
private GameObject actionMenu; private GameObject actionMenu;
private static GameObject thrownCards; private static GameObject thrownCards;
private static float yOffsetTable = 0.51f/2;
private MainMenuController mmc;
public string inPileName;
public bool isInCommonPile;
public int idx;
void Start() { void Start() {
mmc = GameLoader.mmc;
cardPreview = GameObject.FindGameObjectsWithTag("CardPreview")[0]; cardPreview = GameObject.FindGameObjectsWithTag("CardPreview")[0];
thrownCards = GameObject.FindGameObjectsWithTag("ThrownCards")[0]; thrownCards = GameObject.Find("ThrownCards");
actionMenu = transform.Find("ActionMenu").gameObject; actionMenu = transform.Find("ActionMenu").gameObject;
actionMenu.SetActive(false); actionMenu.SetActive(false);
GetComponent<Button>().onClick.AddListener(OnClickCard); GetComponent<Button>().onClick.AddListener(OnClickCard);
} }
public void OnPointerEnter(PointerEventData edata) { public void InitData(string pileName, bool isCommonPile, int index) {
if(cardPreview && !cardBeingPrepared) { inPileName = pileName;
SetPreview(); isInCommonPile = isCommonPile;
} idx = index;
} }
public void OnPointerExit(PointerEventData edata) { // Card Previewing Code
if(cardPreview && !cardBeingPrepared) { // public void OnPointerEnter(PointerEventData edata) {
HidePreview(); // if(cardPreview && !cardBeingPrepared) {
} // SetPreview();
} // }
// }
//public void OnPointerExit(PointerEventData edata) {
// if(cardPreview && !cardBeingPrepared) {
// HidePreview();
// }
// }
public void OnClickCard() { public void OnClickCard() {
// var conn = Client.GetConnection(); // var conn = Client.GetConnection();
// if (conn != null) { // if (conn != null) {
@ -44,8 +58,13 @@ public class Card : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler{
if ((!preparingCard || cardBeingPrepared != gameObject) && !thrown) { if ((!preparingCard || cardBeingPrepared != gameObject) && !thrown) {
cardBeingPrepared = gameObject; cardBeingPrepared = gameObject;
SetPreview(); //SetPreview();
preparingCard = true; preparingCard = true;
} else {
var conn = Client.GetConnection();
if (conn != null) {
conn.OnClickCard(inPileName, isInCommonPile, idx, mmc.currentUsername);
}
} }
} }
@ -66,50 +85,51 @@ public class Card : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler{
private void SetPreview() { private void SetPreview() {
cardPreview.GetComponentsInChildren<RawImage>()[0].enabled = true; cardPreview.GetComponentsInChildren<RawImage>()[0].enabled = true;
cardPreview.GetComponentsInChildren<Text>()[0].enabled = true;
cardPreview.GetComponentsInChildren<Text>()[1].enabled = true;
cardPreview.GetComponentsInChildren<Text>()[2].enabled = true;
cardPreview.GetComponentsInChildren<RawImage>()[1].enabled = true;
cardPreview.GetComponentsInChildren<TMP_Text>()[0].enabled = true;
cardPreview.GetComponentsInChildren<Text>()[0].text = gameObject.GetComponentsInChildren<Text>()[0].text;
cardPreview.GetComponentsInChildren<Text>()[1].text = gameObject.GetComponentsInChildren<Text>()[1].text;
cardPreview.GetComponentsInChildren<Text>()[2].text = gameObject.GetComponentsInChildren<Text>()[2].text;
cardPreview.GetComponentsInChildren<RawImage>()[1].texture = gameObject.GetComponentsInChildren<RawImage>()[1].texture;
cardPreview.GetComponentsInChildren<TMP_Text>()[0].text = gameObject.GetComponentsInChildren<TMP_Text>()[0].text;
cardPreview.GetComponentsInChildren<RawImage>()[0].texture = gameObject.GetComponentsInChildren<RawImage>()[0].texture; cardPreview.GetComponentsInChildren<RawImage>()[0].texture = gameObject.GetComponentsInChildren<RawImage>()[0].texture;
} }
private void HidePreview() { private void HidePreview() {
cardPreview.GetComponentsInChildren<RawImage>()[0].enabled = false; cardPreview.GetComponentsInChildren<RawImage>()[0].enabled = false;
cardPreview.GetComponentsInChildren<Text>()[0].enabled = false;
cardPreview.GetComponentsInChildren<Text>()[1].enabled = false;
cardPreview.GetComponentsInChildren<Text>()[2].enabled = false;
cardPreview.GetComponentsInChildren<RawImage>()[1].enabled = false;
cardPreview.GetComponentsInChildren<TMP_Text>()[0].enabled = false;
} }
public void ThrowCard() { public void ThrowCard() {
var canvas = Instantiate(cardCanvas,new Vector3(0, 0.51f+thrownCards.transform.childCount*0.01f, -2.79f), transform.rotation); var canvas = Instantiate(cardCanvas, thrownCards.transform.position + new Vector3(0, yOffsetTable + thrownCards.transform.childCount*0.01f, -2.79f), transform.rotation);
canvas.GetComponent<Canvas>().worldCamera = Camera.main; canvas.GetComponent<Canvas>().worldCamera = Camera.main;
var newCard = Instantiate(gameObject, Vector3.zero, Quaternion.identity, canvas.transform); var newCard = Instantiate(gameObject, Vector3.zero, Quaternion.identity, canvas.transform);
newCard.transform.localScale = Vector3.one; newCard.transform.localScale = Vector3.one;
newCard.GetComponent<Card>().thrown = true; newCard.GetComponent<Card>().thrown = true;
newCard.GetComponent<Card>().inPileName = "placed";
newCard.GetComponent<Card>().idx = thrownCards.transform.childCount;
newCard.GetComponent<Card>().isInCommonPile = true;
canvas.transform.SetParent(thrownCards.transform); canvas.transform.SetParent(thrownCards.transform);
canvas.transform.localScale = new Vector3(0.0025f, 0.0025f); canvas.transform.localScale = new Vector3(0.01f, 0.01f);
GetComponentsInChildren<RawImage>()[0].enabled = false; canvas.transform.Rotate(new Vector3(90f, 0f, 0f));
GetComponentsInChildren<Text>()[0].enabled = false; canvas.transform.Rotate(new Vector3(0f, 0f, Random.Range(-20, 20)));
GetComponentsInChildren<Text>()[1].enabled = false; Destroy(gameObject);
GetComponentsInChildren<Text>()[2].enabled = false; }
GetComponentsInChildren<RawImage>()[1].enabled = false; public void ThrowCard(GameObject pos) {
GetComponentsInChildren<TMP_Text>()[0].enabled = false; var canvas = Instantiate(cardCanvas, pos.transform.position+new Vector3(0, yOffsetTable + pos.transform.childCount * 0.01f, 0), transform.rotation);
canvas.GetComponent<Canvas>().worldCamera = Camera.main;
var newCard = Instantiate(gameObject, Vector3.zero, Quaternion.identity, canvas.transform);
newCard.transform.localScale = Vector3.one;
newCard.GetComponent<Card>().thrown = true;
newCard.GetComponent<Card>().inPileName = "placed";
newCard.GetComponent<Card>().idx = pos.transform.childCount;
newCard.GetComponent<Card>().isInCommonPile = true;
canvas.transform.SetParent(pos.transform);
canvas.tag = "ThrownCard";
canvas.transform.localScale = new Vector3(0.01f, 0.01f);
canvas.transform.Rotate(new Vector3(90f, 0f, 0f)); canvas.transform.Rotate(new Vector3(90f, 0f, 0f));
canvas.transform.Rotate(new Vector3(0f, 0f, Random.Range(-15, 15))); canvas.transform.Rotate(new Vector3(0f, 0f, Random.Range(-20, 20)));
Destroy(gameObject); Destroy(gameObject);
} }
public void DoContextualAction() { public void DoContextualAction() {
if(preparedCard) { if (preparedCard) {
ThrowCard(); var conn = Client.GetConnection();
if (conn != null) {
GameLoader.ReloadPiles(conn.OnClickCard(inPileName, isInCommonPile, idx, mmc.currentUsername));
}
} }
} }

58
unity/Assets/Scripts/Client.cs

@ -30,6 +30,7 @@ public static class Client
{ {
private ConnectionService.Connection.ConnectionClient connection; private ConnectionService.Connection.ConnectionClient connection;
private Lobby.Lobby.LobbyClient lobby_client; private Lobby.Lobby.LobbyClient lobby_client;
private Game.Game.GameClient game_client;
private Channel channel; private Channel channel;
private string connId; private string connId;
private uint? lobby = null; private uint? lobby = null;
@ -41,6 +42,7 @@ public static class Client
channel = new Channel(address, ChannelCredentials.Insecure); channel = new Channel(address, ChannelCredentials.Insecure);
connection = new ConnectionService.Connection.ConnectionClient(channel); connection = new ConnectionService.Connection.ConnectionClient(channel);
lobby_client = new Lobby.Lobby.LobbyClient(channel); lobby_client = new Lobby.Lobby.LobbyClient(channel);
game_client = new Game.Game.GameClient(channel);
connId = connection.connect(new Common.Name { Name_ = user }).Id; connId = connection.connect(new Common.Name { Name_ = user }).Id;
this.address = address; this.address = address;
} }
@ -90,7 +92,8 @@ public static class Client
return l; return l;
} }
public Lobby.LobbyStatus GetLobbyStatus() { public Lobby.LobbyStatus GetLobbyStatus(out bool hasChanged) {
hasChanged = false;
if (lobby != null) { if (lobby != null) {
if (lobby_status != null) { if (lobby_status != null) {
var hasNew = lobby_client.hasNewStatus( var hasNew = lobby_client.hasNewStatus(
@ -103,12 +106,13 @@ public static class Client
// Debug.Log("HasNewStatus: " + hasNew); // Debug.Log("HasNewStatus: " + hasNew);
if (hasNew) { if (hasNew) {
lobby_status.Set(lobby_client.getStatus(new Google.Protobuf.WellKnownTypes.Empty(), new Metadata { new Metadata.Entry("client_id", connId) })); lobby_status.Set(lobby_client.getStatus(new Google.Protobuf.WellKnownTypes.Empty(), new Metadata { new Metadata.Entry("client_id", connId) }));
hasChanged = true;
} }
} else { } else {
Debug.Log("Getting status"); Debug.Log("Getting status");
lobby_status = new Modifiable<Lobby.LobbyStatus>(lobby_client.getStatus(new Google.Protobuf.WellKnownTypes.Empty(), new Metadata { new Metadata.Entry("client_id", connId) })); lobby_status = new Modifiable<Lobby.LobbyStatus>(lobby_client.getStatus(new Google.Protobuf.WellKnownTypes.Empty(), new Metadata { new Metadata.Entry("client_id", connId) }));
hasChanged = true;
} }
Debug.Log(lobby_status.Get());
return lobby_status.Get(); return lobby_status.Get();
} else { } else {
return null; return null;
@ -116,7 +120,8 @@ public static class Client
} }
public List<Lobby.Vote> GetLobbyVotes(uint game) { public List<Lobby.Vote> GetLobbyVotes(uint game) {
Google.Protobuf.Collections.RepeatedField<Lobby.Vote> votes = GetLobbyStatus().Votes; bool _b = false;
Google.Protobuf.Collections.RepeatedField<Lobby.Vote> votes = GetLobbyStatus(out _b).Votes;
var gameVotes = new List<Lobby.Vote>(); var gameVotes = new List<Lobby.Vote>();
foreach (Lobby.Vote vote in votes) { foreach (Lobby.Vote vote in votes) {
if (vote.Game == game) { if (vote.Game == game) {
@ -127,9 +132,10 @@ public static class Client
} }
public int GetLobbyVoteCount(uint game) { public int GetLobbyVoteCount(uint game) {
Google.Protobuf.Collections.RepeatedField<Lobby.Vote> votes = GetLobbyStatus().Votes; bool _b = false;
Google.Protobuf.Collections.RepeatedField<Lobby.Vote> votes = GetLobbyStatus(out _b).Votes;
var gameVotes = new List<Lobby.Vote>(); var gameVotes = new List<Lobby.Vote>();
foreach(Lobby.Vote vote in votes) { foreach (Lobby.Vote vote in votes) {
if (vote.Game == game) { if (vote.Game == game) {
gameVotes.Add(vote); gameVotes.Add(vote);
} }
@ -137,7 +143,8 @@ public static class Client
return gameVotes.Count; return gameVotes.Count;
} }
public Lobby.Vote GetSelfVote(string player) { public Lobby.Vote GetSelfVote(string player) {
Google.Protobuf.Collections.RepeatedField<Lobby.Vote> votes = GetLobbyStatus().Votes; bool _b = false;
Google.Protobuf.Collections.RepeatedField<Lobby.Vote> votes = GetLobbyStatus(out _b).Votes;
foreach (Lobby.Vote vote in votes) { foreach (Lobby.Vote vote in votes) {
Debug.Log(vote); Debug.Log(vote);
if (vote.Player == player) { if (vote.Player == player) {
@ -173,6 +180,45 @@ public static class Client
return l; return l;
} }
public Game.Image GetCardImage(string cardKind) {
return game_client.getCardImage(new Game.CardKind() { Kind = cardKind }, new Metadata { new Metadata.Entry("client_id", connId) });
}
public ICollection<Game.MessageStatus.Types.Pile> GetCards(string user) {
var status = game_client.status(new Google.Protobuf.WellKnownTypes.Empty(), new Metadata { new Metadata.Entry("client_id", connId) });
return status.PlayerPiles[status.Names.IndexOf(new Common.Name() { Name_ = user })].Piles_.Values;
}
public Dictionary<string, Dictionary<string, Game.MessageStatus.Types.Pile>> GetPiles(string user) {
var status = game_client.status(new Google.Protobuf.WellKnownTypes.Empty(), new Metadata { new Metadata.Entry("client_id", connId) });
var piles = new Dictionary<string, Dictionary<string, Game.MessageStatus.Types.Pile>>();
var playerPilesMap = status.PlayerPiles[status.Names.IndexOf(new Common.Name() { Name_ = user })].Piles_;
var playerPiles = new Dictionary<string, Game.MessageStatus.Types.Pile>();
foreach(string key in playerPilesMap.Keys) {
playerPiles.Add(key, playerPilesMap[key]);
}
var commonPilesMap = status.CommonPiles.Piles_;
var commonPiles = new Dictionary<string, Game.MessageStatus.Types.Pile>();
foreach (string key in commonPilesMap.Keys) {
commonPiles.Add(key, commonPilesMap[key]);
}
piles.Add("Owned", playerPiles);
piles.Add("Common", commonPiles);
return piles;
}
public int GetUserIndex(string user) {
var status = game_client.status(new Google.Protobuf.WellKnownTypes.Empty(), new Metadata { new Metadata.Entry("client_id", connId) });
return status.Names.IndexOf(new Common.Name() { Name_ = user });
}
public Dictionary<string, Dictionary<string, Game.MessageStatus.Types.Pile>> OnClickCard(string pileName, bool isCommonPile, int cardIdx, string user) {
Game.PileKind pileKind = new Game.PileKind() { Owned = (uint)GetUserIndex(user) };
game_client.onClick(new Game.CardId() { PileKind = pileKind, CardIndex = new Game.CardIndex() { Index = (uint)cardIdx }, PileName = pileName }, new Metadata { new Metadata.Entry("client_id", connId) });
return GetPiles(user);
}
public List<ConnectionService.Game> GetGames() public List<ConnectionService.Game> GetGames()
{ {
AsyncServerStreamingCall<ConnectionService.Game> stream = connection.getGames(new Google.Protobuf.WellKnownTypes.Empty()); AsyncServerStreamingCall<ConnectionService.Game> stream = connection.getGames(new Google.Protobuf.WellKnownTypes.Empty());

37
unity/Assets/Scripts/MainMenuController.cs

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine.SceneManagement;
using Grpc.Core; using Grpc.Core;
public class MainMenuController : MonoBehaviour { public class MainMenuController : MonoBehaviour {
@ -27,6 +28,10 @@ public class MainMenuController : MonoBehaviour {
private long discordLobbyId = -1; private long discordLobbyId = -1;
private bool ready = false; private bool ready = false;
private Lobby.LobbyStatus lobbyStatus;
[HideInInspector]
public string currentUsername;
void Start() { void Start() {
for(int i = 5; i < 0; i++){ for(int i = 5; i < 0; i++){
@ -53,6 +58,7 @@ public class MainMenuController : MonoBehaviour {
lobbyCode = lobbyMenu.FindRecursive("LobbyCode")?.GetComponent<Text>(); lobbyCode = lobbyMenu.FindRecursive("LobbyCode")?.GetComponent<Text>();
lobbyScroll = lobbyMenu.FindRecursive("Content"); lobbyScroll = lobbyMenu.FindRecursive("Content");
Popup.OnPopupClosed += OnPopupClosed; Popup.OnPopupClosed += OnPopupClosed;
DontDestroyOnLoad(gameObject);
} }
public void OnPopupClosed(object arg, GameObject popup) { public void OnPopupClosed(object arg, GameObject popup) {
@ -64,7 +70,23 @@ public class MainMenuController : MonoBehaviour {
} }
} }
void Update() {} void FixedUpdate() {
var conn = Client.GetConnection();
if (conn != null) {
if(SceneManager.GetActiveScene().buildIndex == 0) {
if (lobbyMenu.activeSelf) {
bool newStatus;
lobbyStatus = conn.GetLobbyStatus(out newStatus);
if (newStatus)
ReloadMenu(false);
}
}
if (lobbyStatus != null && lobbyStatus.IsStarting) {
SceneManager.LoadScene(1);
}
}
}
public void OnApplicationQuit() { public void OnApplicationQuit() {
var conn = Client.GetConnection(); var conn = Client.GetConnection();
@ -83,6 +105,7 @@ public class MainMenuController : MonoBehaviour {
else else
Client.Connect(username.text); Client.Connect(username.text);
conn = Client.GetConnection(); conn = Client.GetConnection();
currentUsername = username.text;
} }
if (conn != null) { if (conn != null) {
@ -120,6 +143,8 @@ public class MainMenuController : MonoBehaviour {
serverMenu.SetActive(false); serverMenu.SetActive(false);
lobbyMenu.SetActive(true); lobbyMenu.SetActive(true);
lobbyCode.text = "Code: " + code; lobbyCode.text = "Code: " + code;
bool _b;
lobbyStatus = conn.GetLobbyStatus(out _b);
ReloadMenu(); ReloadMenu();
} }
} }
@ -232,7 +257,6 @@ public class MainMenuController : MonoBehaviour {
} }
var conn = Client.GetConnection(); var conn = Client.GetConnection();
if(conn != null) { if(conn != null) {
Debug.Log(conn.GetLobby());
var games = conn.GetGames(); var games = conn.GetGames();
foreach(ConnectionService.Game game in games) { foreach(ConnectionService.Game game in games) {
var gameGO = Instantiate(lobbyScroll.transform.GetChild(0), lobbyScroll.transform); var gameGO = Instantiate(lobbyScroll.transform.GetChild(0), lobbyScroll.transform);
@ -251,9 +275,16 @@ public class MainMenuController : MonoBehaviour {
//Debug.Log(selfVote); //Debug.Log(selfVote);
lobbyMenu.transform.Find("ReadyButton").GetComponent<Image>().color = ready ? new Color(0, 255, 0) : new Color(255, 255, 255); lobbyMenu.transform.Find("ReadyButton").GetComponent<Image>().color = ready ? new Color(0, 255, 0) : new Color(255, 255, 255);
var users = conn.GetUsersInSameLobby(); if (lobbyStatus != null) {
var usernames = lobbyStatus.Names;
List<string> users = new List<string>();
foreach (Common.Name username in usernames) {
users.Add(username.Name_);
}
lobbyMenu.FindRecursive("Usercount").GetComponent<Text>().text = "x " + users.Count; lobbyMenu.FindRecursive("Usercount").GetComponent<Text>().text = "x " + users.Count;
usersInLobby = users; usersInLobby = users;
}
// conn.Close(); // conn.Close();
if (reloadDiscord) { if (reloadDiscord) {
Debug.Log(discordLobbyId); Debug.Log(discordLobbyId);

18
unity/Assets/Scripts/Scrollable.cs

@ -5,14 +5,28 @@ using UnityEngine.UI;
public class Scrollable : MonoBehaviour { public class Scrollable : MonoBehaviour {
public int ignoreElements = 0; public int ignoreElements = 0;
public bool horizontal = false;
void Start() { void Start() {
Reload(); Reload();
} }
public void Reload() { public void Reload() {
var sizeY = (transform.childCount-ignoreElements) * (transform.GetChild(0).GetComponent<RectTransform>().sizeDelta.y + GetComponent<VerticalLayoutGroup>().spacing); var size = 0f;
if (horizontal) {
size = (transform.childCount - ignoreElements) * ((transform.GetChild(0).GetComponent<RectTransform>().sizeDelta.x * transform.GetChild(0).localScale.x) + GetComponent<HorizontalLayoutGroup>().spacing);
} else {
size = (transform.childCount - ignoreElements) * (transform.GetChild(0).GetComponent<RectTransform>().sizeDelta.y + GetComponent<VerticalLayoutGroup>().spacing);
}
if (horizontal) {
GetComponent<RectTransform>().offsetMin = Vector2.zero;
}else {
GetComponent<RectTransform>().offsetMax = Vector2.zero; GetComponent<RectTransform>().offsetMax = Vector2.zero;
GetComponent<RectTransform>().offsetMin = new Vector2(GetComponent<RectTransform>().offsetMin.x, transform.parent.GetComponent<RectTransform>().sizeDelta.y > sizeY ? 0 : -sizeY + transform.parent.GetComponent<RectTransform>().sizeDelta.y + GetComponent<VerticalLayoutGroup>().spacing); }
if (horizontal) {
GetComponent<RectTransform>().offsetMax = new Vector2(-(transform.parent.GetComponent<RectTransform>().sizeDelta.x > size ? 0 : -size + transform.parent.GetComponent<RectTransform>().sizeDelta.x + GetComponent<HorizontalLayoutGroup>().spacing), GetComponent<RectTransform>().offsetMax.y);
} else {
GetComponent<RectTransform>().offsetMin = new Vector2(GetComponent<RectTransform>().offsetMin.x, transform.parent.GetComponent<RectTransform>().sizeDelta.y > size ? 0 : -size + transform.parent.GetComponent<RectTransform>().sizeDelta.y + GetComponent<VerticalLayoutGroup>().spacing);
}
} }
void Update() {} void Update() {}

86
unity/Assets/Scripts/grpc/Game.cs

@ -25,35 +25,36 @@ namespace Game {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"CgpnYW1lLnByb3RvEgRnYW1lGhtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJv", "CgpnYW1lLnByb3RvEgRnYW1lGhtnb29nbGUvcHJvdG9idWYvZW1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WdlU3Rh",
"ZS5DYXJkS2luZBoLLmdhbWUuSW1hZ2USLwoHb25DbGljaxIMLmdhbWUuQ2Fy", "dHVzLlBpbGU6AjgBMpsBCgRHYW1lEisKDGdldENhcmRJbWFnZRIOLmdhbWUu",
"ZElkGhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5EjUKBnN0YXR1cxIWLmdvb2ds", "Q2FyZEtpbmQaCy5nYW1lLkltYWdlEi8KB29uQ2xpY2sSDC5nYW1lLkNhcmRJ",
"ZS5wcm90b2J1Zi5FbXB0eRoTLmdhbWUuTWVzc2FnZVN0YXR1c2IGcHJvdG8z")); "ZBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRI1CgZzdGF0dXMSFi5nb29nbGUu",
"cHJvdG9idWYuRW1wdHkaEy5nYW1lLk1lc3NhZ2VTdGF0dXNiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, 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(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.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.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.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.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.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.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, })}) 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 +1292,7 @@ namespace Game {
public MessageStatus(MessageStatus other) : this() { public MessageStatus(MessageStatus other) : this() {
commonPiles_ = other.commonPiles_ != null ? other.commonPiles_.Clone() : null; commonPiles_ = other.commonPiles_ != null ? other.commonPiles_.Clone() : null;
playerPiles_ = other.playerPiles_.Clone(); playerPiles_ = other.playerPiles_.Clone();
names_ = other.names_.Clone();
currentTurn_ = other.currentTurn_; currentTurn_ = other.currentTurn_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
@ -1303,6 +1305,9 @@ namespace Game {
/// <summary>Field number for the "commonPiles" field.</summary> /// <summary>Field number for the "commonPiles" field.</summary>
public const int CommonPilesFieldNumber = 1; public const int CommonPilesFieldNumber = 1;
private global::Game.MessageStatus.Types.Piles commonPiles_; private global::Game.MessageStatus.Types.Piles commonPiles_;
/// <summary>
/// {a: [""], b:[""]}
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public global::Game.MessageStatus.Types.Piles CommonPiles { public global::Game.MessageStatus.Types.Piles CommonPiles {
get { return commonPiles_; } get { return commonPiles_; }
@ -1316,13 +1321,26 @@ namespace Game {
private static readonly pb::FieldCodec<global::Game.MessageStatus.Types.Piles> _repeated_playerPiles_codec private static readonly pb::FieldCodec<global::Game.MessageStatus.Types.Piles> _repeated_playerPiles_codec
= pb::FieldCodec.ForMessage(18, global::Game.MessageStatus.Types.Piles.Parser); = pb::FieldCodec.ForMessage(18, global::Game.MessageStatus.Types.Piles.Parser);
private readonly pbc::RepeatedField<global::Game.MessageStatus.Types.Piles> playerPiles_ = new pbc::RepeatedField<global::Game.MessageStatus.Types.Piles>(); private readonly pbc::RepeatedField<global::Game.MessageStatus.Types.Piles> playerPiles_ = new pbc::RepeatedField<global::Game.MessageStatus.Types.Piles>();
/// <summary>
/// [{...}, {...}]
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::Game.MessageStatus.Types.Piles> PlayerPiles { public pbc::RepeatedField<global::Game.MessageStatus.Types.Piles> PlayerPiles {
get { return playerPiles_; } get { return playerPiles_; }
} }
/// <summary>Field number for the "names" field.</summary>
public const int NamesFieldNumber = 3;
private static readonly pb::FieldCodec<global::Common.Name> _repeated_names_codec
= pb::FieldCodec.ForMessage(26, global::Common.Name.Parser);
private readonly pbc::RepeatedField<global::Common.Name> names_ = new pbc::RepeatedField<global::Common.Name>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::Common.Name> Names {
get { return names_; }
}
/// <summary>Field number for the "currentTurn" field.</summary> /// <summary>Field number for the "currentTurn" field.</summary>
public const int CurrentTurnFieldNumber = 3; public const int CurrentTurnFieldNumber = 4;
private uint currentTurn_; private uint currentTurn_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public uint CurrentTurn { public uint CurrentTurn {
@ -1347,6 +1365,7 @@ namespace Game {
} }
if (!object.Equals(CommonPiles, other.CommonPiles)) return false; if (!object.Equals(CommonPiles, other.CommonPiles)) return false;
if(!playerPiles_.Equals(other.playerPiles_)) return false; if(!playerPiles_.Equals(other.playerPiles_)) return false;
if(!names_.Equals(other.names_)) return false;
if (CurrentTurn != other.CurrentTurn) return false; if (CurrentTurn != other.CurrentTurn) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@ -1356,6 +1375,7 @@ namespace Game {
int hash = 1; int hash = 1;
if (commonPiles_ != null) hash ^= CommonPiles.GetHashCode(); if (commonPiles_ != null) hash ^= CommonPiles.GetHashCode();
hash ^= playerPiles_.GetHashCode(); hash ^= playerPiles_.GetHashCode();
hash ^= names_.GetHashCode();
if (CurrentTurn != 0) hash ^= CurrentTurn.GetHashCode(); if (CurrentTurn != 0) hash ^= CurrentTurn.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
@ -1378,8 +1398,9 @@ namespace Game {
output.WriteMessage(CommonPiles); output.WriteMessage(CommonPiles);
} }
playerPiles_.WriteTo(output, _repeated_playerPiles_codec); playerPiles_.WriteTo(output, _repeated_playerPiles_codec);
names_.WriteTo(output, _repeated_names_codec);
if (CurrentTurn != 0) { if (CurrentTurn != 0) {
output.WriteRawTag(24); output.WriteRawTag(32);
output.WriteUInt32(CurrentTurn); output.WriteUInt32(CurrentTurn);
} }
if (_unknownFields != null) { if (_unknownFields != null) {
@ -1396,8 +1417,9 @@ namespace Game {
output.WriteMessage(CommonPiles); output.WriteMessage(CommonPiles);
} }
playerPiles_.WriteTo(ref output, _repeated_playerPiles_codec); playerPiles_.WriteTo(ref output, _repeated_playerPiles_codec);
names_.WriteTo(ref output, _repeated_names_codec);
if (CurrentTurn != 0) { if (CurrentTurn != 0) {
output.WriteRawTag(24); output.WriteRawTag(32);
output.WriteUInt32(CurrentTurn); output.WriteUInt32(CurrentTurn);
} }
if (_unknownFields != null) { if (_unknownFields != null) {
@ -1413,6 +1435,7 @@ namespace Game {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(CommonPiles); size += 1 + pb::CodedOutputStream.ComputeMessageSize(CommonPiles);
} }
size += playerPiles_.CalculateSize(_repeated_playerPiles_codec); size += playerPiles_.CalculateSize(_repeated_playerPiles_codec);
size += names_.CalculateSize(_repeated_names_codec);
if (CurrentTurn != 0) { if (CurrentTurn != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(CurrentTurn); size += 1 + pb::CodedOutputStream.ComputeUInt32Size(CurrentTurn);
} }
@ -1434,6 +1457,7 @@ namespace Game {
CommonPiles.MergeFrom(other.CommonPiles); CommonPiles.MergeFrom(other.CommonPiles);
} }
playerPiles_.Add(other.playerPiles_); playerPiles_.Add(other.playerPiles_);
names_.Add(other.names_);
if (other.CurrentTurn != 0) { if (other.CurrentTurn != 0) {
CurrentTurn = other.CurrentTurn; CurrentTurn = other.CurrentTurn;
} }
@ -1462,7 +1486,11 @@ namespace Game {
playerPiles_.AddEntriesFrom(input, _repeated_playerPiles_codec); playerPiles_.AddEntriesFrom(input, _repeated_playerPiles_codec);
break; break;
} }
case 24: { case 26: {
names_.AddEntriesFrom(input, _repeated_names_codec);
break;
}
case 32: {
CurrentTurn = input.ReadUInt32(); CurrentTurn = input.ReadUInt32();
break; break;
} }
@ -1491,7 +1519,11 @@ namespace Game {
playerPiles_.AddEntriesFrom(ref input, _repeated_playerPiles_codec); playerPiles_.AddEntriesFrom(ref input, _repeated_playerPiles_codec);
break; break;
} }
case 24: { case 26: {
names_.AddEntriesFrom(ref input, _repeated_names_codec);
break;
}
case 32: {
CurrentTurn = input.ReadUInt32(); CurrentTurn = input.ReadUInt32();
break; break;
} }

8
unity/ProjectSettings/EditorBuildSettings.asset

@ -4,5 +4,11 @@
EditorBuildSettings: EditorBuildSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
m_Scenes: [] m_Scenes:
- enabled: 1
path: Assets/Scenes/MainMenu.unity
guid: 2e7eb87aefbaeed4692a1080bf81f769
- enabled: 1
path: Assets/Scenes/SampleScene.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
m_configObjects: {} m_configObjects: {}

3
unity/ProjectSettings/TagManager.asset

@ -4,9 +4,8 @@
TagManager: TagManager:
serializedVersion: 2 serializedVersion: 2
tags: tags:
- CardPreview
- Card - Card
- ThrownCards - ThrownCard
layers: layers:
- Default - Default
- TransparentFX - TransparentFX

Loading…
Cancel
Save