应为类委托、枚举、接口或结构错误
本文关键字:接口 结构 错误 枚举 | 更新日期: 2023-09-27 18:20:06
嗨,伙计们,我真的是编码新手,我不明白这个错误是什么,你能解释一下或帮我纠正这个错误吗?我把它放在公共静态字节上,我试图为ps3做一些东西。我也试图从我做的另一个项目中继承一些东西,但我一直收到这个错误
namespace BO2
{
internal class Typewriter
{
uint AllClientHUD = 1023;//Set A Certain Element To All Clients
PS3API PS3 = new PS3API();
}
}
public static byte[] ToHexFloat(float Axis)
{
byte[] bytes = BitConverter.GetBytes(Axis);
Array.Reverse(bytes);
return bytes;
}
public static void SetGlow(int elemIndex, int r1, int g1, int b1, int a1)
{
uint elem = OffsetsHUD.G_HudElems + ((Convert.ToUInt32(elemIndex)) * 0x88);
PS3.SetMemory(elem + HElems.glowColor, RGBA(r1, g1, b1, a1));
System.Threading.Thread.Sleep(20);
}
public static void MoveShaderXY(uint index, float X, float Y)
{
PS3.Extension.WriteFloat(OffsetsHUD.G_HudElems + (index * 0x88) + HElems.X, X);
PS3.Extension.WriteFloat(OffsetsHUD.G_HudElems + (index * 0x88) + HElems.Y, Y);
}
public static void MoveShaderY(uint index, float Y)
{
PS3.Extension.WriteFloat(OffsetsHUD.G_HudElems + (index * 0x88) + HElems.Y, Y);
}
public static void SetGlowText(int elemIndex, int client, string Text, short font, double fontScale, float x, float y, uint align, int sort, int R, int G, int B, int A, int R1, int G1, int B1, int A1)
{
uint elem = OffsetsHUD.G_HudElems + ((Convert.ToUInt32(elemIndex)) * 0x88);
byte[] ClientID = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
PS3.SetMemory(elem, new byte[0x88]);
PS3.SetMemory(elem + HElems.type, ReverseBytes(BitConverter.GetBytes(1)));
PS3.SetMemory(elem + 0x79, new byte[] { 0xFF });
PS3.SetMemory(elem + HElems.FontSize, new byte[] { 0x3f, 0xc0 });
PS3.Extension.WriteInt32(elem + HElems.text, G_LocalizedStringIndex(Text));
PS3.Extension.WriteFloat(elem + HElems.FontSize, (float)fontScale);
PS3.Extension.WriteInt16(elem + 0x70, font);
PS3.SetMemory(elem + 0x70, new byte[] { 0x01 });
PS3.SetMemory(elem + HElems.X, ToHexFloat(x));
PS3.SetMemory(elem + HElems.Y, ToHexFloat(y));
PS3.SetMemory(elem + HElems.color, RGBA(R, G, B, A));
PS3.SetMemory(elem + HElems.color, RGBA(R1, G1, B1, A1));
PS3.SetMemory(elem + HElems.clientOffset, ClientID);
PS3.Extension.WriteByte(elem + HElems.flags, 1);
}
/*
public static uint TOP_RIGHT = 168u;
public static uint TOP_LEFT = 136u;
public static uint TOP_CENTERED = 120u;
public static uint BOTTOM_RIGHT = 170u;
public static uint BOTTOM_LEFT = 138u;
public static uint BOTTOM_CENTER = 154u;
public static uint CENTER_MIDDLE = 146u;
public static uint CENTER_LEFT = 130u;
public static uint CENTER_RIGHT = 162u;
}
C#没有"全局"方法的概念,因此方法必须在类或结构的主体中声明,而不是直接在文件的根中声明。
如果你的所有方法(ToHexFloar、SetGlow等)都与TypeWriter类相关,你应该直接在PS3API PS3=new PS3API()行之后写它们;也就是说在那个班级里。
namespace BO2
{
internal class Typewriter
{
uint AllClientHUD = 1023;//Set A Certain Element To All Clients
PS3API PS3 = new PS3API();
public static byte[] ToHexFloat(float Axis)
{
byte[] bytes = BitConverter.GetBytes(Axis);
Array.Reverse(bytes);
return bytes;
}
public static void SetGlow(int elemIndex, int r1, int g1, int b1, int a1)
{
uint elem = OffsetsHUD.G_HudElems + ((Convert.ToUInt32(elemIndex)) * 0x88);
PS3.SetMemory(elem + HElems.glowColor, RGBA(r1, g1, b1, a1));
System.Threading.Thread.Sleep(20);
}
...
}
}