|
|
@@ -1,14 +1,17 @@
|
|
|
using QFramework;
|
|
|
+using Sirenix.Utilities;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.IO;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
using UnityEngine;
|
|
|
|
|
|
public class ToolConfigProxy : DataProxy
|
|
|
{
|
|
|
List<ToolConfigInfo> m_ToolConfigInfos;
|
|
|
|
|
|
- Dictionary<string,Sprite> m_DicToolSprites;
|
|
|
+ Dictionary<string, Sprite> m_DicToolSprites;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 目前工具间里的已经选择的所有工具信息
|
|
|
@@ -25,6 +28,12 @@ public class ToolConfigProxy : DataProxy
|
|
|
/// </summary>
|
|
|
private List<ToolConfigInfo> m_CurrentToolKitSelectToolConfigInfos;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 从场景拆解出来的物体
|
|
|
+ /// </summary>
|
|
|
+ private List<ToolConfigInfo> m_DisassembleObjs;
|
|
|
+
|
|
|
+ private List<ToolConfig> m_CurrentSelectDisassembleObjs;
|
|
|
/// <summary>
|
|
|
/// 默认工具信息表加载路径
|
|
|
/// </summary>
|
|
|
@@ -50,6 +59,24 @@ public class ToolConfigProxy : DataProxy
|
|
|
m_CurrentToolRoomConfigInfos = new List<ToolConfigInfo>();
|
|
|
|
|
|
m_CurrentToolKitSelectToolConfigInfos = new List<ToolConfigInfo>();
|
|
|
+
|
|
|
+ m_DisassembleObjs = new List<ToolConfigInfo>();
|
|
|
+
|
|
|
+ m_CurrentSelectDisassembleObjs = new List<ToolConfig>();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void RefrushCurrentSelectDisassembleObjs(List<ToolConfig> list)
|
|
|
+ {
|
|
|
+ m_CurrentSelectDisassembleObjs = list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取当前拆解选中物体
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<ToolConfig> GetCurrentSelectDisassembleObjs()
|
|
|
+ {
|
|
|
+ return m_CurrentSelectDisassembleObjs;
|
|
|
}
|
|
|
|
|
|
public override void OnRemove()
|
|
|
@@ -75,6 +102,39 @@ public class ToolConfigProxy : DataProxy
|
|
|
/// <returns></returns>
|
|
|
public List<ToolConfigInfo> GetAllToolConfigInfoFromCTRSTCIs()
|
|
|
{
|
|
|
+ switch (OperateSetting.Instance.m_CurrentOperationMode)
|
|
|
+ {
|
|
|
+ case OperationMode.Learn:
|
|
|
+ case OperationMode.Practice:
|
|
|
+ case OperationMode.Exam:
|
|
|
+ case OperationMode.Challenge:
|
|
|
+ case OperationMode.None:
|
|
|
+ return m_CurrentToolRoomConfigInfos;
|
|
|
+ case OperationMode.FreeParctice:
|
|
|
+ case OperationMode.FreeExam:
|
|
|
+ if (m_CurrentToolLibraryType == ToolLibraryType.ToolKit)
|
|
|
+ {
|
|
|
+ List<ToolConfigInfo> tmpToolConfigs = new List<ToolConfigInfo>();
|
|
|
+ tmpToolConfigs.AddRange(m_CurrentToolRoomConfigInfos);
|
|
|
+ tmpToolConfigs.AddRange(m_DisassembleObjs);
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ foreach (var item in tmpToolConfigs)
|
|
|
+ {
|
|
|
+ sb.Append(item.toolName);
|
|
|
+ }
|
|
|
+ sb.AppendLine("--");
|
|
|
+ foreach (var item in m_DisassembleObjs)
|
|
|
+ {
|
|
|
+ sb.Append(item.toolName);
|
|
|
+ }
|
|
|
+ Debug.Log(sb.ToString());
|
|
|
+ return tmpToolConfigs;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return m_CurrentToolRoomConfigInfos;
|
|
|
+ }
|
|
|
+ }
|
|
|
return m_CurrentToolRoomConfigInfos;
|
|
|
}
|
|
|
|
|
|
@@ -94,7 +154,7 @@ public class ToolConfigProxy : DataProxy
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -115,6 +175,31 @@ public class ToolConfigProxy : DataProxy
|
|
|
m_TmpToolRoomConfigInfos.Clear();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 向m_CurrentToolRoomConfigInfos中添加数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="toolConfigInfo"></param>
|
|
|
+ public void AddToolConfigInfoToAssembleObjs(ToolConfigInfo toolConfigInfo)
|
|
|
+ {
|
|
|
+ if (m_DisassembleObjs.Where(s => s.toolName == toolConfigInfo.toolName).Count() == 0)
|
|
|
+ {
|
|
|
+ m_DisassembleObjs.Add(toolConfigInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 向m_CurrentToolRoomConfigInfos中添加数据信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="toolConfigInfo"></param>
|
|
|
+ public void RemoveToolConfigInfoToAssembleObjs(ToolConfig toolConfig)
|
|
|
+ {
|
|
|
+ if (m_DisassembleObjs.Where(s => s.toolName == toolConfig.toolName).Count() >= 0)
|
|
|
+ {
|
|
|
+ foreach (var item in m_DisassembleObjs.Where(s => s.toolName == toolConfig.toolName).ToArray())
|
|
|
+ {
|
|
|
+ m_DisassembleObjs.Remove(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 从m_CurrentToolKitSelectToolConfigInfos中查找对应数据信息
|
|
|
/// </summary>
|
|
|
@@ -221,12 +306,12 @@ public class ToolConfigProxy : DataProxy
|
|
|
/// </summary>
|
|
|
/// <param name="toolType"></param>
|
|
|
/// <returns></returns>
|
|
|
- public List<ToolConfigInfo> GetToolConfigInfosByToolType(List<ToolConfigInfo> toolConfigInfos,string toolType)
|
|
|
+ public List<ToolConfigInfo> GetToolConfigInfosByToolType(List<ToolConfigInfo> toolConfigInfos, string toolType)
|
|
|
{
|
|
|
- List<ToolConfigInfo> tmpList = new List<ToolConfigInfo>();
|
|
|
+ List<ToolConfigInfo> tmpList = new List<ToolConfigInfo>();
|
|
|
|
|
|
if (toolConfigInfos != null) tmpList = toolConfigInfos.FindAll(tool => tool.toolType == toolType);
|
|
|
-
|
|
|
+
|
|
|
return tmpList;
|
|
|
}
|
|
|
|
|
|
@@ -236,7 +321,7 @@ public class ToolConfigProxy : DataProxy
|
|
|
/// <param name="toolType"></param>
|
|
|
/// <param name="toolName"></param>
|
|
|
/// <returns></returns>
|
|
|
- public List<ToolConfigInfo> GetToolConfigInfosByToolTypeAndName(string toolType,string toolName)
|
|
|
+ public List<ToolConfigInfo> GetToolConfigInfosByToolTypeAndName(string toolType, string toolName)
|
|
|
{
|
|
|
List<ToolConfigInfo> toolConfigInfos = new List<ToolConfigInfo>();
|
|
|
|
|
|
@@ -246,7 +331,7 @@ public class ToolConfigProxy : DataProxy
|
|
|
}
|
|
|
else if (string.IsNullOrEmpty(toolType) && !string.IsNullOrEmpty(toolName))
|
|
|
{
|
|
|
- toolConfigInfos = GetToolConfigInfosByToolNameSearch(m_ToolConfigInfos,toolName);
|
|
|
+ toolConfigInfos = GetToolConfigInfosByToolNameSearch(m_ToolConfigInfos, toolName);
|
|
|
}
|
|
|
else if (!string.IsNullOrEmpty(toolName) && !string.IsNullOrEmpty(toolType))
|
|
|
{
|
|
|
@@ -256,7 +341,7 @@ public class ToolConfigProxy : DataProxy
|
|
|
{
|
|
|
toolConfigInfos = GetAllToolConfigInfos();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return toolConfigInfos;
|
|
|
}
|
|
|
|
|
|
@@ -272,19 +357,26 @@ public class ToolConfigProxy : DataProxy
|
|
|
|
|
|
if (string.IsNullOrEmpty(toolName) && !string.IsNullOrEmpty(toolType))
|
|
|
{
|
|
|
- toolConfigInfos = GetToolConfigInfosByToolType(m_CurrentToolRoomConfigInfos, toolType);
|
|
|
+ toolConfigInfos.AddRange(GetToolConfigInfosByToolType(m_CurrentToolRoomConfigInfos, toolType));
|
|
|
+
|
|
|
+ toolConfigInfos.AddRange(GetToolConfigInfosByToolType(m_DisassembleObjs, toolType));
|
|
|
}
|
|
|
else if (string.IsNullOrEmpty(toolType) && !string.IsNullOrEmpty(toolName))
|
|
|
{
|
|
|
- toolConfigInfos = GetToolConfigInfosByToolNameSearch(m_CurrentToolRoomConfigInfos, toolName);
|
|
|
+ toolConfigInfos.AddRange(GetToolConfigInfosByToolNameSearch(m_CurrentToolRoomConfigInfos, toolName));
|
|
|
+
|
|
|
+ toolConfigInfos.AddRange(GetToolConfigInfosByToolNameSearch(m_DisassembleObjs, toolName));
|
|
|
}
|
|
|
else if (!string.IsNullOrEmpty(toolName) && !string.IsNullOrEmpty(toolType))
|
|
|
{
|
|
|
- toolConfigInfos = m_CurrentToolRoomConfigInfos.FindAll(tool => tool.toolType == toolType && tool.toolName.Contains(toolName));
|
|
|
+ toolConfigInfos.AddRange(m_CurrentToolRoomConfigInfos.FindAll(tool => tool.toolType == toolType && tool.toolName.Contains(toolName)));
|
|
|
+
|
|
|
+ toolConfigInfos.AddRange(m_DisassembleObjs.FindAll(tool => tool.toolType == toolType && tool.toolName.Contains(toolName)));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- toolConfigInfos = m_CurrentToolRoomConfigInfos;
|
|
|
+ toolConfigInfos.AddRange(m_CurrentToolRoomConfigInfos);
|
|
|
+ toolConfigInfos.AddRange(m_DisassembleObjs);
|
|
|
}
|
|
|
|
|
|
return toolConfigInfos;
|
|
|
@@ -346,7 +438,7 @@ public class ToolConfigProxy : DataProxy
|
|
|
{
|
|
|
Sprite sprite = null;
|
|
|
|
|
|
- if (m_DicToolSprites.TryGetValue(toolName,out sprite))
|
|
|
+ if (m_DicToolSprites.TryGetValue(toolName, out sprite))
|
|
|
{
|
|
|
return sprite;
|
|
|
}
|
|
|
@@ -356,7 +448,7 @@ public class ToolConfigProxy : DataProxy
|
|
|
|
|
|
sprite = LoadHelper.LoadSpriteFromStreamming(tmpPath);
|
|
|
|
|
|
- if (sprite != null)
|
|
|
+ if (sprite != null)
|
|
|
{
|
|
|
m_DicToolSprites.Add(toolName, sprite);
|
|
|
}
|