预期的类委托,枚举,接口或结构错误

时间:2014-08-30 01:38:24

标签: c# enums

嗨大家我真的很新编码我不明白这个错误是什么你可以解释或帮我解决这个错误我得到它在公共静态字节我试图为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;

  }

2 个答案:

答案 0 :(得分:1)

C#没有“全局”方法的概念,因此方法必须在类或结构的主体内声明,而不是直接在文件的根目录。

答案 1 :(得分:0)

如果你的所有方法(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);
        }

        ...

    }
}