12345678910111213141516171819202122232425262728293031 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using KairoEngine.Core;
- using Sirenix.OdinInspector;
- namespace KairoEngine.Multiplayer
- {
- [HideMonoScript]
- public class ClientSyncAjustmentSystem : MonoBehaviour
- {
- public ClientBehaviour client;
- private void OnEnable()
- {
- NetMsgEvents.StartListening($"{client.eventStreamName}_PingReceived", OnPingReceived);
- }
- private void OnDisable()
- {
- NetMsgEvents.StopListening($"{client.eventStreamName}_PingReceived", OnPingReceived);
- }
- private void OnPingReceived(string text, int clientId, uint code, NetMsg netMsg)
- {
- NetPingMsg pingMsg = (NetPingMsg)netMsg;
- NetPongMsg pongMsg = new NetPongMsg(pingMsg.pingId);
- client.SendNetMsgToServer((uint)NetOpCode.Pong, pongMsg);
- }
- }
- }
|