2022-01-07 15:11:40 +08:00
|
|
|
|
using Assets.Scripts;
|
|
|
|
|
|
using Assets.Scripts.Apis.Models;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
public class RecommendController : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
public Recommand Area { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Initial(Recommand area, Dictionary<string, Texture> caches = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
transform.Find("Panel/Text").GetComponent<Text>().text = area.Title;
|
|
|
|
|
|
Utils.DisplayImageTempDict(GetComponent<RawImage>(), area.CoverImage, caches);
|
|
|
|
|
|
this.Area = area;
|
|
|
|
|
|
GetComponent<Button>().onClick.RemoveAllListeners();
|
|
|
|
|
|
GetComponent<Button>().onClick.AddListener(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
DoWithType();
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async void DoWithType()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Area == null) return;
|
|
|
|
|
|
switch (Area.Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
//路线
|
|
|
|
|
|
App.RouteIdParam = Area.RouteId;
|
|
|
|
|
|
SceneManager.LoadScene("Ride");
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
var res = await ConfigHelper.mapApi.GetMapRouteAreaDetailItem(Area.AreaId);
|
2022-01-18 13:24:19 +08:00
|
|
|
|
UIManager.ShowNewRouteDetailPanel(res.data.Id);
|
2022-01-07 15:11:40 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
Application.OpenURL(Area.Url);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
App.RouteIdParam = Area.RouteId;
|
|
|
|
|
|
App.CompetionId = Area.CompetitionId;
|
|
|
|
|
|
SceneManager.LoadScene("Ride");
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|