Compare commits
2 Commits
535246e0ba
...
b57f870783
Author | SHA1 | Date |
---|---|---|
|
b57f870783 | |
|
a4d96b0578 |
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -64,6 +64,8 @@ public class GameLauncher : MonoBehaviour
|
|||
MotionEngine.CreateModule<ToolsPackManager>();
|
||||
//人物装备
|
||||
MotionEngine.CreateModule<CharacterEquipWindowManager>();
|
||||
//数据配置文件
|
||||
MotionEngine.CreateModule<DataConfigManager>();
|
||||
}
|
||||
|
||||
private void HandleMotionFrameworkLog(ELogLevel logLevel, string log)
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,14 +31,17 @@ namespace DefaultNamespace
|
|||
|
||||
public void OnUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ChangeEquip(string equipName, bool isChange)
|
||||
|
|
|
@ -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); // 递归解析子对象
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0db1b1ab020c45c48e2d018291287430
|
||||
timeCreated: 1717487105
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using DefaultNamespace;
|
||||
using HighlightPlus;
|
||||
using MotionFramework;
|
||||
using UnityEngine;
|
||||
|
|
|
@ -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,9 +17,10 @@ public enum ToolsPackScene
|
|||
/// </summary>
|
||||
public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
|
||||
{
|
||||
|
||||
private Dictionary<string, GameObject> _toolsPack;
|
||||
private Dictionary<string, Texture2D> _toolsPackWindowBtImage; //工具窗口下的按钮图集
|
||||
private GameObject _toolsPackWindow;
|
||||
private GameObject _toolsPackWindow;
|
||||
private GameObject _toolsPackWindowBt;
|
||||
private Transform _canvas;
|
||||
|
||||
|
@ -161,4 +164,5 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
|
|||
{
|
||||
_toolsPackScene = toolsPackScene;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DefaultNamespace;
|
||||
using MotionFramework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
@ -12,9 +13,9 @@ namespace ToolsPack
|
|||
public class ToolsPackWindowManager : MonoBehaviour
|
||||
{
|
||||
private List<string> _toolsNames;
|
||||
|
||||
|
||||
[SerializeField] private Transform content;
|
||||
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
int count = content.childCount;
|
||||
|
@ -29,9 +30,22 @@ namespace ToolsPack
|
|||
GameObject bt = MotionEngine.GetModule<ToolsPackManager>().GetToolsPackWindowBt();
|
||||
foreach (var v in _toolsNames)
|
||||
{
|
||||
ToolsPackWindowItemBtComponent btComponent= Instantiate(bt, content, false).GetComponent<ToolsPackWindowItemBtComponent>();
|
||||
btComponent.name = v;
|
||||
btComponent.Init(v);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bd0accf636c2ebd449947a94fc2cbab9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"tools": {
|
||||
"name": "工具箱",
|
||||
"models": [
|
||||
"绝缘螺丝刀",
|
||||
"老虎钳",
|
||||
"绝缘胶带",
|
||||
"验电笔",
|
||||
"工作票",
|
||||
"盒装螺丝",
|
||||
"盒装封印",
|
||||
{
|
||||
"name": "集中器",
|
||||
"models": [
|
||||
"集中器无盖模型",
|
||||
"集中器盖子模型"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 79997ac69d478744aa563a33581aa3c5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue