Hot Fix - pickable items

This commit is contained in:
kabix09 2022-12-06 01:58:32 +01:00
parent 7186bef546
commit 78405a418e
13 changed files with 101 additions and 22 deletions

View File

@ -25,7 +25,7 @@ MonoBehaviour:
EndOfDialogueStepAction: EndOfDialogueStepAction:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 5064228440392526989, guid: df6c42c9616028a4badca81953f003ab, type: 3} - m_Target: {fileID: 4267060477434669900, guid: df6c42c9616028a4badca81953f003ab, type: 3}
m_TargetAssemblyTypeName: NpcDialogueManager, Assembly-CSharp m_TargetAssemblyTypeName: NpcDialogueManager, Assembly-CSharp
m_MethodName: DialogueEndAction m_MethodName: DialogueEndAction
m_Mode: 3 m_Mode: 3

View File

@ -29,6 +29,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -321.1878} m_LocalPosition: {x: 0, y: 0, z: -321.1878}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 7621034958370762905} m_Father: {fileID: 7621034958370762905}
m_RootOrder: 0 m_RootOrder: 0
@ -97,7 +98,7 @@ GameObject:
- component: {fileID: 4445501478028932064} - component: {fileID: 4445501478028932064}
- component: {fileID: 240224230425431318} - component: {fileID: 240224230425431318}
m_Layer: 0 m_Layer: 0
m_Name: Lumberjac Axe m_Name: Axe
m_TagString: Pickable m_TagString: Pickable
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -113,6 +114,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.4, y: 0.4, z: 1} m_LocalScale: {x: 0.4, y: 0.4, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 561869551291378103} - {fileID: 561869551291378103}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -129,6 +131,7 @@ SpriteRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 1 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
@ -182,8 +185,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
item: {fileID: 11400000, guid: 6e4f9a44bbdb0b5418932889316a45eb, type: 2} item: {fileID: 11400000, guid: 6e4f9a44bbdb0b5418932889316a45eb, type: 2}
name: name: Axe
name2:
triggered: 0 triggered: 0
isPicked: 0 isPicked: 0
HandleIndexInScelenObjectList: 0 HandleIndexInScelenObjectList: 0

View File

@ -29,6 +29,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.4285713, y: 1.4285713, z: 1} m_LocalScale: {x: 1.4285713, y: 1.4285713, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 2791776640389055197} m_Father: {fileID: 2791776640389055197}
m_RootOrder: 0 m_RootOrder: 0
@ -70,6 +71,7 @@ MonoBehaviour:
_tmpSecondPanel: {fileID: 0} _tmpSecondPanel: {fileID: 0}
_tmpPanelAbove: {fileID: 0} _tmpPanelAbove: {fileID: 0}
obj: {fileID: 6960265943931164901} obj: {fileID: 6960265943931164901}
isAllowedToShowPanels: 1
--- !u!114 &8110589656666280150 --- !u!114 &8110589656666280150
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -112,6 +114,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 70.5, y: 39.5, z: 0} m_LocalPosition: {x: 70.5, y: 39.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 3467416686219291746} - {fileID: 3467416686219291746}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -128,6 +131,7 @@ SpriteRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 1 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
@ -180,9 +184,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c261410eee3e5d640abd23159c28b3cc, type: 3} m_Script: {fileID: 11500000, guid: c261410eee3e5d640abd23159c28b3cc, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
item: {fileID: 11400000, guid: c7d236b6c7adfb541a86ff43f63cd325, type: 2} item: {fileID: 0}
name: name: Gold Ore
name2:
triggered: 0 triggered: 0
isPicked: 0 isPicked: 0
HandleIndexInScelenObjectList: 0 HandleIndexInScelenObjectList: 0

View File

@ -29,6 +29,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 9081071845930167557} m_Father: {fileID: 9081071845930167557}
m_RootOrder: 0 m_RootOrder: 0
@ -114,6 +115,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 5, z: 0} m_LocalPosition: {x: 0, y: 5, z: 0}
m_LocalScale: {x: 0.4, y: 0.4, z: 1} m_LocalScale: {x: 0.4, y: 0.4, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1754993746} - {fileID: 1754993746}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -130,6 +132,7 @@ SpriteRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 1 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
@ -230,8 +233,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
item: {fileID: 11400000, guid: 5935777f7ac390a4187e03f34e7cafdd, type: 2} item: {fileID: 11400000, guid: 5935777f7ac390a4187e03f34e7cafdd, type: 2}
name: name: Pickace
name2:
triggered: 0 triggered: 0
isPicked: 0 isPicked: 0
HandleIndexInScelenObjectList: 0 HandleIndexInScelenObjectList: 0

