Example #1
0
 public static void Save()
 {
     if (level == null)
     {
         level = new List <LayOut>();
     }
     level.Add(layout);
     layout.role.origin = role.location;
     FileManage.SaveLayout(ref layout, "custom");
 }
Example #2
0
        public static void Start()
        {
            AsyncManage.AsyncDelegate(() => { FileManage.LoadAppLayout("001.png", (t) => { maps = t; }); });
            int pid = RegPicture("polygon");

            iid.land  = RegImage(pid, 0);
            buff_land = new LandDate[64];
            VertexPositionTexture[] vpt = new VertexPositionTexture[384];//64*6
            for (int i = 1; i < 384; i++)
            {
                vpt[i].TextureCoordinate.Y = 1;
                i++;
                vpt[i].TextureCoordinate.X = 0.25f;
                i++;
                vpt[i].TextureCoordinate.X = 0.25f;
                i++;
                vpt[i].TextureCoordinate.Y = 1;
                i++;
                vpt[i].TextureCoordinate.X = 0.25f;
                vpt[i].TextureCoordinate.Y = 1;
                i++;
            }
            buff_img[iid.land].vertex = vpt;
            iid.needle = RegImage(pid, 0);
            vpt        = new VertexPositionTexture[384];//128*3
            for (int i = 0; i < 384; i++)
            {
                vpt[i].TextureCoordinate.X = 0.25f;
                vpt[i].TextureCoordinate.Y = 1;
                i++;
                vpt[i].TextureCoordinate.X = 0.375f;
                i++;
                vpt[i].TextureCoordinate.X = 0.5f;
                vpt[i].TextureCoordinate.Y = 1;
            }
            buff_img[iid.needle].vertex = vpt;
            save        = FileManage.LoadArichive();
            role        = new Role();
            role.points = new Point2[4];
            role.pid    = RegPicture("wanna");
            role.imgid  = RegImage(role.pid, 0);
            vpt         = new VertexPositionTexture[6];
            buff_img[role.imgid].vertex = vpt;
            SetTex_PosA(ref buff_img[role.imgid].vertex, 0, Vector2.Zero);
            Initial();
            buff_t[0].col.A = 255;
            buff_t[0].col.R = 255;
        }
Example #3
0
 public static int GetCount()
 {
     if (level != null)
     {
         return(level.Count);
     }
     else
     {
         level = FileManage.LoadLayout("custom");
         if (level != null)
         {
             return(level.Count);
         }
         return(-1);
     }
 }
Example #4
0
 static void CaculNeedle()
 {
     if (buff_needle != null)
     {
         for (int i = 0; i < buff_needle.Length; i++)
         {
             if (buff_needle[i].active)
             {
                 float x = role.location.x - buff_needle[i].location.x;
                 if (x < 0)
                 {
                     x = -x;
                 }
                 if (x < buff_needle[i].distance)
                 {
                     x = role.location.y - buff_needle[i].location.y;
                     if (x < 0)
                     {
                         x = -x;
                     }
                     if (x < buff_needle[i].distance)
                     {
                         if (PToP2A(ref buff_needle[i].points, ref motion))
                         {
                             role.location = role.loc_back;
                             role.motion.x = 0;
                             role.motion.y = 0;
                             save.die_count++;
                             buff_t[0].text = "Die:" + save.die_count.ToString() +
                                              "\r\n" + "Archive:" + save.achi_count.ToString();
                             buff_t[0].screen_pos.X = screenX * 0.5f - 40;
                             FileManage.SaveArichive(save);
                             return;
                         }
                     }
                 }
             }
         }
     }
 }
Example #5
0
 public static void Replace(int index)
 {
     layout.role.origin = role.location;
     FileManage.ReplaceLayout(ref layout, "custom", index);
 }
Example #6
0
        public static void UpdateRole()
        {
            role.time--;
            if (ks.IsKeyDown(Keys.J))
            {
                if (role.jump > 0 & role.time < 0)
                {
                    role.time = 15;
                    if (!role.flooer)
                    {
                        role.jump--;
                    }
                    role.motion.y = dy;
                }
            }
            if (ks.IsKeyDown(Keys.K))
            {
                if (role.jump > 0 & role.time < 0)
                {
                    role.time = 15;
                    if (!role.flooer)
                    {
                        role.jump--;
                    }
                    role.motion.y = dy * 0.8f;
                }
            }
            if (ks.IsKeyDown(Keys.F1))
            {
                if (role.time < 0)
                {
                    role.time     = 15;
                    role.loc_back = role.location;
                    save.achi_count++;
                    save.loaction  = role.location;
                    buff_t[0].text = "Die:" + save.die_count.ToString() +
                                     "\r\n" + "Archive:" + save.achi_count.ToString();
                    buff_t[0].screen_pos.X = screenX * 0.5f - 40;
                }
            }
            if (ks.IsKeyDown(Keys.R))
            {
                if (role.time < 0)
                {
                    role.time     = 15;
                    role.location = role.origin;
                    save.achi_count++;
                    save.loaction = role.location;
                }
            }
            if (ks.IsKeyDown(Keys.Left) | ks.IsKeyDown(Keys.A))
            {
                role.backword = true;
                if (role.motion.x > -dx)
                {
                    role.motion.x -= 0.0008f;
                }
                role.index++;
                if (role.index >= 24)
                {
                    role.index = 5;
                }
            }
            else
            if (ks.IsKeyDown(Keys.Right) | ks.IsKeyDown(Keys.D))
            {
                role.backword = false;
                if (role.motion.x < dx)
                {
                    role.motion.x += 0.0008f;
                }
                role.index++;
                if (role.index >= 24)
                {
                    role.index = 5;
                }
            }
            else
            {
                role.motion.x = 0; role.index = 0;
            }
            if (role.motion.y > -0.022f)
            {
                role.motion.y -= 0.001f;
            }
            GetMotionLine();
            CaculLand();
            CaculNeedle();
            float x = role.location.x + role.motion.x;

            if (x > -1 & x < 1)
            {
                role.location.x = x;
            }
            else if (x > 1)
            {
                if (save.level < maps.Length)
                {
                    buff_t[0].reg  = true;
                    buff_t[0].text = "Die:" + save.die_count.ToString() +
                                     "\r\n" + "Archive:" + save.achi_count.ToString();
                    buff_t[0].screen_pos.X = screenX * 0.5f - 40;
                    if (current.can == Canvas.Game)
                    {
                        save.level++;
                    }
                    else
                    {
                        game.execute = () => { GamePage.page.HideDeclare(); }
                    };
                    LoadLayOut(maps[save.level]);
                    save.loaction = role.origin;
                    role.loc_back = role.origin;
                    current.can   = Canvas.Game;
                    FileManage.SaveArichive(save);
                    return;
                }
            }
            x = role.location.y + role.motion.y;
            if (x > -1 & x < 1)
            {
                role.location.y = x;
            }
            GetPoints(role.location, ref role.points);
            int     c = role.index / 5;
            Vector2 v = Vector2.Zero;

            v.X = c * 0.1666666f;
            if (role.backword)
            {
                SetTex_Pos(ref buff_img[role.imgid].vertex, 0, v);
                CaculRect_Pos(ref buff_img[role.imgid].vertex, role.location, 0.05625f, 0.1f, 0);
            }
            else
            {
                SetTex_PosA(ref buff_img[role.imgid].vertex, 0, v);
                CaculRect_PosA(ref buff_img[role.imgid].vertex, role.location, 0.05625f, 0.1f, 0);
            }
        }