AR以及对战房间部分代码重构
This commit is contained in:
1 parent
fb4da81ce2
commit
a149a7c08e
13 files changed
+280
-262
No files matched your search
@@ -126,9 +126,8 @@ namespace Assets.Scripts.Apis.Models
|
||||
}
|
||||
else
|
||||
{
|
||||
_List[i].Grade = Math.Round(a / b * 100, 4);
|
||||
_List[i].Grade = Math.Min(Math.Round(a / b * 100, 4),12);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private void CalcCenter()
|
||||
|
||||
@@ -392,14 +392,8 @@ public class MainController : BaseScene
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//UIManager.ShowNewRouteOverviewPanel();
|
||||
//UIManager.ShowUserInfoPanel();
|
||||
//UIManager.ShowEditUserPanel();
|
||||
//UIManager.ShowBigMapPanel();
|
||||
//UIManager.ShowEarthPanel();
|
||||
}
|
||||
ShowGameRoomInviteConfirm();
|
||||
|
||||
UIManager.UpdateJoinCompetition();//查询当前我参加的赛事
|
||||
//await GetDeviceListAsync(); PC品牌
|
||||
//显示首页的3d小人
|
||||
@@ -430,6 +424,134 @@ public class MainController : BaseScene
|
||||
{
|
||||
base.Update();
|
||||
|
||||
HandleGameRoom();
|
||||
|
||||
CanvasSizeChanged();
|
||||
|
||||
t -= Time.deltaTime;
|
||||
while (t <= 0)
|
||||
{
|
||||
App.CurrentScene = "Main";
|
||||
UIManager.SendCompetitionStartMessage("Main");
|
||||
t = 1;
|
||||
scanTicks++;
|
||||
emptyt++;
|
||||
if (emptyt >= 10)
|
||||
{
|
||||
emptyt = 0;
|
||||
if (App.currentPageIsHome)
|
||||
{
|
||||
FinishMessageLeft();
|
||||
}
|
||||
}
|
||||
if (scanTicks == 10)
|
||||
{
|
||||
//App.MainDeviceAdapter.StopScan();
|
||||
//Debug.Log("StopScan");
|
||||
}
|
||||
MapUDPService.Send(0, App.CurrentUser.Id, new double[]{ 0d,0d}, competitionId: 0,model:App.Model);
|
||||
HandleCompetition();
|
||||
}
|
||||
}
|
||||
|
||||
private void CanvasSizeChanged()
|
||||
{
|
||||
if (App.canvasWidth != transform.GetComponent<RectTransform>().sizeDelta.x)
|
||||
{
|
||||
App.canvasWidth = transform.GetComponent<RectTransform>().sizeDelta.x;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleCompetition()
|
||||
{
|
||||
var list = MapUDPService.GetAllOnlineUserList();
|
||||
var lang = App.GetLocalLanguage();
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (item.Point != null && item.Point.Length > 0 && item.Point[0] == -1d)
|
||||
{
|
||||
var message = lang == "zh" ? $"{item.Name}进入了 运动地球" : "entered PowerFun";
|
||||
EventQueueSystem.QueueEventOnce(
|
||||
new LinkedMessageEvent(-1, message, item.HeadImage, item.Name, item.RouteName),
|
||||
$"{item.Id}{item.LastActiveTime}{item.Point}");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.RouteName))
|
||||
continue;
|
||||
if (item.RouteId > 0)
|
||||
{
|
||||
var message = "";
|
||||
if (item.TotalTicks == 0 && item.PreDistance == 0)
|
||||
{
|
||||
var routeName = string.IsNullOrEmpty(item.RouteName) ? $"#{item.RouteId}" : item.RouteName;
|
||||
message = lang == "zh"
|
||||
? $"发起了对<color=#f93086>{routeName}</color>的挑战!"
|
||||
: $"started riding <color=#f93086>{item.RouteName}</color>!";
|
||||
}
|
||||
|
||||
if (item.IsCompleted)
|
||||
{
|
||||
message = lang == "zh"
|
||||
? $"完成了<color=#f93086>{item.RouteName}</color>的挑战!"
|
||||
: $"completed <color=#f93086>{item.RouteName}</color> ride!";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
{
|
||||
EventQueueSystem.QueueEventOnce(
|
||||
new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName),
|
||||
$"{item.RouteId}{item.Name}");
|
||||
}
|
||||
}
|
||||
|
||||
//距离50
|
||||
if (item.EndDistance >= 50 && item.EndDistance < 100)
|
||||
{
|
||||
var message = lang == "zh"
|
||||
? $"在<color=#f93086>{item.RouteName}</color>中骑行里程达到<color=#e3d427>{"50KM"}</color>!"
|
||||
: $"riding distance reaches <color=#e3d427>{"50KM"}</color> in <color=#f93086>{item.RouteName}</color>!";
|
||||
EventQueueSystem.QueueEventOnce(
|
||||
new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName),
|
||||
$"{item.RouteId}{item.Name}50KM");
|
||||
}
|
||||
|
||||
//距离100
|
||||
if (item.EndDistance >= 100)
|
||||
{
|
||||
var message = lang == "zh"
|
||||
? $"在<color=#f93086>{item.RouteName}</color>中骑行里程达到<color=#e3d427>{"100KM"}</color>!"
|
||||
: $"riding distance reaches <color=#e3d427>{"100KM"}</color> in <color=#f93086>{item.RouteName}</color>!";
|
||||
EventQueueSystem.QueueEventOnce(
|
||||
new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName),
|
||||
$"{item.RouteId}{item.Name}100KM");
|
||||
}
|
||||
|
||||
//速度50
|
||||
if (item.Speed >= 50)
|
||||
{
|
||||
var message = lang == "zh"
|
||||
? $"在<color=#f93086>{item.RouteName}</color>中骑行速度达到<color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color>!"
|
||||
: $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color> in <color=#f93086>{item.RouteName}</color>!";
|
||||
EventQueueSystem.QueueEventOnce(
|
||||
new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName),
|
||||
$"{item.RouteId}{item.Name}50KM/H");
|
||||
}
|
||||
|
||||
//功体比
|
||||
if (item.WeightKg >= 4)
|
||||
{
|
||||
var message = lang == "zh"
|
||||
? $"在<color=#f93086>{item.RouteName}</color>中功体比达到<color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color>!"
|
||||
: $" riding PWR reaches <color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color> in <color=#f93086>{item.RouteName}</color>!";
|
||||
EventQueueSystem.QueueEventOnce(
|
||||
new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName),
|
||||
$"{item.RouteId}{item.Name}3WeightKg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleGameRoom()
|
||||
{
|
||||
if (DataSorceChanged)
|
||||
{
|
||||
DataSorceChanged = false;
|
||||
@@ -456,108 +578,10 @@ public class MainController : BaseScene
|
||||
gameRoomProcessing = false;
|
||||
SceneManager.LoadScene("Ride");
|
||||
}
|
||||
clearcachet -= Time.deltaTime;
|
||||
if (clearcachet <= 0)
|
||||
{
|
||||
Debug.Log("清一次");
|
||||
Resources.UnloadUnusedAssets();
|
||||
GC.Collect();
|
||||
clearcachet = 30;
|
||||
}
|
||||
if (App.canvasWidth != transform.GetComponent<RectTransform>().sizeDelta.x)
|
||||
{
|
||||
App.canvasWidth = transform.GetComponent<RectTransform>().sizeDelta.x;
|
||||
//Debug.Log(App.canvasWidth);
|
||||
}
|
||||
//Debug.Log(transform.GetComponent<RectTransform>().sizeDelta.x);
|
||||
t -= Time.deltaTime;
|
||||
while (t <= 0)
|
||||
{
|
||||
App.CurrentScene = "Main";
|
||||
UIManager.SendCompetitionStartMessage("Main");
|
||||
t = 1;
|
||||
scanTicks++;
|
||||
emptyt++;
|
||||
if (emptyt >= 10)
|
||||
{
|
||||
emptyt = 0;
|
||||
if (App.currentPageIsHome)
|
||||
{
|
||||
FinishMessageLeft();
|
||||
}
|
||||
}
|
||||
if (scanTicks == 10)
|
||||
{
|
||||
//App.MainDeviceAdapter.StopScan();
|
||||
//Debug.Log("StopScan");
|
||||
}
|
||||
MapUDPService.Send(0, App.CurrentUser.Id, new double[]{ 0d,0d}, competitionId: 0,model:App.Model);
|
||||
//发送消息
|
||||
|
||||
var list = MapUDPService.GetAllOnlineUserList();
|
||||
var lang = App.GetLocalLanguage();
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (item.Point != null && item.Point.Length > 0 && item.Point[0] == -1d)
|
||||
{
|
||||
var message = lang == "zh" ? $"{item.Name}进入了 运动地球" : "entered PowerFun";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(-1, message, item.HeadImage, item.Name, item.RouteName), $"{item.Id}{item.LastActiveTime}{item.Point}");
|
||||
}
|
||||
if (string.IsNullOrEmpty(item.RouteName))
|
||||
continue;
|
||||
if (item.RouteId > 0)
|
||||
{
|
||||
var message = "";
|
||||
if (item.TotalTicks == 0 && item.PreDistance == 0)
|
||||
{
|
||||
var routeName = string.IsNullOrEmpty(item.RouteName) ? $"#{item.RouteId}" : item.RouteName;
|
||||
message = lang=="zh"?$"发起了对<color=#f93086>{routeName}</color>的挑战!" : $"started riding <color=#f93086>{item.RouteName}</color>!";
|
||||
}
|
||||
if (item.IsCompleted)
|
||||
{
|
||||
message = lang == "zh" ? $"完成了<color=#f93086>{item.RouteName}</color>的挑战!" : $"completed <color=#f93086>{item.RouteName}</color> ride!";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
{
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name,item.RouteName), $"{item.RouteId}{item.Name}");
|
||||
}
|
||||
}
|
||||
//距离50
|
||||
if (item.EndDistance >= 50 && item.EndDistance < 100)
|
||||
{
|
||||
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中骑行里程达到<color=#e3d427>{"50KM"}</color>!" : $"riding distance reaches <color=#e3d427>{"50KM"}</color> in <color=#f93086>{item.RouteName}</color>!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}50KM");
|
||||
}
|
||||
//距离100
|
||||
if (item.EndDistance >= 100)
|
||||
{
|
||||
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中骑行里程达到<color=#e3d427>{"100KM"}</color>!" : $"riding distance reaches <color=#e3d427>{"100KM"}</color> in <color=#f93086>{item.RouteName}</color>!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}100KM");
|
||||
}
|
||||
////速度35
|
||||
//if (item.Speed >= 35)
|
||||
//{
|
||||
// var message = lang == "zh" ? $"骑行速度突破<color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color>!" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color>!";
|
||||
// EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}35KM/H");
|
||||
//}
|
||||
//速度50
|
||||
if (item.Speed >= 50)
|
||||
{
|
||||
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中骑行速度达到<color=#e3d427>{Math.Round(item.Speed,2)}KM/H</color>!" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color> in <color=#f93086>{item.RouteName}</color>!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}50KM/H");
|
||||
}
|
||||
//功体比
|
||||
if (item.WeightKg >= 4)
|
||||
{
|
||||
var message = lang == "zh" ? $"在<color=#f93086>{item.RouteName}</color>中功体比达到<color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color>!" : $" riding PWR reaches <color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color> in <color=#f93086>{item.RouteName}</color>!";
|
||||
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}3WeightKg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShowGameRoomInviteConfirm();
|
||||
}
|
||||
|
||||
|
||||
private async Task Login()
|
||||
{
|
||||
var result = await ConfigHelper.userApi.Login("13115011550", "laozhong", "");
|
||||
|
||||
@@ -519,17 +519,20 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
else
|
||||
{
|
||||
SendQuit4GameRoom();
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
}
|
||||
private void SendQuit4GameRoom()
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
//如果在对战房间内,发送退出房间的命令
|
||||
if (mainController.roomId > 0)
|
||||
{
|
||||
MapUDPService.SendGameRoomKick(mainController.roomId, App.CurrentUser.Id, App.CurrentUser.Id);
|
||||
}
|
||||
QuitGameRoom();
|
||||
}
|
||||
|
||||
//如果在对战房间内,发送退出房间的命令
|
||||
private void QuitGameRoom()
|
||||
{
|
||||
if (mainController.roomId == 0) return;
|
||||
MapUDPService.SendGameRoomKick(mainController.roomId, App.CurrentUser.Id, App.CurrentUser.Id);
|
||||
}
|
||||
//不保存退出
|
||||
public virtual void CancelQuit(BaseEventData baseEventData)
|
||||
@@ -537,7 +540,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
modalPanel.SetActive(false);
|
||||
quitPanel.SetActive(false);
|
||||
mainController.ClearTempFile();
|
||||
SendQuit4GameRoom();
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
//取消退出
|
||||
@@ -556,8 +558,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
protected virtual void StopShortRide(BaseEventData baseEventData)
|
||||
{
|
||||
//发送退出房间的命令
|
||||
SendQuit4GameRoom();
|
||||
SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
protected virtual void CancelStopShortRide(BaseEventData baseEventData)
|
||||
|
||||
@@ -1293,7 +1293,7 @@ public BaseUIManager singleUIManager;
|
||||
var path = PFConstants.MapWorkoutRecordFolder + "/" + recordId;
|
||||
Helper.CreateDirectoryIfNotExsit(path);
|
||||
|
||||
string imageFileName = path +"/"+ Guid.NewGuid().ToString() + ".png";
|
||||
var imageFileName = path +"/"+ Guid.NewGuid().ToString() + ".png";
|
||||
CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f), imageFileName);
|
||||
cyclingController.recorderData.StartTime = startTime;
|
||||
cyclingController.recorderData.IsCompleted = totalDistance >= mapData.TotalDistance;
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
if (animator != null)
|
||||
{
|
||||
animator.SetFloat(PreSpeed, (float)preSpeed);
|
||||
animator.SetFloat(AnimatorSpeed, (float)speed);
|
||||
animator.SetFloat(AnimatorSpeed, (float)OnlineSpeed);
|
||||
animator.SetFloat(Grade, (float)currentSlope);
|
||||
animator.SetFloat(Power, (float)power);
|
||||
}
|
||||
@@ -172,6 +172,10 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
}
|
||||
public virtual void ComputeRecord() { }
|
||||
|
||||
private const double DoubleDelta = 1E-6;
|
||||
|
||||
private const double GradeFactor = 0.5f;
|
||||
//计算当前区段属性下一个区段属性
|
||||
public void ComputeNextSlope()
|
||||
{
|
||||
@@ -194,19 +198,20 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
break;
|
||||
}
|
||||
}
|
||||
var DOUBLE_DELTA = 1E-6;
|
||||
if (Math.Abs(totalDistance - mapData.TotalDistance) < DOUBLE_DELTA)
|
||||
|
||||
if (Math.Abs(totalDistance - mapData.TotalDistance) < DoubleDelta)
|
||||
{
|
||||
currentIndex = pointList.Count - 1;
|
||||
}
|
||||
Debug.Log(currentIndex);
|
||||
preIndex = currentIndex > 0 ? currentIndex - 1 : 0;//前一个索引
|
||||
int nextIndex = currentIndex == pointList.Count - 1 ? currentIndex : currentIndex + 1; //计算下一个点的坡度和距离
|
||||
|
||||
elevation = pointList[currentIndex].Elevation;
|
||||
currentSlope = pointList[currentIndex].Grade;
|
||||
currentSlope = pointList[currentIndex].Grade * GradeFactor;
|
||||
//CurrentDistance = pointList[currentIndex].Distance;
|
||||
//计算下一个海拔和坡度&当前区间距离
|
||||
nextSlope = pointList[nextIndex].Grade;
|
||||
nextSlope = pointList[nextIndex].Grade * GradeFactor;
|
||||
nextSlopeDistance = sumDistance - totalDistance * 1000;
|
||||
//NextSlopeTotalDistance = pointList[nextIndex].Distance;
|
||||
currentSlopeDistance = (totalDistance * 1000 - (sumDistance - pointList[currentIndex].Distance));
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Assets.Scenes.Ride.Scripts.Model;
|
||||
using Assets.Scenes.Ride.Scripts.Model.CyclingModels;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.Scenes.VideoRide
|
||||
{
|
||||
@@ -16,11 +15,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
userName = App.CurrentUser.Nickname;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
}
|
||||
|
||||
public void SetEndDistance(double distance)
|
||||
{
|
||||
this.totalDistance = distance;
|
||||
@@ -39,11 +33,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
}
|
||||
|
||||
public override void ComputeAnimator()
|
||||
{
|
||||
base.ComputeAnimator();
|
||||
}
|
||||
|
||||
public override void ComputePlayer()
|
||||
{
|
||||
heartRate = manager.UpDateHeart();
|
||||
@@ -77,7 +66,8 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
gameRoomHandled = true;
|
||||
var gap = model.FirstEndTime.Value - UIManager.Now.GetDateTime();
|
||||
var seconds = Math.Floor(gap.TotalSeconds);
|
||||
UIManager.ShowGameRoomCountDownPanel((int)seconds, () => {
|
||||
UIManager.ShowGameRoomCountDownPanel((int)seconds, () =>
|
||||
{
|
||||
Upload();
|
||||
var uiManager = FindObjectOfType<VideoUIManager>();
|
||||
uiManager.ShowResultPanel();
|
||||
@@ -85,10 +75,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
}
|
||||
|
||||
public override void ComputeAnimatorSpeed()
|
||||
{
|
||||
base.ComputeAnimatorSpeed();
|
||||
}
|
||||
public override void ComputeRecord()
|
||||
{
|
||||
var mapData = manager.GetMapData();
|
||||
|
||||
@@ -10,67 +10,48 @@ public class GameRoomCountDownController : PFUIPanel
|
||||
public Text endCount;
|
||||
|
||||
private int Seconds { get; set; }
|
||||
|
||||
public GameRoomModel GameRoom { get; set; }
|
||||
|
||||
private Action Callback { get; set; }
|
||||
|
||||
protected override void Awake()
|
||||
private bool simple { get; set; }
|
||||
public void Init(int seconds,Action action,bool isEnd = false,bool simple = false)
|
||||
{
|
||||
base.Awake();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
}
|
||||
private bool isSimple { get; set; }
|
||||
public void Init(int seconds,Action action,bool isEnd = false,bool isSimple = false)
|
||||
{
|
||||
stopped = false;
|
||||
_stopped = false;
|
||||
Seconds = seconds;
|
||||
Callback = action;
|
||||
this.simple = simple;
|
||||
endCount.gameObject.SetActive(false);
|
||||
this.isSimple = isSimple;
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
base.Close();
|
||||
}
|
||||
private bool stopped;
|
||||
private bool _stopped;
|
||||
public void Stop()
|
||||
{
|
||||
this.stopped = true;
|
||||
this._stopped = true;
|
||||
}
|
||||
|
||||
float timer = 0f;
|
||||
private float _timer = 0f;
|
||||
private void Update()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
while (timer < 0)
|
||||
_timer -= Time.deltaTime;
|
||||
while (_timer < 0)
|
||||
{
|
||||
if (Seconds == 0)
|
||||
{
|
||||
Callback?.Invoke();
|
||||
}
|
||||
if (Seconds < 0 || stopped)
|
||||
|
||||
if (Seconds <= 0 || _stopped)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isSimple)
|
||||
{
|
||||
count.text = Seconds.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
count.text = Helper.FormatTicks(Seconds);
|
||||
}
|
||||
endCount.text = Helper.FormatTicks(Seconds);
|
||||
}
|
||||
|
||||
count.gameObject.SetActive(Seconds >0);
|
||||
count.text = simple ? Seconds.ToString() : Helper.FormatTicks(Seconds);
|
||||
endCount.text = Helper.FormatTicks(Seconds);
|
||||
Seconds--;
|
||||
timer += 1f;
|
||||
_timer += 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,30 +105,24 @@ public class GameRoomDetailController : PFUIPanel
|
||||
private void ListenerHandler(List<ReceiveMsgModel> message)
|
||||
{
|
||||
var detail = message.FirstOrDefault();
|
||||
if (detail != null)
|
||||
if (detail == null || message.Count > 1) return;
|
||||
|
||||
if (detail.RoomList == null)
|
||||
{
|
||||
if (detail.RoomList == null)
|
||||
{
|
||||
DataSourceChanged = true;
|
||||
GameRoom = null;
|
||||
return;
|
||||
}
|
||||
GameRoom = detail.RoomList.Where(c => c.RoomId == GameRoom.RoomId).FirstOrDefault();
|
||||
if (GameRoom != null)
|
||||
{
|
||||
DataSourceChanged = true;
|
||||
}
|
||||
DataSourceChanged = true;
|
||||
GameRoom = null;
|
||||
return;
|
||||
}
|
||||
GameRoom = detail.RoomList.Where(c => c.RoomId == GameRoom.RoomId).FirstOrDefault();
|
||||
if (GameRoom != null)
|
||||
{
|
||||
DataSourceChanged = true;
|
||||
}
|
||||
}
|
||||
float timer = 0f;
|
||||
private void Update()
|
||||
{
|
||||
TcpHandler();
|
||||
timer -= Time.deltaTime;
|
||||
while (timer < 0)
|
||||
{
|
||||
timer += 1f;
|
||||
}
|
||||
}
|
||||
private void Init()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user