images and text reutilisable sur le swipe

This commit is contained in:
esteb
2023-01-22 00:21:24 +01:00
parent 46ea5867d7
commit c784e559f3
3 changed files with 621 additions and 307 deletions

View File

@@ -16,6 +16,9 @@ public class SwipeManagementScript : MonoBehaviour
public GameObject arrowRight;
//public GameObject arrow;
public Button buttonleft;
public Button buttonright;
public Animator m_Animator;
public TMP_Text textNumber;
@@ -27,8 +30,7 @@ public class SwipeManagementScript : MonoBehaviour
private GameObject image;
public List<GameObject> imageAndTexts;
private int indexList = 0;
private Image imageUI;
// Start is called before the first frame update
void Start()
@@ -36,6 +38,10 @@ public class SwipeManagementScript : MonoBehaviour
textSteps.text = lengths[0].text;
textNumber.text = "Step 1/" + (lengthTexts+1);
arrowLeft.gameObject.SetActive(false);
Button btnLeft = buttonleft.GetComponent<Button>();
Button btnRight = buttonright.GetComponent<Button>();
btnLeft.onClick.AddListener(PreviousText);
btnRight.onClick.AddListener(NextText);
}
// Update is called once per frame
@@ -119,12 +125,12 @@ public class SwipeManagementScript : MonoBehaviour
private void SetImageStep(){
textSteps.text = "";
textNumber.text = "Step" + (numberImage+1) + "/" + (lengthTexts+1);
image = imageAndTexts[indexList];
indexList ++;
image.SetActive(true);
image = GameObject.Find("Image"+ numberImage);
imageUI = image.GetComponent<Image>();
imageUI.enabled = true;
}
private void DisableImageStep(){
image.SetActive(false);
imageUI.enabled = false;
}
}