浏览代码
fix : color, entry and double calls.
fix : color, entry and double calls.
-Updated the Rate limiting code to use similar design to the service one -Fixed colors not appearing for filters (filtering still does not work) -Fixed Emotes sticking after leaving and joining lobbies -Fixed double-calls using the Toggles. -Fixed Lobby Player Entry Init/main/staging/2021_Upgrade/Async_Refactor
UnityJacob
2 年前
当前提交
d9767fc6
共有 21 个文件被更改,包括 374 次插入 和 230 次删除
-
8Assets/Prefabs/UI/JoinContent.prefab
-
24Assets/Prefabs/UI/JoinCreateCanvas.prefab
-
2Assets/Prefabs/UI/LobbyEntryUI.prefab
-
2Assets/Prefabs/UI/LobbyUserList.prefab
-
4Assets/Prefabs/UI/UserCardPanel.prefab
-
51Assets/Prefabs/UI/UserInteractionPanel.prefab
-
23Assets/Scenes/mainScene.unity
-
22Assets/Scripts/GameLobby/Game/GameManager.cs
-
7Assets/Scripts/GameLobby/Game/LocalLobby.cs
-
2Assets/Scripts/GameLobby/Game/LocalPlayer.cs
-
6Assets/Scripts/GameLobby/Infrastructure/Actionvalue.cs
-
154Assets/Scripts/GameLobby/Lobby/LobbyManager.cs
-
6Assets/Scripts/GameLobby/Tests/PlayMode/LobbyRoundtripTests.cs
-
36Assets/Scripts/GameLobby/UI/InLobbyUserUI.cs
-
73Assets/Scripts/GameLobby/UI/JoinMenuUI.cs
-
4Assets/Scripts/GameLobby/UI/LobbyEntryUI.cs
-
59Assets/Scripts/GameLobby/UI/RateLimitVisibility.cs
-
6Assets/Scripts/GameLobby/UI/UserStateVisibilityUI.cs
-
71Assets/Scripts/GameLobby/UI/ColorLobbyUI.cs
-
44Assets/Scripts/GameLobby/UI/RecolorForLobbyType.cs
-
0/Assets/Scripts/GameLobby/UI/ColorLobbyUI.cs.meta
|
|||
using UnityEngine; |
|||
using UnityEngine.Serialization; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace LobbyRelaySample.UI |
|||
{ |
|||
/// <summary>
|
|||
/// We want to illustrate filtering the lobby list by some arbitrary variable. This will allow the lobby host to choose a color for the lobby, and will display a lobby's current color.
|
|||
/// (Note that this isn't sent over Relay to other clients for realtime updates.)
|
|||
/// </summary>
|
|||
public class ColorLobbyUI : MonoBehaviour |
|||
{ |
|||
public bool m_UseLocalLobby; |
|||
static readonly Color s_orangeColor = new Color(0.83f, 0.36f, 0); |
|||
static readonly Color s_greenColor = new Color(0, 0.61f, 0.45f); |
|||
static readonly Color s_blueColor = new Color(0.0f, 0.44f, 0.69f); |
|||
static readonly Color[] s_colorsOrdered = new Color[] |
|||
{ new Color(0.9f, 0.9f, 0.9f, 0.7f), s_orangeColor, s_greenColor, s_blueColor }; |
|||
|
|||
[SerializeField] |
|||
Graphic[] m_toRecolor; |
|||
LocalLobby m_lobby; |
|||
|
|||
void Start() |
|||
{ |
|||
if (m_UseLocalLobby) |
|||
SetLobby(GameManager.Instance.LocalLobby); |
|||
} |
|||
|
|||
public void SetLobby(LocalLobby lobby) |
|||
{ |
|||
ChangeColors(lobby.LocalLobbyColor.Value); |
|||
lobby.LocalLobbyColor.onChanged += ChangeColors; |
|||
} |
|||
|
|||
public void ToggleWhite(bool toggle) |
|||
{ |
|||
if (!toggle) |
|||
return; |
|||
GameManager.Instance.SetLocalLobbyColor(0); |
|||
} |
|||
|
|||
public void ToggleOrange(bool toggle) |
|||
{ |
|||
if (!toggle) |
|||
return; |
|||
GameManager.Instance.SetLocalLobbyColor(1); |
|||
} |
|||
|
|||
public void ToggleGreen(bool toggle) |
|||
{ |
|||
if (!toggle) |
|||
return; |
|||
GameManager.Instance.SetLocalLobbyColor(2); |
|||
} |
|||
|
|||
public void ToggleBlue(bool toggle) |
|||
{ |
|||
if (!toggle) |
|||
return; |
|||
GameManager.Instance.SetLocalLobbyColor(3); |
|||
} |
|||
|
|||
void ChangeColors(LobbyColor lobbyColor) |
|||
{ |
|||
Color color = s_colorsOrdered[(int)lobbyColor]; |
|||
foreach (Graphic graphic in m_toRecolor) |
|||
graphic.color = new Color(color.r, color.g, color.b, graphic.color.a); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace LobbyRelaySample.UI |
|||
{ |
|||
/// <summary>
|
|||
/// We want to illustrate filtering the lobby list by some arbitrary variable. This will allow the lobby host to choose a color for the lobby, and will display a lobby's current color.
|
|||
/// (Note that this isn't sent over Relay to other clients for realtime updates.)
|
|||
/// </summary>
|
|||
public class RecolorForLobbyType : MonoBehaviour |
|||
{ |
|||
static readonly Color s_orangeColor = new Color(0.8352942f, 0.3686275f, 0); |
|||
static readonly Color s_greenColor = new Color(0, 0.6196079f, 0.4509804f); |
|||
static readonly Color s_blueColor = new Color(0.0f, 0.4470589f, 0.6980392f); |
|||
static readonly Color[] s_colorsOrdered = new Color[] |
|||
{ new Color(0.9f, 0.9f, 0.9f, 0.7f), s_orangeColor, s_greenColor, s_blueColor }; |
|||
|
|||
[SerializeField] |
|||
Graphic[] m_toRecolor; |
|||
LocalLobby m_lobby; |
|||
|
|||
void Start() |
|||
{ |
|||
m_lobby = GameManager.Instance.LocalLobby; |
|||
m_lobby.LocalLobbyColor.onChanged += ChangeColors; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Called in-editor by toggles to set the color of the lobby.
|
|||
/// Triggers the ChangeColors method above
|
|||
/// </summary>
|
|||
public void SetLobbyColor(int color) |
|||
{ |
|||
GameManager.Instance.SetLocalLobbyColor(color); |
|||
} |
|||
|
|||
void ChangeColors(LobbyColor lobbyColor) |
|||
{ |
|||
Color color = s_colorsOrdered[(int)lobbyColor]; |
|||
foreach (Graphic graphic in m_toRecolor) |
|||
graphic.color = new Color(color.r, color.g, color.b, graphic.color.a); |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue