Items effects template
This commit is contained in:
parent
2591ed3e74
commit
a84dcf0dcb
@ -16,8 +16,13 @@ MonoBehaviour:
|
|||||||
name: Chestplate
|
name: Chestplate
|
||||||
description:
|
description:
|
||||||
level: 1
|
level: 1
|
||||||
|
value: 0
|
||||||
image: {fileID: 4404702397685382865, guid: 52aa424fe853b154a95a8f677de1a275, type: 3}
|
image: {fileID: 4404702397685382865, guid: 52aa424fe853b154a95a8f677de1a275, type: 3}
|
||||||
itemModel: {fileID: 8687962458953192462, guid: ae7e7f7d0d926174a8edae16f7f4d305, type: 3}
|
itemModel: {fileID: 8687962458953192462, guid: ae7e7f7d0d926174a8edae16f7f4d305, type: 3}
|
||||||
|
price: 0
|
||||||
|
useEffect:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
StrengthBonus: 0
|
StrengthBonus: 0
|
||||||
AgilityBonus: 0
|
AgilityBonus: 0
|
||||||
InteligenceBonus: 0
|
InteligenceBonus: 0
|
||||||
|
@ -16,8 +16,25 @@ MonoBehaviour:
|
|||||||
name: Pickaxe
|
name: Pickaxe
|
||||||
description:
|
description:
|
||||||
level: 1
|
level: 1
|
||||||
|
value: 0
|
||||||
image: {fileID: 8959118705387878318, guid: 25e473b59d2d7534e803be0a2825e0f7, type: 3}
|
image: {fileID: 8959118705387878318, guid: 25e473b59d2d7534e803be0a2825e0f7, type: 3}
|
||||||
itemModel: {fileID: 9081071845930167562, guid: 0bccd32818043074d9785f6d90ebdcb3, type: 3}
|
itemModel: {fileID: 9081071845930167562, guid: 0bccd32818043074d9785f6d90ebdcb3, type: 3}
|
||||||
|
price: 0
|
||||||
|
useEffect:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 0}
|
||||||
|
m_TargetAssemblyTypeName:
|
||||||
|
m_MethodName:
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName:
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
StrengthBonus: 5
|
StrengthBonus: 5
|
||||||
AgilityBonus: 0
|
AgilityBonus: 0
|
||||||
InteligenceBonus: 0
|
InteligenceBonus: 0
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -42476,6 +42476,69 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1327986481}
|
m_GameObject: {fileID: 1327986481}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!1 &1367266905
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1367266906}
|
||||||
|
- component: {fileID: 1367266908}
|
||||||
|
- component: {fileID: 1367266907}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: ItemActionManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1367266906
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1367266905}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 1602706375}
|
||||||
|
m_RootOrder: 4
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1367266907
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1367266905}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 465d2a23e8d8ff0469cc1c2d210721b8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
itemEvent:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
--- !u!114 &1367266908
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1367266905}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 951d8a52404400448801ddc260a9d1d0, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
itemEvent:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
--- !u!1 &1374645920
|
--- !u!1 &1374645920
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -43520,6 +43583,7 @@ Transform:
|
|||||||
- {fileID: 1273555370}
|
- {fileID: 1273555370}
|
||||||
- {fileID: 121907411}
|
- {fileID: 121907411}
|
||||||
- {fileID: 279975746}
|
- {fileID: 279975746}
|
||||||
|
- {fileID: 1367266906}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -28700,6 +28700,7 @@ Transform:
|
|||||||
- {fileID: 2042768023}
|
- {fileID: 2042768023}
|
||||||
- {fileID: 543241739}
|
- {fileID: 543241739}
|
||||||
- {fileID: 100013501}
|
- {fileID: 100013501}
|
||||||
|
- {fileID: 1565604591}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -31773,6 +31774,70 @@ Tilemap:
|
|||||||
e31: 0
|
e31: 0
|
||||||
e32: 0
|
e32: 0
|
||||||
e33: 1
|
e33: 1
|
||||||
|
--- !u!1 &1565604590
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1565604591}
|
||||||
|
- component: {fileID: 1565604592}
|
||||||
|
- component: {fileID: 1565604593}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: ItemActionManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1565604591
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1565604590}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 1144548810}
|
||||||
|
m_RootOrder: 5
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1565604592
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1565604590}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 951d8a52404400448801ddc260a9d1d0, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
itemEvent:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
--- !u!114 &1565604593
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1565604590}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 465d2a23e8d8ff0469cc1c2d210721b8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
itemEvent:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
Instance: {fileID: 0}
|
||||||
--- !u!1 &1565887880
|
--- !u!1 &1565887880
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -38193,7 +38258,9 @@ MonoBehaviour:
|
|||||||
- ChestName: Wooden 2
|
- ChestName: Wooden 2
|
||||||
ChestPrefab: {fileID: 3972494989842158579, guid: 7e5ccad877bb9da41a844878dab01357, type: 3}
|
ChestPrefab: {fileID: 3972494989842158579, guid: 7e5ccad877bb9da41a844878dab01357, type: 3}
|
||||||
Position: {x: 5.85, y: -6, z: 10}
|
Position: {x: 5.85, y: -6, z: 10}
|
||||||
Content: []
|
Content:
|
||||||
|
- Key: 0
|
||||||
|
Value: {fileID: 11400000, guid: 43fcc69d78c8c3847bbedde817f35b45, type: 2}
|
||||||
convertedData: []
|
convertedData: []
|
||||||
--- !u!1 &2063226728
|
--- !u!1 &2063226728
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
8
Assets/Scripts/REFACTORING/Application/Item.meta
Normal file
8
Assets/Scripts/REFACTORING/Application/Item.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5230e28d0bc75e741bd830f82054f898
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/Scripts/REFACTORING/Application/Item/Effects.meta
Normal file
8
Assets/Scripts/REFACTORING/Application/Item/Effects.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 923bb8fb9e5fe7d408b61bf1d244f2d0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,80 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ItemEffectsManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public static ItemEffectsManager Instance { get; private set; }
|
||||||
|
|
||||||
|
public UseItemEvent itemEvent;
|
||||||
|
|
||||||
|
|
||||||
|
public virtual void Awake()
|
||||||
|
{
|
||||||
|
if(Instance == null)
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void UseItemEffect(ItemSlot itemSlot, PanelTypeEnum originPanel)
|
||||||
|
{
|
||||||
|
DetectItemActionGroup(itemSlot, originPanel);
|
||||||
|
|
||||||
|
// origin panel is passed for script to be able to recognize from witch list remove object etc...
|
||||||
|
|
||||||
|
// use other actions binded to item - not here becaues here item should be removed from chest xd
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DetectItemActionGroup(ItemSlot itemSlot, PanelTypeEnum originPanel)
|
||||||
|
{
|
||||||
|
var type = itemSlot?.Item.EquipmentType;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case EquipmentTypeEnum.Potion:
|
||||||
|
{
|
||||||
|
(PotionEffectsManager.Instance).UseItemEffect(itemSlot, originPanel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Debug.LogError($"Event for item of type - {type} - is not implemented");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// TODO add case for next type to handle action for other items ;)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UIWarehouseManager DetectOriginPanel(PanelTypeEnum originPanel)
|
||||||
|
{
|
||||||
|
// don't handle other types because there effects aren't allowed (and source class type is different xd - complicated)
|
||||||
|
switch(originPanel)
|
||||||
|
{
|
||||||
|
case PanelTypeEnum.Inventory:
|
||||||
|
{
|
||||||
|
return InventoryUIManager.Instance;
|
||||||
|
}
|
||||||
|
case PanelTypeEnum.Equippment:
|
||||||
|
{
|
||||||
|
return EquipmentUIManager.Instance;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Debug.LogError($"Event for item of type - {originPanel} - is not implemented");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return UIWarehouseManager.Instance;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 951d8a52404400448801ddc260a9d1d0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
class PotionEffectsManager : ItemEffectsManager
|
||||||
|
{
|
||||||
|
public static new PotionEffectsManager Instance;
|
||||||
|
|
||||||
|
public override void Awake()
|
||||||
|
{
|
||||||
|
if (Instance == null)
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UseItemEffect(ItemSlot itemSlot, PanelTypeEnum originPanel)
|
||||||
|
{
|
||||||
|
// origin panel is passed for script to be able to recognize from witch list remove object etc...
|
||||||
|
DetectPotionType();
|
||||||
|
|
||||||
|
// use other actions binded to item 2
|
||||||
|
itemSlot.Item?.InvokeEffectAction();
|
||||||
|
|
||||||
|
// remove potion from slot in specific panel...
|
||||||
|
var panelUiManager = DetectOriginPanel(originPanel);
|
||||||
|
panelUiManager.RemoveByPosition(itemSlot.Number);
|
||||||
|
panelUiManager.UpdateList(); // refresh view
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DetectPotionType()
|
||||||
|
{
|
||||||
|
// detect potion and use mached action
|
||||||
|
|
||||||
|
// if( ... )
|
||||||
|
// Health....Potion();
|
||||||
|
}
|
||||||
|
|
||||||
|
// use below function in one above - depending on the condition
|
||||||
|
public void HealthBigPotion()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HealthSmallPotion()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Add and invoke you own functions
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 465d2a23e8d8ff0469cc1c2d210721b8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/Scripts/REFACTORING/Application/Shared/Event.meta
Normal file
8
Assets/Scripts/REFACTORING/Application/Shared/Event.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cc2864990a42156428f28b03e83c69dd
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class UseItemEvent : UnityEvent<ItemSlot> { }
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class UseItemFromPanelEvent : UnityEvent<ItemSlot, PanelTypeEnum> { }
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a81a4ccf1140ba14ba00257d1d3f6013
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -7,6 +7,8 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public abstract class DraggablePanelController : PanelController<IndexValuePair<int, EquippableItem>>, DraggablePanelInterface
|
public abstract class DraggablePanelController : PanelController<IndexValuePair<int, EquippableItem>>, DraggablePanelInterface
|
||||||
{
|
{
|
||||||
|
protected PanelTypeEnum Type = PanelTypeEnum.None;
|
||||||
|
|
||||||
public bool AllowToUseItemInPanel = true;
|
public bool AllowToUseItemInPanel = true;
|
||||||
|
|
||||||
[SerializeField] protected new List<ISlot> ChildBoxList = new List<ISlot>();
|
[SerializeField] protected new List<ISlot> ChildBoxList = new List<ISlot>();
|
||||||
|
@ -28,8 +28,12 @@ public abstract class WarehousePanelController : DraggablePanelController
|
|||||||
|
|
||||||
public override void DoubleLeftMouseClick(ItemSlot itemSlot)
|
public override void DoubleLeftMouseClick(ItemSlot itemSlot)
|
||||||
{
|
{
|
||||||
|
Debug.Log("Used item");
|
||||||
if(AllowToUseItemInPanel)
|
if(AllowToUseItemInPanel)
|
||||||
itemSlot.Item?.InvokeEffectAction();
|
{
|
||||||
|
ItemEffectsManager.Instance.UseItemEffect(itemSlot, Type);
|
||||||
|
}
|
||||||
|
//itemSlot.Item?.InvokeEffectAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using System;
|
|||||||
|
|
||||||
public class ChestPanelController : WarehousePanelController
|
public class ChestPanelController : WarehousePanelController
|
||||||
{
|
{
|
||||||
|
|
||||||
protected override UIBaseManager<IndexValuePair<int, EquippableItem>> FetchUiManager()
|
protected override UIBaseManager<IndexValuePair<int, EquippableItem>> FetchUiManager()
|
||||||
{
|
{
|
||||||
return GameObject.FindObjectOfType<ChestContentUIManager>();
|
return GameObject.FindObjectOfType<ChestContentUIManager>();
|
||||||
@ -26,6 +27,8 @@ public class ChestPanelController : WarehousePanelController
|
|||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
AllowToUseItemInPanel = false;
|
AllowToUseItemInPanel = false;
|
||||||
|
|
||||||
|
Type = PanelTypeEnum.Chest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Prepare empty panel
|
// 1. Prepare empty panel
|
||||||
|
@ -14,6 +14,12 @@ public class EquipmentPanelController : DraggablePanelController
|
|||||||
return GameObject.FindObjectOfType<EquipmentUIManager>();
|
return GameObject.FindObjectOfType<EquipmentUIManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
AllowToUseItemInPanel = false;
|
||||||
|
Type = PanelTypeEnum.Shop;
|
||||||
|
}
|
||||||
|
|
||||||
public override void BuildPanelSlots()
|
public override void BuildPanelSlots()
|
||||||
{
|
{
|
||||||
InitSlotsList();
|
InitSlotsList();
|
||||||
|
@ -8,6 +8,12 @@ using System;
|
|||||||
|
|
||||||
public class InventoryPanelController : WarehousePanelController
|
public class InventoryPanelController : WarehousePanelController
|
||||||
{
|
{
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
AllowToUseItemInPanel = true;
|
||||||
|
Type = PanelTypeEnum.Inventory;
|
||||||
|
}
|
||||||
|
|
||||||
protected override UIBaseManager<IndexValuePair<int, EquippableItem>> FetchUiManager()
|
protected override UIBaseManager<IndexValuePair<int, EquippableItem>> FetchUiManager()
|
||||||
{
|
{
|
||||||
var uiManager = GameObject.FindObjectOfType<InventoryUIManager>();
|
var uiManager = GameObject.FindObjectOfType<InventoryUIManager>();
|
||||||
|
@ -26,6 +26,7 @@ public class ShopPanelController : WarehousePanelController
|
|||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
AllowToUseItemInPanel = false;
|
AllowToUseItemInPanel = false;
|
||||||
|
Type = PanelTypeEnum.Shop;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Prepare empty panel
|
// 1. Prepare empty panel
|
||||||
|
16
Assets/Scripts/REFACTORING/Domain/Enum/PanelTypeEnum.cs
Normal file
16
Assets/Scripts/REFACTORING/Domain/Enum/PanelTypeEnum.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public enum PanelTypeEnum
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Inventory,
|
||||||
|
Equippment,
|
||||||
|
Chest,
|
||||||
|
Shop
|
||||||
|
}
|
||||||
|
|
11
Assets/Scripts/REFACTORING/Domain/Enum/PanelTypeEnum.cs.meta
Normal file
11
Assets/Scripts/REFACTORING/Domain/Enum/PanelTypeEnum.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e78c472e4064a19449b3d79cdc65575c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -108,4 +108,10 @@ public class Item : ScriptableObject
|
|||||||
Debug.Log($"Use {name} effect");
|
Debug.Log($"Use {name} effect");
|
||||||
useEffect.Invoke();
|
useEffect.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InvokeEffectAction(int slotNumber)
|
||||||
|
{
|
||||||
|
Debug.Log($"Use {name} effect");
|
||||||
|
useEffect.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user