2 changed files with 60 additions and 0 deletions
			
			
		@ -0,0 +1,49 @@
				@@ -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<TCPEventModel>(); | 
				
			||||
                case (ProtocolType.UDP): | 
				
			||||
                    return this.GetModel<UDPEventModel>(); | 
				
			||||
                default: | 
				
			||||
                    return this.GetModel<TCPEventModel>(); | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
        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_; | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,11 @@
				@@ -0,0 +1,11 @@
					 | 
				
			||||
fileFormatVersion: 2 | 
				
			||||
guid: 6d9891e78e13faa48b25512ed565fd45 | 
				
			||||
MonoImporter: | 
				
			||||
  externalObjects: {} | 
				
			||||
  serializedVersion: 2 | 
				
			||||
  defaultReferences: [] | 
				
			||||
  executionOrder: 0 | 
				
			||||
  icon: {instanceID: 0} | 
				
			||||
  userData:  | 
				
			||||
  assetBundleName:  | 
				
			||||
  assetBundleVariant:  | 
				
			||||
					Loading…
					
					
				
		Reference in new issue