修改完成人物检视逻辑

This commit is contained in:
YangHua 2024-08-20 19:46:44 +08:00
parent 885839a586
commit ee90d20e8e
18 changed files with 79 additions and 42 deletions

Binary file not shown.

View File

@ -7,7 +7,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: "\u5B89\u5168\u5E3D"
m_Name: "\u56FD\u7F51\u5B89\u5168\u5E3D"
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords:
- _SURFACE_TYPE_TRANSPARENT

View File

@ -20,7 +20,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: "\u7EB1\u5E03\u624B\u5957"
m_Name: "\u7EDD\u7F18\u624B\u5957"
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords:
- _EMISSION

View File

@ -20,7 +20,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: "\u5B89\u5168\u5E3D"
m_Name: "\u56FD\u7F51\u5B89\u5168\u5E3D"
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords:
- _EMISSION

View File

@ -7,7 +7,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: "\u7EB1\u5E03\u624B\u5957"
m_Name: "\u7EDD\u7F18\u624B\u5957"
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords:
- _EMISSION

View File

@ -137,6 +137,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ad9f843a32e8ae64589a09a12c9665b8, type: 3}
m_Name:
m_EditorClassIdentifier:
itemInfo: []
itemCloseBtn: {fileID: 3108141478781955695}
--- !u!1 &1287235293540347711
GameObject:
m_ObjectHideFlags: 0

View File

