diff --git a/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs b/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs new file mode 100644 index 0000000..279f23c --- /dev/null +++ b/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using QFrameworkCP; + +namespace JXSoft { + //通讯协议管理 + public class ProtocolSettingsModel : AbstractModel, ICanGetModel + { + protected override void OnInit() + { + } + private ProtocolType protocolType = ProtocolType.NOPROTOCOL; + public DataEventModel getProtocol() + { + switch (protocolType) + { + case (ProtocolType.TCP): + return this.GetModel(); + case (ProtocolType.UDP): + return this.GetModel(); + default: + return this.GetModel(); + } + } + public void setProtocol(ProtocolType type) + { + protocolType = type; + this.SendEvent(new OnProtocolSet(type)); + } + } + + [SerializeField] + public enum ProtocolType + { + NOPROTOCOL = 0, + TCP = 1, + UDP = 2, + } + public struct OnProtocolSet + { + public ProtocolType type; + public OnProtocolSet(ProtocolType type_) + { + type = type_; + } + } + +} diff --git a/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs.meta b/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs.meta new file mode 100644 index 0000000..b1afd7d --- /dev/null +++ b/Assets/MsgTransmitTools/src/ProtocolSettingsModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d9891e78e13faa48b25512ed565fd45 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: