Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
Short-circuit leaderboard window show animation if scores are received
Browse files Browse the repository at this point in the history
Set animation to jump to `show` from any state but `dismiss` if the score are received.
It solves a race condition where the scores would be fetched quickly (especially when using caching)
and the window would still be appearing and wouldn't listen to the `unlock` (i.e. show) event.

Fix #47 and Fix #65
  • Loading branch information
loicteixeira committed Mar 18, 2017
1 parent 5676987 commit 5ac18db
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 15 deletions.
74 changes: 61 additions & 13 deletions Assets/Plugins/GameJolt/Animations/GameJoltController.controller
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,55 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Dismiss
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Lock
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Unlock
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Trophies
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: ShowLoadingIndicator
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: HideLoadingIndicator
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Leaderboards
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Notification
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base
Expand Down Expand Up @@ -390,6 +390,29 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &110125496
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Unlock
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 110203510}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: .875
m_HasExitTime: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &110127220
AnimatorStateTransition:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -479,6 +502,29 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &110136088
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Unlock
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 110203510}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &110143312
AnimatorStateTransition:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -1071,6 +1117,7 @@ AnimatorState:
m_CycleOffset: 0
m_Transitions:
- {fileID: 110148476}
- {fileID: 110136088}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
Expand All @@ -1090,6 +1137,7 @@ AnimatorState:
m_Transitions:
- {fileID: 110143312}
- {fileID: 110159544}
- {fileID: 110125496}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
Expand Down Expand Up @@ -1485,13 +1533,13 @@ AnimatorStateMachine:
first: {fileID: 110743428}
second: []
data:
first: {fileID: 110701254}
first: {fileID: 110797252}
second: []
data:
first: {fileID: 110737452}
first: {fileID: 110701254}
second: []
data:
first: {fileID: 110797252}
first: {fileID: 110737452}
second: []
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: -96, y: 24, z: 0}
Expand Down Expand Up @@ -1537,7 +1585,7 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 110214570}
m_Position: {x: 264, y: 120, z: 0}
m_Position: {x: 264, y: 108, z: 0}
- serializedVersion: 1
m_State: {fileID: 110213486}
m_Position: {x: 264, y: 216, z: 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ override public void Show(Action<bool> callback)
}
}

animator.SetTrigger("Unlock");

SetScores();
}
else
Expand Down
12 changes: 12 additions & 0 deletions Assets/Tests/UI/UI.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,18 @@ Prefab:
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 191248, guid: 7a2e587034d846647b593aa159d7ed8d, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 196684, guid: 7a2e587034d846647b593aa159d7ed8d, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 124444, guid: 7a2e587034d846647b593aa159d7ed8d, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 7a2e587034d846647b593aa159d7ed8d, type: 2}
m_IsPrefabParent: 0
Expand Down

0 comments on commit 5ac18db

Please # to comment.