Browse Source

增加UDP使用案例

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
4eee267da3
  1. 53
      Assets/MsgTransmitTools/Example/Scenes/UDPLinkExample.unity
  2. 26
      Assets/MsgTransmitTools/Example/Script/UDPExample.cs
  3. 11
      Assets/MsgTransmitTools/Example/Script/UDPExample.cs.meta

53
Assets/MsgTransmitTools/Example/Scenes/UDPLinkExample.unity

@ -130,6 +130,7 @@ GameObject: @@ -130,6 +130,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 495072130}
- component: {fileID: 495072131}
m_Layer: 0
m_Name: ScriptManage
m_TagString: Untagged
@ -151,6 +152,18 @@ Transform: @@ -151,6 +152,18 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &495072131
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 495072129}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4d0e1e2ff99ce341a7954c75d38f96a, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1048467951
GameObject:
m_ObjectHideFlags: 0
@ -618,6 +631,36 @@ PrefabInstance: @@ -618,6 +631,36 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411067251951680, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411067251951680, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411067251951680, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411067251951680, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411067920407139, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411067920407139, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411067946607568, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_AnchorMax.x
@ -628,6 +671,16 @@ PrefabInstance: @@ -628,6 +671,16 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411068659631618, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1657411068659631618, guid: 024f7da41de8c5a48a15953f6782dd47,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 024f7da41de8c5a48a15953f6782dd47, type: 3}
--- !u!224 &4149678946757492273 stripped

26
Assets/MsgTransmitTools/Example/Script/UDPExample.cs

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using JXSoft;
public class UDPExample : MonoBehaviour,IUDPClient
{
// Start is called before the first frame update
void Start()
{
this.RegisterMessageEvent<UResponseTest>(e =>
{
Debug.Log(e.msg);
});
this.onReceive<UResponseTest>();
}
// Update is called once per frame
void Update()
{
}
}
public class UResponseTest:AbstractJsonResponse {
public string msg;
}

11
Assets/MsgTransmitTools/Example/Script/UDPExample.cs.meta

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c4d0e1e2ff99ce341a7954c75d38f96a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save