diff --git a/Assets/JsonIOTools/JsonIOUtility.cs b/Assets/JsonIOTools/JsonIOUtility.cs index e0f8948..a75d147 100644 --- a/Assets/JsonIOTools/JsonIOUtility.cs +++ b/Assets/JsonIOTools/JsonIOUtility.cs @@ -79,7 +79,6 @@ namespace JXSoft } #endregion - #region fileListOpreate private DataDirectory dataDirectory; //Loading FileList From Folder(Default using Application.persistentDataPath) diff --git a/Assets/MsgTransmitTools/Example/Script/UDPExample.cs b/Assets/MsgTransmitTools/Example/Script/UDPExample.cs index f546bed..77fde34 100644 --- a/Assets/MsgTransmitTools/Example/Script/UDPExample.cs +++ b/Assets/MsgTransmitTools/Example/Script/UDPExample.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using UnityEngine; using JXSoft; +using LitJson; +using System; public class UDPExample : MonoBehaviour,IUDPClient { @@ -23,4 +25,18 @@ public class UDPExample : MonoBehaviour,IUDPClient } public class UResponseTest:AbstractJsonResponse { public string msg; + public UResponseTest() { } + public override bool trySetData(string json) + { + try + { + UResponseTest res = JsonMapper.ToObject(json); + msg = res.msg; + return true; + } + catch (Exception e) { + Debug.Log(e); + return false; + } + } } diff --git a/Assets/MsgTransmitTools/src/DataEventModel.cs b/Assets/MsgTransmitTools/src/DataEventModel.cs index 7eba7a0..4b8b991 100644 --- a/Assets/MsgTransmitTools/src/DataEventModel.cs +++ b/Assets/MsgTransmitTools/src/DataEventModel.cs @@ -1,10 +1,10 @@ using System; using System.Collections; using System.Collections.Generic; -using JXSoft; using QFrameworkCP; using UnityEngine; using UnityEngine.Events; +using LitJson; namespace JXSoft { @@ -112,7 +112,9 @@ namespace JXSoft { bool isSet = response.trySetData(json); if (isSet) { - Debug.Log("Received:" + response.toProtocolData() + response.GetType()); + if (response.toProtocolData() != "") { + Debug.Log("Received:" + response.toProtocolData() + response.GetType()); + } this.SendEvent(new ResponseMsgEvent(response)); } } @@ -158,11 +160,6 @@ namespace JXSoft { /// 协议数据格式 /// bool trySetData(string protocolData); - /// - /// 如果接收到信息定性为异常信息,获取异常信息 - /// - /// 异常信息结果 - string getException(); } public interface IRequest @@ -181,33 +178,31 @@ namespace JXSoft { public abstract class AbstractJsonResponse : IResponse { private string exceptionMsg; + public virtual string toProtocolData() { - return JsonUtility.ToJson(this, true); + return ""; } public virtual bool trySetData(string json) { try { - JsonUtility.FromJsonOverwrite(json, this); + JsonUtility.FromJsonOverwrite(json,this); return true; } catch (Exception e) { exceptionMsg = e.ToString(); + Debug.Log(exceptionMsg); return false; } } - public string getException() - { - return exceptionMsg; - } } public abstract class AbstractJsonRequest : IRequest{ public string toProtocolData() { - return JsonUtility.ToJson(this, true); + return JsonMapper.ToJson(this); } } public class StringRequest : IRequest diff --git a/Assets/Plugin/LitJson/LitJSON.csproj.meta b/Assets/Plugin/LitJson/LitJSON.csproj.meta deleted file mode 100644 index e932a82..0000000 --- a/Assets/Plugin/LitJson/LitJSON.csproj.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 3b357981191bd544eae0b5a95b7f6b22 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugin/LitJson/litjson.png b/Assets/Plugin/LitJson/litjson.png deleted file mode 100644 index a4c15e5..0000000 Binary files a/Assets/Plugin/LitJson/litjson.png and /dev/null differ diff --git a/Assets/Plugin/LitJson/litjson.png.meta b/Assets/Plugin/LitJson/litjson.png.meta deleted file mode 100644 index 4bf1656..0000000 --- a/Assets/Plugin/LitJson/litjson.png.meta +++ /dev/null @@ -1,92 +0,0 @@ -fileFormatVersion: 2 -guid: 419d1de541c175244883a33bdd6253f9 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 0 - wrapV: 0 - wrapW: 0 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: