Skip to content
Snippets Groups Projects
Commit 5f01d5b9 authored by John Schihada's avatar John Schihada
Browse files

Fixed bug occuring when assigning fact during hint-animation + Set default of...

Fixed bug occuring when assigning fact during hint-animation + Set default of selected scroll to OppositeLen
parent ec9fdaa5
No related branches found
No related tags found
No related merge requests found
...@@ -44005,6 +44005,11 @@ PrefabInstance: ...@@ -44005,6 +44005,11 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 75 value: 75
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 293934904814280933, guid: b996060e27da25c498842defc1996d84,
type: 3}
propertyPath: preferredStartScrollName
value: OppositeLen
objectReference: {fileID: 0}
- target: {fileID: 293934904949885392, guid: b996060e27da25c498842defc1996d84, - target: {fileID: 293934904949885392, guid: b996060e27da25c498842defc1996d84,
type: 3} type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
...@@ -44328,6 +44328,11 @@ PrefabInstance: ...@@ -44328,6 +44328,11 @@ PrefabInstance:
propertyPath: m_SizeDelta.y propertyPath: m_SizeDelta.y
value: 150 value: 150
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 293934904814280933, guid: b996060e27da25c498842defc1996d84,
type: 3}
propertyPath: preferredStartScrollName
value: OppositeLen
objectReference: {fileID: 0}
- target: {fileID: 293934904949885392, guid: b996060e27da25c498842defc1996d84, - target: {fileID: 293934904949885392, guid: b996060e27da25c498842defc1996d84,
type: 3} type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
public class ImageHintAnimation : MonoBehaviour public class ImageHintAnimation : MonoBehaviour
{ {
public Image imageToChange; public Image imageToChange;
private Color imageToChangeDefaultColor; public Color imageToChangeDefaultColor { get; set; }
private Color animationStartColor; private Color animationStartColor;
private Color animationEndColor; private Color animationEndColor;
...@@ -42,13 +42,19 @@ public void AnimationTrigger() ...@@ -42,13 +42,19 @@ public void AnimationTrigger()
} }
} }
public void ResetAnimation()
{
if (imageToChange != null)
{
Reset();
}
}
private void Animate() private void Animate()
{ {
if (timer >= animateDuration) if (timer >= animateDuration)
{ {
animating = false; Reset();
timer = 0;
imageToChange.color = imageToChangeDefaultColor;
} }
else else
{ {
...@@ -57,6 +63,13 @@ private void Animate() ...@@ -57,6 +63,13 @@ private void Animate()
} }
private void Reset()
{
animating = false;
timer = 0;
imageToChange.color = imageToChangeDefaultColor;
}
private void updateAnimationParameters() { private void updateAnimationParameters() {
animationStartColor = globalSettings.hintAnimationStartColor; animationStartColor = globalSettings.hintAnimationStartColor;
animationEndColor = globalSettings.hintAnimationEndColor; animationEndColor = globalSettings.hintAnimationEndColor;
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
public class DisplayScrolls : MonoBehaviour public class DisplayScrolls : MonoBehaviour
{ {
public string preferredStartScrollName;
public List<Scroll> scrolls; public List<Scroll> scrolls;
public GameObject[] ScrollButtons; public GameObject[] ScrollButtons;
public GameObject ScrollPrefab; public GameObject ScrollPrefab;
...@@ -98,6 +100,11 @@ void BuildScrolls(string jsonString) ...@@ -98,6 +100,11 @@ void BuildScrolls(string jsonString)
obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = this.scrolls[i].label; obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = this.scrolls[i].label;
ScrollButtons[i] = obj; ScrollButtons[i] = obj;
} }
Scroll preferredStartScroll = this.scrolls.Find(x => x.label.Equals(preferredStartScrollName));
if(preferredStartScroll != null)
this.DetailScreen.GetComponent<ScrollDetails>().setScroll(preferredStartScroll);
else
this.DetailScreen.GetComponent<ScrollDetails>().setScroll(this.scrolls[0]); this.DetailScreen.GetComponent<ScrollDetails>().setScroll(this.scrolls[0]);
} }
} }
...@@ -16,6 +16,10 @@ public void OnDrop(PointerEventData eventData){ ...@@ -16,6 +16,10 @@ public void OnDrop(PointerEventData eventData){
Destroy(current); Destroy(current);
current = Instantiate(eventData.pointerDrag,Vector3.zero, Quaternion.identity); current = Instantiate(eventData.pointerDrag,Vector3.zero, Quaternion.identity);
//Set imageToChangeDefaultColor of current: Fix so that current won't take the color
//the dragged item was having during animation
current.GetComponent<ImageHintAnimation>().imageToChangeDefaultColor = eventData.pointerDrag.GetComponent<ImageHintAnimation>().imageToChangeDefaultColor;
current.GetComponent<ImageHintAnimation>().ResetAnimation();
current.transform.SetParent(gameObject.transform, false); current.transform.SetParent(gameObject.transform, false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment