一、工厂设计模式(Factory Pattern) 核心思想 将对象的创建和使用分离,通过统一的接口创建对象,避免直接在代码中硬编码 new 或 Instantiate,提高灵活性和可扩展性。
//处理接受消息 分包、黏包问题的方法 private void HandleReceiveMsg(byte[] receiveBytes, int receiveNum) { int msgID = 0; int msgLength = 0;
using System; using System.Collections.Generic; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; namespace Teac
using System.Collections; using System.Collections.Generic; using System.Threading; using UnityEngine; public class Lesson4 : MonoBehaviour { Thr
using System.Collections; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using UnityEngine; public class Les
服务端和客户端需要做什么 客户端 1.创建套接字Socket 2.用Connect方法与服务端相连 3.用Send和Receive相关方法收发数据 4.用Shutdown方法释放连接 5.关闭套接字 服务端 1.创建套接字Socket 2.用Bind方法将套接字与本地地址绑定 3.用Listen方法
using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Sockets; using UnityEngine; public class Lesson5 : Mon
using System; using System.Collections; using System.Collections.Generic; using System.Text; using UnityEngine; using UnityEngine.WSA; public abstrac
using System.Collections; using System.Collections.Generic; using System.Net; using System.Threading.Tasks; using UnityEngine; public class Lesson2 :
编辑器生成 using Excel; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.IO; using System.Text; us