Update UIScript, Leaderboard Handler For Database

This commit is contained in:
Philip W 2021-11-06 06:44:20 +00:00
parent 527c2a8d85
commit f5f3953f9e
5 changed files with 410 additions and 301 deletions

View File

@ -213,6 +213,62 @@ AnimationClip:
path: Return Button (1) path: Return Button (1)
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 4.5
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: LeaderboardPanel
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 4.5
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: GameOverLabel/ScoreSubmitPanel
classID: 1
script: {fileID: 0}
m_PPtrCurves: [] m_PPtrCurves: []
m_SampleRate: 60 m_SampleRate: 60
m_WrapMode: 0 m_WrapMode: 0
@ -270,6 +326,20 @@ AnimationClip:
typeID: 1 typeID: 1
customType: 0 customType: 0
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 3660318455
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 368066584
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
pptrCurveMapping: [] pptrCurveMapping: []
m_AnimationClipSettings: m_AnimationClipSettings:
serializedVersion: 2 serializedVersion: 2
@ -488,6 +558,62 @@ AnimationClip:
path: Return Button (1) path: Return Button (1)
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 4.5
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: LeaderboardPanel
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 4.5
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: GameOverLabel/ScoreSubmitPanel
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: [] m_EulerEditorCurves: []
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0

View File

