123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using IFramework.Custom;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class UDPProvider : MonoBehaviour
- {
- public enum ProviderType
- {
- UDPClient,
- UDPServer,
- }
- //private UDPClientProvider clientProvider;
- //private UDPServerProvider serverProvider;
- public ProviderType providerType;
- public int port = 16898;
- private string ip = "127.0.0.1";
- void Start()
- {
- Init();
- }
- private void Init()
- {
- switch(providerType)
- {
- case ProviderType.UDPClient:
- //clientProvider = new UDPClientProvider();
- //clientProvider.Connect(ip, port);
- break;
- case ProviderType.UDPServer:
- //serverProvider = new UDPServerProvider();
- //serverProvider.StartServer(port);
- break;
- default:
- break;
- }
- }
- private void OnDestroy()
- {
- //serverProvider?.Dispose();
- //clientProvider?.Dispose();
- }
- }
|