This commit is contained in:
Sewmina Dilshan 2022-05-19 16:51:35 +05:30
commit a1c6216e1f
45 changed files with 259142 additions and 10 deletions

View File

@ -46651,7 +46651,17 @@ MonoBehaviour:
coinsTxt: {fileID: 7548028370160062038}
gemsTxt: {fileID: 7548028370765915785}
inventoryParent: {fileID: 7548028370540024263}
emptySlotImage: {fileID: 21300000, guid: 3219b4ecaa97f44898f3804d963b932d, type: 3}
emptySlotImage: {fileID: 21300000, guid: c26bbd44818884eaa97433b4cbbab68d, type: 3}
yourReqPopup: {fileID: 540058088}
coinsInput: {fileID: 0}
gemsInput: {fileID: 0}
oxygenInput: {fileID: 0}
metalInput: {fileID: 0}
coinsAmount: 0
gemsAmount: 0
oxygenAmount: 0
metalAmount: 0
selectedItemImg: {fileID: 0}
--- !u!4 &375084964 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4627310524903758, guid: d194838adb73ce841a9e1626c9d51744, type: 3}
@ -96967,6 +96977,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
- m_Target: {fileID: 374839933}
m_TargetAssemblyTypeName: SellMenu, Assembly-CSharp
m_MethodName: Refresh
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
--- !u!1 &820676544
GameObject:
m_ObjectHideFlags: 0
@ -207480,7 +207502,7 @@ MonoBehaviour:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 5a30c37041d1b4791acf7fc0629950f3, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_PreserveAspect: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
@ -215965,7 +215987,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.00018310547, y: -85}
m_AnchoredPosition: {x: 0.00012207031, y: -85}
m_SizeDelta: {x: 1920, y: 65.05449}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &1840047502

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0eedbe6cbb1bb3e4fa1a4d0787e6de5c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15,15 +15,31 @@ public class InventoryItem : ScriptableObject
[System.Serializable]
public class InventoryEntry{
public class InventoryEntry
{
public string Item;
public int Count;
public InventoryEntry(string item, int count){
public InventoryEntry(string item, int count)
{
Item = item;
Count = count;
}
}
public static class Inventory{
public static class Inventory
{
public static InventoryItem GetInventoryItem(string itemName)
{
Object[] shopItems = Resources.LoadAll("ScriptableObjects/ShopItems");
Debug.Log("Searching thru " + shopItems.Length + " SOs");
foreach (Object itemObj in shopItems)
{
InventoryItem item = itemObj as InventoryItem;
if (item.itemName == itemName)
{
return item;
}
}
return null;
}
}

View File

@ -24,6 +24,7 @@ public class SellMenu : MonoBehaviour
public int gemsAmount;
public int oxygenAmount;
public int metalAmount;
public Image selectedItemImg;
void Start()
{
Refresh();
@ -50,9 +51,17 @@ public class SellMenu : MonoBehaviour
for(int i =0; i < inventorySlots.Length; i++){
if(i < DBmanager.Inventory.Count){
inventorySlots[i].GetComponent<Image>().sprite =emptySlotImage;
InventoryItem itemData = Inventory.GetInventoryItem(DBmanager.Inventory[i].Item);
if(itemData==null){
Debug.LogError("Couldn't find data for " + DBmanager.Inventory[i].Item);
}
inventorySlots[i].transform.GetChild(0).GetComponent<Image>().sprite = itemData.image;
inventorySlots[i].interactable=true;
inventorySlots[i].onClick.RemoveAllListeners();
inventorySlots[i].onClick.AddListener(()=>{selectInventoryItem(itemData);});
}else{
inventorySlots[i].GetComponent<Image>().sprite = emptySlotImage;
inventorySlots[i].transform.GetChild(0).GetComponent<Image>().sprite = emptySlotImage;
inventorySlots[i].interactable=false;
}
}
}
@ -72,4 +81,7 @@ public class SellMenu : MonoBehaviour
// selected
Refresh();
}
public void selectInventoryItem(InventoryItem item){
selectedItemImg.sprite = item.image;
}
}

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1e0f25debf988f94daf1dedf149c9494, type: 3}
m_Name: Key
m_Name: key
m_EditorClassIdentifier:
itemName: Secrets
price: 2500

33
UPF.sln Normal file
View File

@ -0,0 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Whinarn.UnityMeshSimplifier.Runtime", "Whinarn.UnityMeshSimplifier.Runtime.csproj", "{b99ffb8c-f6f2-f646-802e-7cb2e62d8c0c}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.com.consulo.ide.Editor", "Unity.com.consulo.ide.Editor.csproj", "{f3918ae7-b834-5fa8-e000-01833c449c8e}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Whinarn.UnityMeshSimplifier.Editor", "Whinarn.UnityMeshSimplifier.Editor.csproj", "{9c3e4793-780d-e333-1ec5-d5e17feec6f2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{20764e99-32a2-613b-c7bd-2b420a48759f}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}.Debug|Any CPU.Build.0 = Debug|Any CPU
{b99ffb8c-f6f2-f646-802e-7cb2e62d8c0c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{b99ffb8c-f6f2-f646-802e-7cb2e62d8c0c}.Debug|Any CPU.Build.0 = Debug|Any CPU
{f3918ae7-b834-5fa8-e000-01833c449c8e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{f3918ae7-b834-5fa8-e000-01833c449c8e}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9c3e4793-780d-e333-1ec5-d5e17feec6f2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9c3e4793-780d-e333-1ec5-d5e17feec6f2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20764e99-32a2-613b-c7bd-2b420a48759f}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20764e99-32a2-613b-c7bd-2b420a48759f}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
unoptimized.apk Normal file

Binary file not shown.