下面的脚本是我开始研究的,它需要一个TextAsset并分割线条并将其与各种字符串进行比较。但是我的检查函数只返回false。有什么重大的我想念,统一不会抛出任何错误,所以我不知道该怎么做来解决这个问题。bool isItem(TextAsset f)总是返回false
internal sealed class Checker {
private string AssetType(TextAsset fileToBeChecked) {
string[] line = fileToBeChecked.text.Split (new char[] { '\n' });
return line [0];
}
public bool isItem(TextAsset file) {
string type = AssetType (file).ToLower();
if (type == "helmet" || type == "cuirass" || type == "gauntlets" || type == "gloves" || type == "boots" || type == "leggings" || type == "shield" || type == "robes" || type == "shirt" || type == "pants" || type == "shoes" || type == "hood" || type == "staff" || type == "stave" || type == "sword" || type == "greatsword" || type == "dagger" || type == "mace" || type == "warhammer" || type == "axe" || type == "waraxe" || type == "bow" || type == "misc") {
return true;
} else {
return false;
}
}
}
}
我的测试文件如下:
Helmet
1
Dragon's Vale
0
10
0
14
1280
调试
那么,什么是'type'当您调试呢? –
这应该很容易使用调试器解决。我们不知道'AssetType(file).ToLower()'返回的是什么,因为我们不知道你的上下文。那么我们应该怎么知道为什么这些条件永远不会通过? – HimBromBeere
@EvanTrimboli包含信息状态头盔的文件,当我有功能给我的价值后拉它说头盔。但是当它与“头盔”相比时,它返回了错误。 –