powerfun-unity/Assets/Scripts/UI/Prefab/Race/RaceModalScript.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2021-08-27 15:06:56 +08:00
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RaceModalScript : RaceScript
{
// Start is called before the first frame update
void Start()
{
UIManager.AddEvent(transform.Find("Container/Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
//停止计时器
2021-09-02 14:18:26 +08:00
gameObject.SetActive(false);
2021-08-27 15:06:56 +08:00
transform.GetComponent<RaceScript>().SetCurrentItem(null);
2021-09-02 14:18:26 +08:00
_parent.GetComponent<RaceItemScript>().Refresh();
2021-08-27 15:06:56 +08:00
});
}
// Update is called once per frame
void Update()
{
}
2021-09-02 14:18:26 +08:00
public override void Show()
2021-08-27 15:06:56 +08:00
{
2021-09-02 14:18:26 +08:00
base.Show();
}
Transform _parent;
public void Initial(Transform parent, MapCompetition mapCompetition)
{
_parent = parent;
2021-08-27 15:06:56 +08:00
var item = transform.Find("Container/Main/ItemSmall-Mobile");
item.GetComponent<RaceItemScript>().Initial(mapCompetition, transform,"modal");
//开始计时器
transform.GetComponent<RaceScript>().SetCurrentItem(item);
Utils.DisplayImage(transform.Find("Container/Main/Left").GetComponent<RawImage>(),
mapCompetition.RouteCover, true);
}
}