Compare commits

...

3 Commits

6 changed files with 31 additions and 25 deletions

View File

@ -828,10 +828,6 @@
<Project>{e8ea8a32-db36-1909-a8a7-26f06060f4d3}</Project>
<Name>UniTask.Linq</Name>
</ProjectReference>
<ProjectReference Include="AmplifyShaderEditor.csproj">
<Project>{876d7bbd-6f78-6599-5008-d6ab40ab5602}</Project>
<Name>AmplifyShaderEditor</Name>
</ProjectReference>
<ProjectReference Include="NaughtyAttributes.Core.csproj">
<Project>{b366c870-8269-aeae-4186-8220020279aa}</Project>
<Name>NaughtyAttributes.Core</Name>

View File

@ -781,10 +781,6 @@
<Project>{e8ea8a32-db36-1909-a8a7-26f06060f4d3}</Project>
<Name>UniTask.Linq</Name>
</ProjectReference>
<ProjectReference Include="AmplifyShaderEditor.csproj">
<Project>{876d7bbd-6f78-6599-5008-d6ab40ab5602}</Project>
<Name>AmplifyShaderEditor</Name>
</ProjectReference>
<ProjectReference Include="NaughtyAttributes.Core.csproj">
<Project>{b366c870-8269-aeae-4186-8220020279aa}</Project>
<Name>NaughtyAttributes.Core</Name>

View File

@ -828,10 +828,6 @@
<Project>{e8ea8a32-db36-1909-a8a7-26f06060f4d3}</Project>
<Name>UniTask.Linq</Name>
</ProjectReference>
<ProjectReference Include="AmplifyShaderEditor.csproj">
<Project>{876d7bbd-6f78-6599-5008-d6ab40ab5602}</Project>
<Name>AmplifyShaderEditor</Name>
</ProjectReference>
<ProjectReference Include="NaughtyAttributes.Core.csproj">
<Project>{b366c870-8269-aeae-4186-8220020279aa}</Project>
<Name>NaughtyAttributes.Core</Name>

View File

@ -6,6 +6,7 @@ using DefaultNamespace;
using MotionFramework;
using MotionFramework.Scripts.Runtime.Engine.Engine.Network.WebRequest;
using Newtonsoft.Json.Linq;
using ToolsPack;
using Unity.VisualScripting;
using UnityEngine;
@ -87,9 +88,22 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
/// 删除工具包
/// </summary>
/// <param name="toolsName"></param>
public void DeleteToolsPack(string toolsName)
public void DeleteToolsPack(string toolsName, int index)
{
_toolsPack.Remove(toolsName);
if (_toolsPack[toolsName].Count > 0)
{
for (int i = 0; i < _toolsPack[toolsName].Count; i++)
{
if (i == index)
{
_toolsPack[toolsName].RemoveAt(i);
}
}
}
else
{
_toolsPack.Remove(toolsName);
}
}
/// <summary>
@ -98,8 +112,6 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
/// <returns></returns>
public Dictionary<string, List<GameObject>> GetToolsPack()
{
return _toolsPack;
}
@ -107,7 +119,7 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
/// 根据名字查询工具包内容
/// </summary>
/// <returns></returns>
public GameObject GetToolsPack(string toolsName,int index)
public GameObject GetToolsPack(string toolsName, int index)
{
List<GameObject> game;
if (_toolsPack.TryGetValue(toolsName, out game))
@ -185,7 +197,12 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
_toolsPackWindowItemBts.Clear();
}
public void DeleteToolsPackWindowItemBts(string toolName)
/// <summary>
/// 删除背包里的UI按钮
/// </summary>
/// <param name="toolName"></param>
/// <param name="index"></param>
public void DeleteToolsPackWindowItemBts(string toolName, int index)
{
List<string> list = MotionEngine.GetModule<DataConfigManager>().GetToolsPackData(toolName);
if (list != null)
@ -194,7 +211,7 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
{
for (int j = 0; j < list.Count; j++)
{
if (_toolsPackWindowItemBts[i].name == list[j])
if (_toolsPackWindowItemBts[i].name == list[j] && _toolsPackWindowItemBts[i].GetComponent<ToolsPackWindowItemBtComponent>().GetIndex() == index)
{
GameObject g = _toolsPackWindowItemBts[i];
_toolsPackWindowItemBts.Remove(g);

View File

@ -22,8 +22,8 @@ namespace ToolsPack
{
GameObject toolsGame = MotionEngine.GetModule<ToolsPackManager>().GetToolsPack(btName,index);
toolsGame.SetActive(true);
MotionEngine.GetModule<ToolsPackManager>().DeleteToolsPack(btName);
MotionEngine.GetModule<ToolsPackManager>().DeleteToolsPackWindowItemBts(btName);
MotionEngine.GetModule<ToolsPackManager>().DeleteToolsPack(btName,index);
MotionEngine.GetModule<ToolsPackManager>().DeleteToolsPackWindowItemBts(btName,index);
});
}
@ -52,5 +52,10 @@ namespace ToolsPack
{
btNameText.gameObject.SetActive(false);
}
public int GetIndex()
{
return index;
}
}
}

View File

@ -1,8 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmplifyShaderEditor", "AmplifyShaderEditor.csproj", "{876d7bbd-6f78-6599-5008-d6ab40ab5602}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NaughtyAttributes.Core", "NaughtyAttributes.Core.csproj", "{b366c870-8269-aeae-4186-8220020279aa}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniTask.Linq", "UniTask.Linq.csproj", "{e8ea8a32-db36-1909-a8a7-26f06060f4d3}"
@ -34,8 +32,6 @@ Global
Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{876d7bbd-6f78-6599-5008-d6ab40ab5602}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{876d7bbd-6f78-6599-5008-d6ab40ab5602}.Debug|Any CPU.Build.0 = Debug|Any CPU
{b366c870-8269-aeae-4186-8220020279aa}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{b366c870-8269-aeae-4186-8220020279aa}.Debug|Any CPU.Build.0 = Debug|Any CPU
{e8ea8a32-db36-1909-a8a7-26f06060f4d3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU