对战与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();
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,19 @@ public class GameRoomCell : MonoBehaviour, ICell, IBeginDragHandler, IDragHandle
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter,OnEnter);
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerExit, OnExit);
|
||||
UIManager.AddEvent(JoinBtn, EventTriggerType.PointerClick, JoinGameRoom);
|
||||
//对战正在进行
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if (gameRoom.Status == 1)
|
||||
{
|
||||
manager.ShowCycingPanel(gameRoom);
|
||||
}
|
||||
else if (gameRoom.Status == 2)
|
||||
{
|
||||
manager.ShowDonePanel(gameRoom.RoomId);
|
||||
}
|
||||
});
|
||||
|
||||
//对战正在进行
|
||||
UIManager.AddEvent(CycingBtn, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
|
||||
@@ -39,6 +39,10 @@ public class GameRoomResult : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
manager = FindObjectOfType<CyclingController>();
|
||||
//if (manager == null)
|
||||
//{
|
||||
// manager = FindObjectOfType<VideoGameManager>();
|
||||
//}
|
||||
var closeBtn = transform.Find("Close").gameObject;
|
||||
Head = transform.Find("Mine/Head").GetComponent<RawImage>();
|
||||
Ranking = transform.Find("Mine/Ranking").GetComponent<Text>();
|
||||
|
||||
@@ -35,6 +35,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
|
||||
//[SerializeField] RawImage rawImage;
|
||||
void Start()
|
||||
{
|
||||
transform.Find("CollectImg").gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
||||
@@ -237,6 +237,7 @@ public class GameRoomDetailController : PFUIPanel
|
||||
{
|
||||
//路线
|
||||
App.RouteIdParam = GameRoom.MapRouteId;
|
||||
App.MainSceneParam["Name"] = "GameRoomList";
|
||||
if (GameRoom.EnableAR)
|
||||
{
|
||||
SceneManager.LoadScene("VideoPlay");
|
||||
|
||||
@@ -96,6 +96,8 @@ public class GameRoomListController : PFUIPanel
|
||||
|
||||
[SerializeField]
|
||||
GameObject _downLoadTask;
|
||||
[SerializeField]
|
||||
GameObject _avatar;
|
||||
|
||||
private GameObject RoomCell { get; set; }
|
||||
|
||||
@@ -126,12 +128,18 @@ public class GameRoomListController : PFUIPanel
|
||||
Query();
|
||||
});
|
||||
UIManager.AddEvent(_searchBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, SearchBtn_Click);
|
||||
UIManager.AddEvent(_avatar, UnityEngine.EventSystems.EventTriggerType.PointerClick, AvatarBtn_Click);
|
||||
|
||||
}
|
||||
private void SearchBtn_Click(BaseEventData data)
|
||||
{
|
||||
pageHelper.PageIndex = 0;
|
||||
Query();
|
||||
}
|
||||
private void AvatarBtn_Click(BaseEventData data)
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
}
|
||||
private void Query()
|
||||
{
|
||||
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, pageHelper.PageIndex, pageHelper.PageSize, seachName);
|
||||
@@ -494,7 +502,7 @@ public class GameRoomListController : PFUIPanel
|
||||
Query();
|
||||
});
|
||||
}
|
||||
|
||||
InputField hourInputField, minInputField;
|
||||
private void InitStep2()
|
||||
{
|
||||
//关门时间
|
||||
@@ -510,8 +518,8 @@ public class GameRoomListController : PFUIPanel
|
||||
btn5 = right2.transform.Find("btn5").gameObject;
|
||||
btn6 = right2.transform.Find("btn6").gameObject;
|
||||
//房间名和密码
|
||||
var hourInputField = right2.transform.Find("HourInputField").GetComponent<InputField>();
|
||||
var minInputField = right2.transform.Find("MinInputField").GetComponent<InputField>();
|
||||
hourInputField = right2.transform.Find("HourInputField").GetComponent<InputField>();
|
||||
minInputField = right2.transform.Find("MinInputField").GetComponent<InputField>();
|
||||
var roomNameInputField = right2.transform.Find("RoomNameInputField").GetComponent<InputField>();
|
||||
var passwordInputField = right2.transform.Find("PasswordInputField").GetComponent<InputField>();
|
||||
btnMore.SetActive(true);
|
||||
@@ -539,7 +547,7 @@ public class GameRoomListController : PFUIPanel
|
||||
Roompwd = e;
|
||||
HandleFormInput();
|
||||
});
|
||||
|
||||
|
||||
UIManager.AddEvent(minInputField.gameObject, EventTriggerType.Select, (e) => {
|
||||
hourInputField.GetComponent<Outline>().enabled = true;
|
||||
HandleFormInput();
|
||||
@@ -563,6 +571,7 @@ public class GameRoomListController : PFUIPanel
|
||||
UIManager.AddEvent(btnMore, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
btnMore.SetActive(false);
|
||||
HandleCloseTimeBtnClick(0, hourInputField.name);
|
||||
hourInputField.gameObject.SetActive(true);
|
||||
minInputField.gameObject.SetActive(true);
|
||||
});
|
||||
@@ -571,13 +580,23 @@ public class GameRoomListController : PFUIPanel
|
||||
hourInputField.onValueChanged.AddListener((e) => {
|
||||
hours = Convert.ToInt32(e);
|
||||
CloseTime = hours * 60 + mins;
|
||||
ValidateCloseTime(hours, CloseTime);
|
||||
HandleCloseTimeBtnClick(CloseTime, hourInputField.name);
|
||||
});
|
||||
//分钟
|
||||
minInputField.onValueChanged.RemoveAllListeners();
|
||||
UIManager.AddEvent(minInputField.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
HandleCloseTimeBtnClick(CloseTime, minInputField.name);
|
||||
});
|
||||
UIManager.AddEvent(hourInputField.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
HandleCloseTimeBtnClick(CloseTime, hourInputField.name);
|
||||
});
|
||||
minInputField.onValueChanged.AddListener((e) => {
|
||||
mins = Convert.ToInt32(e);
|
||||
CloseTime = hours * 60 + mins;
|
||||
ValidateCloseTime(hours, CloseTime);
|
||||
HandleCloseTimeBtnClick(CloseTime, minInputField.name);
|
||||
});
|
||||
|
||||
@@ -604,6 +623,22 @@ public class GameRoomListController : PFUIPanel
|
||||
HandleMembersBtnClick(6, btn6.name);
|
||||
});
|
||||
}
|
||||
|
||||
private bool ValidateCloseTime(int value,int closeTime)
|
||||
{
|
||||
bool result = true;
|
||||
if (value < 0)
|
||||
{
|
||||
result = false;
|
||||
Utils.showToast(gameObject, App.GetLocalString("cannot be negative!"));
|
||||
}
|
||||
if (closeTime > 120)
|
||||
{
|
||||
result = false;
|
||||
Utils.showToast(gameObject, App.GetLocalString("closetime cannot over 120 minutes!"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private void HandleStepBtn(string btnName)
|
||||
{
|
||||
next.SetActive(btnName == previous.name);
|
||||
@@ -620,7 +655,7 @@ public class GameRoomListController : PFUIPanel
|
||||
}
|
||||
private void HandleFormInput()
|
||||
{
|
||||
if (Members >= 2 && !string.IsNullOrEmpty(RoomName) && CloseTime > 0)
|
||||
if (Members >= 2 && !string.IsNullOrEmpty(RoomName) && CloseTime > 0 && CloseTime < 120)
|
||||
{
|
||||
create.GetComponent<Image>().color = PFConstants.Pink;
|
||||
create.transform.Find("Text").GetComponent<Text>().color = Color.white;
|
||||
@@ -639,6 +674,14 @@ public class GameRoomListController : PFUIPanel
|
||||
}
|
||||
private void HandleCloseTimeBtnClick(int closeTime, string btnName)
|
||||
{
|
||||
if (btnName != "MinInputField" && btnName != "HourInputField")
|
||||
{
|
||||
hourInputField.text = "0";
|
||||
minInputField.text = "0";
|
||||
hourInputField.gameObject.SetActive(false);
|
||||
minInputField.gameObject.SetActive(false);
|
||||
btnMore.SetActive(true);
|
||||
}
|
||||
ColorUtility.TryParseHtmlString("#3D3E4D", out Color grey);
|
||||
ColorUtility.TryParseHtmlString("#F93086", out Color pink);
|
||||
CloseTime = closeTime;
|
||||
@@ -865,7 +908,7 @@ public class GameRoomListController : PFUIPanel
|
||||
private async void GetList()
|
||||
{
|
||||
if (isEnd) return;
|
||||
var res = await ConfigHelper.mapApi.GetList(pageIndex, pageSize, ftname, distance, string.Join(",", hands), is3d, sort, sortDire, isEnableAR:false);//isEnableAR TODO:临时禁用AR地图
|
||||
var res = await ConfigHelper.mapApi.GetList(pageIndex, pageSize, ftname, distance, string.Join(",", hands), is3d, sort, sortDire, isEnableAR:false, isEnableBattle: true);
|
||||
if (res.result)
|
||||
{
|
||||
if (res.data.Count == 0)
|
||||
|
||||
@@ -57,10 +57,11 @@ public class NewHomeController : PFUIPanel
|
||||
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
|
||||
mainNav.ShowExit();
|
||||
|
||||
UIManager.AddEvent(transform.Find("TodayData/ChangePlayerBtn").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowChangePlayerPanel();
|
||||
});
|
||||
//TODO:换装功能还未完善先注释功能
|
||||
//UIManager.AddEvent(transform.Find("TodayData/ChangePlayerBtn").gameObject, EventTriggerType.PointerClick, b =>
|
||||
//{
|
||||
// UIManager.ShowChangePlayerPanel();
|
||||
//});
|
||||
BtnBattle = BtnContainer.Find("BtnBattle");
|
||||
UIManager.AddEvent(BtnBattle.gameObject, EventTriggerType.PointerClick, GoGameRoom);
|
||||
UIManager.AddEvent(BtnBattle.gameObject, EventTriggerType.PointerEnter, OnHover);
|
||||
|
||||
Reference in new issue
Block a user