对战与AR骑行相关逻辑修改
This commit is contained in:
1 parent
3bcb3ee83e
commit
89b5275efd
64 files changed
+50131
-29495
No files matched your search
@@ -1,13 +1,18 @@
|
||||
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 ActivityAdController : PFUIPanel
|
||||
{
|
||||
Dictionary<string, Texture> caches;
|
||||
private int activityType = 0;//0:内置网页 1:骑行 2:赛事
|
||||
private int routeId = 0;
|
||||
private int competitionId = 0;
|
||||
protected override void Awake()
|
||||
{
|
||||
caches = new Dictionary<string, Texture>();
|
||||
@@ -22,6 +27,23 @@ public class ActivityAdController : PFUIPanel
|
||||
UIManager.AddEvent(transform.Find("Image").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, async b =>
|
||||
{
|
||||
Close();
|
||||
if (activityType == 1)
|
||||
{
|
||||
App.RouteIdParam = routeId;
|
||||
var routeRes = ConfigHelper.mapApi.GetById(routeId);
|
||||
if (routeRes.result)
|
||||
{
|
||||
if (routeRes.data.EnableAR)
|
||||
{
|
||||
SceneManager.LoadScene("VideoPlay");
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
//可以传参
|
||||
//UIManager.ShowActivityPanel(url);
|
||||
await ConfigHelper.activityApi.JoinActivity(id);
|
||||
@@ -44,18 +66,22 @@ public class ActivityAdController : PFUIPanel
|
||||
private void ShowSelf()
|
||||
{
|
||||
var ad = App.adQueue.Dequeue();
|
||||
UIManager.ShowActivityAdPanel(ad.Id, ad.DetailUrl, ad.Url + $"?Token={App.CurrentUser.cookie}");
|
||||
ad.Url = ad.Url + $"?Token={App.CurrentUser.cookie}";
|
||||
UIManager.ShowActivityAdPanel(ad);
|
||||
}
|
||||
string image = null, url = null;
|
||||
int id = 0;
|
||||
public void Initial(int id, string image, string url)
|
||||
public void Initial(ActivityModel activity)
|
||||
{
|
||||
this.id = id;
|
||||
this.image = image;
|
||||
this.id = activity.Id;
|
||||
this.image = activity.DetailUrl;
|
||||
var ri = transform.Find("Image").GetComponent<RawImage>();
|
||||
Utils.DisplayImageTempDict(ri, image, caches);
|
||||
App.ActivityUrl = url;
|
||||
this.url = url;
|
||||
this.url = activity.Url;
|
||||
this.activityType = activity.ActivityType;
|
||||
this.routeId = activity.RouteId;
|
||||
this.competitionId = activity.CompetitionId;
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
@@ -66,6 +92,5 @@ public class ActivityAdController : PFUIPanel
|
||||
{
|
||||
caches = null;
|
||||
Resources.UnloadUnusedAssets();
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user