This commit is contained in:
yzx 2024-07-08 13:27:59 +08:00
parent 6b94bacf29
commit cb018229ce
3 changed files with 15 additions and 24 deletions

View File

@ -48,11 +48,9 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
private GameObject _toolsPackWindowTemp;
private ToolsPackScene _toolsPackScene;
// 定义一个委托类型
public delegate void StringEventHandler(string message);
// 定义一个事件,使用委托类型
public event StringEventHandler OnStringEvent;
// 触发事件的方法
@ -293,7 +291,6 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
/// <param name="index"></param>
public void DeleteToolsPackWindowItemBts(string toolName, int index)
{
List<GameObject> games = new List<GameObject>();
List<string> list = MotionEngine.GetModule<DataConfigManager>().GetToolsPackData(toolName);
if (list != null)
{
@ -313,19 +310,13 @@ public class ToolsPackManager : ModuleSingleton<ToolsPackManager>, IModule
{
toolspack.ReduceGameNumber();
GameObject g = _toolsPackWindowItemBts[i];
games.Add(g);
_toolsPackWindowItemBts.Remove(g);
UnityEngine.Object.Destroy(g);
}
}
}
}
foreach (var v in games)
{
_toolsPackWindowItemBts.Remove(v);
UnityEngine.Object.Destroy(v);
}
}
else
{

View File

@ -118,12 +118,17 @@ namespace ToolsPack
return _toolsPackWindowItemBtModels.Count - 1;
}
public int GetGameNumber()
{
return gameNumber;
}
/// <summary>
/// 添加物体堆叠数
/// </summary>
/// <param name="btName"></param>
/// <param name="index"></param>
public void AddGameNumber(string btName, int index)
{
gameNumber++;
@ -131,14 +136,9 @@ namespace ToolsPack
_toolsPackWindowItemBtModels.Add(index, btName);
}
// public void AddGameNumber(string btName, int index, ModelTypeEnum modelTypeEnum)
// {
// _modelTypeEnum = modelTypeEnum;
// gameNumber++;
// numberText.text = $"x{gameNumber.ToString()}";
// _toolsPackWindowItemBtModels.Add(index, btName);
// }
/// <summary>
/// 减去堆叠数
/// </summary>
public void ReduceGameNumber()
{
string na = this.gameObject.name;

View File

@ -187,7 +187,7 @@ namespace ToolsPack
ToolsPackWindowItemBtComponent btComponent = Instantiate(bt, content, false).GetComponent<ToolsPackWindowItemBtComponent>();
btComponent.name = to;
btComponent.Init(to, v.Key, lis.Index, lis.ModelTypeEnum);
_toolsNameTemp.Add(v.Key, btComponent);
_toolsNameTemp.Add(to, btComponent);
}
}
}