浏览代码
Adding in a color field to the lobbies, and the ability to filter by color in the lobby list. I still need to ensure the additional UI works for arbitrary aspect ratios.
/main/staging
Adding in a color field to the lobbies, and the ability to filter by color in the lobby list. I still need to ensure the additional UI works for arbitrary aspect ratios.
/main/staging
nathaniel.buck@unity3d.com
3 年前
当前提交
2689dab6
共有 15 个文件被更改,包括 2079 次插入 和 64 次删除
-
887Assets/Prefabs/UI/JoinContent.prefab
-
15Assets/Prefabs/UI/JoinCreateCanvas.prefab
-
32Assets/Prefabs/UI/LobbyButtonUI.prefab
-
969Assets/Prefabs/UI/LobbyGameCanvas.prefab
-
115Assets/Scenes/mainScene.unity
-
7Assets/Scripts/Entities/GameStateManager.cs
-
17Assets/Scripts/Entities/LocalLobby.cs
-
4Assets/Scripts/Lobby/LobbyAPIInterface.cs
-
16Assets/Scripts/Lobby/LobbyAsyncRequests.cs
-
7Assets/Scripts/Lobby/LobbyContentHeartbeat.cs
-
17Assets/Scripts/Lobby/ToLocalLobby.cs
-
6Assets/Scripts/Tests/PlayMode/LobbyRoundtripTests.cs
-
1Assets/Scripts/UI/UIPanelBase.cs
-
39Assets/Scripts/UI/RecolorForLobbyType.cs
-
11Assets/Scripts/UI/RecolorForLobbyType.cs.meta
887
Assets/Prefabs/UI/JoinContent.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
969
Assets/Prefabs/UI/LobbyGameCanvas.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
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>
|
|||
[RequireComponent(typeof(LocalLobbyObserver))] |
|||
public class RecolorForLobbyType : MonoBehaviour |
|||
{ |
|||
private static readonly Color s_orangeColor = new Color(0.75f, 0.5f, 0.1f); |
|||
private static readonly Color s_greenColor = new Color(0.5f, 1, 0.7f); |
|||
private static readonly Color s_blueColor = new Color(0.75f, 0.7f, 1); |
|||
private static readonly Color[] s_colorsOrdered = new Color[] { Color.white, s_orangeColor, s_greenColor, s_blueColor }; |
|||
|
|||
[SerializeField] |
|||
private Graphic[] m_toRecolor; |
|||
private LocalLobby m_lobby; |
|||
|
|||
public void UpdateLobby(LocalLobby lobby) |
|||
{ |
|||
m_lobby = lobby; |
|||
Color color = s_colorsOrdered[(int)lobby.Color]; |
|||
foreach (Graphic graphic in m_toRecolor) |
|||
graphic.color = new Color(color.r, color.g, color.b, graphic.color.a); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Called in-editor by toggles to set the color of the lobby.
|
|||
/// </summary>
|
|||
public void ChangeColor(int color) |
|||
{ |
|||
if (m_lobby != null) |
|||
m_lobby.Color = (LobbyColor)color; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4079cd003fcd20c40a3bac78acf44b55 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue