fix:AR相关修改
This commit is contained in:
1 parent
74ba5790f9
commit
c95f6b7c70
12 files changed
+382
-368
No files matched your search
@@ -69,6 +69,8 @@ public class GameRoomListController : PFUIPanel
|
||||
private Transform cycingRoomModal;
|
||||
private Transform resultRoomModal;
|
||||
private GameObject RoomRankItem;
|
||||
|
||||
InputField hourInputField, minInputField;
|
||||
|
||||
private string RoomName;
|
||||
private string Roompwd;
|
||||
@@ -103,6 +105,12 @@ public class GameRoomListController : PFUIPanel
|
||||
private bool ListChanged = false;
|
||||
private bool CreateRoomSuccessed = false;
|
||||
PFUIPageHelper pageHelper;
|
||||
private ARDownloader downloader;
|
||||
private GameRoomModel modelGameRoom { get; set; }
|
||||
private Text CyclingTimer { get; set; }
|
||||
List<GameRoomModel> list;
|
||||
private int Total { get; set; }
|
||||
private bool CreateClicked { get; set; }
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
@@ -126,73 +134,7 @@ public class GameRoomListController : PFUIPanel
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
index++;
|
||||
var g = Instantiate(RoomCell, _rectTransform);
|
||||
g.GetComponent<GameRoomCell>().ConfigureCell(item, index);
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
//查询自己当前创建的房间信息并进入
|
||||
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];
|
||||
App.gameRoomDetail = GameRoom;
|
||||
CreateRoomSuccessed = true;
|
||||
//进入房间清空列表
|
||||
list = null;
|
||||
Total = 0;
|
||||
ListChanged = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
@@ -208,14 +150,6 @@ public class GameRoomListController : PFUIPanel
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
App.Model = "GameRoom";
|
||||
MapUDPService.MessageListener = ListenerHandler;
|
||||
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, pageHelper.PageIndex, pageHelper.PageSize, seachName);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//房间已经进行骑行时间
|
||||
@@ -265,8 +199,84 @@ public class GameRoomListController : PFUIPanel
|
||||
|
||||
RenderDownloadTask();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
App.Model = "GameRoom";
|
||||
MapUDPService.MessageListener = ListenerHandler;
|
||||
MapUDPService.SendQueryGameRoomList(App.CurrentUser.Id, pageHelper.PageIndex, pageHelper.PageSize, seachName);
|
||||
}
|
||||
|
||||
//LOOM中取数据渲染下载当前下载进度
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
index++;
|
||||
var g = Instantiate(RoomCell, _rectTransform);
|
||||
g.GetComponent<GameRoomCell>().ConfigureCell(item, index);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
//查询自己当前创建的房间信息并进入
|
||||
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];
|
||||
App.gameRoomDetail = GameRoom;
|
||||
CreateRoomSuccessed = true;
|
||||
//进入房间清空列表
|
||||
list = null;
|
||||
Total = 0;
|
||||
ListChanged = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void RenderDownloadTask()
|
||||
{
|
||||
var downLoadList = transform.Find("DownLoadList").gameObject;
|
||||
@@ -510,7 +520,7 @@ public class GameRoomListController : PFUIPanel
|
||||
Query();
|
||||
});
|
||||
}
|
||||
InputField hourInputField, minInputField;
|
||||
|
||||
private void InitStep2()
|
||||
{
|
||||
//关门时间
|
||||
@@ -647,6 +657,7 @@ public class GameRoomListController : PFUIPanel
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void HandleStepBtn(string btnName)
|
||||
{
|
||||
next.SetActive(btnName == previous.name);
|
||||
@@ -661,6 +672,7 @@ public class GameRoomListController : PFUIPanel
|
||||
step1Btn.transform.Find("Bg").gameObject.SetActive(btnName == previous.name);
|
||||
step2Btn.transform.Find("Bg").gameObject.SetActive(btnName != previous.name);
|
||||
}
|
||||
|
||||
private void HandleFormInput()
|
||||
{
|
||||
if (Members >= 2 && !string.IsNullOrEmpty(RoomName) && CloseTime > 0 && CloseTime < 120)
|
||||
@@ -680,6 +692,7 @@ public class GameRoomListController : PFUIPanel
|
||||
create.GetComponent<Button>().enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleCloseTimeBtnClick(int closeTime, string btnName)
|
||||
{
|
||||
if (btnName != "MinInputField" && btnName != "HourInputField")
|
||||
@@ -699,6 +712,7 @@ public class GameRoomListController : PFUIPanel
|
||||
btn60.GetComponent<Image>().color = btn60.name == btnName ? pink : grey;
|
||||
HandleFormInput();
|
||||
}
|
||||
|
||||
private void HandleMembersBtnClick(int members, string btnName)
|
||||
{
|
||||
ColorUtility.TryParseHtmlString("#3D3E4D", out Color grey);
|
||||
@@ -711,6 +725,7 @@ public class GameRoomListController : PFUIPanel
|
||||
btn6.GetComponent<Image>().color = btn6.name == btnName ? pink : grey;
|
||||
HandleFormInput();
|
||||
}
|
||||
|
||||
private void ChangeDistance(int index)
|
||||
{
|
||||
var text = distanceOptions.GetComponent<Dropdown>().options[index].text;
|
||||
@@ -718,6 +733,7 @@ public class GameRoomListController : PFUIPanel
|
||||
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition = 1;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void OnEndDrag(BaseEventData arg0)
|
||||
{
|
||||
var scrollrect = scroll.GetComponent<ScrollRect>();
|
||||
@@ -731,6 +747,7 @@ public class GameRoomListController : PFUIPanel
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowPwdConfirm()
|
||||
{
|
||||
enterRoomModal.gameObject.SetActive(true);
|
||||
@@ -758,17 +775,13 @@ public class GameRoomListController : PFUIPanel
|
||||
}
|
||||
}
|
||||
|
||||
private ARDownloader downloader;
|
||||
|
||||
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; //倒计时
|
||||
CyclingTimer = cycingRoomModal.Find("Modal/Timer").GetComponent<Text>();
|
||||
}
|
||||
|
||||
public void ShowDonePanel(int roomId)
|
||||
{
|
||||
var result = ConfigHelper.GameRoomApi.GetDetail(roomId);
|
||||
@@ -794,6 +807,7 @@ public class GameRoomListController : PFUIPanel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowStatusModal(Transform tr,GameRoomModel data)
|
||||
{
|
||||
tr.Find("Modal/Id").GetComponent<Text>().text = data.RoomId.ToString().PadLeft(7, '0');
|
||||
@@ -823,6 +837,7 @@ public class GameRoomListController : PFUIPanel
|
||||
UIManager.AddEvent(quit, EventTriggerType.PointerClick, (e) => { tr.gameObject.SetActive(false); });
|
||||
tr.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void GetInRoom()
|
||||
{
|
||||
//1.房间人数已经满了
|
||||
@@ -844,19 +859,23 @@ public class GameRoomListController : PFUIPanel
|
||||
MapUDPService.SendJoinGameRoom(App.gameRoomDetail.RoomId,App.CurrentUser.Id,UIManager.Now.GetDateTime().ToUniversalTime());
|
||||
UIManager.ShowGameRoomDetailPanel();
|
||||
}
|
||||
|
||||
public void SelectRoom(GameRoomModel room)
|
||||
{
|
||||
GameRoom = room;
|
||||
RoomId = GameRoom.RoomId;
|
||||
}
|
||||
|
||||
public int GetRoomId()
|
||||
{
|
||||
return RoomId;
|
||||
}
|
||||
|
||||
public GameRoomModel GetCurrentRoom()
|
||||
{
|
||||
return GameRoom;
|
||||
}
|
||||
|
||||
public void Select(MapRoute map)
|
||||
{
|
||||
Map = map;
|
||||
@@ -887,6 +906,7 @@ public class GameRoomListController : PFUIPanel
|
||||
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(map.CountryCode);
|
||||
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
content.transform.DestroyChildren();
|
||||
@@ -894,54 +914,53 @@ public class GameRoomListController : PFUIPanel
|
||||
isEnd = false;
|
||||
GetList();
|
||||
}
|
||||
|
||||
private void onEndEdit()
|
||||
{
|
||||
var t = searchInput.GetComponent<InputField>().text;
|
||||
ftname = t;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void DisplayMaps(List<MapRoute> list)
|
||||
{
|
||||
if (map != null)
|
||||
if (map == null) return;
|
||||
foreach (var item in list)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var obj = Instantiate(map);
|
||||
obj.GetComponent<GameRoomMapItem>().Initial(item, caches);
|
||||
//obj.SendMessage("Initial", );
|
||||
obj.transform.SetParent(content.transform);
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
var obj = Instantiate(map, content.transform, true);
|
||||
obj.GetComponent<GameRoomMapItem>().Initial(item, caches);
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private async void GetList()
|
||||
{
|
||||
if (isEnd) return;
|
||||
var res = await ConfigHelper.mapApi.GetList(pageIndex, pageSize, ftname, distance, string.Join(",", hands), is3d, sort, sortDire, isEnableAR: isEnableAR, isEnableBattle: true);
|
||||
if (res.result)
|
||||
var res = await ConfigHelper.mapApi.GetList(pageIndex, pageSize, ftname, distance, string.Join(",", hands),
|
||||
is3d, sort, sortDire, isEnableAR: isEnableAR, isEnableBattle: true);
|
||||
if (!res.result) return;
|
||||
|
||||
if (res.data.Count == 0)
|
||||
{
|
||||
if (res.data.Count == 0)
|
||||
if (pageIndex != 0)
|
||||
{
|
||||
if (pageIndex != 0)
|
||||
{
|
||||
isEnd = true;
|
||||
scroll.transform.Find("Error").gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("当前没查到内容");
|
||||
scroll.transform.Find("Error").gameObject.SetActive(true);
|
||||
}
|
||||
isEnd = true;
|
||||
scroll.transform.Find("Error").gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
isEnd = false;
|
||||
DisplayMaps(res.data);
|
||||
scroll.transform.Find("Error").gameObject.SetActive(false);
|
||||
Debug.Log("当前没查到内容");
|
||||
scroll.transform.Find("Error").gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
isEnd = false;
|
||||
DisplayMaps(res.data);
|
||||
scroll.transform.Find("Error").gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
//创建房间
|
||||
private void CreateGameRoom(BaseEventData data)
|
||||
{
|
||||
@@ -957,6 +976,7 @@ public class GameRoomListController : PFUIPanel
|
||||
|
||||
MapList.SetActive(true);
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
|
||||
Reference in new issue
Block a user