浏览代码

Join Menu tabs retain their color on change.

/main/staging/december_UI_bugs
当前提交
413eb4b3
共有 4 个文件被更改,包括 102 次插入59 次删除
  1. 88
      Assets/Prefabs/UI/JoinCreateCanvas.prefab
  2. 18
      Assets/Scripts/UI/CreateMenuUI.cs
  3. 36
      Assets/Scripts/UI/JoinCreateLobbyUI.cs
  4. 19
      Assets/Scripts/UI/JoinMenuUI.cs

88
Assets/Prefabs/UI/JoinCreateCanvas.prefab


m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1034500561768382320}
m_TargetAssemblyTypeName: LobbyRooms.UI.UIPanelBase, LobbyRooms
m_MethodName: Show
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
- m_Target: {fileID: 5643181761482593758}
m_TargetAssemblyTypeName: LobbyRooms.UI.UIPanelBase, LobbyRooms
m_MethodName: Hide
- m_Target: {fileID: 4578721078997909056}
m_TargetAssemblyTypeName: LobbyRelaySample.UI.JoinCreateLobbyUI, LobbyRelaySample
m_MethodName: SetCreateTab
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 33.25
m_fontSize: 40
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 1

m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1034500561768382320}
m_TargetAssemblyTypeName: LobbyRooms.UI.UIPanelBase, LobbyRooms
m_MethodName: Hide
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
- m_Target: {fileID: 5643181761482593758}
m_TargetAssemblyTypeName: LobbyRooms.UI.UIPanelBase, LobbyRooms
m_MethodName: Show
- m_Target: {fileID: 4578721078997909056}
m_TargetAssemblyTypeName: LobbyRelaySample.UI.JoinCreateLobbyUI, LobbyRelaySample
m_MethodName: SetJoinTab
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

m_StringArgument:
m_BoolArgument: 1
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &201442509941519423
MonoBehaviour:

- component: {fileID: 5836614391142406753}
- component: {fileID: 5836614391142406752}
- component: {fileID: 4578721078997909056}
- component: {fileID: 6102798993520257211}
- component: {fileID: 6102798993520257211}
m_Layer: 5
m_Name: JoinCreateCanvas
m_TagString: Untagged

m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
m_PresetInfoIsWorld: 0
--- !u!114 &5836614391142406752
MonoBehaviour:
m_ObjectHideFlags: 0

m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!225 &6102798993520257211
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5836614391142406755}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
m_CurrentTab: 0
--- !u!114 &1512606419251751951
MonoBehaviour:
m_ObjectHideFlags: 0

m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!225 &6102798993520257211
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5836614391142406755}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &7348548600648247480
GameObject:
m_ObjectHideFlags: 0

value: 0
objectReference: {fileID: 0}
- target: {fileID: 6473743066396215718, guid: 328b912adedf1bc41a44f60a12723cc0, type: 3}
propertyPath: m_JoinCreateLobbyUI
value:
objectReference: {fileID: 4578721078997909056}
- target: {fileID: 6473743066396215718, guid: 328b912adedf1bc41a44f60a12723cc0, type: 3}
propertyPath: m_onVisibilityChange.m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}

m_CorrespondingSourceObject: {fileID: 7255335463425698201, guid: 328b912adedf1bc41a44f60a12723cc0, type: 3}
m_PrefabInstance: {fileID: 6308438907748136662}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1034500561768382320 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6473743066396215718, guid: 328b912adedf1bc41a44f60a12723cc0, type: 3}
m_PrefabInstance: {fileID: 6308438907748136662}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8bea15db614f57749bb2bac5ae7811fa, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &6492536299820417403
PrefabInstance:
m_ObjectHideFlags: 0

propertyPath: m_JoinCodeField
value:
objectReference: {fileID: 2465479314273514634}
- target: {fileID: 1462126939442648229, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_JoinCreateLobbyUI
value:
objectReference: {fileID: 4578721078997909056}
- target: {fileID: 1462126939442648229, guid: c308ffc2a02e5ab4bbe70a8b2e8108c6, type: 3}
propertyPath: m_onVisibilityChange.m_PersistentCalls.m_Calls.Array.size
value: 2

18
Assets/Scripts/UI/CreateMenuUI.cs


/// </summary>
public class CreateMenuUI : UIPanelBase
{
private LocalLobby.LobbyData m_ServerRequestData = new LocalLobby.LobbyData{ LobbyName = "New Lobby", MaxPlayerCount = 4 };
public JoinCreateLobbyUI m_JoinCreateLobbyUI;
private LocalLobby.LobbyData m_ServerRequestData = new LocalLobby.LobbyData { LobbyName = "New Lobby", MaxPlayerCount = 4 };
Hide();
m_JoinCreateLobbyUI.m_OnTabChanged.AddListener(OnTabChanged);
void OnTabChanged(JoinCreateTabs tabState)
{
if (tabState == JoinCreateTabs.Create)
{
Show();
}
else
{
Hide();
}
}
public void SetServerName(string serverName)
{
m_ServerRequestData.LobbyName = serverName;

36
Assets/Scripts/UI/JoinCreateLobbyUI.cs


using System;
using UnityEngine;
using UnityEngine.Events;
public enum JoinCreateTabs
{
Join,
Create
}
public UnityEvent<JoinCreateTabs> m_OnTabChanged;
[SerializeField] //Serialized for Visisbility in Editor
JoinCreateTabs m_CurrentTab = JoinCreateTabs.Join;
public JoinCreateTabs CurrentTab
{
get => m_CurrentTab;
set
{
m_CurrentTab = value;
m_OnTabChanged?.Invoke(m_CurrentTab);
}
}
public void SetJoinTab()
{
CurrentTab = JoinCreateTabs.Join;
}
public void SetCreateTab()
{
CurrentTab = JoinCreateTabs.Create;
}
m_OnTabChanged?.Invoke(m_CurrentTab);
Show(false);
}
else

19
Assets/Scripts/UI/JoinMenuUI.cs


[SerializeField]
TMP_InputField m_JoinCodeField;
public JoinCreateLobbyUI m_JoinCreateLobbyUI;
/// <summary>
/// Key: Lobby ID, Value Lobby UI
/// </summary>

/// <summary>Contains some amount of information used to join an existing lobby.</summary>
LocalLobby.LobbyData m_LocalLobbySelected;
public override void Start()
{
base.Start();
m_JoinCreateLobbyUI.m_OnTabChanged.AddListener(OnTabChanged);
}
void OnTabChanged(JoinCreateTabs tabState)
{
if (tabState == JoinCreateTabs.Join)
{
Show();
}
else
{
Hide();
}
}
public void LobbyButtonSelected(LocalLobby lobby)
{

正在加载...
取消
保存