对战AR
This commit is contained in:
1 parent
509c309252
commit
11b131b24a
60 files changed
+2505
-632
No files matched your search
@@ -134,7 +134,7 @@ public class GameRoomDetailController : PFUIPanel
|
||||
d3.SetActive(enable3d);
|
||||
ar.SetActive(GameRoom.EnableAR);
|
||||
|
||||
DataSourceChanged = true;
|
||||
//DataSourceChanged = true;
|
||||
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, 0, 1, GameRoom.RoomId.ToString());
|
||||
readyBtn.SetActive(true);
|
||||
cancelBtn.SetActive(false);
|
||||
|
||||
@@ -90,6 +90,12 @@ public class GameRoomListController : PFUIPanel
|
||||
[SerializeField]
|
||||
GameObject _searchBtn;
|
||||
|
||||
[SerializeField]
|
||||
GameObject _noDataFound;
|
||||
|
||||
[SerializeField]
|
||||
GameObject _downLoadTask;
|
||||
|
||||
private GameObject RoomCell { get; set; }
|
||||
|
||||
//Dummy data List
|
||||
@@ -104,7 +110,6 @@ public class GameRoomListController : PFUIPanel
|
||||
{
|
||||
base.Awake();
|
||||
RoomRankItem = Resources.Load<GameObject>("UI/Prefab/GameRoom/RoomRankItem");
|
||||
|
||||
RoomCell = Resources.Load<GameObject>("UI/Prefab/GameRoom/Room");
|
||||
//分页
|
||||
pageHelper = FindObjectOfType<PFUIPageHelper>();
|
||||
@@ -112,26 +117,35 @@ public class GameRoomListController : PFUIPanel
|
||||
pageHelper.PageSize = 6;
|
||||
pageHelper.Register((e) =>
|
||||
{
|
||||
|
||||
Query();
|
||||
});
|
||||
|
||||
|
||||
_searchInputField.onValueChanged.AddListener((e) => { seachName = e; });
|
||||
_searchInputField.onEndEdit.AddListener((e) => {
|
||||
seachName = e;
|
||||
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, pageHelper.PageIndex, pageHelper.PageSize, seachName);
|
||||
Query();
|
||||
});
|
||||
UIManager.AddEvent(_searchBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Search);
|
||||
UIManager.AddEvent(_searchBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, SearchBtn_Click);
|
||||
}
|
||||
private void Search(BaseEventData data)
|
||||
private void SearchBtn_Click(BaseEventData data)
|
||||
{
|
||||
pageHelper.PageIndex = 0;
|
||||
Query();
|
||||
}
|
||||
private void Query()
|
||||
{
|
||||
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, pageHelper.PageIndex, pageHelper.PageSize, seachName);
|
||||
}
|
||||
private void Refreash()
|
||||
{
|
||||
Utils.DestroyChildren(_rectTransform);
|
||||
pageHelper.Total = Total;
|
||||
pageHelper.Build();
|
||||
if (list == null)
|
||||
{
|
||||
_noDataFound.SetActive(true);
|
||||
return;
|
||||
}
|
||||
_noDataFound.SetActive(false);
|
||||
int index = 0;
|
||||
foreach (var item in list)
|
||||
{
|
||||
@@ -139,23 +153,33 @@ public class GameRoomListController : PFUIPanel
|
||||
var g = Instantiate(RoomCell, _rectTransform);
|
||||
g.GetComponent<GameRoomCell>().ConfigureCell(item, index);
|
||||
}
|
||||
pageHelper.Total = 10;
|
||||
pageHelper.Build();
|
||||
|
||||
}
|
||||
List<GameRoomModel> list;
|
||||
private int Total { get; set; }
|
||||
private bool CreateClicked { get; set; }
|
||||
private void ListenerHandler(List<ReceiveMsgModel> message)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (message.Count > 1)
|
||||
return;
|
||||
//查询列表
|
||||
var roomList = message.Where(c => c.RoomList != null).FirstOrDefault();
|
||||
if (roomList != null)
|
||||
{
|
||||
list = roomList.RoomList;
|
||||
Total = roomList.GameRoomTotal;
|
||||
ListChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
list = null;
|
||||
Total = 0;
|
||||
ListChanged = true;
|
||||
}
|
||||
//查询自己当前创建的房间信息并进入
|
||||
var info = message.Where(c => c.RoomList.Where(o => o.UserId == App.CurrentUser.Id).Any()).FirstOrDefault();
|
||||
var info = message.Where(c => c.RoomList != null && c.RoomList.Where(o => o.UserId == App.CurrentUser.Id && o.Status == 0).Any()).FirstOrDefault();
|
||||
if (info != null)
|
||||
{
|
||||
GameRoom = info.RoomList[0];
|
||||
@@ -186,33 +210,69 @@ public class GameRoomListController : PFUIPanel
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
|
||||
//LOOM中取数据渲染下载当前下载进度
|
||||
var downLoadList = transform.Find("DownLoadList").gameObject;
|
||||
var downloadPanel = transform.Find("DownloadPanel").gameObject;
|
||||
if (!downLoadList.activeSelf && !downloadPanel.activeSelf)
|
||||
{
|
||||
foreach (var item in Loom.DownLoadTaskList)
|
||||
{
|
||||
var content = downLoadList.transform.Find("Viewport/Content");
|
||||
var newtask = Instantiate(_downLoadTask, content);
|
||||
newtask.GetComponent<GameRoomDownloadTask>().Init(0, item.Key);
|
||||
}
|
||||
}
|
||||
App.Model = "GameRoom";
|
||||
MapUDPService.MessageListener = ListenerHandler;
|
||||
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, pageHelper.PageIndex, pageHelper.PageSize, seachName);
|
||||
}
|
||||
float timer = 1f;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
//房间已经进行骑行时间
|
||||
if (cycingRoomModal.gameObject.activeSelf)
|
||||
{
|
||||
var s = UIManager.Now.GetDateTime() - modelGameRoom.StartTime.Value.ToLocalTime();
|
||||
CyclingTimer.text = Helper.FormatTicks((int)s.TotalSeconds);
|
||||
}
|
||||
while (timer < 0)
|
||||
#region 搜索面板的滚轮监听
|
||||
if (scroll != null)
|
||||
{
|
||||
if (ListChanged)
|
||||
if (Input.GetAxis("Mouse ScrollWheel") != 0)
|
||||
{
|
||||
Refreash();
|
||||
ListChanged = false;
|
||||
if (scroll.GetComponent<ScrollRect>().verticalNormalizedPosition <= 0 ||
|
||||
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition >= (pageIndex == 0 ? 1.2 : 1))
|
||||
{
|
||||
startMouse = true;
|
||||
}
|
||||
}
|
||||
if (CreateRoomSuccessed & CreateClicked)
|
||||
else
|
||||
{
|
||||
CreateRoomSuccessed = false;
|
||||
CreateClicked = false;
|
||||
UIManager.ShowGameRoomDetailPanel();
|
||||
if (startMouse)
|
||||
{
|
||||
startMouse = false;
|
||||
OnEndDrag(null);
|
||||
}
|
||||
}
|
||||
timer += 1f;
|
||||
if (Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
onEndEdit();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (ListChanged)
|
||||
{
|
||||
Refreash();
|
||||
ListChanged = false;
|
||||
}
|
||||
//对战房间创建事件监听
|
||||
if (CreateRoomSuccessed & CreateClicked)
|
||||
{
|
||||
CreateRoomSuccessed = false;
|
||||
CreateClicked = false;
|
||||
UIManager.ShowGameRoomDetailPanel();
|
||||
}
|
||||
}
|
||||
private void InitStep1()
|
||||
@@ -416,11 +476,6 @@ public class GameRoomListController : PFUIPanel
|
||||
CreateClicked = true;
|
||||
});
|
||||
}
|
||||
private bool CreateClicked { get; set; }
|
||||
private void ResetMapList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void InitStep2()
|
||||
{
|
||||
@@ -603,20 +658,23 @@ public class GameRoomListController : PFUIPanel
|
||||
var download = transform.Find("DownloadPanel").gameObject;
|
||||
if (GameRoom.EnableAR && !File.Exists(filepath))
|
||||
{
|
||||
//查询fileUrl
|
||||
GameRoom.FileUrl = ConfigHelper.GameRoomApi.GetMapVideoURL(GameRoom.MapRouteId).data;
|
||||
download.SetActive(true);
|
||||
download.GetComponent<GameRoomDownLoad>().Init(RoomId, GameRoom.FileName, GameRoom.FileUrl, this);
|
||||
}
|
||||
GetInRoom();
|
||||
else
|
||||
{
|
||||
GetInRoom();
|
||||
}
|
||||
}
|
||||
|
||||
private GameRoomModel modelGameRoom { get; set; }
|
||||
//private GameRoomModel modelGameRoom { get; set; }
|
||||
private Text CyclingTimer { get; set; }
|
||||
public void ShowCycingPanel(GameRoomModel gameRoomModel)
|
||||
{
|
||||
ShowStatusModal(cycingRoomModal, gameRoomModel);
|
||||
//倒计时
|
||||
modelGameRoom = gameRoomModel;
|
||||
modelGameRoom = gameRoomModel; //倒计时
|
||||
CyclingTimer = cycingRoomModal.Find("Modal/Timer").GetComponent<Text>();
|
||||
}
|
||||
public void ShowDonePanel(int roomId)
|
||||
@@ -651,21 +709,20 @@ public class GameRoomListController : PFUIPanel
|
||||
var bestHead = tr.Find("Modal/BestTab/Head").GetComponent<RawImage>();
|
||||
var bestName = tr.Find("Modal/BestTab/NickName").GetComponent<Text>();
|
||||
var bestTimer = tr.Find("Modal/BestTab/Timer").GetComponent<Text>();
|
||||
|
||||
bestName.text = data.BestNickName;
|
||||
bestTimer.text = data.BestTotalTime;
|
||||
|
||||
//查询某线路最佳
|
||||
var result = ConfigHelper.mapApi.GetMapBestInfo(data.MapRouteId);
|
||||
if (result.result && !string.IsNullOrEmpty(result.data.BestNickName))
|
||||
{
|
||||
bestName.text = result.data.BestNickName;
|
||||
bestTimer.text = result.data.BestTotalTime;
|
||||
Utils.DisplayImage(bestHead, result.data.BestWxHeadImg);
|
||||
}
|
||||
Utils.DisplayImage(graph, data.AltitudeGraph);
|
||||
Utils.DisplayImage(bestHead, data.BestWxHeadImg);
|
||||
tr.Find("Modal/Props/DistanceText").GetComponent<Text>().text = data.Distance.ToString("f1") + "KM";
|
||||
tr.Find("Modal/Props/EleText").GetComponent<Text>().text = data.TotalClimb.ToString("f0") + "M";
|
||||
tr.Find("Modal/Props/SlopeText").GetComponent<Text>().text = data.AverageGrade.ToString("f1") + "%";
|
||||
tr.Find("Modal/StartTime").GetComponent<Text>().text = data.StartTime.Value.ToLocalTime().ToString();
|
||||
//var timegap = data.StartTime.Value.ToLocalTime() - UIManager.Now.GetDateTime();
|
||||
//if (timegap.Ticks > 0)
|
||||
//{
|
||||
// tr.Find("Modal/StartTime").GetComponent<Text>().text = Helper.FormatTicks((int)timegap.Ticks);
|
||||
//}
|
||||
|
||||
var close = tr.Find("Modal/Close").gameObject;
|
||||
var quit = tr.Find("Modal/Quit").gameObject;
|
||||
UIManager.AddEvent(close, EventTriggerType.PointerClick, (e) => { tr.gameObject.SetActive(false); });
|
||||
|
||||
@@ -47,7 +47,6 @@ public class GameRoomLoadingController : PFUIPanel
|
||||
videoLoading = FindObjectOfType<VideoLoading>();
|
||||
playerLoading = FindObjectOfType<LoadingController>();
|
||||
videoManager = FindObjectOfType<VideoGameManager>();
|
||||
videoManager?.SetCyclingModel(Assets.Scenes.Ride.Scripts.Model.CyclingModel.GameRoom);
|
||||
}
|
||||
private bool DataSourceChanged { get; set; }
|
||||
private void ListenerHandler(List<ReceiveMsgModel> message)
|
||||
@@ -103,7 +102,7 @@ public class GameRoomLoadingController : PFUIPanel
|
||||
{
|
||||
var detail = Instantiate(prefab, content);
|
||||
roomDetail = detail.GetComponent<GameRoomLoadingItem>();
|
||||
roomDetail.Init(item.UserId, item.WxHeadImage, item.RoomId, item.Process);
|
||||
roomDetail.Init(item.UserId, item.Name, item.WxHeadImage,item.Country,item.RoomId, item.Process);
|
||||
}
|
||||
}
|
||||
//判断是否进入骑行场景
|
||||
|
||||
@@ -40,7 +40,7 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
|
||||
var BtnContainer = transform.Find("MainFuncContainer");
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
var nav = transform.Find("MainNav-mobile").GetComponent<NewMainNav>();
|
||||
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 });
|
||||
@@ -61,12 +61,12 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowChangePlayerPanel();
|
||||
});
|
||||
BtnBattle = transform.Find("MainFuncContainer/BtnBattle");
|
||||
BtnBattle = BtnContainer.Find("BtnBattle");
|
||||
UIManager.AddEvent(BtnBattle.gameObject, EventTriggerType.PointerClick, GoGameRoom);
|
||||
UIManager.AddEvent(BtnBattle.gameObject, EventTriggerType.PointerEnter, OnHover);
|
||||
UIManager.AddEvent(BtnBattle.gameObject, EventTriggerType.PointerExit, OnExit);
|
||||
#endif
|
||||
var BtnContainer = transform.Find("MainFuncContainer");
|
||||
|
||||
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerClick, GoRide);
|
||||
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerEnter, OnHover);
|
||||
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerExit, OnExit);
|
||||
@@ -130,7 +130,12 @@ public class HomeController : PFUIPanel
|
||||
}
|
||||
private void GoGameRoom(BaseEventData e)
|
||||
{
|
||||
#if UNITY_STANDALONE_WIN
|
||||
var pe = (PointerEventData)e;
|
||||
var parent = pe.pointerEnter.transform.parent;
|
||||
UIManager.ShowGameRoomListPanel();
|
||||
OnExit(e);
|
||||
#endif
|
||||
}
|
||||
private void GoRide(BaseEventData e)
|
||||
{
|
||||
@@ -207,6 +212,10 @@ public class HomeController : PFUIPanel
|
||||
//parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
parent.DOScale(new Vector3(1.05f, 1.05f, 0), 0.3f);
|
||||
//parent.GetComponent<RectTransform>().localScale = ;
|
||||
|
||||
#if UNITY_STANDALONE_WIN
|
||||
parent.Find("ImageL").gameObject.SetActive(true);
|
||||
#endif
|
||||
}
|
||||
private void OnExit(BaseEventData e)
|
||||
{
|
||||
@@ -220,6 +229,9 @@ public class HomeController : PFUIPanel
|
||||
}
|
||||
parent.DOScale(new Vector3(1f, 1f, 0), 0.3f);
|
||||
//parent.GetComponent<RectTransform>().localScale = new Vector3(1f, 1f, 0);
|
||||
#if UNITY_STANDALONE_WIN
|
||||
parent.Find("ImageL").gameObject.SetActive(false);
|
||||
#endif
|
||||
}
|
||||
void MoreFunc()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user