Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
7f3921b163 | |
|
|
a885a394c0 |
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Guru
|
namespace DofLibrary
|
||||||
{
|
{
|
||||||
|
|
||||||
public class GameEventMgr
|
public class GameEventMgr
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ namespace DofLibrary
|
||||||
|
|
||||||
if (OnConnected != null)
|
if (OnConnected != null)
|
||||||
{
|
{
|
||||||
Loom.QueueOnMainThread(() =>
|
LoomUtil.QueueOnMainThread(() =>
|
||||||
{
|
{
|
||||||
OnConnected.Invoke();
|
OnConnected.Invoke();
|
||||||
});
|
});
|
||||||
|
|
@ -139,7 +139,7 @@ namespace DofLibrary
|
||||||
|
|
||||||
if (msg is ServerMessage server_msg)
|
if (msg is ServerMessage server_msg)
|
||||||
{
|
{
|
||||||
Loom.QueueOnMainThread(() =>
|
LoomUtil.QueueOnMainThread(() =>
|
||||||
{
|
{
|
||||||
ProcessMessage(server_msg);
|
ProcessMessage(server_msg);
|
||||||
});
|
});
|
||||||
|
|
@ -169,7 +169,7 @@ namespace DofLibrary
|
||||||
Debug.Log("[GameKcpClient]: Connection closed");
|
Debug.Log("[GameKcpClient]: Connection closed");
|
||||||
if (OnDisConnected != null)
|
if (OnDisConnected != null)
|
||||||
{
|
{
|
||||||
Loom.QueueOnMainThread(() =>
|
LoomUtil.QueueOnMainThread(() =>
|
||||||
{
|
{
|
||||||
OnDisConnected.Invoke();
|
OnDisConnected.Invoke();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,17 @@ using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Guru
|
namespace DofLibrary
|
||||||
{
|
{
|
||||||
// Loom lets you easily run code on another thread and have that other thread run code on the main game thread when it needs to.
|
// Loom lets you easily run code on another thread and have that other thread run code on the main game thread when it needs to.
|
||||||
public class Loom : MonoBehaviour
|
public class LoomUtil : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static int maxThreads = 10;
|
public static int maxThreads = 10;
|
||||||
|
|
||||||
private static int numThreads;
|
private static int numThreads;
|
||||||
private static Loom _instance;
|
private static LoomUtil _instance;
|
||||||
|
|
||||||
public static Loom Instance
|
public static LoomUtil Instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Guru
|
||||||
initialized = true;
|
initialized = true;
|
||||||
var g = new GameObject("Loom");
|
var g = new GameObject("Loom");
|
||||||
DontDestroyOnLoad(g);
|
DontDestroyOnLoad(g);
|
||||||
_instance = g.AddComponent<Loom>();
|
_instance = g.AddComponent<LoomUtil>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using ProtoBuf.Meta;
|
using ProtoBuf.Meta;
|
||||||
|
|
||||||
namespace Guru
|
namespace DofLibrary
|
||||||
{
|
{
|
||||||
public interface ISupportInitialize
|
public interface ISupportInitialize
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "com.guru.unity.gurudoflib",
|
"name": "com.guru.unity.gurudoflib",
|
||||||
"displayName": "GuruDofLib",
|
"displayName": "GuruDofLib",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"description": "\u57fa\u4e8eGuru kcp\u5e93\u5b9e\u73b0\u7684\u5ba2\u6237\u7aef\u63a5\u53e3\u5c01\u88c5",
|
"description": "\u57fa\u4e8eGuru kcp\u5e93\u5b9e\u73b0\u7684\u5ba2\u6237\u7aef\u63a5\u53e3\u5c01\u88c5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"unity",
|
"unity",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue