diff --git a/Assets/BannerController.cs b/Assets/BannerController.cs new file mode 100644 index 00000000..623f2004 --- /dev/null +++ b/Assets/BannerController.cs @@ -0,0 +1,157 @@ +using Assets.Scripts; +using Assets.Scripts.Apis.Models; +using DG.Tweening; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEngine.UI; + +public class BannerController : MonoBehaviour +{ + // Start is called before the first frame update + private List itemList; + private List standardPositions; + private List list; + private int currentIndex = 1; + void Awake() + { + itemList = new List + { + transform.Find("1").GetComponent(), + transform.Find("2").GetComponent(), + transform.Find("3").GetComponent() + }; + standardPositions = new List + { + transform.Find("1").localPosition,transform.Find("2").localPosition,transform.Find("3").localPosition + }; + + Debug.Log(standardPositions[0]); + Debug.Log(standardPositions[1]); + Debug.Log(standardPositions[2]); + } + private void Start() + { + GetList(); + } + async void GetList() + { + var res = await ConfigHelper.mapApi.GetRecommendAreaList(); + if (res.result) + { + if (res.data.Count >= 3) + { + Initial(res.data); + gameObject.SetActive(true); + } + else + { + gameObject.SetActive(false); + } + } + } + + public void Initial(List list) + { + int index = 0; + foreach (CanvasGroup c in itemList) + { + var area = list[index++]; + c.GetComponent().Initial(area); + if (c.alpha != 1) + { + c.GetComponent