作者: 孙鸿飞

76 篇文章

Unity通过射线识别UI层
public GraphicRaycaster raycaster; public EventSystem eventSystem; private void Update() { PointerEventData pointerEventData = new PointerEventData(eventSystem); pointerEventD…
Socket Udp异步通信举例
在C#中,使用UDP接收消息也可以通过两种异步方式实现:一种是使用BeginReceive和EndReceive方法(基于APM模式),另一种是使用ReceiveAsync方法(基于TAP模式)。以下是两种方式的示例代码: 1. 使用 BeginReceive 和 EndReceive(APM模式) using Sys…
C#组播地址
组播(Multicast)是一种网络通信方式,它允许一个源节点向多个目的节点发送数据,而无需为每个目的节点单独发送。组播在IP网络中被广泛用于多媒体流传输、视频会议等场景。组播地址是在IPv4和IPv6中用于标识一个组播组的地址。 一、IPv4中的组播地址 IPv4组播地址范围为224.0.0.0到239.255.255.255,这些地址被称为D类…
C#实现自动连接串口
using System; using System.IO.Ports; using System.Text; using System.Threading; namespace ConsoleApplication3 { internal class Program { public SerialPort serialPort; public b…
C#文件的读写多种方式
在C#中,文件读写有多种方法,我将为您详细介绍: 1. File类方法(最简单) // 写入文件 File.WriteAllText("path.txt", "Hello World"); File.WriteAllLines("path.txt", new string[] {"Line1", "Line2"}); // 读取文件 str…
设计模式讲解
简单工厂 设计模式之工厂模式(简单工厂、工厂方法、抽象工厂)_工厂模式和抽象工厂模式-CSDN博客
更新brew源
查看 brew.git 当前源 $ cd "$(brew --repo)" && git remote -v origin https://github.com/Homebrew/brew.git (fetch) origin https://github.com/Homebrew/brew.git (push) 查看 homebr…
Chart Graph动态添加数据
using System; using ChartAndGraph; using UnityEngine; using UnityEngine.UI; using Random = UnityEngine.Random; public class RealTimeGraph : MonoBehaviour { public GraphChart G…
Unity时钟
using UnityEngine; using UnityEngine.UI; public class ClockControl : MonoBehaviour { public Transform clock; public Slider slider; public Vector3 targetRotation; public Vector…