Browse Source

删除了异常信息获取接口,有需要的可以自行定义

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
608347f330
  1. 1
      Assets/JsonIOTools/JsonIOUtility.cs
  2. 16
      Assets/MsgTransmitTools/Example/Script/UDPExample.cs
  3. 21
      Assets/MsgTransmitTools/src/DataEventModel.cs
  4. 7
      Assets/Plugin/LitJson/LitJSON.csproj.meta
  5. BIN
      Assets/Plugin/LitJson/litjson.png
  6. 92
      Assets/Plugin/LitJson/litjson.png.meta

1
Assets/JsonIOTools/JsonIOUtility.cs

@ -79,7 +79,6 @@ namespace JXSoft @@ -79,7 +79,6 @@ namespace JXSoft
}
#endregion
#region fileListOpreate
private DataDirectory dataDirectory;
//Loading FileList From Folder(Default using Application.persistentDataPath)

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

@ -2,6 +2,8 @@ @@ -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 @@ -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<UResponseTest>(json);
msg = res.msg;
return true;
}
catch (Exception e) {
Debug.Log(e);
return false;
}
}
}

21
Assets/MsgTransmitTools/src/DataEventModel.cs

@ -1,10 +1,10 @@ @@ -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 { @@ -112,7 +112,9 @@ namespace JXSoft {
bool isSet = response.trySetData(json);
if (isSet)
{
if (response.toProtocolData() != "") {
Debug.Log("Received:" + response.toProtocolData() + response.GetType());
}
this.SendEvent(new ResponseMsgEvent(response));
}
}
@ -158,11 +160,6 @@ namespace JXSoft { @@ -158,11 +160,6 @@ namespace JXSoft {
/// <param name="protocolData">协议数据格式</param>
/// <returns></returns>
bool trySetData(string protocolData);
/// <summary>
/// 如果接收到信息定性为异常信息,获取异常信息
/// </summary>
/// <returns>异常信息结果</returns>
string getException();
}
public interface IRequest
@ -181,33 +178,31 @@ namespace JXSoft { @@ -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

7
Assets/Plugin/LitJson/LitJSON.csproj.meta

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 3b357981191bd544eae0b5a95b7f6b22
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Plugin/LitJson/litjson.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

92
Assets/Plugin/LitJson/litjson.png.meta

@ -1,92 +0,0 @@ @@ -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:
Loading…
Cancel
Save