Added a selection process for each property

This commit is contained in:
Anthony Berg 2020-12-11 00:40:09 +00:00
parent 0f3d14cd6a
commit fa91572726
2 changed files with 111 additions and 0 deletions

View File

@ -19839,6 +19839,88 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2010431105} m_GameObject: {fileID: 2010431105}
m_CullTransparentMesh: 0 m_CullTransparentMesh: 0
--- !u!1 &2021050761
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2021050763}
- component: {fileID: 2021050762}
m_Layer: 0
m_Name: TickMark 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &2021050762
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2021050761}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
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: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 3404d4488402b104db6dc3724bf4773a, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &2021050763
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2021050761}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 90.361084, y: 194.69046, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2040913807 --- !u!1 &2040913807
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -28,6 +28,9 @@ public class Trade : MonoBehaviour
public List<Button> player1PropertiesButtons; //This is a list for all the buttons for the properties for player 1. public List<Button> player1PropertiesButtons; //This is a list for all the buttons for the properties for player 1.
public List<Button> player2PropertiesButtons; //This is a list for all the buttons for the properties for player 2. public List<Button> player2PropertiesButtons; //This is a list for all the buttons for the properties for player 2.
private List<bool> player1SelectedProperties = new List<bool>(); //This is the selected properties for player 1 to trade.
private List<bool> player2SelectedProperties = new List<bool>(); //This is the selected properties for player 2 to trade.
//Function when opening the trade UI //Function when opening the trade UI
public void OpenTrade() public void OpenTrade()
{ {
@ -95,13 +98,39 @@ public class Trade : MonoBehaviour
TradeMenu.SetActive(true); //This opens the trade menu. TradeMenu.SetActive(true); //This opens the trade menu.
} }
private void SelectProperty(int button, int player)
{
//This switch statement decides between which player the button has been assigned.
switch (player)
{
case 1: //Player 1
player1SelectedProperties[button] = !player1SelectedProperties[button]; //Switch between selection.
break;
case 2: //Player 2
player2SelectedProperties[button] = !player2SelectedProperties[button]; //Switch between selection.
break;
}
}
void Awake() void Awake()
{ {
main = FindObjectOfType<Main>(); //This gets the data from the main file. main = FindObjectOfType<Main>(); //This gets the data from the main file.
for (int i = 0; i < 28; i++)
{
player1SelectedProperties.Add(false);
player2SelectedProperties.Add(false);
}
} }
void Start() void Start()
{ {
playerSelectionNext.onClick.AddListener(PlayerSelectNext); //This lets the next button work on the player selector. playerSelectionNext.onClick.AddListener(PlayerSelectNext); //This lets the next button work on the player selector.
for (int i = 0; i < player1PropertiesButtons.Count; i++) //This goes through all of the buttons in the main menu.
{
int i1 = i;
player1PropertiesButtons[i].onClick.AddListener(() => SelectProperty(i1, 1)); //This adds a specific menu for each of the buttons.
player2PropertiesButtons[i].onClick.AddListener(() => SelectProperty(i1, 2)); //This adds a specific menu for each of the buttons.
}
} }
} }