Simple Buy Item Logic
This commit is contained in:
+19
-16
@@ -17,6 +17,8 @@
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/LuckField.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/UnluckyField.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Fields/VSField.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Items/Item.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Items/UIItem.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/AnimationHandler.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/NoPlayablePlayer.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Assets/Scripts/Players/PlayablePlayer.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
@@ -33,25 +35,25 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Discover.Launch.Via.Unity": "true",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Discover.Launch.Via.Unity": "true",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\afist\\AppData\\Roaming\\JetBrains\\Rider2022.3\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\afist\\AppData\\Roaming\\JetBrains\\Rider2022.3\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\afist\\AppData\\Local\\Symbols\\src"
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\braus\\AppData\\Roaming\\JetBrains\\Rider2022.3\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\braus\\AppData\\Roaming\\JetBrains\\Rider2022.3\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\braus\\AppData\\Local\\Symbols\\src"
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RunManager" selected="Attach to Unity Editor.Attach to Unity Editor">
|
||||
<configuration name="Standalone Player" type="RunUnityExe" factoryName="Unity Executable">
|
||||
<option name="EXE_PATH" value="$USER_HOME$/OneDrive/Desktop/FlufflPartyBuild\FlufflParty.exe" />
|
||||
<option name="EXE_PATH" value="$USER_HOME$/OneDrive/Desktop/FlufflPartyBuild/FlufflParty.exe" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="C:\Users\braus\OneDrive\Desktop\FlufflPartyTestBuild" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
@@ -59,7 +61,7 @@
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="Start Unity" type="RunUnityExe" factoryName="Unity Executable">
|
||||
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\2021.3.17f1\Editor\Unity.exe" />
|
||||
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\2021.3.16f1\Editor\Unity.exe" />
|
||||
<option name="PROGRAM_PARAMETERS" value="-projectPath F:\Projects\Unity\flufflparty\FlufflParty -debugCodeOptimization" />
|
||||
<option name="WORKING_DIRECTORY" value="F:\Projects\Unity\flufflparty\FlufflParty" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
@@ -67,7 +69,7 @@
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="UnitTests (batch mode)" type="RunUnityExe" factoryName="Unity Executable">
|
||||
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\2021.3.17f1\Editor\Unity.exe" />
|
||||
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\2021.3.16f1\Editor\Unity.exe" />
|
||||
<option name="PROGRAM_PARAMETERS" value="-runTests -batchmode -projectPath F:\Projects\Unity\flufflparty\FlufflParty -testResults Logs/results.xml -testPlatform EditMode -debugCodeOptimization" />
|
||||
<option name="WORKING_DIRECTORY" value="F:\Projects\Unity\flufflparty\FlufflParty" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
@@ -131,6 +133,7 @@
|
||||
<workItem from="1677436455528" duration="8395000" />
|
||||
<workItem from="1677516389539" duration="4730000" />
|
||||
<workItem from="1677521614865" duration="735000" />
|
||||
<workItem from="1677789832911" duration="4340000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ce4ca5426ace8f41820fb29d9da39b9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83afd1409d8fc1741801d664c8e0ec6d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 784 KiB |
@@ -0,0 +1,159 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a3f082245234a0498827cf100d31e7a
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 512
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 885a1932fe76b17489a27f75f32e521d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,101 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &8348942333553110132
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8689333182318196430}
|
||||
- component: {fileID: 5708714848101611883}
|
||||
- component: {fileID: 7556365767940820385}
|
||||
- component: {fileID: 8043942569442897806}
|
||||
m_Layer: 0
|
||||
m_Name: ItemMushroom
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8689333182318196430
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8348942333553110132}
|
||||
m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067}
|
||||
m_LocalPosition: {x: 93.33682, y: 1.0039761, z: 125.83022}
|
||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.6}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5708714848101611883
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8348942333553110132}
|
||||
m_Mesh: {fileID: -5495902117074765545, guid: 4e52562c1222351499196c7be78e933b, type: 3}
|
||||
--- !u!23 &7556365767940820385
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8348942333553110132}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: -3846018093981099296, guid: 4e52562c1222351499196c7be78e933b, type: 3}
|
||||
- {fileID: -6478536213147159724, guid: 4e52562c1222351499196c7be78e933b, type: 3}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!114 &8043942569442897806
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8348942333553110132}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b369e867ce7bd2944baef65e2537086c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
sprite: {fileID: 21300000, guid: 2a3f082245234a0498827cf100d31e7a, type: 3}
|
||||
cost: 5
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d00b626b793557643a67184af1354f88
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -416,8 +416,8 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 6.7
|
||||
m_fontSizeBase: 6.7
|
||||
m_fontSize: 11.72
|
||||
m_fontSizeBase: 11.72
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ using System.Threading;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Client : MonoBehaviour
|
||||
{
|
||||
@@ -27,6 +28,7 @@ public class Client : MonoBehaviour
|
||||
[SerializeField] private GameObject[] playerInfo;
|
||||
private PlayerInfoElements[] playerInfoElements = new PlayerInfoElements[4];
|
||||
[SerializeField] private GameObject layout2;
|
||||
[SerializeField] private Image[] uiItems;
|
||||
|
||||
private int playerAmount = 0;
|
||||
|
||||
@@ -182,6 +184,18 @@ public class Client : MonoBehaviour
|
||||
players[job.data[1]].uiHandler = uiHandler;
|
||||
players[job.data[1]].textLeftMoves = textLeftMoves;
|
||||
players[job.data[1]].AddCoins(3);
|
||||
|
||||
Image[] tempUIItems = new Image[3];
|
||||
|
||||
int f = 0;
|
||||
|
||||
for (int i = job.data[1] * 3; i < job.data[1] * 3 + 3; i++)
|
||||
{
|
||||
tempUIItems[f] = uiItems[i];
|
||||
}
|
||||
|
||||
players[job.data[1]].uiItems = tempUIItems;
|
||||
|
||||
players[job.data[1]].Init();
|
||||
|
||||
playerNameTexts[job.data[1]].text = Encoding.ASCII.GetString(name).Replace(" ", "");
|
||||
@@ -281,4 +295,6 @@ public class Client : MonoBehaviour
|
||||
{
|
||||
stream.Write(new byte[]{8, 0, 0, 0, 0, 0, 0, 0, 0, 0});
|
||||
}
|
||||
|
||||
//TODO: SendBuyItem
|
||||
}
|
||||
@@ -4,8 +4,12 @@ using UnityEngine;
|
||||
|
||||
public class ItemShop : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject Layout2;
|
||||
[SerializeField] private GameObject LayoutItemShop;
|
||||
[SerializeField] private Client client;
|
||||
|
||||
[SerializeField] private UIItem[] items;
|
||||
|
||||
public static Player currentPlayer = null;
|
||||
|
||||
public void Init(Player _currentPlayer)
|
||||
{
|
||||
currentPlayer = _currentPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 143fbc3928a7403f94f31a42796f7c0c
|
||||
timeCreated: 1677790192
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Item : MonoBehaviour
|
||||
{
|
||||
public Sprite sprite;
|
||||
public Type type;
|
||||
|
||||
public int Cost
|
||||
{
|
||||
get
|
||||
{
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField] private int cost;
|
||||
|
||||
public enum Type
|
||||
{
|
||||
Mushroom = 0, DoubleDice = 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b369e867ce7bd2944baef65e2537086c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIItem : MonoBehaviour
|
||||
{
|
||||
public Item item;
|
||||
|
||||
public void BuyItem()
|
||||
{
|
||||
Player player = ItemShop.currentPlayer;
|
||||
|
||||
if (player.coins - item.Cost >= 0)
|
||||
{
|
||||
player.AddCoins(-item.Cost);
|
||||
UIHandler.GetInstance().ButtonBack();
|
||||
player.AddItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2133c87b176066c42bf8ebee13208124
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public abstract class Player : MonoBehaviour
|
||||
{
|
||||
@@ -20,6 +21,8 @@ public abstract class Player : MonoBehaviour
|
||||
public TMP_Text textCoinsInfo, textStarsInfo, textLeftMoves;
|
||||
protected bool eventstop = false;
|
||||
public UIHandler uiHandler;
|
||||
public Item[] items = new Item[3];
|
||||
public Image[] uiItems;
|
||||
|
||||
//for coin animation
|
||||
private AnimationHandler animationHandler;
|
||||
@@ -72,6 +75,19 @@ public abstract class Player : MonoBehaviour
|
||||
PlayAnimation(AnimationType.Coin);
|
||||
Client.GetCurrentInstance().CalculatePlacement();
|
||||
}
|
||||
|
||||
public void AddItem(Item item)
|
||||
{
|
||||
for (int i = 0; i < items.Length; i++)
|
||||
{
|
||||
if (items[i] == null)
|
||||
{
|
||||
items[i] = item;
|
||||
uiItems[i].sprite = item.sprite;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTriggerEnter(Collider c)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,15 @@ public class UIHandler : MonoBehaviour
|
||||
[SerializeField] private GameObject layout2;
|
||||
[SerializeField] private GameObject layoutMiniMap;
|
||||
[SerializeField] private GameObject layoutBuyStar;
|
||||
[SerializeField] private GameObject layoutItemShop;
|
||||
|
||||
private static UIHandler currentInstance;
|
||||
|
||||
public static UIHandler GetInstance()
|
||||
{
|
||||
return currentInstance;
|
||||
}
|
||||
|
||||
public bool MapOpen
|
||||
{
|
||||
get
|
||||
@@ -28,7 +36,9 @@ public class UIHandler : MonoBehaviour
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
|
||||
layoutItemShop.SetActive(false);
|
||||
|
||||
currentInstance = this;
|
||||
}
|
||||
|
||||
public void ActivateLayout1()
|
||||
@@ -38,6 +48,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutMiniMap()
|
||||
@@ -47,6 +58,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutMiniMap.SetActive(true);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutBuyStar(Player player)
|
||||
@@ -57,6 +69,7 @@ public class UIHandler : MonoBehaviour
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(true);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(false);
|
||||
|
||||
LayoutBuyStarController controller = layoutBuyStar.GetComponent<LayoutBuyStarController>();
|
||||
|
||||
@@ -81,6 +94,18 @@ public class UIHandler : MonoBehaviour
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(true);
|
||||
layoutItemShop.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutItemShop()
|
||||
{
|
||||
layout0.SetActive(false);
|
||||
layout1.SetActive(false);
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
layoutItemShop.SetActive(true);
|
||||
layoutItemShop.GetComponent<ItemShop>().Init(currentPlayer);
|
||||
}
|
||||
|
||||
public void ButtonBuyStar()
|
||||
@@ -103,6 +128,12 @@ public class UIHandler : MonoBehaviour
|
||||
|
||||
public void ButtonEnter()
|
||||
{
|
||||
|
||||
ActivateLayoutItemShop();
|
||||
}
|
||||
|
||||
public void ButtonBack()
|
||||
{
|
||||
ActivateLayout1();
|
||||
((PlayablePlayer)currentPlayer).SkipShop();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user