Compare commits
No commits in common. "2f18e539c7c56d72a29425087d8be3920914e990" and "55bb5136413b8d74904d76dca1bad26be9210497" have entirely different histories.
2f18e539c7
...
55bb513641
@ -1,9 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
|
||||||
using QFramework;
|
using QFramework;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SocialPlatforms.Impl;
|
using UnityEngine.SocialPlatforms.Impl;
|
||||||
@ -50,29 +48,6 @@ public class ScoreController : MonoSingleton<ScoreController>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string GetModuleDictJson(string name = "")
|
|
||||||
{
|
|
||||||
var resultDict = new Dictionary<string, object>();
|
|
||||||
resultDict.Add("name", name);
|
|
||||||
foreach (var dataPair in moduleDict)
|
|
||||||
{
|
|
||||||
var data = dataPair.Value;
|
|
||||||
if (data.scoreDict != null)
|
|
||||||
{
|
|
||||||
foreach (var scoreStepPair in data.scoreDict)
|
|
||||||
{
|
|
||||||
var scoreStep = scoreStepPair.Value;
|
|
||||||
string key = $"{scoreStep.step}{scoreStep.name}";
|
|
||||||
resultDict[key] = scoreStep.value;
|
|
||||||
|
|
||||||
resultDict.Add(key + "Time", string.IsNullOrEmpty(scoreStep.time) == true ? "" : scoreStep.time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return JsonConvert.SerializeObject(resultDict);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void OnStart(OnModuleStart start)
|
private void OnStart(OnModuleStart start)
|
||||||
{
|
{
|
||||||
@ -109,8 +84,6 @@ public class ScoreController : MonoSingleton<ScoreController>
|
|||||||
{
|
{
|
||||||
scoreDict[key].value = 0;
|
scoreDict[key].value = 0;
|
||||||
}
|
}
|
||||||
DateTime currentTime = DateTime.Now;
|
|
||||||
scoreDict[key].time = currentTime.ToString(scoreDict[key].timeFormat);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,76 +9,33 @@ public class AsposeHelper : MonoBehaviour
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//public static void Writer(string json, Action callback = null)
|
|
||||||
//{
|
|
||||||
// // 加载Word文档
|
|
||||||
// Document doc = new Document(Global.reportDemoPath);
|
|
||||||
|
|
||||||
// JObject jObject = JObject.Parse(json);
|
|
||||||
|
|
||||||
// foreach (JProperty property in jObject.Properties())
|
|
||||||
// {
|
|
||||||
// string key = property.Name;
|
|
||||||
// string value = property.Value.ToString();
|
|
||||||
// doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// string filePath = ChinarFileController.SaveProject(Path.GetFileName(Global.reportDemoPath).Split('.')[1]);
|
|
||||||
// if (string.IsNullOrEmpty(filePath) == false)
|
|
||||||
// {
|
|
||||||
// doc.Save(filePath);
|
|
||||||
// }
|
|
||||||
// callback?.Invoke();
|
|
||||||
// // 替换文本
|
|
||||||
// //SaveWithDialog(doc, callback);
|
|
||||||
// //Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath);
|
|
||||||
//}
|
|
||||||
|
|
||||||
public static void Writer(string json, Action callback = null)
|
public static void Writer(string json, Action callback = null)
|
||||||
{
|
{
|
||||||
// ¼ÓÔØWordÎĵµ
|
// ¼ÓÔØWordÎĵµ
|
||||||
Document doc = new Document(Global.reportDemoPath);
|
Document doc = new Document(Global.reportDemoPath);
|
||||||
|
|
||||||
JToken jToken = JToken.Parse(json);
|
JObject jObject = JObject.Parse(json);
|
||||||
TraverseAndReplace(jToken, doc);
|
|
||||||
|
|
||||||
string filePath = ChinarFileController.SaveProject(Path.GetFileName(Global.reportDemoPath).Split('.')[1]);
|
foreach (JProperty property in jObject.Properties())
|
||||||
if (!string.IsNullOrEmpty(filePath))
|
|
||||||
{
|
|
||||||
doc.Save(filePath);
|
|
||||||
}
|
|
||||||
callback?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void TraverseAndReplace(JToken jToken, Document doc)
|
|
||||||
{
|
|
||||||
if (jToken.Type == JTokenType.Object)
|
|
||||||
{
|
|
||||||
foreach (JProperty property in ((JObject)jToken).Properties())
|
|
||||||
{
|
|
||||||
if (property.Value.Type == JTokenType.Object || property.Value.Type == JTokenType.Array)
|
|
||||||
{
|
|
||||||
TraverseAndReplace(property.Value, doc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
string key = property.Name;
|
string key = property.Name;
|
||||||
string value = property.Value.ToString();
|
string value = property.Value.ToString();
|
||||||
doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
|
doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
string filePath = ChinarFileController.SaveProject(Path.GetFileName(Global.reportDemoPath).Split('.')[1]);
|
||||||
else if (jToken.Type == JTokenType.Array)
|
if (string.IsNullOrEmpty(filePath) == false)
|
||||||
{
|
{
|
||||||
foreach (JToken item in jToken)
|
doc.Save(filePath);
|
||||||
{
|
|
||||||
TraverseAndReplace(item, doc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
callback?.Invoke();
|
||||||
|
// 替换文本
|
||||||
|
//SaveWithDialog(doc, callback);
|
||||||
|
//Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//private static void SaveWithDialog(Document doc, Action<DialogResult> callback)
|
//private static void SaveWithDialog(Document doc, Action<DialogResult> callback)
|
||||||
//{
|
//{
|
||||||
|
|||||||
@ -58,7 +58,11 @@ namespace QFramework.Example
|
|||||||
|
|
||||||
public string GetScoreDataJson()
|
public string GetScoreDataJson()
|
||||||
{
|
{
|
||||||
return ScoreController.Instance.GetModuleDictJson(InputName.text);
|
var data = new LabReprotData();
|
||||||
|
data.realname = InputName.text;
|
||||||
|
data.biaobencaiji_1_buzhou_1 = "[1111]";
|
||||||
|
string json = JsonConvert.SerializeObject(data);
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -127,9 +131,9 @@ namespace QFramework.Example
|
|||||||
this.Score.text = score.ToString();
|
this.Score.text = score.ToString();
|
||||||
this.Sum.text = sum.ToString();
|
this.Sum.text = sum.ToString();
|
||||||
|
|
||||||
//#if UNITY_WEBGL
|
//#if UNITY_WEBGL
|
||||||
// LYTWebGLHelper.Instance.UpLoadData((int)score, stepNames, maxScore, scores);
|
// LYTWebGLHelper.Instance.UpLoadData((int)score, stepNames, maxScore, scores);
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnShow()
|
protected override void OnShow()
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using QFramework;
|
using QFramework;
|
||||||
using QFramework.Example;
|
using QFramework.Example;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -74,8 +73,6 @@ namespace XMLTool
|
|||||||
public string sum;
|
public string sum;
|
||||||
public string bind;
|
public string bind;
|
||||||
public float value;
|
public float value;
|
||||||
public string time;
|
|
||||||
public string timeFormat = "yyyy-MM-dd HH:mm:ss";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -434,7 +431,6 @@ namespace XMLTool
|
|||||||
name = item.Attribute("name")?.Value,
|
name = item.Attribute("name")?.Value,
|
||||||
sum = item.Attribute("sum")?.Value,
|
sum = item.Attribute("sum")?.Value,
|
||||||
bind = item.Attribute("bind")?.Value,
|
bind = item.Attribute("bind")?.Value,
|
||||||
timeFormat = item.Attribute("timeFormat")?.Value,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user