目前我知道48是0的ASCII等价物,但是我正在做所有事情以获得正常的十进制形式。请查看下面的代码,看看我到底要做什么。 truckUpgradeArray基本上是6 0s作为一个字符串,但是当我把它们放入TRUCKS数组时,它是一个整数数组,它显示为48.即使调试并看到你的值是什么,它显示为0。
void loadUpgrades()
{
truckUpgradeArray = null;
int arrayPos = 0;
truckUpgradeArray = PlayerPrefs.GetString("truckUpgradeArray");
Debug.Log(truckUpgradeArray);
var truckArray = truckUpgradeArray.ToCharArray();
int o = 0;
for (int i = 0; i < truckArray.Length; i++)
{
char c = truckArray [i];
int u = (int) c;
TRUCKS[o, arrayPos] = u;
arrayPos++;
if (arrayPos == 3) {
o++;
arrayPos = 0;
}
}
}
答案 0 :(得分:1)
function popupFactory<T extends AbstractPopup>(popupType: new() => T, data: {}): T
{
var popup = new popupType();
return popup;
}
var p = popupFactory(ConcretePopup, {})