浏览代码

Select with controller method

/UI
uChema 4 年前
当前提交
3d8f54ca
共有 4 个文件被更改,包括 88 次插入32 次删除
  1. 46
      UOP1_Project/Assets/Prefabs/UI/InventoryItem.prefab
  2. 60
      UOP1_Project/Assets/Prefabs/UI/InventoryScreen.prefab
  3. 7
      UOP1_Project/Assets/Scripts/Inventory/InventoryItemFiller.cs
  4. 7
      UOP1_Project/Assets/Scripts/Inventory/UIInventoryManager.cs

46
UOP1_Project/Assets/Prefabs/UI/InventoryItem.prefab


m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 377764689}
m_TargetAssemblyTypeName:
m_MethodName: set_sprite
m_Mode: 0
m_Arguments:

m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}

m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 151566559}
m_TargetAssemblyTypeName:
m_MethodName: HoverItem
m_Mode: 1
m_Arguments:

m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 151566559}
m_TargetAssemblyTypeName:
m_MethodName: UnhoverItem
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- eventID: 9
callback:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 151566559}
m_TargetAssemblyTypeName: InventoryItemFiller, Assembly-CSharp
m_MethodName: HoverItem
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- eventID: 10
callback:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 151566559}
m_TargetAssemblyTypeName:
m_MethodName: UnhoverItem
m_Mode: 1
m_Arguments:

m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2136969675}
m_TargetAssemblyTypeName:
m_MethodName: set_text
m_Mode: 0
m_Arguments:

m_Material: {fileID: 0}
m_Color: {r: 0.627451, g: 0.6039216, b: 0.5019608, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.9489832, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

60
UOP1_Project/Assets/Prefabs/UI/InventoryScreen.prefab


objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d3899a1f923ed45d9a4474970d199c2d, type: 3}
--- !u!114 &6350433132237309146 stripped
--- !u!114 &6818213622019162968 stripped
m_CorrespondingSourceObject: {fileID: 5875391950397090403, guid: d3899a1f923ed45d9a4474970d199c2d,
m_CorrespondingSourceObject: {fileID: 6284766382283648481, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
m_PrefabInstance: {fileID: 696035460119260857}
m_PrefabAsset: {fileID: 0}

m_Script: {fileID: 11500000, guid: 4f07228a5666044b5a0f0633262f71f9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8285521342486369925 stripped
--- !u!114 &6350433132237309146 stripped
m_CorrespondingSourceObject: {fileID: 8886944925026531388, guid: d3899a1f923ed45d9a4474970d199c2d,
m_CorrespondingSourceObject: {fileID: 5875391950397090403, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
m_PrefabInstance: {fileID: 696035460119260857}
m_PrefabAsset: {fileID: 0}

m_Script: {fileID: 11500000, guid: 4f07228a5666044b5a0f0633262f71f9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &6818213622019162968 stripped
--- !u!114 &8285521342486369925 stripped
m_CorrespondingSourceObject: {fileID: 6284766382283648481, guid: d3899a1f923ed45d9a4474970d199c2d,
m_CorrespondingSourceObject: {fileID: 8886944925026531388, guid: d3899a1f923ed45d9a4474970d199c2d,
type: 3}
m_PrefabInstance: {fileID: 696035460119260857}
m_PrefabAsset: {fileID: 0}

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c, type: 3}
--- !u!224 &221919747404738548 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
m_PrefabInstance: {fileID: 4927264552654137991}
m_PrefabAsset: {fileID: 0}
--- !u!114 &3277521686480019469 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7574264689645128330, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,

m_Script: {fileID: 11500000, guid: 93dbe2b925cf041d1bab6ad1cc9ef1c0, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &221919747404738548 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5149096329462859123, guid: 8b138dd8c9fac4f9bbe1bac525c63a3c,
type: 3}
m_PrefabInstance: {fileID: 4927264552654137991}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5892398130329617504
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b1676cd460f4f4cc7a197021499c80d8, type: 3}
--- !u!224 &1767827766 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 7499314617860786457, guid: b1676cd460f4f4cc7a197021499c80d8,
type: 3}
m_PrefabInstance: {fileID: 7499314616395259951}
m_PrefabAsset: {fileID: 0}
--- !u!114 &2340965687570063786 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5219158542763655557, guid: b1676cd460f4f4cc7a197021499c80d8,

m_Script: {fileID: 11500000, guid: 9017e8eb9e8364152b6600ce8d330ffd, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &1767827766 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 7499314617860786457, guid: b1676cd460f4f4cc7a197021499c80d8,
type: 3}
m_PrefabInstance: {fileID: 7499314616395259951}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &9125883717371129678
PrefabInstance:
m_ObjectHideFlags: 0

m_RemovedComponents:
- {fileID: 5074195970675175550, guid: b01383ebcda1049008a325f2ca7e6aca, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: b01383ebcda1049008a325f2ca7e6aca, type: 3}
--- !u!1 &8612381967711337285 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 657795093660955452, guid: b01383ebcda1049008a325f2ca7e6aca,
type: 3}
m_PrefabInstance: {fileID: 9125883717645895801}
m_PrefabAsset: {fileID: 0}
--- !u!224 &8947289629807390876 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 184241180236232933, guid: b01383ebcda1049008a325f2ca7e6aca,
type: 3}
m_PrefabInstance: {fileID: 9125883717645895801}
m_PrefabAsset: {fileID: 0}
--- !u!114 &5854709384753378033 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3451373362961513096, guid: b01383ebcda1049008a325f2ca7e6aca,

m_Script: {fileID: 11500000, guid: 56eb0353ae6e5124bb35b17aff880f16, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &8947289629807390876 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 184241180236232933, guid: b01383ebcda1049008a325f2ca7e6aca,
type: 3}
m_PrefabInstance: {fileID: 9125883717645895801}
m_PrefabAsset: {fileID: 0}
--- !u!1 &8612381967711337285 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 657795093660955452, guid: b01383ebcda1049008a325f2ca7e6aca,
type: 3}
m_PrefabInstance: {fileID: 9125883717645895801}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1575787593498220194 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7745052901829238491, guid: b01383ebcda1049008a325f2ca7e6aca,

7
UOP1_Project/Assets/Scripts/Inventory/InventoryItemFiller.cs


_bgImage.color = itemStack.Item.ItemType.TypeColor;
_itemButton.onClick.RemoveAllListeners();
_itemButton.onClick.AddListener(() =>
{
SelectItem();

_itemButton.gameObject.SetActive(false);
_bgInactiveImage.gameObject.SetActive(true);
}
public void HoverFirstElement()
{
_itemButton.Select();
}
public void HoverItem()

7
UOP1_Project/Assets/Scripts/Inventory/UIInventoryManager.cs


_instanciatedItems = new List<InventoryItemFiller>();
int maxCount = Mathf.Max(listItemsToShow.Count, _instanciatedItems.Count);
for (int i = 0; i < maxCount; i++)
{
if (i < listItemsToShow.Count)

{
UnselectItem(selectedItemId);
selectedItemId = -1;
}
//hover First Element
if (_instanciatedItems.Count > 0)
{
_instanciatedItems[0].HoverFirstElement();
}
}
public void UpdateOnItemInInventory(ItemStack itemToUpdate, bool removeItem)

正在加载...
取消
保存