修改背包逻辑
This commit is contained in:
parent
c6f4b2eeeb
commit
e9f71f53c5
|
@ -611,7 +611,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
selfObj: {fileID: 0}
|
||||
objPrefab: {fileID: 6621331633947903829}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!114 &2468428323860960022
|
||||
MonoBehaviour:
|
||||
|
|
|
@ -66,7 +66,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
selfObj: {fileID: 0}
|
||||
objPrefab: {fileID: 2557768358979172439}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!114 &2186571632370376101
|
||||
MonoBehaviour:
|
||||
|
|
|
@ -65,6 +65,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 1
|
||||
objPrefab: {fileID: 8642374616707477856}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!114 &2906462593900441407
|
||||
MonoBehaviour:
|
||||
|
|
|
@ -65,6 +65,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
objPrefab: {fileID: 2528995886889388087}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!114 &2397141117729196589
|
||||
MonoBehaviour:
|
||||
|
|
|
@ -148,6 +148,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
objPrefab: {fileID: 3700622895044939927}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!114 &9159459832370388555
|
||||
MonoBehaviour:
|
||||
|
|
|
@ -504,6 +504,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
objPrefab: {fileID: 7670065417942988621}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!65 &3014182739139812810
|
||||
BoxCollider:
|
||||
|
|
|
@ -53,6 +53,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
objPrefab: {fileID: 3005425371173972425}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!65 &5298069477168308409
|
||||
BoxCollider:
|
||||
|
|
|
@ -65,6 +65,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
objPrefab: {fileID: 1776503018750407771}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!114 &2357552334371453598
|
||||
MonoBehaviour:
|
||||
|
|
|
@ -54,7 +54,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
selfObj: {fileID: 0}
|
||||
objPrefab: {fileID: 7175692158753146328}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!65 &2292098275725943769
|
||||
BoxCollider:
|
||||
|
|
|
@ -52,6 +52,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
objPrefab: {fileID: 3945920568849990411}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!65 &7642060814474931475
|
||||
BoxCollider:
|
||||
|
|
|
@ -53,7 +53,8 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
selfObj: {fileID: 0}
|
||||
objPrefab: {fileID: 3648551727639942988}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
_highlight: {fileID: 0}
|
||||
--- !u!65 &2828524944087783442
|
||||
BoxCollider:
|
||||
|
|
|
@ -12,12 +12,12 @@ GameObject:
|
|||
- component: {fileID: 4721816915586039359}
|
||||
- component: {fileID: 7491023694202728592}
|
||||
m_Layer: 5
|
||||
m_Name: CountText
|
||||
m_Name: TipsText
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8986047229568511319
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -33,11 +33,11 @@ RectTransform:
|
|||
m_Father: {fileID: 3711049640330397891}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: -10, y: 12}
|
||||
m_SizeDelta: {x: 20, y: 24}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -7.1, y: -7.1}
|
||||
m_SizeDelta: {x: 41.1713, y: 19.6763}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &4721816915586039359
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -66,10 +66,10 @@ MonoBehaviour:
|
|||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 10
|
||||
m_text:
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontAsset: {fileID: 11400000, guid: f8ef5cb2ab4d4da4093d3fe60f978c99, type: 2}
|
||||
m_sharedMaterial: {fileID: -4829118149068189727, guid: f8ef5cb2ab4d4da4093d3fe60f978c99, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
|
@ -93,8 +93,8 @@ MonoBehaviour:
|
|||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 16
|
||||
m_fontSizeBase: 16
|
||||
m_fontSize: 12
|
||||
m_fontSizeBase: 12
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
|
@ -146,7 +146,6 @@ GameObject:
|
|||
- component: {fileID: 3711049640330397891}
|
||||
- component: {fileID: 8078226639558209602}
|
||||
- component: {fileID: 3944633717089808067}
|
||||
- component: {fileID: 8050215455937781931}
|
||||
- component: {fileID: 7488210369510801467}
|
||||
m_Layer: 5
|
||||
m_Name: UI_CheckMyselfItem
|
||||
|
@ -205,7 +204,7 @@ MonoBehaviour:
|
|||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: c440f35582c13154db88b809ccce0758, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: eb6b790132cb6814299359ccbafbb3db, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
|
@ -215,50 +214,6 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &8050215455937781931
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7984153428917771150}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 3944633717089808067}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &7488210369510801467
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -276,7 +231,10 @@ MonoBehaviour:
|
|||
triggerID: 0
|
||||
toolName:
|
||||
toolOrDeviceOrMaterial: 0
|
||||
selfObj: {fileID: 0}
|
||||
objPrefab: {fileID: 0}
|
||||
selfPosInToolRoom: {x: 0, y: 0, z: 0}
|
||||
tips: {fileID: 7491023694202728592}
|
||||
isOn: 0
|
||||
--- !u!1 &8746938320234467046
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -290,12 +248,12 @@ GameObject:
|
|||
- component: {fileID: 8192472674953986160}
|
||||
- component: {fileID: 4871810231244820406}
|
||||
m_Layer: 5
|
||||
m_Name: ItemCloseBtn
|
||||
m_Name: IconBtn
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2341971459522957585
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -313,8 +271,8 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 51, y: 46}
|
||||
m_SizeDelta: {x: 14, y: 14}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 104.673996, y: 104.673996}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2534980939409269878
|
||||
CanvasRenderer:
|
||||
|
@ -344,7 +302,7 @@ MonoBehaviour:
|
|||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 63cd4070754e8fd4da758c87db957b35, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: c440f35582c13154db88b809ccce0758, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
|
|
|
@ -8,14 +8,14 @@ using UnityEngine;
|
|||
public class PacksackBagMgr : BaseManager<PacksackBagMgr>
|
||||
{
|
||||
//包里用了哪些工器具
|
||||
private readonly Dictionary<ItemInfo, List<ItemInfo>> toolAndMaterialDic = new Dictionary<ItemInfo, List<ItemInfo>>();
|
||||
|
||||
private readonly Dictionary<int, List<ItemInfo>> toolAndMaterialDic = new Dictionary<int, List<ItemInfo>>();
|
||||
public Dictionary<int, ItemInfo> wearDic = new Dictionary<int, ItemInfo>();
|
||||
|
||||
private PacksackBagMgr()
|
||||
{
|
||||
}
|
||||
|
||||
public Dictionary<ItemInfo, List<ItemInfo>> GetCurrentBagData()
|
||||
public Dictionary<int, List<ItemInfo>> GetCurrentBagData()
|
||||
{
|
||||
return toolAndMaterialDic;
|
||||
}
|
||||
|
@ -27,32 +27,36 @@ public class PacksackBagMgr : BaseManager<PacksackBagMgr>
|
|||
/// <param name="name"></param>
|
||||
public void AddOneToolOrMater(ItemInfo itemInfo)
|
||||
{
|
||||
if (toolAndMaterialDic.ContainsKey(itemInfo))
|
||||
if (toolAndMaterialDic.ContainsKey(itemInfo.toolId))
|
||||
{
|
||||
toolAndMaterialDic[itemInfo].Add(itemInfo);
|
||||
toolAndMaterialDic[itemInfo.toolId].Add(itemInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolAndMaterialDic.Add(itemInfo, new List<ItemInfo>() { itemInfo });
|
||||
toolAndMaterialDic.Add(itemInfo.toolId, new List<ItemInfo>() { itemInfo });
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<ItemInfo, List<ItemInfo>> GetItemsByE_TMDType(E_ToolOrDeviceOrMaterials tmdTpye)
|
||||
public Dictionary<int, List<ItemInfo>> GetItemsByE_TMDType(E_ToolOrDeviceOrMaterials tmdTpye)
|
||||
{
|
||||
Dictionary<ItemInfo, List<ItemInfo>> tempNew = new Dictionary<ItemInfo, List<ItemInfo>>();
|
||||
Dictionary<int, List<ItemInfo>> tempNew = new Dictionary<int, List<ItemInfo>>();
|
||||
|
||||
var dicTemp = GetCurrentBagData();
|
||||
var dicTemp = toolAndMaterialDic;
|
||||
foreach (var item in dicTemp.Keys)
|
||||
{
|
||||
if (item.toolOrDeviceOrMaterial == tmdTpye)
|
||||
for (int i = 0; i < dicTemp[item].Count; i++)
|
||||
{
|
||||
if (tempNew.ContainsKey(item))
|
||||
if (dicTemp[item][i].toolOrDeviceOrMaterial == tmdTpye)
|
||||
{
|
||||
tempNew[item].Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempNew.Add(item, new List<ItemInfo>() { item });
|
||||
|
||||
if (tempNew.ContainsKey(dicTemp[item][i].toolId))
|
||||
{
|
||||
tempNew[dicTemp[item][i].toolId].Add(dicTemp[item][i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempNew.Add(dicTemp[item][i].toolId, new List<ItemInfo>() { dicTemp[item][i] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,22 +68,48 @@ public class PacksackBagMgr : BaseManager<PacksackBagMgr>
|
|||
/// 移除一个工器具或材料
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
public bool RemoveOneToolOrMater(ItemInfo itemInfo, ref int count)
|
||||
public void RemoveOneToolOrMater(ItemInfo itemInfo)
|
||||
{
|
||||
if (toolAndMaterialDic.ContainsKey(itemInfo))
|
||||
if (toolAndMaterialDic.ContainsKey(itemInfo.toolId))
|
||||
{
|
||||
if (toolAndMaterialDic[itemInfo].Count > 1)
|
||||
if (toolAndMaterialDic[itemInfo.toolId].Count > 1)
|
||||
{
|
||||
toolAndMaterialDic[itemInfo].Remove(itemInfo);
|
||||
count = toolAndMaterialDic[itemInfo].Count;
|
||||
return true;
|
||||
toolAndMaterialDic[itemInfo.toolId].Remove(itemInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolAndMaterialDic.Remove(itemInfo);
|
||||
return false;
|
||||
toolAndMaterialDic.Remove(itemInfo.toolId);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 移除多个
|
||||
/// </summary>
|
||||
/// <param name="itemInfo"></param>
|
||||
public void RemoveAllToolOrMater(ItemInfo itemInfo)
|
||||
{
|
||||
if (toolAndMaterialDic.ContainsKey(itemInfo.toolId))
|
||||
{
|
||||
toolAndMaterialDic.Remove(itemInfo.toolId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加 穿戴 状态 0 去掉 1 穿上
|
||||
/// </summary>
|
||||
/// <param name="itemInfo"></param>
|
||||
/// <param name="state"></param>
|
||||
public void WearItemState(ItemInfo itemInfo, bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
if (!wearDic.ContainsKey(itemInfo.toolId))
|
||||
wearDic.Add(itemInfo.toolId, itemInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wearDic.ContainsKey(itemInfo.toolId))
|
||||
wearDic.Remove(itemInfo.toolId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,53 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class TooRoomlMannger : MonoBehaviour
|
||||
{
|
||||
public BaseToolOrDevice[] allTMDs;
|
||||
public Transform headSlot;
|
||||
public Transform bodySlot;
|
||||
public Transform HandSlot;
|
||||
private List<Material> _cancel; //未穿戴材质球
|
||||
private List<Material> _wear; //穿戴材质球
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
_cancel = new List<Material>();
|
||||
_wear = new List<Material>();
|
||||
|
||||
_cancel = Resources.LoadAll<Material>("Materials/CharacterEquip/Cancel").ToList();
|
||||
_wear = Resources.LoadAll<Material>("Materials/CharacterEquip/Wear").ToList();
|
||||
foreach (var tmd in allTMDs)
|
||||
{
|
||||
tmd.GetInfo();
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
public void Wear(string equipName, bool ischange)
|
||||
{
|
||||
Material ma = null;
|
||||
if (ischange)
|
||||
{
|
||||
ma = _wear.SingleOrDefault(s => s.name == equipName);
|
||||
}
|
||||
else
|
||||
{
|
||||
ma = _cancel.SingleOrDefault(s => s.name == equipName);
|
||||
}
|
||||
|
||||
switch (equipName)
|
||||
{
|
||||
case "安全帽":
|
||||
headSlot.GetComponent<SkinnedMeshRenderer>().material = ma;
|
||||
break;
|
||||
case "工作服":
|
||||
bodySlot.GetComponent<SkinnedMeshRenderer>().material = ma;
|
||||
break;
|
||||
case "纱布手套":
|
||||
HandSlot.GetComponent<SkinnedMeshRenderer>().material = ma;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ public class ItemInfo
|
|||
public int triggerID;
|
||||
public string toolName;
|
||||
public E_ToolOrDeviceOrMaterials toolOrDeviceOrMaterial;
|
||||
public GameObject selfObj;
|
||||
public GameObject objPrefab;
|
||||
public Vector3 selfPosInToolRoom;
|
||||
}
|
||||
/// <summary>
|
||||
/// 工具或者材料基类,此脚本必须挂在工具或者材料上
|
||||
|
@ -42,8 +43,9 @@ public abstract class BaseToolOrDevice : MonoBehaviour
|
|||
itemInfo.triggerID = dTMD.id;
|
||||
itemInfo.toolName = dTMD.objName;
|
||||
itemInfo.toolOrDeviceOrMaterial = (E_ToolOrDeviceOrMaterials)dTMD.type;
|
||||
itemInfo.selfObj = this.gameObject;
|
||||
gameObject.SetActive(true);
|
||||
itemInfo.objPrefab = Resources.Load<GameObject>("Prefabs/Objects/Tools/" + gameObject.name);
|
||||
itemInfo.selfPosInToolRoom = transform.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -51,6 +53,7 @@ public abstract class BaseToolOrDevice : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
if (GameManager.RunModelMgr.SceneType != E_SceneType.ToolRoom) return;
|
||||
|
|
|
@ -9,25 +9,21 @@ public class Tool_SelectComponent : BaseToolOrDevice
|
|||
{
|
||||
base.OnEnter();
|
||||
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
|
||||
GameManager.UIMgr.ShowPanel<ItemTips>(E_UI_Layer.System, (panel) =>
|
||||
{
|
||||
panel.Init(gameObject.name, pos);
|
||||
});
|
||||
//GameManager.UIMgr.ShowPanel<ItemTips>(E_UI_Layer.System, (panel) =>
|
||||
//{
|
||||
// panel.Init(gameObject.name, pos);
|
||||
//});
|
||||
///¸ßÁÁ
|
||||
_highlight.highlighted = true;
|
||||
}
|
||||
public override void OnDown()
|
||||
{
|
||||
base.OnDown();
|
||||
////렴흙교관
|
||||
//묏야츰냔뵨묏야렴흙묏야움
|
||||
|
||||
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(itemInfo.triggerID, true) == 0)
|
||||
{
|
||||
GameManager.PacksackBagMgr.AddOneToolOrMater(itemInfo);
|
||||
_highlight.highlighted = false;
|
||||
gameObject.SetActive(false);
|
||||
GameManager.UIMgr.HidePanel<ItemTips>();//ÌáÊ¾Ãæ°å
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,13 +34,4 @@ public class Tool_SelectComponent : BaseToolOrDevice
|
|||
base.OnExit();
|
||||
_highlight.highlighted = false;
|
||||
}
|
||||
|
||||
[Button]
|
||||
public void TestAddOne()
|
||||
{
|
||||
GameManager.PacksackBagMgr.AddOneToolOrMater(itemInfo);
|
||||
_highlight.highlighted = false;
|
||||
gameObject.SetActive(false);
|
||||
GameManager.UIMgr.HidePanel<ItemTips>();//瓊刻충겼
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,16 @@ using UnityEngine;
|
|||
public class UI_CheckMyselfItem : BaseItem
|
||||
{
|
||||
public ItemInfo itemInfo;
|
||||
public TextMeshProUGUI tips;
|
||||
public bool isOn = false;
|
||||
public void Init(ItemInfo _itemInfo)
|
||||
{
|
||||
itemInfo = _itemInfo;
|
||||
if(PacksackBagMgr.Instance.wearDic.ContainsKey(itemInfo.toolId))
|
||||
{
|
||||
isOn = true;
|
||||
tips.text = isOn ? "ÒÑ×°Åä" : "";
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClick(string btnName)
|
||||
|
@ -16,21 +23,11 @@ public class UI_CheckMyselfItem : BaseItem
|
|||
base.OnClick(btnName);
|
||||
switch (btnName)
|
||||
{
|
||||
case "ItemCloseBtn":
|
||||
if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
|
||||
{
|
||||
int count = 0;
|
||||
if (!GameManager.PacksackBagMgr.RemoveOneToolOrMater(itemInfo, ref count))
|
||||
{
|
||||
itemInfo.selfObj.SetActive(true);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
GetControl<TextMeshProUGUI>("CountText").text = count.ToString();
|
||||
}
|
||||
}
|
||||
case "IconBtn":
|
||||
isOn = !isOn;
|
||||
tips.text = isOn ? "ÒÑ×°Åä" : "";
|
||||
PacksackBagMgr.Instance.WearItemState(itemInfo, isOn);
|
||||
Debug.Log("IconBtn");
|
||||
break;
|
||||
case "UI_CheckMyselfItem":
|
||||
Debug.Log("UI_CheckMyselfItem");
|
||||
|
|
|
@ -6,11 +6,11 @@ using UnityEngine;
|
|||
|
||||
public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
|
||||
{
|
||||
public ItemInfo itemInfo;
|
||||
public List<ItemInfo> itemInfo;
|
||||
|
||||
public void Init(ItemInfo _itemInfo, int count)
|
||||
public void Init(List<ItemInfo> _itemInfo)
|
||||
{
|
||||
GetControl<TextMeshProUGUI>("CountText").text = count.ToString();
|
||||
GetControl<TextMeshProUGUI>("CountText").text = _itemInfo.Count.ToString();
|
||||
itemInfo = _itemInfo;
|
||||
}
|
||||
|
||||
|
@ -22,17 +22,21 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
|
|||
case "ItemCloseBtn":
|
||||
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
|
||||
{
|
||||
int count = 0;
|
||||
if (!GameManager.PacksackBagMgr.RemoveOneToolOrMater(itemInfo, ref count))
|
||||
int counts = 0; ;
|
||||
if (itemInfo.Count > 1)
|
||||
{
|
||||
itemInfo.selfObj.SetActive(true);
|
||||
Destroy(gameObject);
|
||||
counts = itemInfo.Count - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
GetControl<TextMeshProUGUI>("CountText").text = count.ToString();
|
||||
}
|
||||
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":
|
||||
|
@ -40,23 +44,4 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[Button]
|
||||
public void TestRemoveOne()
|
||||
{
|
||||
if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
|
||||
{
|
||||
int count = 0;
|
||||
if (!GameManager.PacksackBagMgr.RemoveOneToolOrMater(itemInfo, ref count))
|
||||
{
|
||||
itemInfo.selfObj.SetActive(true);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
GetControl<TextMeshProUGUI>("CountText").text = count.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ using UnityEngine.UI;
|
|||
|
||||
public class UI_CheckMyselfPanel : BasePanel
|
||||
{
|
||||
private string[] validToolNames = { "国网安全帽", "绝缘手套", "绝缘靴", "工作服" };
|
||||
private int[] validToolNames = { 5008, 5010, 5011, 5009 };
|
||||
public RectTransform _content;
|
||||
public UI_CheckMyselfItem ui_CheckMySelfItem;
|
||||
|
||||
|
@ -16,14 +16,13 @@ public class UI_CheckMyselfPanel : BasePanel
|
|||
public override void ShowMe()
|
||||
{
|
||||
var currentBagDataForTool = GameManager.PacksackBagMgr.GetItemsByE_TMDType(E_ToolOrDeviceOrMaterials.Tool);
|
||||
var _content = GetControl<ScrollRect>("itemScrollView").content;
|
||||
|
||||
foreach (var item in currentBagDataForTool.Keys)
|
||||
{
|
||||
if (validToolNames.Contains(item.toolName))
|
||||
if (validToolNames.Contains(item))
|
||||
{
|
||||
UI_CheckMyselfItem cItem = Instantiate(ui_CheckMySelfItem, _content);
|
||||
cItem.Init(item);
|
||||
cItem.Init(currentBagDataForTool[item][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ using UnityEngine.UI;
|
|||
|
||||
public class UI_ToolAndMaterialPanel : BasePanel
|
||||
{
|
||||
private Dictionary<ItemInfo, List<ItemInfo>> bagDatas;
|
||||
private Dictionary<int, List<ItemInfo>> bagDatas;
|
||||
public RectTransform _content;
|
||||
public UI_ToolOrMaterialsOrDeviceItem ui_TmdItem;
|
||||
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class UI_ToolAndMaterialPanel : BasePanel
|
|||
|
||||
private void CreatItem(E_ToolOrDeviceOrMaterials tmdTpye)
|
||||
{
|
||||
if(_content.transform.childCount > 0)
|
||||
if (_content.transform.childCount > 0)
|
||||
{
|
||||
for (int i = 0; i < _content.transform.childCount; i++)
|
||||
{
|
||||
|
@ -36,11 +36,19 @@ public class UI_ToolAndMaterialPanel : BasePanel
|
|||
}
|
||||
|
||||
bagDatas = GameManager.PacksackBagMgr.GetItemsByE_TMDType(tmdTpye);
|
||||
var wearInfo = PacksackBagMgr.Instance.wearDic;
|
||||
|
||||
foreach (var item in bagDatas.Keys)
|
||||
{
|
||||
UI_ToolOrMaterialsOrDeviceItem uiTMDitem = Instantiate(ui_TmdItem, _content);
|
||||
uiTMDitem.Init(item, bagDatas[item].Count);
|
||||
if (!wearInfo.ContainsKey(item))
|
||||
{
|
||||
UI_ToolOrMaterialsOrDeviceItem uiTMDitem = Instantiate(ui_TmdItem, _content);
|
||||
uiTMDitem.Init(bagDatas[item]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void OnChangeToggle(string toogleName, bool isOn)
|
||||
|
|
|
@ -15,15 +15,20 @@ public class OfficeTimelineControl : MonoBehaviour
|
|||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
playerController.SetActive(false);
|
||||
mPlayableDirector = GetComponent<PlayableDirector>();
|
||||
mPlayableDirector.Stop();
|
||||
mPlayableDirector.stopped += OnPlayableDirectorStopped;
|
||||
playerModel = transform.GetChild(0).gameObject;
|
||||
StartTimeline(); //TODO 这里先掉一下,后续应该流程控制的时候触发调用
|
||||
//GameManager.EventMgr.AddEventListener();
|
||||
//playerController.SetActive(false);
|
||||
//mPlayableDirector = GetComponent<PlayableDirector>();
|
||||
//mPlayableDirector.Stop();
|
||||
//mPlayableDirector.stopped += OnPlayableDirectorStopped;
|
||||
//playerModel = transform.GetChild(0).gameObject;
|
||||
//StartTimeline(); //TODO 这里先掉一下,后续应该流程控制的时候触发调用
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown("p"))
|
||||
{
|
||||
OnPlayableDirectorStopped(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartTimeline()
|
||||
{
|
||||
mPlayableDirector.Play();
|
||||
|
@ -31,11 +36,11 @@ public class OfficeTimelineControl : MonoBehaviour
|
|||
|
||||
private void OnPlayableDirectorStopped(PlayableDirector aDirector)
|
||||
{
|
||||
if (mPlayableDirector == aDirector)
|
||||
{
|
||||
GameManager.EventMgr.EventTrigger(Enum_EventType.OfficeTimeLineOver);
|
||||
Invoke("DestroyPlayer", 1f);
|
||||
}
|
||||
//if (mPlayableDirector == aDirector)
|
||||
//{
|
||||
GameManager.EventMgr.EventTrigger(Enum_EventType.OfficeTimeLineOver);
|
||||
Invoke("DestroyPlayer", 1f);
|
||||
//}
|
||||
}
|
||||
|
||||
private void DestroyPlayer()
|
||||
|
@ -48,6 +53,6 @@ public class OfficeTimelineControl : MonoBehaviour
|
|||
|
||||
void OnDestroy()
|
||||
{
|
||||
mPlayableDirector.stopped -= OnPlayableDirectorStopped;
|
||||
//mPlayableDirector.stopped -= OnPlayableDirectorStopped;
|
||||
}
|
||||
}
|
|
@ -735,7 +735,7 @@ PlayerSettings:
|
|||
PS5: DOTWEEN
|
||||
Stadia: DOTWEEN
|
||||
Standalone: DOTWEEN;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3
|
||||
WebGL: DOTWEEN
|
||||
WebGL: DOTWEEN;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3
|
||||
Windows Store Apps: DOTWEEN
|
||||
XboxOne: DOTWEEN
|
||||
iPhone: DOTWEEN
|
||||
|
|
Loading…
Reference in New Issue