@ -308,10 +308,10 @@ RectTransform:
m_Father: {fileID: 1059183747} m_Father: {fileID: 1059183747}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -125}
m_SizeDelta: {x: 0, y: 50} m_SizeDelta: {x: 1000, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &204554430 --- !u!222 &204554430
CanvasRenderer: CanvasRenderer:
@ -435,10 +435,10 @@ RectTransform:
m_Father: {fileID: 1059183747} m_Father: {fileID: 1059183747}
m_RootOrder: 5 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -430}
m_SizeDelta: {x: 0, y: 80} m_SizeDelta: {x: 1000, y: 80}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &222835919 --- !u!114 &222835919
MonoBehaviour: MonoBehaviour:
@ -473,7 +473,8 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: Rank Name Score m_Text: 4th AAA 111
222
--- !u!222 &222835920 --- !u!222 &222835920
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -545,7 +546,6 @@ MonoBehaviour:
typeOfControl: 0 typeOfControl: 0
speed: 8 speed: 8
constraintRotationAmount: 0.37 constraintRotationAmount: 0.37
spin: 0
--- !u!50 &267901560 --- !u!50 &267901560
Rigidbody2D: Rigidbody2D:
serializedVersion: 4 serializedVersion: 4
@ -583,10 +583,6 @@ MonoBehaviour:
typeOfControl: 1 typeOfControl: 1
speed: 1.5 speed: 1.5
constrainedDistance: 6 constrainedDistance: 6
movement: {x: 0, y: 0}
moveHorizontal: 0
initalPositionX: 0
constraintOffsetXPosition: 0
--- !u!1 &288784317 --- !u!1 &288784317
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -680,7 +676,6 @@ GameObject:
- component: {fileID: 289906078} - component: {fileID: 289906078}
- component: {fileID: 289906081} - component: {fileID: 289906081}
- component: {fileID: 289906080} - component: {fileID: 289906080}
- component: {fileID: 289906079}
m_Layer: 5 m_Layer: 5
m_Name: ScoreTitle m_Name: ScoreTitle
m_TagString: Untagged m_TagString: Untagged
@ -702,30 +697,11 @@ RectTransform:
m_Father: {fileID: 1059183747} m_Father: {fileID: 1059183747}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -50}
m_SizeDelta: {x: 0, y: 100} m_SizeDelta: {x: 1000, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!95 &289906079
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 289906077}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 9815d2f4bad1198418ace54819d33599, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &289906080 --- !u!114 &289906080
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -759,7 +735,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: Rank Name Score m_Text: Rank Name Score Time
--- !u!222 &289906081 --- !u!222 &289906081
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -800,10 +776,10 @@ RectTransform:
m_Father: {fileID: 1059183747} m_Father: {fileID: 1059183747}
m_RootOrder: 6 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -510}
m_SizeDelta: {x: 0, y: 80} m_SizeDelta: {x: 1000, y: 80}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &303121901 --- !u!114 &303121901
MonoBehaviour: MonoBehaviour:
@ -838,7 +814,8 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: Rank Name Score m_Text: 5th AAA 111
222
--- !u!222 &303121902 --- !u!222 &303121902
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -878,9 +855,9 @@ RectTransform:
m_Father: {fileID: 873720541} m_Father: {fileID: 873720541}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -166.07999}
m_SizeDelta: {x: 1000, y: 50} m_SizeDelta: {x: 1000, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &328545999 --- !u!222 &328545999
@ -1174,7 +1151,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 60592eec3660fca4f981ef3e48ceb03a, type: 3} m_Script: {fileID: 11500000, guid: 60592eec3660fca4f981ef3e48ceb03a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
time: 0
--- !u!1 &565676024 --- !u!1 &565676024
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1224,8 +1200,6 @@ MonoBehaviour:
shootSpeed: 5 shootSpeed: 5
shootDirection: {x: 0, y: 1} shootDirection: {x: 0, y: 1}
relativeToRotation: 1 relativeToRotation: 1
timeOfLastSpawn: 0
playerNumber: 0
--- !u!1 &605827951 --- !u!1 &605827951
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1416,10 +1390,10 @@ RectTransform:
m_Father: {fileID: 1059183747} m_Father: {fileID: 1059183747}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -350}
m_SizeDelta: {x: 0, y: 80} m_SizeDelta: {x: 1000, y: 80}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &615826098 --- !u!114 &615826098
MonoBehaviour: MonoBehaviour:
@ -1454,7 +1428,8 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: Rank Name Score m_Text: 3rd AAA 111
222
--- !u!222 &615826099 --- !u!222 &615826099
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1677,11 +1652,11 @@ RectTransform:
- {fileID: 664661075} - {fileID: 664661075}
- {fileID: 605827952} - {fileID: 605827952}
m_Father: {fileID: 873720541} m_Father: {fileID: 873720541}
m_RootOrder: 2 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -291.08}
m_SizeDelta: {x: 1000, y: 100} m_SizeDelta: {x: 1000, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &839555745 --- !u!114 &839555745
@ -1788,8 +1763,8 @@ RectTransform:
m_Children: m_Children:
- {fileID: 1083330062} - {fileID: 1083330062}
- {fileID: 328545998} - {fileID: 328545998}
- {fileID: 839555744}
- {fileID: 1714273384} - {fileID: 1714273384}
- {fileID: 839555744}
- {fileID: 2086538273} - {fileID: 2086538273}
m_Father: {fileID: 1911360419} m_Father: {fileID: 1911360419}
m_RootOrder: 0 m_RootOrder: 0
@ -2012,9 +1987,6 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
health: 3 health: 3
ui: {fileID: 0}
maxHealth: 0
playerNumber: 0
--- !u!4 &990867870 --- !u!4 &990867870
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2042,7 +2014,6 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
droppedItemAmount: 3 droppedItemAmount: 3
pasties: []
--- !u!1 &1011785959 --- !u!1 &1011785959
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2090,7 +2061,6 @@ MonoBehaviour:
prefabToSpawn: {fileID: 105984, guid: 8177d22e11d634712aa2c506186fc6bc, type: 3} prefabToSpawn: {fileID: 105984, guid: 8177d22e11d634712aa2c506186fc6bc, type: 3}
ItemOne: {fileID: 0} ItemOne: {fileID: 0}
spawnInterval: 2 spawnInterval: 2
boxCollider2D: {fileID: 0}
--- !u!61 &1011785962 --- !u!61 &1011785962
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2265,6 +2235,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 57c66944257aaea43a0675130f87a21b, type: 3} m_Script: {fileID: 11500000, guid: 57c66944257aaea43a0675130f87a21b, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
submitUsername: {fileID: 0}
GameOverPanel: {fileID: 0}
--- !u!1 &1061207721 --- !u!1 &1061207721
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2533,9 +2505,9 @@ RectTransform:
m_Father: {fileID: 873720541} m_Father: {fileID: 873720541}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -91.07999}
m_SizeDelta: {x: 1000, y: 100} m_SizeDelta: {x: 1000, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!95 &1083330063 --- !u!95 &1083330063
@ -2610,7 +2582,6 @@ GameObject:
- component: {fileID: 1433312460} - component: {fileID: 1433312460}
- component: {fileID: 1433312462} - component: {fileID: 1433312462}
- component: {fileID: 1433312461} - component: {fileID: 1433312461}
- component: {fileID: 1433312463}
m_Layer: 5 m_Layer: 5
m_Name: ScoreText (1) m_Name: ScoreText (1)
m_TagString: Untagged m_TagString: Untagged
@ -2632,10 +2603,10 @@ RectTransform:
m_Father: {fileID: 1059183747} m_Father: {fileID: 1059183747}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -190}
m_SizeDelta: {x: 0, y: 80} m_SizeDelta: {x: 1000, y: 80}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1433312461 --- !u!114 &1433312461
MonoBehaviour: MonoBehaviour:
@ -2670,7 +2641,8 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: Rank Name Score m_Text: 1st AAA 111
222
--- !u!222 &1433312462 --- !u!222 &1433312462
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2679,25 +2651,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1433312459} m_GameObject: {fileID: 1433312459}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!95 &1433312463
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1433312459}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: add7db82ba60ab04f8b1f295c2f56ef5, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &1444297364 --- !u!1 &1444297364
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2957,11 +2910,11 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 873720541} m_Father: {fileID: 873720541}
m_RootOrder: 3 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -216.07999}
m_SizeDelta: {x: 1000, y: 50} m_SizeDelta: {x: 1000, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1714273385 --- !u!222 &1714273385
@ -3553,9 +3506,6 @@ MonoBehaviour:
inventory: {fileID: 224000013484281887} inventory: {fileID: 224000013484281887}
resourceItemPrefab: {fileID: 1000010562469388, guid: ec870ed13dd68446abb3fc5534317068, resourceItemPrefab: {fileID: 1000010562469388, guid: ec870ed13dd68446abb3fc5534317068,
type: 3} type: 3}
scores: 0000000000000000
playersHealth: 0000000000000000
gameOver: 0
--- !u!114 &1880477763 --- !u!114 &1880477763
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3836,13 +3786,14 @@ GameObject:
- component: {fileID: 1911052147} - component: {fileID: 1911052147}
- component: {fileID: 1891273396} - component: {fileID: 1891273396}
- component: {fileID: 1891273397} - component: {fileID: 1891273397}
- component: {fileID: 1891273398}
m_Layer: 5 m_Layer: 5
m_Name: GameOverPanel m_Name: GameOverPanel
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!210 &1891273396 --- !u!210 &1891273396
SortingGroup: SortingGroup:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3873,6 +3824,20 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &1891273398
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1891273395}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 57c66944257aaea43a0675130f87a21b, type: 3}
m_Name:
m_EditorClassIdentifier:
submitUsername: {fileID: 839555745}
GameOverPanel: {fileID: 1891273395}
--- !u!1 &1891273445 --- !u!1 &1891273445
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4345,10 +4310,10 @@ RectTransform:
m_Father: {fileID: 1059183747} m_Father: {fileID: 1059183747}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -270}
m_SizeDelta: {x: 0, y: 80} m_SizeDelta: {x: 1000, y: 80}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2084735052 --- !u!114 &2084735052
MonoBehaviour: MonoBehaviour:
@ -4383,7 +4348,8 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: Rank Name Score m_Text: 2nd AAA 111
222
--- !u!222 &2084735053 --- !u!222 &2084735053
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4427,9 +4393,9 @@ RectTransform:
m_Father: {fileID: 873720541} m_Father: {fileID: 873720541}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 500, y: -384.49}
m_SizeDelta: {x: 300, y: 86.82} m_SizeDelta: {x: 300, y: 86.82}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!95 &2086538274 --- !u!95 &2086538274
@ -4495,9 +4461,9 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 1891200087} - m_Target: {fileID: 1891273398}
m_TargetAssemblyTypeName: WinLoseHandler, Assembly-CSharp m_TargetAssemblyTypeName: LeaderboardHandle, Assembly-CSharp
m_MethodName: ReturnToMenu m_MethodName: SubmitScores
m_Mode: 1 m_Mode: 1
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}

