封装暂时性修改
This commit is contained in:
@@ -12,9 +12,9 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 70dc9fcaed7d5274a8381edb4e206a92, type: 3}
|
m_Script: {fileID: 11500000, guid: 70dc9fcaed7d5274a8381edb4e206a92, type: 3}
|
||||||
m_Name: NetworkData
|
m_Name: NetworkData
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
url: 192.168.1.99
|
url: 124.222.214.188
|
||||||
port: 8777
|
port: 8777
|
||||||
api_url: 192.168.1.111:8080
|
api_url: 124.222.214.188:8080
|
||||||
api_https: 0
|
api_https: 0
|
||||||
solo_type: 0
|
solo_type: 0
|
||||||
auth_type: 10
|
auth_type: 10
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ MonoBehaviour:
|
|||||||
m_Name: ResourceDownloaderConfig
|
m_Name: ResourceDownloaderConfig
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
cdnUrl: https://cardcdn.ambigrat.com
|
cdnUrl: https://cardcdn.ambigrat.com
|
||||||
serverUrl: http://192.168.1.111:8080
|
serverUrl: http://124.222.214.188:8080
|
||||||
resourcesEndpoint: /test/{version}.zip
|
resourcesEndpoint: /test/{version}.zip
|
||||||
versionEndpoint: /version
|
versionEndpoint: /version
|
||||||
validateVersionedUrl: 1
|
validateVersionedUrl: 1
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ namespace TcgEngine.UI
|
|||||||
|
|
||||||
private void RefreshPanel()
|
private void RefreshPanel()
|
||||||
{
|
{
|
||||||
|
// dsdd
|
||||||
|
int ss = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenPanel(DeckLine line)
|
public void OpenPanel(DeckLine line)
|
||||||
|
|||||||
@@ -1,77 +1,23 @@
|
|||||||
// The SteamManager is designed to work with Steamworks.NET
|
|
||||||
// This file is released into the public domain.
|
|
||||||
// Where that dedication is not recognized you are granted a perpetual,
|
|
||||||
// irrevocable license to copy and modify this file as you see fit.
|
|
||||||
//
|
|
||||||
// Version: 1.0.12
|
|
||||||
|
|
||||||
#if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX || STEAMWORKS_WIN || STEAMWORKS_LIN_OSX)
|
|
||||||
#define STEAMWORKS_ENABLED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
#if !STEAMWORKS_ENABLED
|
|
||||||
using System.Collections;
|
|
||||||
using Steamworks;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace TcgEngine
|
namespace TcgEngine
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// The SteamManager provides a base implementation of Steamworks.NET on which you can build upon.
|
|
||||||
// It handles the basics of starting up and shutting down the SteamAPI for use.
|
|
||||||
//
|
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class SteamManager : MonoBehaviour
|
public class SteamManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
#if !STEAMWORKS_ENABLED
|
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX
|
||||||
protected static bool s_EverInitialized = false;
|
private static SteamManager s_instance;
|
||||||
|
private bool m_bInitialized = false;
|
||||||
protected static SteamManager s_instance;
|
|
||||||
|
|
||||||
protected static SteamManager Instance
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (s_instance == null)
|
|
||||||
{
|
|
||||||
return new GameObject("SteamManager").AddComponent<SteamManager>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return s_instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool m_bInitialized = false;
|
|
||||||
|
|
||||||
public static bool Initialized
|
public static bool Initialized
|
||||||
{
|
{
|
||||||
get { return Instance.m_bInitialized; }
|
get { return s_instance != null && s_instance.m_bInitialized; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SteamAPIWarningMessageHook_t m_SteamAPIWarningMessageHook;
|
void Awake()
|
||||||
|
|
||||||
[AOT.MonoPInvokeCallback(typeof(SteamAPIWarningMessageHook_t))]
|
|
||||||
protected static void SteamAPIDebugTextHook(int nSeverity, System.Text.StringBuilder pchDebugText)
|
|
||||||
{
|
{
|
||||||
Debug.LogWarning(pchDebugText);
|
// 单例检查
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_2019_3_OR_NEWER
|
|
||||||
// In case of disabled Domain Reload, reset static members before entering Play Mode.
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void InitOnPlayMode()
|
|
||||||
{
|
|
||||||
s_EverInitialized = false;
|
|
||||||
s_instance = null;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected virtual void Awake()
|
|
||||||
{
|
|
||||||
// Only one instance of SteamManager at a time!
|
|
||||||
if (s_instance != null)
|
if (s_instance != null)
|
||||||
{
|
{
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
@@ -79,138 +25,71 @@ namespace TcgEngine
|
|||||||
}
|
}
|
||||||
|
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
||||||
if (s_EverInitialized)
|
|
||||||
{
|
|
||||||
// This is almost always an error.
|
|
||||||
// The most common case where this happens is when SteamManager gets destroyed because of Application.Quit(),
|
|
||||||
// and then some Steamworks code in some other OnDestroy gets called afterwards, creating a new SteamManager.
|
|
||||||
// You should never call Steamworks functions in OnDestroy, always prefer OnDisable if possible.
|
|
||||||
throw new System.Exception("Tried to Initialize the SteamAPI twice in one session!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// We want our SteamManager Instance to persist across scenes.
|
|
||||||
DontDestroyOnLoad(gameObject);
|
DontDestroyOnLoad(gameObject);
|
||||||
|
|
||||||
if (!Packsize.Test())
|
|
||||||
{
|
|
||||||
Debug.LogError(
|
|
||||||
"[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.",
|
|
||||||
this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DllCheck.Test())
|
|
||||||
{
|
|
||||||
Debug.LogError(
|
|
||||||
"[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.",
|
|
||||||
this);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// If Steam is not running or the game wasn't started through Steam, SteamAPI_RestartAppIfNecessary starts the
|
#if STEAMWORKS_NET
|
||||||
// Steam client and also launches this game again if the User owns it. This can act as a rudimentary form of DRM.
|
// 尝试加载 Steamworks.NET
|
||||||
|
if (Steamworks.SteamAPI.RestartAppIfNecessary(new Steamworks.AppId_t(480)))
|
||||||
// Once you get a Steam AppID assigned by Valve, you need to replace AppId_t.Invalid with it and
|
|
||||||
// remove steam_appid.txt from the game depot. eg: "(AppId_t)480" or "new AppId_t(480)".
|
|
||||||
// See the Valve documentation for more information: https://partner.steamgames.com/doc/sdk/api#initialization_and_shutdown
|
|
||||||
if (SteamAPI.RestartAppIfNecessary(AppId_t.Invalid))
|
|
||||||
{
|
{
|
||||||
|
Debug.LogWarning("[SteamManager] Steam 重启请求,退出当前实例。");
|
||||||
Application.Quit();
|
Application.Quit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_bInitialized = Steamworks.SteamAPI.Init();
|
||||||
|
|
||||||
|
if (m_bInitialized)
|
||||||
|
{
|
||||||
|
Debug.Log("[SteamManager] Steam 初始化成功。");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning("[SteamManager] SteamAPI.Init() 失败,将以离线模式运行。");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// 没有定义 STEAMWORKS_NET 宏
|
||||||
|
Debug.Log("[SteamManager] 未启用 Steamworks.NET,跳过初始化。");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
catch (System.DllNotFoundException e)
|
catch (System.DllNotFoundException e)
|
||||||
{
|
{
|
||||||
// We catch this exception here, as it will be the first occurrence of it.
|
Debug.LogWarning("[SteamManager] 未找到 steam_api64.dll,以离线模式运行。\n" + e.Message);
|
||||||
Debug.LogError(
|
m_bInitialized = false;
|
||||||
"[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" +
|
|
||||||
e, this);
|
|
||||||
|
|
||||||
Application.Quit();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
// Initializes the Steamworks API.
|
|
||||||
// If this returns false then this indicates one of the following conditions:
|
|
||||||
// [*] The Steam client isn't running. A running Steam client is required to provide implementations of the various Steamworks interfaces.
|
|
||||||
// [*] The Steam client couldn't determine the App ID of game. If you're running your application from the executable or debugger directly then you must have a [code-inline]steam_appid.txt[/code-inline] in your game directory next to the executable, with your app ID in it and nothing else. Steam will look for this file in the current working directory. If you are running your executable from a different directory you may need to relocate the [code-inline]steam_appid.txt[/code-inline] file.
|
|
||||||
// [*] Your application is not running under the same OS user context as the Steam client, such as a different user or administration access level.
|
|
||||||
// [*] Ensure that you own a license for the App ID on the currently active Steam account. Your game must show up in your Steam library.
|
|
||||||
// [*] Your App ID is not completely set up, i.e. in Release State: Unavailable, or it's missing default packages.
|
|
||||||
// Valve's documentation for this is located here:
|
|
||||||
// https://partner.steamgames.com/doc/sdk/api#initialization_and_shutdown
|
|
||||||
m_bInitialized = SteamAPI.Init();
|
|
||||||
if (!m_bInitialized)
|
|
||||||
{
|
{
|
||||||
Debug.LogError(
|
Debug.LogError("[SteamManager] 初始化异常,将以离线模式运行。\n" + e);
|
||||||
"[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.",
|
m_bInitialized = false;
|
||||||
this);
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s_EverInitialized = true;
|
void Update()
|
||||||
}
|
|
||||||
|
|
||||||
// This should only ever get called on first load and after an Assembly reload, You should never Disable the Steamworks Manager yourself.
|
|
||||||
protected virtual void OnEnable()
|
|
||||||
{
|
{
|
||||||
if (s_instance == null)
|
#if STEAMWORKS_NET
|
||||||
{
|
if (m_bInitialized)
|
||||||
s_instance = this;
|
Steamworks.SteamAPI.RunCallbacks();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_bInitialized)
|
void OnDestroy()
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_SteamAPIWarningMessageHook == null)
|
|
||||||
{
|
|
||||||
// Set up our callback to receive warning messages from Steam.
|
|
||||||
// You must launch with "-debug_steamapi" in the launch args to receive warnings.
|
|
||||||
m_SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);
|
|
||||||
SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OnApplicationQuit gets called too early to shutdown the SteamAPI.
|
|
||||||
// Because the SteamManager should be persistent and never disabled or destroyed we can shutdown the SteamAPI here.
|
|
||||||
// Thus it is not recommended to perform any Steamworks work in other OnDestroy functions as the order of execution can not be garenteed upon Shutdown. Prefer OnDisable().
|
|
||||||
protected virtual void OnDestroy()
|
|
||||||
{
|
{
|
||||||
if (s_instance != this)
|
if (s_instance != this)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
#if STEAMWORKS_NET
|
||||||
|
if (m_bInitialized)
|
||||||
|
{
|
||||||
|
Steamworks.SteamAPI.Shutdown();
|
||||||
|
Debug.Log("[SteamManager] Steam 已正常关闭。");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
s_instance = null;
|
s_instance = null;
|
||||||
|
|
||||||
if (!m_bInitialized)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SteamAPI.Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Update()
|
|
||||||
{
|
|
||||||
if (!m_bInitialized)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run Steam client callbacks
|
|
||||||
SteamAPI.RunCallbacks();
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public static bool Initialized {
|
// 非桌面平台(例如WebGL/Android/iOS)
|
||||||
get {
|
public static bool Initialized => false;
|
||||||
return false;
|
#endif
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !STEAMWORKS_ENABLED
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ EditorBuildSettings:
|
|||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/TcgEngine/Scenes/Game/Game.unity
|
path: Assets/TcgEngine/Scenes/Game/Game.unity
|
||||||
guid: be2ace95e45905b49ad984cce7ea70e5
|
guid: be2ace95e45905b49ad984cce7ea70e5
|
||||||
- enabled: 1
|
- enabled: 0
|
||||||
path: Assets/TcgEngine/Scenes/Server/Server.unity
|
path: Assets/TcgEngine/Scenes/Server/Server.unity
|
||||||
guid: acefba10b24d5f14aa51f6451ec467bf
|
guid: acefba10b24d5f14aa51f6451ec467bf
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user