Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp

This commit is contained in:
Caiyanpeng committed 2022-01-07 11:05:43 +08:00
commit fa0d9e973c
15 files changed
+779 -694

No files matched your search

+9 -16
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,24 +32,17 @@ 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 = 5f;
float time = 10f;
// Update is called once per frame
void Update()
{
@@ -57,7 +50,7 @@ public class MultiTips:PFUIText
while (time<0)
{
SetText();
time += 5f;
time += 10f;
}
}
}