loading页面Tips调整&骑行卡顿问题解决

This commit is contained in:
lishuo committed 2022-01-06 18:01:48 +08:00
1 parent 0628bd3716
commit 43dc844998
4 files changed
+18 -23

No files matched your search

+2 -2
View File
@@ -16,9 +16,9 @@ namespace Assets.Scripts.Apis
{
return Get($"Map/GetMapToken?name={name}");
}
public string GetTipsList()
public JsonResult<List<string>> GetTipsList()
{
return Get($"Map/GetTipList");
return Get<JsonResult<List<string>>>($"Map/GetTipList");
}
/// <summary>
@@ -117,8 +117,10 @@ namespace Assets.Scenes.Ride.Scripts
//实时计算MaxAp
//mainController.ComputeMaxAP(Power, ticks);
//实时保存骑行记录
mainController.SaveRealTime();
if (ticks / 60 == 0)
{
mainController.SaveRealTime();
}
}
}
protected override void BeforeRun()
+7 -14
View File
@@ -11,17 +11,17 @@ public class MultiTips:PFUIText
private Button button;
private string[] tips { get; set; }
private int currentIndex = 0;
private System.Random random;
new void Awake()
{
base.Awake();
text = GetComponent<Text>();
var tiplist = ConfigHelper.mapApi.GetTipsList();
if (!string.IsNullOrEmpty(tiplist))
var result = ConfigHelper.mapApi.GetTipsList();
if (result.result)
{
tips = tiplist.Split('#');
tips = result.data.ToArray();
}
var random = new System.Random();
random = new System.Random();
currentIndex = random.Next(0, tips.Length);
SetText();
}
@@ -32,21 +32,14 @@ public class MultiTips:PFUIText
}
public void SetText()
{
if(text == null)
if(text == null || tips.Length == 0)
{
return;
}
currentIndex = random.Next(0, tips.Length);
if (currentIndex <= tips.Length)
{
text.text = tips[currentIndex];
if (currentIndex + 1 < tips.Length)
{
currentIndex++;
}
else
{
currentIndex = 0;
}
}
}
float time = 10f;