[英]Using Lists in a C# application through Boo
import EternalDungeon
import System.Collections
static def PlayerActivate():
for x in range(ED.Mobs.Count):
if ED.Mobs(x).Pos == ED.player.SpaceInFront():
ED.Mobs(x).OnHit(ED.Sword)
break
When this is compiled, I get the error 编译时,出现错误
BCE0077: It's not possible to invoke an expression of type 'System.Collections.Generic.List'1[[EternalDungeon.Mob, Eternal Dungeon, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=null]]
At (6,15) and (7,16). 在(6,15)和(7,16)。 In C# I include assemblies like so, which is probably wrong and wierd: 在C#中,我包括这样的程序集,这可能是错误的,也是奇怪的:
compiler.Parameters.References.Add(Assembly.LoadFile(Directory.GetCurrentDirectory() + @"\Eternal Dungeon.exe";));
compiler.Parameters.References.Add(Assembly.GetAssembly(typeof(System.Collections.Comparer)));
Any help is appreciated, and I'm rather new to both Boo and 'Assemblies'. 感谢您的帮助,我对Boo和“ Assemblies”都是陌生的。 Thanks in advance. 提前致谢。
Solved the problem myself, I confused lists for arrays, 我自己解决了这个问题,我混淆了数组列表,
if ED.Mobs(x).Pos == ED.player.SpaceInFront():
Changes to 更改为
if ED.Mobs[x].Pos == ED.player.SpaceInFront():
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.