View File

@ -5,7 +5,7 @@ using UnityEngine.UI;
public class UITimer : MonoBehaviour public class UITimer : MonoBehaviour
{ {
private float time; public float time { get; set; }
// Update is called once per frame // Update is called once per frame
void Update() void Update()

View File

@ -6,7 +6,14 @@ using MySql.Data.MySqlClient;
using System.Net; using System.Net;
public class LeaderboardHandle : MonoBehaviour public class LeaderboardHandle : MonoBehaviour
{ {
public InputField submitUsername;
public GameObject GameOverPanel;
public float time { get; set; }
public int finalScore { get; set; }
private MySqlConnectionStringBuilder mySQLConectionBuilder = new MySqlConnectionStringBuilder(); private MySqlConnectionStringBuilder mySQLConectionBuilder = new MySqlConnectionStringBuilder();
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -15,23 +22,30 @@ public class LeaderboardHandle : MonoBehaviour
mySQLConectionBuilder.UserID = "sql4449219"; mySQLConectionBuilder.UserID = "sql4449219";
mySQLConectionBuilder.Password = "hsFqWLxIIF"; mySQLConectionBuilder.Password = "hsFqWLxIIF";
mySQLConectionBuilder.Database = "sql4449219"; mySQLConectionBuilder.Database = "sql4449219";
} }
// Update is called once per frame public void SubmitScores()
void Update()
{ {
SetScoreRecords(mySQLConectionBuilder.ConnectionString, submitUsername.text);
GameOverPanel.GetComponent<Animator>().enabled = true;
List<Score> Scores = new List<Score>(GetScoreRecords(mySQLConectionBuilder.ConnectionString));
for (int i = 0; i < Scores.Count; i++)
{
Text scoreLabel = GameObject.Find($"ScoreText ({i + 1})").GetComponent<Text>();
string editedText = scoreLabel.text.Replace("AAA", $"{Scores[i].username}").Replace("111", $"{Scores[i].score}").Replace("222", $"{Scores[i].timeLasted}");
scoreLabel.text = editedText;
}
} }
private void SetScoreRecords(string connectionString, string username, int score, int timeLasted) private void SetScoreRecords(string connectionString, string username)
{ {
try try
{ {
using (MySqlConnection connection = new MySqlConnection(connectionString)) using (MySqlConnection connection = new MySqlConnection(connectionString))
{ {
connection.Open(); connection.Open();
string sql = $"INSERT INTO Scores VALUES ('{username}', '{score}', '{timeLasted}', '{GetIPAddress()}')"; string sql = $"INSERT INTO Scores VALUES ('{username.ToUpper()}', '{finalScore}', '{Mathf.FloorToInt(time)}', '{GetIPAddress()}')";
using (MySqlCommand command = new MySqlCommand(sql, connection)) using (MySqlCommand command = new MySqlCommand(sql, connection))
{ {
command.ExecuteNonQuery(); command.ExecuteNonQuery();
@ -44,14 +58,14 @@ public class LeaderboardHandle : MonoBehaviour
} }
} }
private void GetScoreRecords(string connectionString) private List<Score> GetScoreRecords(string connectionString)
{ {
List<Score> records = new List<Score>();
try try
{ {
using (MySqlConnection connection = new MySqlConnection(connectionString)) using (MySqlConnection connection = new MySqlConnection(connectionString))
{ {
connection.Open(); connection.Open();
Debug.Log("connection established");
string sql = "SELECT * FROM Scores ORDER BY Score DESC LIMIT 5"; string sql = "SELECT * FROM Scores ORDER BY Score DESC LIMIT 5";
using (MySqlCommand command = new MySqlCommand(sql, connection)) using (MySqlCommand command = new MySqlCommand(sql, connection))
{ {
@ -59,7 +73,7 @@ public class LeaderboardHandle : MonoBehaviour
{ {
while (reader.Read()) while (reader.Read())
{ {
records.Add(new Score(reader.GetString(0), reader.GetInt32(1), reader.GetInt32(2)));
} }
} }
} }
@ -69,6 +83,7 @@ public class LeaderboardHandle : MonoBehaviour
{ {
Debug.Log(e.ToString()); Debug.Log(e.ToString());
} }
return records;
} }
public class Score public class Score

View File

@ -26,7 +26,7 @@ public class UIScript : MonoBehaviour
// Internal variables to keep track of score, health, and resources, win state // Internal variables to keep track of score, health, and resources, win state
private int[] scores = new int[2]; public int[] scores { get; set; } = new int[2];
private int[] playersHealth = new int[2]; private int[] playersHealth = new int[2];
private Dictionary<int, ResourceStruct> resourcesDict = new Dictionary<int, ResourceStruct>(); //holds a reference to all the resources collected, and to their UI private Dictionary<int, ResourceStruct> resourcesDict = new Dictionary<int, ResourceStruct>(); //holds a reference to all the resources collected, and to their UI
private bool gameOver = false; //this gets changed when the game is won OR lost private bool gameOver = false; //this gets changed when the game is won OR lost
@ -34,13 +34,13 @@ public class UIScript : MonoBehaviour
private void Start() private void Start()
{ {
if(numberOfPlayers == Players.OnePlayer) if (numberOfPlayers == Players.OnePlayer)
{ {
// No setup needed // No setup needed
} }
else else
{ {
if(gameType == GameType.Score) if (gameType == GameType.Score)
{ {
// Show the 2-player score interface // Show the 2-player score interface
rightLabel.text = leftLabel.text = "Score"; rightLabel.text = leftLabel.text = "Score";
@ -70,7 +70,7 @@ public class UIScript : MonoBehaviour
{ {
scores[playerNumber] += amount; scores[playerNumber] += amount;
if(numberOfPlayers == Players.OnePlayer) if (numberOfPlayers == Players.OnePlayer)
{ {
numberLabels[1].text = scores[playerNumber].ToString(); //with one player, the score is on the right numberLabels[1].text = scores[playerNumber].ToString(); //with one player, the score is on the right
} }
@ -79,7 +79,7 @@ public class UIScript : MonoBehaviour
numberLabels[playerNumber].text = scores[playerNumber].ToString(); numberLabels[playerNumber].text = scores[playerNumber].ToString();
} }
if(gameType == GameType.Score if (gameType == GameType.Score
&& scores[playerNumber] >= scoreToWin) && scores[playerNumber] >= scoreToWin)
{ {
GameWon(playerNumber); GameWon(playerNumber);
@ -91,7 +91,7 @@ public class UIScript : MonoBehaviour
{ {
scores[playerNumber]--; scores[playerNumber]--;
if(numberOfPlayers == Players.OnePlayer) if (numberOfPlayers == Players.OnePlayer)
{ {
numberLabels[1].text = scores[playerNumber].ToString(); //with one player, the score is on the right numberLabels[1].text = scores[playerNumber].ToString(); //with one player, the score is on the right
} }
@ -123,8 +123,10 @@ public class UIScript : MonoBehaviour
if (!gameOver) if (!gameOver)
{ {
gameOver = true; gameOver = true;
statsPanel.SetActive(false);
gameOverPanel.SetActive(true); gameOverPanel.SetActive(true);
GameObject.Find("GameOverPanel").GetComponent<LeaderboardHandle>().time = this.GetComponentInChildren<UITimer>().time;
GameObject.Find("GameOverPanel").GetComponent<LeaderboardHandle>().finalScore = scores[0];
statsPanel.SetActive(false);
} }
} }
@ -142,7 +144,7 @@ public class UIScript : MonoBehaviour
{ {
SetHealth(playersHealth[playerNumber] + change, playerNumber); SetHealth(playersHealth[playerNumber] + change, playerNumber);
if(gameType != GameType.Endless if (gameType != GameType.Endless
&& playersHealth[playerNumber] <= 0) && playersHealth[playerNumber] <= 0)
{ {
GameOver(playerNumber); GameOver(playerNumber);
@ -155,7 +157,7 @@ public class UIScript : MonoBehaviour
//Adds a resource to the dictionary, and to the UI //Adds a resource to the dictionary, and to the UI
public void AddResource(int resourceType, int pickedUpAmount, Sprite graphics) public void AddResource(int resourceType, int pickedUpAmount, Sprite graphics)
{ {
if(resourcesDict.ContainsKey(resourceType)) if (resourcesDict.ContainsKey(resourceType))
{ {
//update the dictionary key //update the dictionary key
int newAmount = resourcesDict[resourceType].amount + pickedUpAmount; int newAmount = resourcesDict[resourceType].amount + pickedUpAmount;
@ -179,9 +181,9 @@ public class UIScript : MonoBehaviour
//checks if a certain resource is in the inventory, in the needed quantity //checks if a certain resource is in the inventory, in the needed quantity
public bool CheckIfHasResources(int resourceType, int amountNeeded = 1) public bool CheckIfHasResources(int resourceType, int amountNeeded = 1)
{ {
if(resourcesDict.ContainsKey(resourceType)) if (resourcesDict.ContainsKey(resourceType))
{ {
if(resourcesDict[resourceType].amount >= amountNeeded) if (resourcesDict[resourceType].amount >= amountNeeded)
{ {
return true; return true;
} }