swipe almost finished
This commit is contained in:
parent
8cea51f47f
commit
e02467b154
@ -24,6 +24,7 @@ public class SwipeScript : MonoBehaviour
|
|||||||
Button btnRight = arrowRight.GetComponent<Button>();
|
Button btnRight = arrowRight.GetComponent<Button>();
|
||||||
btnLeft.onClick.AddListener(PreviousText);
|
btnLeft.onClick.AddListener(PreviousText);
|
||||||
btnRight.onClick.AddListener(NextText);
|
btnRight.onClick.AddListener(NextText);
|
||||||
|
imageText.sprite = lengths[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -44,22 +45,33 @@ public class SwipeScript : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void NextText(){
|
private void NextText(){
|
||||||
numberImage ++;
|
if(numberImage < lengthTexts)
|
||||||
if(numberImage == lengthTexts){
|
{
|
||||||
arrowRight.gameObject.SetActive(false);
|
numberImage ++;
|
||||||
}else{
|
if(numberImage == lengthTexts){
|
||||||
arrowRight.gameObject.SetActive(true);
|
arrowRight.gameObject.SetActive(false);
|
||||||
|
}else{
|
||||||
|
arrowRight.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
if(numberImage != 0){
|
||||||
|
arrowLeft.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
imageText.sprite = lengths[numberImage];
|
||||||
}
|
}
|
||||||
imageText.sprite = lengths[numberImage];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PreviousText(){
|
private void PreviousText(){
|
||||||
numberImage --;
|
if(numberImage > 0) {
|
||||||
if(numberImage == 0){
|
numberImage --;
|
||||||
arrowLeft.gameObject.SetActive(false);
|
if(numberImage == 0){
|
||||||
}else{
|
arrowLeft.gameObject.SetActive(false);
|
||||||
arrowLeft.gameObject.SetActive(true);
|
}else{
|
||||||
|
arrowLeft.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
if(numberImage != lengthTexts){
|
||||||
|
arrowRight.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
imageText.sprite = lengths[numberImage];
|
||||||
}
|
}
|
||||||
imageText.sprite = lengths[numberImage];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user