Compare commits
3 Commits
18275fb076
...
055fbc3aeb
Author | SHA1 | Date |
---|---|---|
|
055fbc3aeb | |
|
bb427c1bd2 | |
|
5037898610 |
|
@ -35,7 +35,7 @@ namespace ZEditor
|
||||||
|
|
||||||
#region Win
|
#region Win
|
||||||
|
|
||||||
[MenuItem("Tool/****构建PC包****")]
|
[MenuItem("Tool/Build/****构建PC包****")]
|
||||||
public static void BuildPCGame()
|
public static void BuildPCGame()
|
||||||
{
|
{
|
||||||
Run(BuildTarget.StandaloneWindows, pc);
|
Run(BuildTarget.StandaloneWindows, pc);
|
||||||
|
@ -45,7 +45,7 @@ namespace ZEditor
|
||||||
|
|
||||||
#region Android
|
#region Android
|
||||||
|
|
||||||
[MenuItem("Tool/****构建Android包****")]
|
[MenuItem("Tool/Build/****构建Android包****")]
|
||||||
public static void BuildAndroidGame()
|
public static void BuildAndroidGame()
|
||||||
{
|
{
|
||||||
Run(BuildTarget.Android, android);
|
Run(BuildTarget.Android, android);
|
||||||
|
@ -55,7 +55,7 @@ namespace ZEditor
|
||||||
|
|
||||||
#region WebGL
|
#region WebGL
|
||||||
|
|
||||||
[MenuItem("Tool/****构建WebGL包****")]
|
[MenuItem("Tool/Build/****构建WebGL包****")]
|
||||||
public static void BuildWebGLGame()
|
public static void BuildWebGLGame()
|
||||||
{
|
{
|
||||||
Run(BuildTarget.WebGL, webgl);
|
Run(BuildTarget.WebGL, webgl);
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using Sirenix.OdinInspector.Editor;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using ZC;
|
||||||
|
|
||||||
|
namespace ZEditor
|
||||||
|
{
|
||||||
|
public class QuestionEditor : OdinEditorWindow
|
||||||
|
{
|
||||||
|
[MenuItem("Tool/题库编辑面板")]
|
||||||
|
private static void OpenWindow()
|
||||||
|
{
|
||||||
|
GetWindow<QuestionEditor>().Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
[FolderPath] public string savePath = "Assets/DemoGame/GameRes/Config";
|
||||||
|
public string saveName;
|
||||||
|
private string path => $"{savePath}/{saveName}.asset";
|
||||||
|
|
||||||
|
public List<AnswerData> AnswerDatas = new List<AnswerData>();
|
||||||
|
|
||||||
|
[Button("加载")]
|
||||||
|
void LoadData(string fileName)
|
||||||
|
{
|
||||||
|
string filePath = $"{savePath}/{fileName}.asset";
|
||||||
|
var loadAssetAtPath = AssetDatabase.LoadAssetAtPath<QuestionBankData>(filePath);
|
||||||
|
AnswerDatas = loadAssetAtPath.AnswerDatas;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Button("保存")]
|
||||||
|
void SaveData()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(savePath))
|
||||||
|
{
|
||||||
|
Debug.LogError("请填入正确路径!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(saveName))
|
||||||
|
{
|
||||||
|
Debug.LogError("请填入正确文件名!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
var questionBankData = ScriptableObject.CreateInstance<QuestionBankData>();
|
||||||
|
questionBankData.AnswerDatas = new List<AnswerData>(AnswerDatas);
|
||||||
|
AssetDatabase.CreateAsset(questionBankData, path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var data = AssetDatabase.LoadAssetAtPath<QuestionBankData>(path);
|
||||||
|
data.AnswerDatas = AnswerDatas;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
saveName = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 290ea4dab1c646dcbb9375d178a85f3f
|
||||||
|
timeCreated: 1730038626
|
|
@ -0,0 +1,65 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
|
using Sirenix.OdinInspector.Editor;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
|
using ZC;
|
||||||
|
|
||||||
|
namespace ZEditor
|
||||||
|
{
|
||||||
|
public class TipsEditor : OdinEditorWindow
|
||||||
|
{
|
||||||
|
[MenuItem("Tool/提示文本编辑面板")]
|
||||||
|
private static void OpenWindow()
|
||||||
|
{
|
||||||
|
GetWindow<TipsEditor>().Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
[FolderPath] public string savePath = "Assets/DemoGame/GameRes/Config";
|
||||||
|
public string saveName = "TipsData";
|
||||||
|
private string path => $"{savePath}/{saveName}.asset";
|
||||||
|
|
||||||
|
public List<TipsSData> TipsSDatas = new List<TipsSData>();
|
||||||
|
|
||||||
|
[Button("加载")]
|
||||||
|
void LoadData(string fileName = "TipsData")
|
||||||
|
{
|
||||||
|
string filePath = $"{savePath}/{fileName}.asset";
|
||||||
|
var loadAssetAtPath = AssetDatabase.LoadAssetAtPath<TipsData>(filePath);
|
||||||
|
TipsSDatas = loadAssetAtPath.Datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Button("保存")]
|
||||||
|
void SaveData()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(savePath))
|
||||||
|
{
|
||||||
|
Debug.LogError("请填入正确路径!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(saveName))
|
||||||
|
{
|
||||||
|
Debug.LogError("请填入正确文件名!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
var questionBankData = ScriptableObject.CreateInstance<TipsData>();
|
||||||
|
questionBankData.Datas = new List<TipsSData>(TipsSDatas);
|
||||||
|
AssetDatabase.CreateAsset(questionBankData, path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var data = AssetDatabase.LoadAssetAtPath<TipsData>(path);
|
||||||
|
data.Datas = TipsSDatas;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
// saveName = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3a443f39a7d44d278f913ebf519a2981
|
||||||
|
timeCreated: 1730086555
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4bc9670fa7014130a180ddedb93dffb5
|
||||||
|
timeCreated: 1730041828
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ZC
|
||||||
|
{
|
||||||
|
[System.Serializable]
|
||||||
|
public class QuestionBankData : ScriptableObject
|
||||||
|
{
|
||||||
|
public string questionName;
|
||||||
|
public List<AnswerData> AnswerDatas = new List<AnswerData>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class AnswerData
|
||||||
|
{
|
||||||
|
public int index;
|
||||||
|
public string title;
|
||||||
|
public List<OptionData> options = new List<OptionData>();
|
||||||
|
public string trueOption;
|
||||||
|
public string analyze;
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class OptionData
|
||||||
|
{
|
||||||
|
public string content;
|
||||||
|
|
||||||
|
public bool isTrue;
|
||||||
|
// public string analyze;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d756517b2bde43b68b5ed56251a48a9b
|
||||||
|
timeCreated: 1730041548
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ZC
|
||||||
|
{
|
||||||
|
public enum TipsDataType
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class TipsData : ScriptableObject
|
||||||
|
{
|
||||||
|
public List<TipsSData> Datas = new List<TipsSData>();
|
||||||
|
|
||||||
|
public string GetData(TipsDataType tipsType)
|
||||||
|
{
|
||||||
|
foreach (var tipsSData in Datas)
|
||||||
|
{
|
||||||
|
if (tipsSData.tipsType == tipsType)
|
||||||
|
{
|
||||||
|
return tipsSData.context;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NullReferenceException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class TipsSData
|
||||||
|
{
|
||||||
|
public TipsDataType tipsType;
|
||||||
|
public string context;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dfce79b435004412ba57aabd7d03e78e
|
||||||
|
timeCreated: 1730085798
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using TMPro;
|
||||||
using TMPro;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace ZC
|
namespace ZC
|
||||||
|
@ -120,26 +119,4 @@ namespace ZC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class QuestionBankData
|
|
||||||
{
|
|
||||||
public List<AnswerData> AnswerDatas = new List<AnswerData>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AnswerData
|
|
||||||
{
|
|
||||||
public int index;
|
|
||||||
public string title;
|
|
||||||
public List<OptionData> options = new List<OptionData>();
|
|
||||||
public string trueOption;
|
|
||||||
public string analyze;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class OptionData
|
|
||||||
{
|
|
||||||
public string content;
|
|
||||||
|
|
||||||
public bool isTrue;
|
|
||||||
// public string analyze;
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue