Update UIScript, Leaderboard Handler For Database
This commit is contained in:
parent
527c2a8d85
commit
f5f3953f9e
@ -213,6 +213,62 @@ AnimationClip:
|
||||
path: Return Button (1)
|
||||
classID: 1
|
||||
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_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
@ -270,6 +326,20 @@ AnimationClip:
|
||||
typeID: 1
|
||||
customType: 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: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
@ -488,6 +558,62 @@ AnimationClip:
|
||||
path: Return Button (1)
|
||||
classID: 1
|
||||
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_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
|
190
Unity-Files/Assets/Examples/Defender/Defender.unity
generated
190
Unity-Files/Assets/Examples/Defender/Defender.unity
generated
@ -308,10 +308,10 @@ RectTransform:
|
||||
m_Father: {fileID: 1059183747}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 50}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -125}
|
||||
m_SizeDelta: {x: 1000, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &204554430
|
||||
CanvasRenderer:
|
||||
@ -435,10 +435,10 @@ RectTransform:
|
||||
m_Father: {fileID: 1059183747}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 80}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -430}
|
||||
m_SizeDelta: {x: 1000, y: 80}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &222835919
|
||||
MonoBehaviour:
|
||||
@ -473,7 +473,8 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Rank Name Score
|
||||
m_Text: 4th AAA 111
|
||||
222
|
||||
--- !u!222 &222835920
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -545,7 +546,6 @@ MonoBehaviour:
|
||||
typeOfControl: 0
|
||||
speed: 8
|
||||
constraintRotationAmount: 0.37
|
||||
spin: 0
|
||||
--- !u!50 &267901560
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
@ -583,10 +583,6 @@ MonoBehaviour:
|
||||
typeOfControl: 1
|
||||
speed: 1.5
|
||||
constrainedDistance: 6
|
||||
movement: {x: 0, y: 0}
|
||||
moveHorizontal: 0
|
||||
initalPositionX: 0
|
||||
constraintOffsetXPosition: 0
|
||||
--- !u!1 &288784317
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -680,7 +676,6 @@ GameObject:
|
||||
- component: {fileID: 289906078}
|
||||
- component: {fileID: 289906081}
|
||||
- component: {fileID: 289906080}
|
||||
- component: {fileID: 289906079}
|
||||
m_Layer: 5
|
||||
m_Name: ScoreTitle
|
||||
m_TagString: Untagged
|
||||
@ -702,30 +697,11 @@ RectTransform:
|
||||
m_Father: {fileID: 1059183747}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 100}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -50}
|
||||
m_SizeDelta: {x: 1000, y: 100}
|
||||
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
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -759,7 +735,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Rank Name Score
|
||||
m_Text: Rank Name Score Time
|
||||
--- !u!222 &289906081
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -800,10 +776,10 @@ RectTransform:
|
||||
m_Father: {fileID: 1059183747}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 80}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -510}
|
||||
m_SizeDelta: {x: 1000, y: 80}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &303121901
|
||||
MonoBehaviour:
|
||||
@ -838,7 +814,8 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Rank Name Score
|
||||
m_Text: 5th AAA 111
|
||||
222
|
||||
--- !u!222 &303121902
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -878,9 +855,9 @@ RectTransform:
|
||||
m_Father: {fileID: 873720541}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -166.07999}
|
||||
m_SizeDelta: {x: 1000, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &328545999
|
||||
@ -1174,7 +1151,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 60592eec3660fca4f981ef3e48ceb03a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
time: 0
|
||||
--- !u!1 &565676024
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1224,8 +1200,6 @@ MonoBehaviour:
|
||||
shootSpeed: 5
|
||||
shootDirection: {x: 0, y: 1}
|
||||
relativeToRotation: 1
|
||||
timeOfLastSpawn: 0
|
||||
playerNumber: 0
|
||||
--- !u!1 &605827951
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1416,10 +1390,10 @@ RectTransform:
|
||||
m_Father: {fileID: 1059183747}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 80}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -350}
|
||||
m_SizeDelta: {x: 1000, y: 80}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &615826098
|
||||
MonoBehaviour:
|
||||
@ -1454,7 +1428,8 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Rank Name Score
|
||||
m_Text: 3rd AAA 111
|
||||
222
|
||||
--- !u!222 &615826099
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1677,11 +1652,11 @@ RectTransform:
|
||||
- {fileID: 664661075}
|
||||
- {fileID: 605827952}
|
||||
m_Father: {fileID: 873720541}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -291.08}
|
||||
m_SizeDelta: {x: 1000, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &839555745
|
||||
@ -1788,8 +1763,8 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1083330062}
|
||||
- {fileID: 328545998}
|
||||
- {fileID: 839555744}
|
||||
- {fileID: 1714273384}
|
||||
- {fileID: 839555744}
|
||||
- {fileID: 2086538273}
|
||||
m_Father: {fileID: 1911360419}
|
||||
m_RootOrder: 0
|
||||
@ -2012,9 +1987,6 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
health: 3
|
||||
ui: {fileID: 0}
|
||||
maxHealth: 0
|
||||
playerNumber: 0
|
||||
--- !u!4 &990867870
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2042,7 +2014,6 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
droppedItemAmount: 3
|
||||
pasties: []
|
||||
--- !u!1 &1011785959
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2090,7 +2061,6 @@ MonoBehaviour:
|
||||
prefabToSpawn: {fileID: 105984, guid: 8177d22e11d634712aa2c506186fc6bc, type: 3}
|
||||
ItemOne: {fileID: 0}
|
||||
spawnInterval: 2
|
||||
boxCollider2D: {fileID: 0}
|
||||
--- !u!61 &1011785962
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2265,6 +2235,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 57c66944257aaea43a0675130f87a21b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
submitUsername: {fileID: 0}
|
||||
GameOverPanel: {fileID: 0}
|
||||
--- !u!1 &1061207721
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2533,9 +2505,9 @@ RectTransform:
|
||||
m_Father: {fileID: 873720541}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -91.07999}
|
||||
m_SizeDelta: {x: 1000, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &1083330063
|
||||
@ -2610,7 +2582,6 @@ GameObject:
|
||||
- component: {fileID: 1433312460}
|
||||
- component: {fileID: 1433312462}
|
||||
- component: {fileID: 1433312461}
|
||||
- component: {fileID: 1433312463}
|
||||
m_Layer: 5
|
||||
m_Name: ScoreText (1)
|
||||
m_TagString: Untagged
|
||||
@ -2632,10 +2603,10 @@ RectTransform:
|
||||
m_Father: {fileID: 1059183747}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 80}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -190}
|
||||
m_SizeDelta: {x: 1000, y: 80}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1433312461
|
||||
MonoBehaviour:
|
||||
@ -2670,7 +2641,8 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Rank Name Score
|
||||
m_Text: 1st AAA 111
|
||||
222
|
||||
--- !u!222 &1433312462
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2679,25 +2651,6 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1433312459}
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2957,11 +2910,11 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 873720541}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -216.07999}
|
||||
m_SizeDelta: {x: 1000, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1714273385
|
||||
@ -3553,9 +3506,6 @@ MonoBehaviour:
|
||||
inventory: {fileID: 224000013484281887}
|
||||
resourceItemPrefab: {fileID: 1000010562469388, guid: ec870ed13dd68446abb3fc5534317068,
|
||||
type: 3}
|
||||
scores: 0000000000000000
|
||||
playersHealth: 0000000000000000
|
||||
gameOver: 0
|
||||
--- !u!114 &1880477763
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3836,13 +3786,14 @@ GameObject:
|
||||
- component: {fileID: 1911052147}
|
||||
- component: {fileID: 1891273396}
|
||||
- component: {fileID: 1891273397}
|
||||
- component: {fileID: 1891273398}
|
||||
m_Layer: 5
|
||||
m_Name: GameOverPanel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!210 &1891273396
|
||||
SortingGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3873,6 +3824,20 @@ Animator:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4345,10 +4310,10 @@ RectTransform:
|
||||
m_Father: {fileID: 1059183747}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 80}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -270}
|
||||
m_SizeDelta: {x: 1000, y: 80}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2084735052
|
||||
MonoBehaviour:
|
||||
@ -4383,7 +4348,8 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Rank Name Score
|
||||
m_Text: 2nd AAA 111
|
||||
222
|
||||
--- !u!222 &2084735053
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4427,9 +4393,9 @@ RectTransform:
|
||||
m_Father: {fileID: 873720541}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 500, y: -384.49}
|
||||
m_SizeDelta: {x: 300, y: 86.82}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!95 &2086538274
|
||||
@ -4495,9 +4461,9 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1891200087}
|
||||
m_TargetAssemblyTypeName: WinLoseHandler, Assembly-CSharp
|
||||
m_MethodName: ReturnToMenu
|
||||
- m_Target: {fileID: 1891273398}
|
||||
m_TargetAssemblyTypeName: LeaderboardHandle, Assembly-CSharp
|
||||
m_MethodName: SubmitScores
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
@ -5,7 +5,7 @@ using UnityEngine.UI;
|
||||
|
||||
public class UITimer : MonoBehaviour
|
||||
{
|
||||
private float time;
|
||||
public float time { get; set; }
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
|
@ -6,7 +6,14 @@ using MySql.Data.MySqlClient;
|
||||
using System.Net;
|
||||
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();
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@ -15,23 +22,30 @@ public class LeaderboardHandle : MonoBehaviour
|
||||
mySQLConectionBuilder.UserID = "sql4449219";
|
||||
mySQLConectionBuilder.Password = "hsFqWLxIIF";
|
||||
mySQLConectionBuilder.Database = "sql4449219";
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
public void SubmitScores()
|
||||
{
|
||||
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
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
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))
|
||||
{
|
||||
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
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
connection.Open();
|
||||
Debug.Log("connection established");
|
||||
string sql = "SELECT * FROM Scores ORDER BY Score DESC LIMIT 5";
|
||||
using (MySqlCommand command = new MySqlCommand(sql, connection))
|
||||
{
|
||||
@ -59,7 +73,7 @@ public class LeaderboardHandle : MonoBehaviour
|
||||
{
|
||||
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());
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
public class Score
|
||||
|
@ -6,219 +6,221 @@ using UnityEngine.UI;
|
||||
[AddComponentMenu("")]
|
||||
public class UIScript : MonoBehaviour
|
||||
{
|
||||
[Header("Configuration")]
|
||||
public Players numberOfPlayers = Players.OnePlayer;
|
||||
[Header("Configuration")]
|
||||
public Players numberOfPlayers = Players.OnePlayer;
|
||||
|
||||
public GameType gameType = GameType.Score;
|
||||
public GameType gameType = GameType.Score;
|
||||
|
||||
// If the scoreToWin is -1, the game becomes endless (no win conditions, but you could do game over)
|
||||
public int scoreToWin = 5;
|
||||
// If the scoreToWin is -1, the game becomes endless (no win conditions, but you could do game over)
|
||||
public int scoreToWin = 5;
|
||||
|
||||
|
||||
[Header("References (don't touch)")]
|
||||
//Right is used for the score in P1 games
|
||||
public Text[] numberLabels = new Text[2];
|
||||
public Text rightLabel, leftLabel;
|
||||
public Text winLabel;
|
||||
public GameObject statsPanel, gameOverPanel, winPanel;
|
||||
public Transform inventory;
|
||||
public GameObject resourceItemPrefab;
|
||||
[Header("References (don't touch)")]
|
||||
//Right is used for the score in P1 games
|
||||
public Text[] numberLabels = new Text[2];
|
||||
public Text rightLabel, leftLabel;
|
||||
public Text winLabel;
|
||||
public GameObject statsPanel, gameOverPanel, winPanel;
|
||||
public Transform inventory;
|
||||
public GameObject resourceItemPrefab;
|
||||
|
||||
|
||||
// Internal variables to keep track of score, health, and resources, win state
|
||||
private int[] scores = 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
|
||||
// Internal variables to keep track of score, health, and resources, win state
|
||||
public int[] scores { get; set; } = 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 bool gameOver = false; //this gets changed when the game is won OR lost
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if(numberOfPlayers == Players.OnePlayer)
|
||||
{
|
||||
// No setup needed
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gameType == GameType.Score)
|
||||
{
|
||||
// Show the 2-player score interface
|
||||
rightLabel.text = leftLabel.text = "Score";
|
||||
private void Start()
|
||||
{
|
||||
if (numberOfPlayers == Players.OnePlayer)
|
||||
{
|
||||
// No setup needed
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gameType == GameType.Score)
|
||||
{
|
||||
// Show the 2-player score interface
|
||||
rightLabel.text = leftLabel.text = "Score";
|
||||
|
||||
// Show the score as 0 for both players
|
||||
numberLabels[0].text = numberLabels[1].text = "0";
|
||||
scores[0] = scores[1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show the 2-player life interface
|
||||
rightLabel.text = leftLabel.text = "Life";
|
||||
// Show the score as 0 for both players
|
||||
numberLabels[0].text = numberLabels[1].text = "0";
|
||||
scores[0] = scores[1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show the 2-player life interface
|
||||
rightLabel.text = leftLabel.text = "Life";
|
||||
|
||||
// Life will be provided by the PlayerHealth components
|
||||
}
|
||||
}
|
||||
}
|
||||
// Life will be provided by the PlayerHealth components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//version of the one below with one parameter to be able to connect UnityEvents
|
||||
public void AddOnePoint(int playerNumber)
|
||||
{
|
||||
AddPoints(playerNumber, 1);
|
||||
}
|
||||
//version of the one below with one parameter to be able to connect UnityEvents
|
||||
public void AddOnePoint(int playerNumber)
|
||||
{
|
||||
AddPoints(playerNumber, 1);
|
||||
}
|
||||
|
||||
|
||||
public void AddPoints(int playerNumber, int amount = 1)
|
||||
{
|
||||
scores[playerNumber] += amount;
|
||||
public void AddPoints(int playerNumber, int amount = 1)
|
||||
{
|
||||
scores[playerNumber] += amount;
|
||||
|
||||
if(numberOfPlayers == Players.OnePlayer)
|
||||
{
|
||||
numberLabels[1].text = scores[playerNumber].ToString(); //with one player, the score is on the right
|
||||
}
|
||||
else
|
||||
{
|
||||
numberLabels[playerNumber].text = scores[playerNumber].ToString();
|
||||
}
|
||||
if (numberOfPlayers == Players.OnePlayer)
|
||||
{
|
||||
numberLabels[1].text = scores[playerNumber].ToString(); //with one player, the score is on the right
|
||||
}
|
||||
else
|
||||
{
|
||||
numberLabels[playerNumber].text = scores[playerNumber].ToString();
|
||||
}
|
||||
|
||||
if(gameType == GameType.Score
|
||||
&& scores[playerNumber] >= scoreToWin)
|
||||
{
|
||||
GameWon(playerNumber);
|
||||
}
|
||||
}
|
||||
if (gameType == GameType.Score
|
||||
&& scores[playerNumber] >= scoreToWin)
|
||||
{
|
||||
GameWon(playerNumber);
|
||||
}
|
||||
}
|
||||
|
||||
//currently unused by other Playground scripts
|
||||
public void RemoveOnePoint(int playerNumber)
|
||||
{
|
||||
scores[playerNumber]--;
|
||||
//currently unused by other Playground scripts
|
||||
public void RemoveOnePoint(int playerNumber)
|
||||
{
|
||||
scores[playerNumber]--;
|
||||
|
||||
if(numberOfPlayers == Players.OnePlayer)
|
||||
{
|
||||
numberLabels[1].text = scores[playerNumber].ToString(); //with one player, the score is on the right
|
||||
}
|
||||
else
|
||||
{
|
||||
numberLabels[playerNumber].text = scores[playerNumber].ToString();
|
||||
}
|
||||
}
|
||||
if (numberOfPlayers == Players.OnePlayer)
|
||||
{
|
||||
numberLabels[1].text = scores[playerNumber].ToString(); //with one player, the score is on the right
|
||||
}
|
||||
else
|
||||
{
|
||||
numberLabels[playerNumber].text = scores[playerNumber].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void GameWon(int playerNumber)
|
||||
{
|
||||
// only set game over UI if game is not over
|
||||
if (!gameOver)
|
||||
{
|
||||
gameOver = true;
|
||||
winLabel.text = "Player " + ++playerNumber + " wins!";
|
||||
statsPanel.SetActive(false);
|
||||
winPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void GameOver(int playerNumber)
|
||||
{
|
||||
public void GameWon(int playerNumber)
|
||||
{
|
||||
// only set game over UI if game is not over
|
||||
if (!gameOver)
|
||||
{
|
||||
gameOver = true;
|
||||
statsPanel.SetActive(false);
|
||||
gameOverPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
if (!gameOver)
|
||||
{
|
||||
gameOver = true;
|
||||
winLabel.text = "Player " + ++playerNumber + " wins!";
|
||||
statsPanel.SetActive(false);
|
||||
winPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetHealth(int amount, int playerNumber)
|
||||
{
|
||||
playersHealth[playerNumber] = amount;
|
||||
numberLabels[playerNumber].text = playersHealth[playerNumber].ToString();
|
||||
}
|
||||
public void GameOver(int playerNumber)
|
||||
{
|
||||
// only set game over UI if game is not over
|
||||
if (!gameOver)
|
||||
{
|
||||
gameOver = 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ChangeHealth(int change, int playerNumber)
|
||||
{
|
||||
SetHealth(playersHealth[playerNumber] + change, playerNumber);
|
||||
|
||||
if(gameType != GameType.Endless
|
||||
&& playersHealth[playerNumber] <= 0)
|
||||
{
|
||||
GameOver(playerNumber);
|
||||
}
|
||||
|
||||
}
|
||||
public void SetHealth(int amount, int playerNumber)
|
||||
{
|
||||
playersHealth[playerNumber] = amount;
|
||||
numberLabels[playerNumber].text = playersHealth[playerNumber].ToString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Adds a resource to the dictionary, and to the UI
|
||||
public void AddResource(int resourceType, int pickedUpAmount, Sprite graphics)
|
||||
{
|
||||
if(resourcesDict.ContainsKey(resourceType))
|
||||
{
|
||||
//update the dictionary key
|
||||
int newAmount = resourcesDict[resourceType].amount + pickedUpAmount;
|
||||
resourcesDict[resourceType].UIItem.ShowNumber(newAmount);
|
||||
resourcesDict[resourceType].amount = newAmount;
|
||||
}
|
||||
else
|
||||
{
|
||||
//create the UIItemScript and display the icon
|
||||
UIItemScript newUIItem = Instantiate<GameObject>(resourceItemPrefab).GetComponent<UIItemScript>();
|
||||
newUIItem.transform.SetParent(inventory, false);
|
||||
public void ChangeHealth(int change, int playerNumber)
|
||||
{
|
||||
SetHealth(playersHealth[playerNumber] + change, playerNumber);
|
||||
|
||||
resourcesDict.Add(resourceType, new ResourceStruct(pickedUpAmount, newUIItem));
|
||||
if (gameType != GameType.Endless
|
||||
&& playersHealth[playerNumber] <= 0)
|
||||
{
|
||||
GameOver(playerNumber);
|
||||
}
|
||||
|
||||
resourcesDict[resourceType].UIItem.ShowNumber(pickedUpAmount);
|
||||
resourcesDict[resourceType].UIItem.DisplayIcon(graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//checks if a certain resource is in the inventory, in the needed quantity
|
||||
public bool CheckIfHasResources(int resourceType, int amountNeeded = 1)
|
||||
{
|
||||
if(resourcesDict.ContainsKey(resourceType))
|
||||
{
|
||||
if(resourcesDict[resourceType].amount >= amountNeeded)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//not enough
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//resource not present
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Adds a resource to the dictionary, and to the UI
|
||||
public void AddResource(int resourceType, int pickedUpAmount, Sprite graphics)
|
||||
{
|
||||
if (resourcesDict.ContainsKey(resourceType))
|
||||
{
|
||||
//update the dictionary key
|
||||
int newAmount = resourcesDict[resourceType].amount + pickedUpAmount;
|
||||
resourcesDict[resourceType].UIItem.ShowNumber(newAmount);
|
||||
resourcesDict[resourceType].amount = newAmount;
|
||||
}
|
||||
else
|
||||
{
|
||||
//create the UIItemScript and display the icon
|
||||
UIItemScript newUIItem = Instantiate<GameObject>(resourceItemPrefab).GetComponent<UIItemScript>();
|
||||
newUIItem.transform.SetParent(inventory, false);
|
||||
|
||||
resourcesDict.Add(resourceType, new ResourceStruct(pickedUpAmount, newUIItem));
|
||||
|
||||
resourcesDict[resourceType].UIItem.ShowNumber(pickedUpAmount);
|
||||
resourcesDict[resourceType].UIItem.DisplayIcon(graphics);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//to use only before checking that the resource is in the dictionary
|
||||
public void ConsumeResource(int resourceType, int amountNeeded = 1)
|
||||
{
|
||||
resourcesDict[resourceType].amount -= amountNeeded;
|
||||
resourcesDict[resourceType].UIItem.ShowNumber(resourcesDict[resourceType].amount);
|
||||
}
|
||||
//checks if a certain resource is in the inventory, in the needed quantity
|
||||
public bool CheckIfHasResources(int resourceType, int amountNeeded = 1)
|
||||
{
|
||||
if (resourcesDict.ContainsKey(resourceType))
|
||||
{
|
||||
if (resourcesDict[resourceType].amount >= amountNeeded)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//not enough
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//resource not present
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum Players
|
||||
{
|
||||
OnePlayer = 0,
|
||||
TwoPlayers
|
||||
}
|
||||
//to use only before checking that the resource is in the dictionary
|
||||
public void ConsumeResource(int resourceType, int amountNeeded = 1)
|
||||
{
|
||||
resourcesDict[resourceType].amount -= amountNeeded;
|
||||
resourcesDict[resourceType].UIItem.ShowNumber(resourcesDict[resourceType].amount);
|
||||
}
|
||||
|
||||
public enum GameType
|
||||
{
|
||||
Score = 0,
|
||||
Life,
|
||||
Endless
|
||||
}
|
||||
|
||||
public enum Players
|
||||
{
|
||||
OnePlayer = 0,
|
||||
TwoPlayers
|
||||
}
|
||||
|
||||
public enum GameType
|
||||
{
|
||||
Score = 0,
|
||||
Life,
|
||||
Endless
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -226,12 +228,12 @@ public class UIScript : MonoBehaviour
|
||||
//just a virtual representation of the resources for the private dictionary
|
||||
public class ResourceStruct
|
||||
{
|
||||
public int amount;
|
||||
public UIItemScript UIItem;
|
||||
public int amount;
|
||||
public UIItemScript UIItem;
|
||||
|
||||
public ResourceStruct(int a, UIItemScript uiRef)
|
||||
{
|
||||
amount = a;
|
||||
UIItem = uiRef;
|
||||
}
|
||||
public ResourceStruct(int a, UIItemScript uiRef)
|
||||
{
|
||||
amount = a;
|
||||
UIItem = uiRef;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user