Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts: # Assets/Scripts/Apis/Models/MapCompetition.cs # Assets/Scripts/UI/Prefab/Race/RaceButtonGroupScript.cs
This commit is contained in:
commit
ac59808915
25 files changed
+826
-200
No files matched your search
@@ -0,0 +1,62 @@
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class RaceButtonGroupScript : MonoBehaviour
|
||||
{
|
||||
private Transform BtnEnter, BtnCancel, BtnWatch;
|
||||
public MapCompetition map { get; set; }
|
||||
public Transform parent { get; set; }
|
||||
// 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()
|
||||
{
|
||||
if (!map.HasJoin)
|
||||
{
|
||||
parent.GetComponent<RaceItemScript>().Join();
|
||||
}else
|
||||
{
|
||||
App.RouteIdParam = map.RouteId;
|
||||
App.CompetionId = map.Id;
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
Debug.Log(map);
|
||||
}
|
||||
void GoCancel()
|
||||
{
|
||||
if (map.HasJoin)
|
||||
{
|
||||
parent.GetComponent<RaceItemScript>().CancelJoin();
|
||||
}
|
||||
}
|
||||
void GoWatch()
|
||||
{
|
||||
App.RouteIdParam = map.RouteId;
|
||||
App.CompetionId = map.Id;
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user