diff --git a/Assets/RaceButtonGroupScript.cs b/Assets/RaceButtonGroupScript.cs new file mode 100644 index 00000000..fc5402f0 --- /dev/null +++ b/Assets/RaceButtonGroupScript.cs @@ -0,0 +1,44 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class RaceButtonGroupScript : MonoBehaviour +{ + private Transform BtnEnter, BtnCancel, BtnWatch; + // Start is called before the first frame update + void Start() + { + BtnEnter = transform.Find("BtnEnter"); + BtnCancel = transform.Find("BtnCancel"); + BtnWatch = transform.Find("BtnWatch"); + if (BtnEnter != null) + { + UIManager.AddEvent(BtnEnter.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => GoEnter()); + } + if (BtnCancel != null) + { + UIManager.AddEvent(BtnCancel.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => GoCancel()); + } + if (BtnWatch != null) + { + UIManager.AddEvent(BtnWatch.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => GoWatch()); + } + } + void GoEnter() + { + Debug.Log("Enter"); + } + void GoCancel() + { + Debug.Log("Cancel"); + } + void GoWatch() + { + Debug.Log("Watch"); + } + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/RaceButtonGroupScript.cs.meta b/Assets/RaceButtonGroupScript.cs.meta new file mode 100644 index 00000000..d73fc25b --- /dev/null +++ b/Assets/RaceButtonGroupScript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5357b651626f6a1488bd3b1b756d271b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/RaceHomeScript.cs b/Assets/RaceHomeScript.cs new file mode 100644 index 00000000..7667cbd7 --- /dev/null +++ b/Assets/RaceHomeScript.cs @@ -0,0 +1,184 @@ +using Assets.Scripts; +using Assets.Scripts.Apis.Models; +using DG.Tweening; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; +using UnityEngine.UI; + +public class RaceHomeScript : RaceScript +{ + // Start is called before the first frame update + private ScrollRect scroll; + private Transform content,rightContainer,leftContainer,btnGoList; + private float contentSize; + private int count; + private Button L, R; + //当前鼠标悬浮的卡片 + async void Start() + { + scroll = transform.Find("LeftContainer/Swiper").GetComponent(); + content = scroll.content; + //Initial(); + if (scroll != null) + { + L = scroll.transform.Find("Left").GetComponent