Compare commits

...

2 Commits

Author SHA1 Message Date
yzx b57f870783 Merge branch 'SXElectricityInformationAcquisition' of http://gitea.umayle.com/huangjiayu/ShanxiKnowledgeBase into SXElectricityInformationAcquisition
# Conflicts:
#	SXElectricityInformationAcquisition/Assets/Scenes/工具间Scenes/工具间.unity
2024-06-04 16:18:59 +08:00
yzx a4d96b0578 提交 2024-06-04 16:18:40 +08:00
15 changed files with 227 additions and 12 deletions

View File

@ -45,7 +45,14 @@
<Analyzer Include="E:\Program Files\Unity 2022.3.22f1\Editor\Data\Tools\Unity.SourceGenerators\Unity.Properties.SourceGenerator.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\HighlightPlus\Editor\HighlightProfileEditor.cs" />
<Compile Include="Assets\HighlightPlus\Editor\HighlightManagerEditor.cs" />
<Compile Include="Assets\HighlightPlus\Editor\HighlightSeeThroughOccluderEditor.cs" />
<Compile Include="Assets\HighlightPlus\Editor\HighlightEffectEditor.cs" />
<Compile Include="Assets\HighlightPlus\Editor\TransparentWithDepth.cs" />
<Compile Include="Assets\HighlightPlus\Editor\VRCheck.cs" />
<Compile Include="Assets\Model\Fantastic City Generator\DayNight\Editor\DayNightEditor.cs" />
<Compile Include="Assets\HighlightPlus\Editor\HighlightTriggerEditor.cs" />
<Reference Include="UnityEngine">
<HintPath>E:\Program Files\Unity 2022.3.22f1\Editor\Data\Managed\UnityEngine\UnityEngine.dll</HintPath>
</Reference>

View File

@ -67,8 +67,10 @@
<Compile Include="Assets\HighlightPlus\Scripts\InputProxy.cs" />
<Compile Include="Assets\Scripts\ToolsPack\ToolsPackWindowItemBtComponent.cs" />
<Compile Include="Assets\Model\Fantastic City Generator\DayNight\ShiftAtRuntime.cs" />
<Compile Include="Assets\Scripts\CharacterEquipWindow\CharacterEquipBtOnClick.cs" />
<Compile Include="Assets\Model\Fantastic City Generator\Traffic System\DataSpawn.cs" />
<Compile Include="Assets\HighlightPlus\Scripts\HighlightSeeThroughOccluder.cs" />
<Compile Include="Assets\Scripts\DataConfigManager.cs" />
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\HighlightOverlay.shader" />
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\HighlightOccluder.shader" />
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\CustomVertexTransform.cginc" />
@ -89,9 +91,11 @@
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\HighlightSolidColor.shader" />
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\HighlightComposeGlow.shader" />
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\HighlightAddDepthClip.shader" />
<None Include="Assets\StreamingAssets\DataConfig\ToolsPackData.json" />
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\HighlightComposeOutline.shader" />
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\HighlightOutline.shader" />
<None Include="Assets\Framework\ThirdParty\NaughtyAttributes\package.json" />
<None Include="Assets\Shader\PBR Material Double.shader" />
<Reference Include="UnityEngine">
<HintPath>E:\Program Files\Unity 2022.3.22f1\Editor\Data\Managed\UnityEngine\UnityEngine.dll</HintPath>
</Reference>

View File

@ -64,6 +64,8 @@ public class GameLauncher : MonoBehaviour
MotionEngine.CreateModule<ToolsPackManager>();
//人物装备
MotionEngine.CreateModule<CharacterEquipWindowManager>();
//数据配置文件
MotionEngine.CreateModule<DataConfigManager>();
}
private void HandleMotionFrameworkLog(ELogLevel logLevel, string log)

View File

@ -1,9 +1,29 @@
using UnityEngine;
using System;
using MotionFramework;
using UnityEngine;
using UnityEngine.UI;
namespace DefaultNamespace
{
public class CharacterEquipBtOnClick : MonoBehaviour
{
private bool isChange = false;
public void Start()
{
this.GetComponent<Button>().onClick.AddListener(delegate
{
if (isChange)
{
isChange = false;
}
else
{
isChange = true;
}
MotionEngine.GetModule<CharacterEquipWindowManager>().ChangeEquip(this.name, isChange);
});
}
}
}

View File

@ -31,14 +31,17 @@ namespace DefaultNamespace
public void OnUpdate()
{
}
public void OnDestroy()
{
}
public void OnGUI()
{
}
public void ChangeEquip(string equipName, bool isChange)

View File

