79 lines
2.1 KiB
C#
79 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Logic.Multilingual;
|
|
using UnityEngine;
|
|
|
|
public enum NetworkPlayerTipType
|
|
{
|
|
None,
|
|
SteamUnavailable,
|
|
SteamLoginRequired,
|
|
SteamClientOutdated,
|
|
SteamSessionLost,
|
|
LobbyCreateFailed,
|
|
LobbyJoinFailed,
|
|
LobbyOperationFailed,
|
|
LobbyMembersNotReady,
|
|
LobbyMembersNotSynced,
|
|
LobbyMemberConfigFailed,
|
|
HostDisconnected,
|
|
P2PConnectionFailed,
|
|
P2PConnectionTimeout,
|
|
P2PMessageSendFailed,
|
|
P2PBroadcastFailed,
|
|
P2PQueueFull,
|
|
P2PReceiveFailed,
|
|
NetworkMessageParseFailed,
|
|
InvalidNetworkMapData,
|
|
NetworkPlayerMappingFailed,
|
|
GameStartFailed,
|
|
ReconnectRequested,
|
|
ReconnectStarted,
|
|
ReconnectFailed,
|
|
ReconnectSucceeded,
|
|
ActionSyncMismatch,
|
|
MapSyncMismatch,
|
|
ActionSendFailed,
|
|
LobbyDataRequestFailed,
|
|
InviteVersionMismatch,
|
|
P2PModuleInitFailed
|
|
}
|
|
|
|
[Serializable]
|
|
[CreateAssetMenu(fileName = "NetworkPlayerTipDataAssets", menuName = "TH1 Game Data/Network Player Tip Data Asset")]
|
|
public class NetworkPlayerTipDataAssets : ScriptableObject
|
|
{
|
|
public float DefaultCooldownSeconds = 3f;
|
|
public List<NetworkPlayerTipInfo> NetworkPlayerTipInfoList = new List<NetworkPlayerTipInfo>();
|
|
|
|
[NonSerialized]
|
|
private Dictionary<NetworkPlayerTipType, NetworkPlayerTipInfo> _tipInfoDict;
|
|
|
|
public bool GetNetworkPlayerTipInfo(NetworkPlayerTipType tipType, out NetworkPlayerTipInfo info)
|
|
{
|
|
EnsureDict();
|
|
return _tipInfoDict.TryGetValue(tipType, out info);
|
|
}
|
|
|
|
private void EnsureDict()
|
|
{
|
|
if (_tipInfoDict != null && _tipInfoDict.Count == NetworkPlayerTipInfoList.Count) return;
|
|
|
|
_tipInfoDict = new Dictionary<NetworkPlayerTipType, NetworkPlayerTipInfo>();
|
|
foreach (var info in NetworkPlayerTipInfoList)
|
|
{
|
|
if (info == null || info.TipType == NetworkPlayerTipType.None) continue;
|
|
_tipInfoDict[info.TipType] = info;
|
|
}
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class NetworkPlayerTipInfo
|
|
{
|
|
public NetworkPlayerTipType TipType;
|
|
[MultilingualField] public string Title;
|
|
[MultilingualField] public string Message;
|
|
public float CooldownSeconds = 3f;
|
|
}
|