View File

@ -0,0 +1,60 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a3bcdd1e2dba0c4791bcb151c0df6c1, type: 3}
m_Name: TestMission
m_EditorClassIdentifier:
PlayerTask:
id: 0
title:
description:
difficulty: 0
Status: 0
CurrentStep: 0
MissionStepsList:
- Status: 0
DialogueStep:
WasDisplayed: 0
ListOfSentences: []
EndOfDialogueStepAction:
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
Reward:
Items:
- {fileID: 11400000, guid: 5935777f7ac390a4187e03f34e7cafdd, type: 2}
Cash: 0
FinalCondidtion:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 11400000}
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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f4f0ed1c42424bd4dadc963d6a9aa351
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -5,7 +5,7 @@ using System;
public class PickableController : MonoBehaviour public class PickableController : MonoBehaviour
{ {
public EquippableItem item; public Item item;
public string name; public string name;
//public string name2; //TODO Clear here //public string name2; //TODO Clear here
public bool triggered; public bool triggered;
@ -13,10 +13,15 @@ public class PickableController : MonoBehaviour
public int HandleIndexInScelenObjectList; public int HandleIndexInScelenObjectList;
public void Awake()
{
item = Resources.Load<Item>("Items/" + name);
//item.Name = gameObject.name;
}
public void Start() public void Start()
{ {
// if object after beeing created by Instaniate() gets "Clone)" postfix, EquippableItem.name gets this // if object after beeing created by Instaniate() gets "Clone)" postfix, EquippableItem.name gets this
item.Name = gameObject.name;
// if (PlayerPrefs.GetInt("continued") == 1) // if (PlayerPrefs.GetInt("continued") == 1)
// { // {
@ -41,7 +46,7 @@ public class PickableController : MonoBehaviour
{ {
if(!InventoryUIManager.Instance.IsFull()) if(!InventoryUIManager.Instance.IsFull())
{ {
InventoryUIManager.Instance.Add(this.item); InventoryUIManager.Instance.Add(new EquippableItem(this.item));
if(InventoryUIManager.Instance.GetPanelStatus()) if(InventoryUIManager.Instance.GetPanelStatus())
GameObject.FindObjectOfType<InventoryPanelController>().BuildPanelContent(InventoryUIManager.Instance.GetList()); GameObject.FindObjectOfType<InventoryPanelController>().BuildPanelContent(InventoryUIManager.Instance.GetList());

View File

@ -44,7 +44,7 @@ public class NPCDialogue : MonoBehaviour
void Awake() void Awake()
{ {
requiredItem = "Lumberjac Axe"; requiredItem = "Axe";
} }
void Start() void Start()

View File

@ -48,6 +48,7 @@ public class NPCQuest : MonoBehaviour
GameObject _axe = Instantiate(axe, new Vector3(37.1f, -31.7f, 0), Quaternion.identity, globalGUI.transform); GameObject _axe = Instantiate(axe, new Vector3(37.1f, -31.7f, 0), Quaternion.identity, globalGUI.transform);
// 1.2 Fix names (prevent add "(Clone)" postfix) // 1.2 Fix names (prevent add "(Clone)" postfix)
_axe.name = axe.GetComponent<PickableController>().item.Name; _axe.name = axe.GetComponent<PickableController>().item.Name;
_axe.GetComponent<PickableController>().item.name = axe.name; _axe.GetComponent<PickableController>().item.name = axe.name;
// 2. Add object to DynamicList in LocalSceneManager // 2. Add object to DynamicList in LocalSceneManager

View File

@ -27,6 +27,7 @@ public class GoldOre : MonoBehaviour
GameObject droppedItem = Instantiate(goldOre, gameObject.transform.position, Quaternion.identity, globalGUI.transform); GameObject droppedItem = Instantiate(goldOre, gameObject.transform.position, Quaternion.identity, globalGUI.transform);
// Object and also ith binded piclable object gets "(Clone)" to its names - we must cut it // Object and also ith binded piclable object gets "(Clone)" to its names - we must cut it
droppedItem.name = goldOre.name; droppedItem.name = goldOre.name;
Debug.Log(goldOre.name);
droppedItem.GetComponent<PickableController>().item.name = goldOre.name; droppedItem.GetComponent<PickableController>().item.name = goldOre.name;
//droppedItem.GetComponent<PickableController>().HandleIndexInScelenObjectList = //droppedItem.GetComponent<PickableController>().HandleIndexInScelenObjectList =
SceneEquippableItemManager.Instance.AddDynamicItem(droppedItem); SceneEquippableItemManager.Instance.AddDynamicItem(droppedItem);

View File

@ -98,8 +98,7 @@ public class SceneInventoryDataManager : SceneBaseDataManager<IndexValuePair<int
#region override load & save #region override load & save
protected override bool LoadData(SceneElementTypeEnum type, ref DataListManager<IndexValuePair<int, EquippableItem>> dataListManager) protected override bool LoadData(SceneElementTypeEnum type, ref DataListManager<IndexValuePair<int, EquippableItem>> dataListManager)
{ {
try
{
// 1. Convert EquippableItemPrefabAsset to EquippableItem list // 1. Convert EquippableItemPrefabAsset to EquippableItem list
List<IndexValuePair<int, EquippableItem>> convertedList = new List<IndexValuePair<int, EquippableItem>>(); List<IndexValuePair<int, EquippableItem>> convertedList = new List<IndexValuePair<int, EquippableItem>>();
@ -112,11 +111,7 @@ public class SceneInventoryDataManager : SceneBaseDataManager<IndexValuePair<int
dataListManager.SetList(convertedList); dataListManager.SetList(convertedList);
return true; return true;
}
catch (Exception e)
{
Debug.LogError(e.Message);
}
return false; return false;
} }

View File

@ -38,7 +38,9 @@ public class EquippableItemPrefabAssetData : PrefabAssetModelData
new Vector3(Position[0], Position[1], Position[2]) new Vector3(Position[0], Position[1], Position[2])
); );
equippableItemPrefabAsset.EquippableItem = (EquippableItem)EquippableItemData.MapDataToObject(equippableItemPrefabAsset.PrefabAssetName); equippableItemPrefabAsset.EquippableItem = new EquippableItem(
EquippableItemData.MapDataToObject(equippableItemPrefabAsset.PrefabAssetName)
);
return equippableItemPrefabAsset; return equippableItemPrefabAsset;
} }

View File

@ -86,7 +86,7 @@ public class SceneEquippableItemManager : MonoBehaviour
public int AddDynamicItem(GameObject dynamicObject) public int AddDynamicItem(GameObject dynamicObject)
{ {
EquippableItem item = dynamicObject.GetComponent<PickableController>().item; EquippableItem item = new EquippableItem(dynamicObject.GetComponent<PickableController>().item);
EquippableItemPrefabAsset equippableItemPrefarbAsset = new EquippableItemPrefabAsset(item.name, dynamicObject.name, dynamicObject.transform.position, item); EquippableItemPrefabAsset equippableItemPrefarbAsset = new EquippableItemPrefabAsset(item.name, dynamicObject.name, dynamicObject.transform.position, item);
this.DynamicElements.Add(equippableItemPrefarbAsset); this.DynamicElements.Add(equippableItemPrefarbAsset);