Merge remote-tracking branch 'origin/dev_cyp' into dev_lishuo
# Conflicts: # Assets/Scripts/Apis/Models/MapCompetition.cs
This commit is contained in:
commit
d18ff09002
50 files changed
+14689
-227
No files matched your search
@@ -452,5 +452,26 @@ namespace Assets.Scripts
|
||||
DisplayImage(raw, s);
|
||||
}
|
||||
}
|
||||
public static void SetTextWithEllipsis(this Text textComponent, string value)
|
||||
{
|
||||
var generator = new TextGenerator();
|
||||
var rectTransform = textComponent.GetComponent<RectTransform>();
|
||||
var settings = textComponent.GetGenerationSettings(rectTransform.rect.size);
|
||||
generator.Populate(value, settings);
|
||||
var characterCountVisible = generator.characterCountVisible;
|
||||
var updatedText = value;
|
||||
if (value.Length > characterCountVisible && characterCountVisible != -1)
|
||||
{
|
||||
updatedText = value.Substring(0, characterCountVisible - 3);
|
||||
updatedText += "…";
|
||||
}
|
||||
textComponent.text = updatedText;
|
||||
}
|
||||
public static string GetCountDown(TimeSpan time)
|
||||
{
|
||||
var second = Math.Ceiling(time.TotalSeconds);
|
||||
var ts = TimeSpan.FromSeconds(second);
|
||||
return $"{ (int)ts.TotalHours }:{ts:mm}:{ts:ss}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user