static void Initial() { LandDate l = new LandDate() { active = true, location = new Point2(0, -0.94f), w = 2, h = 0.12f, distance = 1.2f }; buff_land = new LandDate[] { l }; buff_needle = null; LoadLand(ref buff_land, iid.land); LoadRole(); buff_img[iid.needle].count = 0; buff_t[0].reg = false; game.execute = () => { GamePage.page.ShowDeclare(); }; }
public static void Initial() { if (initail) { for (int i = 0; i < 64; i++) { layout.land[i].active = false; } for (int i = 0; i < 128; i++) { layout.needle[i].active = false; } } else { int c = RegPicture("other"); iid.other = RegImage(c, 4); c = RegPicture("polygon"); iid.bar = RegImage(c, 0); iid.record = RegImage(c, 8); layout.land = new LandDate[64]; layout.needle = new LandDate[128]; VertexPositionTexture[] vpt = new VertexPositionTexture[6]; vpt[0].TextureCoordinate.Y = 1; vpt[2].TextureCoordinate.X = 0.75f; vpt[2].TextureCoordinate.Y = 1; vpt[3].TextureCoordinate.X = 0.75f; vpt[3].TextureCoordinate.Y = 1; vpt[5].TextureCoordinate.X = 0.75f; buff_img[iid.bar].vertex = vpt; createBar = new LandDate(); layout.tool = new LandDate[4]; layout.tool[0].points = new Point2[4]; SetTex_Pos(ref buff_img[iid.other].vertex, 0, 0, 0, 0.25f, 1); buff_img[iid.other].count = 2; layout.record = new LandDate[8]; } buff_img[iid.land].count = 0; role.location.x = -0.88f; role.location.y = -0.82f; LoadRole(); initail = true; }
unsafe static LayOut LoadLayout(ref byte[] data, int offset) { LayOut l = new LayOut(); fixed(byte *pb = &data[offset]) { float *pf = (float *)pb; l.role.origin.x = *pf; pf++; l.role.origin.y = *pf; pf++; int *head = (int *)pf; pf += 22;//offset=96 int p = (int)pf; int c = *head; LandDate[] t = new LandDate[c]; LoadData(ref data, ref t, p); l.land = t; head++; p += c * 20; c = *head; t = new LandDate[c]; LoadData(ref data, ref t, p); l.needle = t; head++; p += c * 20; c = *head; t = new LandDate[c]; LoadData(ref data, ref t, p); l.record = t; } return(l); }
static void CreateNeedle(ref LandDate n, ref VertexPositionTexture[] vpt, int index) { Point2[] p = new Point2[3]; float scale = n.w; if (scale != 0)//0==def 1 { float a = n.h; if (a != 0)//angle { p[0].x = tri_mod[0].x; p[0].y = scale * tri_mod[0].y; p[1].x = tri_mod[1].x; p[1].y = scale * tri_mod[1].y; p[2].x = tri_mod[2].x; p[2].y = scale * tri_mod[2].y; p = RotatePoint2(ref p, ref n.location, a, 0.5625f); n.points = p; } else { float x = n.location.x; float y = n.location.y; p[0].x = scale * tri_modA[0].x + x; p[0].y = y; p[1].x = x; p[1].y = scale * tri_modA[1].y + y; p[2].x = scale * tri_modA[2].x + x; p[2].y = y; n.points = p; } } else { float a = n.h; if (a != 0)//angle { p = RotatePoint2(ref tri_mod, ref n.location, a, 0.5625f); n.points = p; } else { float x = n.location.x; float y = n.location.y; p[0].x = tri_modA[0].x + x; p[0].y = y; p[1].x = x; p[1].y = tri_modA[1].y + y; p[2].x = tri_modA[2].x + x; p[2].y = y; n.points = p; } } vpt[index].Position.X = p[0].x; vpt[index].Position.Y = p[0].y; index++; vpt[index].Position.X = p[1].x; vpt[index].Position.Y = p[1].y; index++; vpt[index].Position.X = p[2].x; vpt[index].Position.Y = p[2].y; }