@ -0,0 +1,119 @@
using System.Collections.Generic;
using System.IO;
using MotionFramework;
using Newtonsoft.Json.Linq;
using UnityEngine;
namespace DefaultNamespace
{
public class DataConfigManager : ModuleSingleton<DataConfigManager>, IModule
{
private Dictionary<string, List<string>> toolsPackDict;
public void OnCreate(object createParam)
{
LoadConfig();
}
public void OnUpdate()
{
}
public void OnDestroy()
{
}
public void OnGUI()
{
}
public List<string> GetToolsPackData(string toolsName)
{
foreach (var v in toolsPackDict)
{
if (v.Key == toolsName)
{
if (v.Value.Count > 0)
{
return v.Value;
}
else
{
return null;
}
}
}
return null;
}
private void LoadConfig()
{
string path = Application.streamingAssetsPath + "/DataConfig/ToolsPackData.json";
if (File.Exists(path))
{
string jsonContent = File.ReadAllText(path);
JObject jsonObj = JObject.Parse(jsonContent);
toolsPackDict = new Dictionary<string, List<string>>();
var tools = jsonObj["tools"] as JObject;
if (tools != null)
{
ParseTools(tools["models"] as JArray);
}
// Debug.Log("工具和子项:");
// foreach (var item in toolsDict)
// {
// Debug.Log($"{item.Key}:");
// foreach (var subItem in item.Value)
// {
// Debug.Log($" - {subItem}");
// }
// }
}
else
{
}
}
void ParseTools(JArray models)
{
foreach (var model in models)
{
if (model is JValue)
{
string modelName = model.ToString();
if (!toolsPackDict.ContainsKey(modelName))
{
toolsPackDict[modelName] = new List<string>();
}
}
else if (model is JObject subTool)
{
string subToolName = subTool["name"].ToString();
var subItems = subTool["models"] ?? subTool["items"];
List<string> subItemList = new List<string>();
if (subItems is JArray subArray)
{
foreach (var subItem in subArray)
{
subItemList.Add(subItem.ToString());
}
}
toolsPackDict[subToolName] = subItemList;
if (subItems is JArray)
{
continue;
}
ParseTools(subItems as JArray); // 递归解析子对象
}
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0db1b1ab020c45c48e2d018291287430
timeCreated: 1717487105

View File

@ -1,4 +1,5 @@
using System;
using DefaultNamespace;
using HighlightPlus;
using MotionFramework;
using UnityEngine;

View File

@ -1,7 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using MotionFramework;
using MotionFramework.Scripts.Runtime.Engine.Engine.Network.WebRequest;
using Newtonsoft.Json.Linq;
using UnityEngine;
public enum ToolsPackScene
@ -15,6 +17,7 @@ public enum ToolsPackScene
/// </summary>
public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
{
private Dictionary<string, GameObject> _toolsPack;
private Dictionary<string, Texture2D> _toolsPackWindowBtImage; //工具窗口下的按钮图集
private GameObject _toolsPackWindow;
@ -161,4 +164,5 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
{
_toolsPackScene = toolsPackScene;
}
}

View File

@ -16,6 +16,8 @@ namespace ToolsPack
{
closeBt.GetComponent<Button>().onClick.AddListener(delegate
{
(string str, GameObject toolsGame) = MotionEngine.GetModule<ToolsPackManager>().GetToolsPack(this.name);
toolsGame.SetActive(true);
MotionEngine.GetModule<ToolsPackManager>().DeleteToolsPack(this.name);
Destroy(this.gameObject);
});

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using DefaultNamespace;
using MotionFramework;
using UnityEngine;
using UnityEngine.Serialization;
@ -29,10 +30,23 @@ namespace ToolsPack
GameObject bt = MotionEngine.GetModule<ToolsPackManager>().GetToolsPackWindowBt();
foreach (var v in _toolsNames)
{
ToolsPackWindowItemBtComponent btComponent= Instantiate(bt, content, false).GetComponent<ToolsPackWindowItemBtComponent>();
List<string> li = MotionEngine.GetModule<DataConfigManager>().GetToolsPackData(v);
if (li == null)
{
ToolsPackWindowItemBtComponent btComponent = Instantiate(bt, content, false).GetComponent<ToolsPackWindowItemBtComponent>();
btComponent.name = v;
btComponent.Init(v);
}
else
{
foreach (var to in li)
{
ToolsPackWindowItemBtComponent btComponent = Instantiate(bt, content, false).GetComponent<ToolsPackWindowItemBtComponent>();
btComponent.name = to;
btComponent.Init(to);
}
}
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd0accf636c2ebd449947a94fc2cbab9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,21 @@
{
"tools": {
"name": "工具箱",
"models": [
"绝缘螺丝刀",
"老虎钳",
"绝缘胶带",
"验电笔",
"工作票",
"盒装螺丝",
"盒装封印",
{
"name": "集中器",
"models": [
"集中器无盖模型",
"集中器盖子模型"
]
}
]
}
}

View File

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

View File

@ -19,12 +19,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotionFramework", "MotionFr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniTask.Addressables", "UniTask.Addressables.csproj", "{4d0abe3e-2eff-5141-cb61-b756eb38b78b}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{bae393ca-b3f2-035c-979c-ff7e0d806194}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniTask.TextMeshPro", "UniTask.TextMeshPro.csproj", "{76df232d-8837-10f6-4eb2-65d4b80d2c66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniTask.DOTween", "UniTask.DOTween.csproj", "{c5ee6955-1356-fe62-795c-07a46b224741}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{bae393ca-b3f2-035c-979c-ff7e0d806194}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniTask.Editor", "UniTask.Editor.csproj", "{db9a3453-d36d-6192-985b-3e8cc856b5bd}"
EndProject
Global
@ -50,12 +50,12 @@ Global
{27e42685-adfb-0aa0-06e3-f5025d183005}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4d0abe3e-2eff-5141-cb61-b756eb38b78b}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4d0abe3e-2eff-5141-cb61-b756eb38b78b}.Debug|Any CPU.Build.0 = Debug|Any CPU
{bae393ca-b3f2-035c-979c-ff7e0d806194}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{bae393ca-b3f2-035c-979c-ff7e0d806194}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76df232d-8837-10f6-4eb2-65d4b80d2c66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76df232d-8837-10f6-4eb2-65d4b80d2c66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{c5ee6955-1356-fe62-795c-07a46b224741}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{c5ee6955-1356-fe62-795c-07a46b224741}.Debug|Any CPU.Build.0 = Debug|Any CPU
{bae393ca-b3f2-035c-979c-ff7e0d806194}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{bae393ca-b3f2-035c-979c-ff7e0d806194}.Debug|Any CPU.Build.0 = Debug|Any CPU
{db9a3453-d36d-6192-985b-3e8cc856b5bd}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{db9a3453-d36d-6192-985b-3e8cc856b5bd}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection