|
|
@@ -1,4 +1,5 @@
|
|
|
- using System.Collections;
|
|
|
+using QFramework;
|
|
|
+using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.IO;
|
|
|
using UnityEngine;
|
|
|
@@ -9,13 +10,31 @@ public class ToolConfigProxy : DataProxy
|
|
|
|
|
|
Dictionary<string,Sprite> m_DicToolSprites;
|
|
|
|
|
|
- public List<ToolConfigInfo> m_CurrentToolKitConfigInfos;
|
|
|
+ /// <summary>
|
|
|
+ /// 目前工具间里的已经选择的所有工具信息
|
|
|
+ /// </summary>
|
|
|
+ public List<ToolConfigInfo> m_CurrentToolRoomConfigInfos;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 临时缓存保存使用
|
|
|
+ /// </summary>
|
|
|
+ public List<ToolConfigInfo> m_TmpToolRoomConfigInfos;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 工具包中选择的工具
|
|
|
+ /// </summary>
|
|
|
+ private List<ToolConfigInfo> m_CurrentToolKitSelectToolConfigInfos;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 默认工具信息表加载路径
|
|
|
/// </summary>
|
|
|
string m_ToolConfigPath;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 目前题库类型
|
|
|
+ /// </summary>
|
|
|
+ public ToolLibraryType m_CurrentToolLibraryType;
|
|
|
+
|
|
|
public override void OnRegister()
|
|
|
{
|
|
|
base.OnRegister();
|
|
|
@@ -26,7 +45,11 @@ public class ToolConfigProxy : DataProxy
|
|
|
|
|
|
m_ToolConfigInfos = ExcelHelper.ReadInfoFromExcel<ToolConfigInfo>(m_ToolConfigPath, 1);
|
|
|
|
|
|
- m_CurrentToolKitConfigInfos = new List<ToolConfigInfo>();
|
|
|
+ m_TmpToolRoomConfigInfos = new List<ToolConfigInfo>();
|
|
|
+
|
|
|
+ m_CurrentToolRoomConfigInfos = new List<ToolConfigInfo>();
|
|
|
+
|
|
|
+ m_CurrentToolKitSelectToolConfigInfos = new List<ToolConfigInfo>();
|
|
|
}
|
|
|
|
|
|
public override void OnRemove()
|
|
|
@@ -36,6 +59,118 @@ public class ToolConfigProxy : DataProxy
|
|
|
m_ToolConfigInfos.Clear();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 从m_CurrentToolRoomConfigInfos中查找对应数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ToolConfigInfo GetToolConfigInfoFromCTRSTCIsById(int id)
|
|
|
+ {
|
|
|
+ return m_TmpToolRoomConfigInfos.Find(t => t.id == id.ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工具间中的所有数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<ToolConfigInfo> GetAllToolConfigInfoFromCTRSTCIs()
|
|
|
+ {
|
|
|
+ return m_CurrentToolRoomConfigInfos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 从m_CurrentToolRoomConfigInfos中查找并删除对应数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public bool RemoveToolConfigInfoFromCTRSTCIsById(int id)
|
|
|
+ {
|
|
|
+ ToolConfigInfo tmpConfigInfo = GetToolConfigInfoFromCTRSTCIsById(id);
|
|
|
+
|
|
|
+ if (tmpConfigInfo != null)
|
|
|
+ {
|
|
|
+ m_CurrentToolRoomConfigInfos.Remove(tmpConfigInfo);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 向m_CurrentToolRoomConfigInfos中添加数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="toolConfigInfo"></param>
|
|
|
+ public void AddToolConfigInfoToCTRSTCIs(ToolConfigInfo toolConfigInfo)
|
|
|
+ {
|
|
|
+ m_TmpToolRoomConfigInfos.Add(toolConfigInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 清除m_CurrentToolRoomConfigInfos数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="toolConfigInfo"></param>
|
|
|
+ public void ClearToolConfigInfoToCTRSTCIs()
|
|
|
+ {
|
|
|
+ m_TmpToolRoomConfigInfos.Clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 从m_CurrentToolKitSelectToolConfigInfos中查找对应数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ToolConfigInfo GetToolConfigInfoFromCTKSTCIsById(int id)
|
|
|
+ {
|
|
|
+ return m_CurrentToolKitSelectToolConfigInfos.Find(t => t.id == id.ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工具包中的所有数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<ToolConfigInfo> GetAllToolConfigInfoFromCTKSTCIs()
|
|
|
+ {
|
|
|
+ return m_CurrentToolKitSelectToolConfigInfos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 从m_CurrentToolKitSelectToolConfigInfos中查找并删除对应数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public bool RemoveToolConfigInfoFromCTKSTCIsById(int id)
|
|
|
+ {
|
|
|
+ ToolConfigInfo tmpConfigInfo = GetToolConfigInfoFromCTKSTCIsById(id);
|
|
|
+
|
|
|
+ if (tmpConfigInfo != null)
|
|
|
+ {
|
|
|
+ m_CurrentToolKitSelectToolConfigInfos.Remove(tmpConfigInfo);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 向m_CurrentToolKitSelectToolConfigInfos中添加数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="toolConfigInfo"></param>
|
|
|
+ public void AddToolConfigInfoToCTKSTCIs(ToolConfigInfo toolConfigInfo)
|
|
|
+ {
|
|
|
+ m_CurrentToolKitSelectToolConfigInfos.Add(toolConfigInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 清除m_CurrentToolKitSelectToolConfigInfos数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="toolConfigInfo"></param>
|
|
|
+ public void ClearToolConfigInfoToCTKSTCIs()
|
|
|
+ {
|
|
|
+ m_CurrentToolKitSelectToolConfigInfos.Clear();
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取所有的工具类型
|
|
|
/// </summary>
|
|
|
@@ -137,25 +272,24 @@ public class ToolConfigProxy : DataProxy
|
|
|
|
|
|
if (string.IsNullOrEmpty(toolName) && !string.IsNullOrEmpty(toolType))
|
|
|
{
|
|
|
- toolConfigInfos = GetToolConfigInfosByToolType(m_CurrentToolKitConfigInfos, toolType);
|
|
|
+ toolConfigInfos = GetToolConfigInfosByToolType(m_CurrentToolRoomConfigInfos, toolType);
|
|
|
}
|
|
|
else if (string.IsNullOrEmpty(toolType) && !string.IsNullOrEmpty(toolName))
|
|
|
{
|
|
|
- toolConfigInfos = GetToolConfigInfosByToolNameSearch(m_CurrentToolKitConfigInfos, toolName);
|
|
|
+ toolConfigInfos = GetToolConfigInfosByToolNameSearch(m_CurrentToolRoomConfigInfos, toolName);
|
|
|
}
|
|
|
else if (!string.IsNullOrEmpty(toolName) && !string.IsNullOrEmpty(toolType))
|
|
|
{
|
|
|
- toolConfigInfos = m_CurrentToolKitConfigInfos.FindAll(tool => tool.toolType == toolType && tool.toolName.Contains(toolName));
|
|
|
+ toolConfigInfos = m_CurrentToolRoomConfigInfos.FindAll(tool => tool.toolType == toolType && tool.toolName.Contains(toolName));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- toolConfigInfos = m_CurrentToolKitConfigInfos;
|
|
|
+ toolConfigInfos = m_CurrentToolRoomConfigInfos;
|
|
|
}
|
|
|
|
|
|
return toolConfigInfos;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 获取所有工具更具工具名的模糊搜索
|
|
|
/// </summary>
|
|
|
@@ -194,21 +328,13 @@ public class ToolConfigProxy : DataProxy
|
|
|
return m_ToolConfigInfos.Find(t => t.toolName == _toolName);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 设置工具背包的工具
|
|
|
- /// </summary>
|
|
|
- /// <param name="toolIds">工具信息ID</param>
|
|
|
- public void SetCurrrentToolKitToolConfigInfo(List<int> toolIds)
|
|
|
+ /// <summary>
|
|
|
+ /// 设置工具背包的工具
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="toolConfigInfos">工具信息</param>
|
|
|
+ public void SetCurrrentToolRoomToolConfigInfos(List<ToolConfigInfo> toolConfigInfos)
|
|
|
{
|
|
|
- m_CurrentToolKitConfigInfos = new List<ToolConfigInfo>();
|
|
|
-
|
|
|
- foreach (var id in toolIds)
|
|
|
- {
|
|
|
- ToolConfigInfo toolConfigInfo = new ToolConfigInfo();
|
|
|
-
|
|
|
- toolConfigInfo = GetTooConfigInfoById(id);
|
|
|
- m_CurrentToolKitConfigInfos.Add(toolConfigInfo);
|
|
|
- }
|
|
|
+ m_CurrentToolRoomConfigInfos = toolConfigInfos;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|