浏览代码

Merge branch 'CloudFunction' into unity2020

/unity2020
siyao 3 年前
当前提交
65e2fd71
共有 6 个文件被更改,包括 12 次插入1046 次删除
  1. 1
      Assets/HuaweiService/Editor/cloud_db/CloudDBSetting.cs
  2. 13
      Assets/HuaweiService/Editor/cloud_db/ClassTemplate.cs
  3. 5
      Assets/HuaweiService/Editor/cloud_db/GenCode.cs
  4. 5
      Assets/HuaweiService/cloud_function/Utils.cs
  5. 1001
      Assets/HuaweiService/cloud_function/Newtonsoft.Json.dll
  6. 33
      Assets/HuaweiService/cloud_function/Newtonsoft.Json.dll.meta

1
Assets/HuaweiService/Editor/cloud_db/CloudDBSetting.cs


using System;
using Newtonsoft.Json;
using UnityEditor;
using UnityEngine;

13
Assets/HuaweiService/Editor/cloud_db/ClassTemplate.cs


using System;
using Newtonsoft.Json;
public Permissions[] permissions;
public ObjectType[] objectTypes;
public System.Collections.Generic.List<Permissions> permissions;
public System.Collections.Generic.List<ObjectType> objectTypes;
[Serializable]
public PermissionInfo[] infos;
public System.Collections.Generic.List<PermissionInfo> permissions;
[Serializable]
[Serializable]
public Field[] fields;
public System.Collections.Generic.List<Field> fields;
[Serializable]
public class Field {
public bool isNeedEncrypt;
public string fieldName;

5
Assets/HuaweiService/Editor/cloud_db/GenCode.cs


using System.IO;
using Newtonsoft.Json;
using UnityEngine;
namespace HuaweiService.CloudDB.Editor {

Directory.CreateDirectory (ExportFileDir);
using (StreamReader r = new StreamReader (ObjectTypeFilePath)) {
string json = r.ReadToEnd ();
template = JsonConvert.DeserializeObject<ClassTemplate> (json);
template = JsonUtility.FromJson<ClassTemplate> (json);
GenerateObjectTypeInfoHelper ();
foreach (ObjectType objectType in template.objectTypes) {
GenerateModels (objectType);

public void GenerateModels (ObjectType objectType) {
string objectTypeName = objectType.objectTypeName;
Field[] fields = objectType.fields;
Field[] fields = objectType.fields.ToArray();
string path = ExportFileDir + $"/{objectTypeName}.cs";
Debug.LogFormat ("Generating Class: {0}.", objectTypeName);

5
Assets/HuaweiService/cloud_function/Utils.cs


using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using UnityEngine;
namespace HuaweiService.CloudFunction {

}
public static T FromJson<T> (string json) {
T m = JsonConvert.DeserializeObject<T> (json);
T m = JsonUtility.FromJson<T>(json);
return m;
}
}

public JsonModel () { }
public JsonModel (object obj) {
ClassName = obj.GetType ().Name.ToLower ();
ClassValue = JsonConvert.SerializeObject (obj);
ClassValue = JsonUtility.ToJson(obj);
}
}

1001
Assets/HuaweiService/cloud_function/Newtonsoft.Json.dll
文件差异内容过多而无法显示
查看文件

33
Assets/HuaweiService/cloud_function/Newtonsoft.Json.dll.meta


fileFormatVersion: 2
guid: a80efc5e8faf849ac871faebb4080ea4
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存