@ -626,7 +626,7 @@ PrefabInstance:
- target: {fileID: 8782376414673638281, guid: 69e264891bba88c4b87f73112f0b3c84, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: bf6b11f1a7c512745a24503e6af14f44, type: 2}
objectReference: {fileID: 2100000, guid: 5636cb61d4933e446ac7bf2ddecabf95, type: 2}
- target: {fileID: 8803340364929241480, guid: 69e264891bba88c4b87f73112f0b3c84, type: 3}
propertyPath: m_Layer
value: 6
@ -654,6 +654,21 @@ Transform:
m_CorrespondingSourceObject: {fileID: 1584437988020157986, guid: 69e264891bba88c4b87f73112f0b3c84, type: 3}
m_PrefabInstance: {fileID: 810725974}
m_PrefabAsset: {fileID: 0}
--- !u!4 &810725976 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4268823935262762977, guid: 69e264891bba88c4b87f73112f0b3c84, type: 3}
m_PrefabInstance: {fileID: 810725974}
m_PrefabAsset: {fileID: 0}
--- !u!4 &810725977 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2575655662766773950, guid: 69e264891bba88c4b87f73112f0b3c84, type: 3}
m_PrefabInstance: {fileID: 810725974}
m_PrefabAsset: {fileID: 0}
--- !u!4 &810725978 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 9023546900043378599, guid: 69e264891bba88c4b87f73112f0b3c84, type: 3}
m_PrefabInstance: {fileID: 810725974}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &860489968
PrefabInstance:
m_ObjectHideFlags: 0
@ -1041,7 +1056,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2528995886889388087, guid: c26cb815ef7c52f4790cfe113ed6566f, type: 3}
propertyPath: m_Name
value: "\u5DE5\u4F5C\u670D (1)"
value: "\u5DE5\u4F5C\u670D"
objectReference: {fileID: 0}
- target: {fileID: 2528995886889388087, guid: c26cb815ef7c52f4790cfe113ed6566f, type: 3}
propertyPath: m_IsActive
@ -1452,10 +1467,9 @@ MonoBehaviour:
- {fileID: 4762243372118872815}
- {fileID: 1943116163}
- {fileID: 1510720948}
headSlot: {fileID: 0}
bodySlot: {fileID: 0}
HandSlot: {fileID: 0}
isChange: 0
headSlot: {fileID: 810725978}
bodySlot: {fileID: 810725977}
HandSlot: {fileID: 810725976}
--- !u!1 &2090806849
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,9 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class TooRoomlMannger : MonoBehaviour
public class TooRoomlMannger : SingletonMono<TooRoomlMannger>
{
public BaseToolOrDevice[] allTMDs;
public Transform headSlot;
@ -11,7 +12,6 @@ public class TooRoomlMannger : MonoBehaviour
public Transform HandSlot;
private List<Material> _cancel; //帤援渴第窐ヶ
private List<Material> _wear; //援渴第窐ヶ
public bool isChange = false;
// Start is called before the first frame update
void Start()
{
@ -25,9 +25,11 @@ public class TooRoomlMannger : MonoBehaviour
tmd.GetInfo();
}
}
public void Wear(string equipName)
public void Wear(string equipName,bool isChange)
{
isChange = !isChange;
Material ma = null;
if (isChange)
{
@ -40,15 +42,18 @@ public class TooRoomlMannger : MonoBehaviour
switch (equipName)
{
case "安全帽":
case "国网安全帽":
headSlot.GetComponent<SkinnedMeshRenderer>().material = ma;
break;
case "馱釬督":
bodySlot.GetComponent<SkinnedMeshRenderer>().material = ma;
break;
case "纱布手套":
case "绝缘手套":
HandSlot.GetComponent<SkinnedMeshRenderer>().material = ma;
break;
case "绝缘靴":
Debug.Log("靴子");
break;
}
}

View File

@ -7,11 +7,10 @@ public class MirrorController : PermanentTriggerBase
protected override void OnMDown()
{
base.OnMDown();
GameManager.UIMgr.ShowPanel<UI_CheckMyselfPanel>(E_UI_Layer.Mid, (p) =>
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerID, true) == 0)
{
});
GameManager.UIMgr.ShowPanel<UI_CheckMyselfPanel>(E_UI_Layer.Mid);
}
}

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
@ -11,7 +12,7 @@ public class UI_CheckMyselfItem : BaseItem
public void Init(ItemInfo _itemInfo)
{
itemInfo = _itemInfo;
if(PacksackBagMgr.Instance.wearDic.ContainsKey(itemInfo.toolId))
if (PacksackBagMgr.Instance.wearDic.ContainsKey(itemInfo.toolId))
{
isOn = true;
tips.text = isOn ? "ÒÑ×°Åä" : "";
@ -24,9 +25,13 @@ public class UI_CheckMyselfItem : BaseItem
switch (btnName)
{
case "IconBtn":
isOn = !isOn;
tips.text = isOn ? "ÒÑ×°Åä" : "";
PacksackBagMgr.Instance.WearItemState(itemInfo, isOn);
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(itemInfo.triggerID, true) == 0)
{
isOn = !isOn;
tips.text = isOn ? "ÒÑ×°Åä" : "";
PacksackBagMgr.Instance.WearItemState(itemInfo, isOn);
TooRoomlMannger.Instance.Wear(itemInfo.toolName, isOn);
}
Debug.Log("IconBtn");
break;
case "UI_CheckMyselfItem":

View File

@ -3,13 +3,18 @@ using System.Collections.Generic;
using Sirenix.OdinInspector;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
{
public List<ItemInfo> itemInfo;
public Button itemCloseBtn;
public void Init(List<ItemInfo> _itemInfo)
{
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
{
itemCloseBtn.gameObject.SetActive(false);
}
GetControl<TextMeshProUGUI>("CountText").text = _itemInfo.Count.ToString();
itemInfo = _itemInfo;
}
@ -20,24 +25,20 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
switch (btnName)
{
case "ItemCloseBtn":
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
int counts = 0; ;
if (itemInfo.Count > 1)
{
int counts = 0; ;
if (itemInfo.Count > 1)
{
counts = itemInfo.Count - 1;
}
GameObject obj = Instantiate(itemInfo[counts].objPrefab);
obj.transform.position = itemInfo[counts].selfPosInToolRoom;
obj.name = itemInfo[counts].toolName;
obj.GetComponent<Tool_SelectComponent>().itemInfo = itemInfo[counts];
GameManager.PacksackBagMgr.RemoveOneToolOrMater(itemInfo[counts]);
itemInfo.Remove(itemInfo[counts]);
GetControl<TextMeshProUGUI>("CountText").text = itemInfo.Count.ToString();
if (itemInfo.Count == 0)
Destroy(gameObject);
counts = itemInfo.Count - 1;
}
GameObject obj = Instantiate(itemInfo[counts].objPrefab);
obj.transform.position = itemInfo[counts].selfPosInToolRoom;
obj.name = itemInfo[counts].toolName;
obj.GetComponent<Tool_SelectComponent>().itemInfo = itemInfo[counts];
GameManager.PacksackBagMgr.RemoveOneToolOrMater(itemInfo[counts]);
itemInfo.Remove(itemInfo[counts]);
GetControl<TextMeshProUGUI>("CountText").text = itemInfo.Count.ToString();
if (itemInfo.Count == 0)
Destroy(gameObject);
break;
case "UI_ToolOrMaterialsOrDeviceItem":
Debug.Log("ICon");

View File

@ -20,6 +20,6 @@ public class SingletonMono<T> : MonoBehaviour where T : MonoBehaviour
instance = this as T;
//我们挂载继承该单例模式基类的脚本后 依附的对象过场景时就不会被移除了
//就可以保证在游戏的整个生命周期中都存在
DontDestroyOnLoad(instance.gameObject);
//DontDestroyOnLoad(instance.gameObject);
}
}

View File

@ -217,6 +217,17 @@ public class EventCenter : BaseManager<EventCenter>
}
}
/// <summary>
/// 触发有参事件
/// </summary>
public void EventTrigger<T,D>(string eventName, T info)
{
if (eventDic.ContainsKey(eventName))
{
(eventDic[eventName] as EventInfo<T>).actions?.Invoke(info);
}
}
/// <summary>
/// 清空所有事件监听
/// </summary>