45 lines
1006 B
C#
45 lines
1006 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class CoinScript : MonoBehaviour
|
|
{
|
|
public TextMeshProUGUI tMP_CoinCount;
|
|
public GameObject gold;
|
|
public GameObject silver;
|
|
public Transform endPoint;
|
|
public bool isBoss;
|
|
public Action JiaFen;
|
|
public void SetCoinCount(int count)
|
|
{
|
|
tMP_CoinCount.text = NumAdd(count.ToString());
|
|
}
|
|
public static string NumAdd(string num)
|
|
{
|
|
string str= $"<sprite=10>";
|
|
int a = num.Length;
|
|
bool isDouHao= false ;
|
|
if (a >= 4)
|
|
{
|
|
//"<Sprite=13>";
|
|
a-=3;
|
|
isDouHao = true;
|
|
}
|
|
for (int i = 0; i < num.Length; i++)
|
|
{
|
|
if (isDouHao)
|
|
{
|
|
if (i == a)
|
|
{
|
|
str += "<sprite=13>";
|
|
}
|
|
}
|
|
|
|
str += $"<sprite={num[i]}>" ;
|
|
}
|
|
return str;
|
|
}
|
|
}
|