Compare commits
	
		
			No commits in common. "main" and "0.0.7" have entirely different histories. 
		
	
	
		| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace DofLibrary
 | 
			
		||||
namespace Guru
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    public class GameEventMgr
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ namespace DofLibrary
 | 
			
		|||
 | 
			
		||||
        private void ProcessMessage(ServerMessage serverMessage)
 | 
			
		||||
        {
 | 
			
		||||
            //Debug.Log("[ProcessMessage]");
 | 
			
		||||
            Debug.Log("[ProcessMessage]");
 | 
			
		||||
            if (serverMessage.PlayerEntered != null)
 | 
			
		||||
            {
 | 
			
		||||
                //Debug.Log("[ProcessMessage]PlayerEntered");
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +116,7 @@ namespace DofLibrary
 | 
			
		|||
 | 
			
		||||
            if (OnConnected != null)
 | 
			
		||||
            {
 | 
			
		||||
                LoomUtil.QueueOnMainThread(() =>
 | 
			
		||||
                Loom.QueueOnMainThread(() =>
 | 
			
		||||
                {
 | 
			
		||||
                    OnConnected.Invoke();
 | 
			
		||||
                });
 | 
			
		||||
| 
						 | 
				
			
			@ -139,7 +139,7 @@ namespace DofLibrary
 | 
			
		|||
 | 
			
		||||
            if (msg is ServerMessage server_msg)
 | 
			
		||||
            {
 | 
			
		||||
                LoomUtil.QueueOnMainThread(() =>
 | 
			
		||||
                Loom.QueueOnMainThread(() =>
 | 
			
		||||
                {
 | 
			
		||||
                    ProcessMessage(server_msg);
 | 
			
		||||
                });
 | 
			
		||||
| 
						 | 
				
			
			@ -169,7 +169,7 @@ namespace DofLibrary
 | 
			
		|||
            Debug.Log("[GameKcpClient]: Connection closed");
 | 
			
		||||
            if (OnDisConnected != null)
 | 
			
		||||
            {
 | 
			
		||||
                LoomUtil.QueueOnMainThread(() =>
 | 
			
		||||
                Loom.QueueOnMainThread(() =>
 | 
			
		||||
                {
 | 
			
		||||
                    OnDisConnected.Invoke();
 | 
			
		||||
                });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,11 +56,6 @@ namespace DofLibrary
 | 
			
		|||
        /// </summary>
 | 
			
		||||
        void AllLevelEnd(float timeSpent);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 发送 玩家中途离开房间 消息
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        void PlayerLeave();
 | 
			
		||||
        
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 发送心跳包
 | 
			
		||||
        /// </summary>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,17 +3,17 @@ using System.Collections.Generic;
 | 
			
		|||
using System.Threading;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace DofLibrary
 | 
			
		||||
namespace Guru
 | 
			
		||||
{
 | 
			
		||||
    // 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 LoomUtil : MonoBehaviour
 | 
			
		||||
    public class Loom : MonoBehaviour
 | 
			
		||||
    {
 | 
			
		||||
        public static int maxThreads = 10;
 | 
			
		||||
 | 
			
		||||
        private static int numThreads;
 | 
			
		||||
        private static LoomUtil _instance;
 | 
			
		||||
        private static Loom _instance;
 | 
			
		||||
 | 
			
		||||
        public static LoomUtil Instance
 | 
			
		||||
        public static Loom Instance
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ namespace DofLibrary
 | 
			
		|||
                initialized = true;
 | 
			
		||||
                var g = new GameObject("Loom");
 | 
			
		||||
                DontDestroyOnLoad(g);
 | 
			
		||||
                _instance = g.AddComponent<LoomUtil>();
 | 
			
		||||
                _instance = g.AddComponent<Loom>();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ namespace DofLibrary
 | 
			
		|||
                }
 | 
			
		||||
            };
 | 
			
		||||
            Send(playerEnter);
 | 
			
		||||
            //Debug.Log("PlayerEnter message sent");
 | 
			
		||||
            Debug.Log("PlayerEnter message sent");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void LevelPrepared(string levelId)
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ namespace DofLibrary
 | 
			
		|||
                }
 | 
			
		||||
            };
 | 
			
		||||
            Send(message);
 | 
			
		||||
            //Debug.Log("LevelPrepared message sent");
 | 
			
		||||
            Debug.Log("LevelPrepared message sent");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void PointFound(string levelId, int pointId, float combo)
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +79,7 @@ namespace DofLibrary
 | 
			
		|||
                }
 | 
			
		||||
            };
 | 
			
		||||
            Send(message);
 | 
			
		||||
            //Debug.Log("PointFound message sent");
 | 
			
		||||
            Debug.Log("PointFound message sent");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void LevelEnd(string levelId)
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +93,7 @@ namespace DofLibrary
 | 
			
		|||
                }
 | 
			
		||||
            };
 | 
			
		||||
            Send(message);
 | 
			
		||||
            //Debug.Log("LevelEnd message sent");
 | 
			
		||||
            Debug.Log("LevelEnd message sent");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void AllLevelEnd(float timeSpent)
 | 
			
		||||
| 
						 | 
				
			
			@ -107,22 +107,9 @@ namespace DofLibrary
 | 
			
		|||
                }
 | 
			
		||||
            };
 | 
			
		||||
            Send(message);
 | 
			
		||||
            //Debug.Log("AllLevelEnd message sent");
 | 
			
		||||
            Debug.Log("AllLevelEnd message sent");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void PlayerLeave()
 | 
			
		||||
        {
 | 
			
		||||
            var message = new ClientMessage
 | 
			
		||||
            {
 | 
			
		||||
                PlayerLeave = new PlayerLeave
 | 
			
		||||
                {
 | 
			
		||||
                    Cid = _cid
 | 
			
		||||
                }
 | 
			
		||||
            };
 | 
			
		||||
            Send(message);
 | 
			
		||||
            //Debug.Log("PlayerLeave message sent");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        public void Heartbeat(long timestamp)
 | 
			
		||||
        {
 | 
			
		||||
            var message = new ClientMessage
 | 
			
		||||
| 
						 | 
				
			
			@ -133,7 +120,7 @@ namespace DofLibrary
 | 
			
		|||
                }
 | 
			
		||||
            };
 | 
			
		||||
            Send(message);
 | 
			
		||||
            //Debug.Log("Heartbeat message sent");
 | 
			
		||||
            Debug.Log("Heartbeat message sent");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void Send(ClientMessage message)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -328,12 +328,6 @@ namespace Dof
 | 
			
		|||
        [global::ProtoBuf.ProtoMember(2, Name = @"score")]
 | 
			
		||||
        public int Score { get; set; }
 | 
			
		||||
 | 
			
		||||
        [global::ProtoBuf.ProtoMember(3, Name = @"rank")]
 | 
			
		||||
        public int Rank { get; set; }
 | 
			
		||||
 | 
			
		||||
        [global::ProtoBuf.ProtoMember(4, Name = @"award")]
 | 
			
		||||
        public int Award { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [global::ProtoBuf.ProtoContract()]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
using System.IO;
 | 
			
		||||
using ProtoBuf.Meta;
 | 
			
		||||
 | 
			
		||||
namespace DofLibrary
 | 
			
		||||
namespace Guru
 | 
			
		||||
{
 | 
			
		||||
    public interface ISupportInitialize
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,8 +85,6 @@ message AllLevelEnd {
 | 
			
		|||
message GameScore {
 | 
			
		||||
  string uid = 1;
 | 
			
		||||
  int32 score = 2;
 | 
			
		||||
  int32 rank = 3;
 | 
			
		||||
  int32 award = 4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message GameFinish {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
{
 | 
			
		||||
  "name": "com.guru.unity.gurudoflib",
 | 
			
		||||
  "displayName": "GuruDofLib",
 | 
			
		||||
  "version": "0.1.2",
 | 
			
		||||
  "version": "0.0.7",
 | 
			
		||||
  "description": "\u57fa\u4e8eGuru kcp\u5e93\u5b9e\u73b0\u7684\u5ba2\u6237\u7aef\u63a5\u53e3\u5c01\u88c5",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "unity",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue