public static Animation Combine(Animation[] listAnimation) { int w = 0, h = 0; for (int i = 0; i < listAnimation.Length; i++) { if (i > 0) { if (listAnimation[i].FrameCount != listAnimation[i - 1].FrameCount) { return listAnimation[0]; } } if (listAnimation[i].FrameSize.X > w) w = listAnimation[i].FrameSize.X; if (listAnimation[i].FrameSize.Y > h) h = listAnimation[i].FrameSize.Y; } Animation result = new Animation(); for (int i = 0; i < listAnimation[0].FrameCount; i++) { Bitmap bmp = new Bitmap(w, h); Graphics g = Graphics.FromImage(bmp); for (int j = 0; j < listAnimation.Length; j++) { g.DrawImage(listAnimation[j].GetFrame(i), listAnimation[j].GetOffset(i)); } result.AddBitmap(bmp); } return result; }
public static Animation Combine(Animation a1, Animation a2) { if (a1.FrameCount != a2.FrameCount) return a1; int w = a1.FrameSize.X > a2.FrameSize.X ? a1.FrameSize.X : a2.FrameSize.X; int h = a1.FrameSize.Y > a2.FrameSize.Y ? a1.FrameSize.Y : a2.FrameSize.Y; Animation result = new Animation(); for (int i = 0; i < a1.FrameCount; i++) { Bitmap bmp = new Bitmap(w, h); Graphics g = Graphics.FromImage(bmp); g.DrawImage(a1.GetFrame(i),a1.GetOffset(i)); g.DrawImage(a2.GetFrame(i),a2.GetOffset(i)); result.AddBitmap(bmp); } return result; }
public static Animation Combine(Animation a1, Animation a2) { if (a1.FrameCount != a2.FrameCount) { return(a1); } int w = a1.FrameSize.X > a2.FrameSize.X ? a1.FrameSize.X : a2.FrameSize.X; int h = a1.FrameSize.Y > a2.FrameSize.Y ? a1.FrameSize.Y : a2.FrameSize.Y; Animation result = new Animation(); for (int i = 0; i < a1.FrameCount; i++) { Bitmap bmp = new Bitmap(w, h); Graphics g = Graphics.FromImage(bmp); g.DrawImage(a1.GetFrame(i), a1.GetOffset(i)); g.DrawImage(a2.GetFrame(i), a2.GetOffset(i)); result.AddBitmap(bmp); } return(result); }
public static Animation Combine(Animation[] listAnimation) { int w = 0, h = 0; for (int i = 0; i < listAnimation.Length; i++) { if (i > 0) { if (listAnimation[i].FrameCount != listAnimation[i - 1].FrameCount) { return(listAnimation[0]); } } if (listAnimation[i].FrameSize.X > w) { w = listAnimation[i].FrameSize.X; } if (listAnimation[i].FrameSize.Y > h) { h = listAnimation[i].FrameSize.Y; } } Animation result = new Animation(); for (int i = 0; i < listAnimation[0].FrameCount; i++) { Bitmap bmp = new Bitmap(w, h); Graphics g = Graphics.FromImage(bmp); for (int j = 0; j < listAnimation.Length; j++) { g.DrawImage(listAnimation[j].GetFrame(i), listAnimation[j].GetOffset(i)); } result.AddBitmap(bmp); } return(result); }
public Animation GetAction(JXAction action) { Animation ani = new Animation(); Animation currentHead = head.getAction(action.BodyID); Animation currentBody = body.getAction(action.BodyID); Animation currentLeftHand = leftHand.getAction(action.BodyID); Animation currentRightHand = rightHand.getAction(action.BodyID); if (action.HorseID == 0)// no horse { if (action.OneHandWeaponID == 0 && action.TwoHandWeaponID == 0 && action.DoubleWeaponID == 0) // no weapon { for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List<Bitmap> lstBMP = new List<Bitmap>(); if (j == 0) { lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } else { if (action.DoubleWeaponID == 0)// one or two hand weapon { Animation currentWeapon; if (action.OneHandWeaponID != 0) { currentWeapon = oneHandWeapon.getAction(action.OneHandWeaponID); } else { currentWeapon = twoHandWeapon.getAction(action.TwoHandWeaponID); } for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List<Bitmap> lstBMP = new List<Bitmap>(); if (j == 0) { lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } else// double weapon { Animation currentWeaponLeft = doubleWeaponLeft.getAction(action.DoubleWeaponID); Animation currentWeaponRight = doubleWeaponRight.getAction(action.DoubleWeaponID); for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List<Bitmap> lstBMP = new List<Bitmap>(); if (j == 0) { lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } } } else// horse { Animation currentHorseHead = horseHead.getAction(action.HorseID); Animation currentHorseBack = horseBack.getAction(action.HorseID); Animation currentHorseTail = horseTail.getAction(action.HorseID); if (action.OneHandWeaponID == 0 && action.TwoHandWeaponID == 0 && action.DoubleWeaponID == 0) // no weapon, horse { for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List<Bitmap> lstBMP = new List<Bitmap>(); if (j == 0) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } else { if (action.DoubleWeaponID == 0)// one or two hand weapon, horse { Animation currentWeapon; if (action.OneHandWeaponID != 0) { currentWeapon = oneHandWeapon.getAction(action.OneHandWeaponID); } else { currentWeapon = twoHandWeapon.getAction(action.TwoHandWeaponID); } for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List<Bitmap> lstBMP = new List<Bitmap>(); if (j == 0) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } else// double weapon, horse { Animation currentWeaponLeft = doubleWeaponLeft.getAction(action.DoubleWeaponID); Animation currentWeaponRight = doubleWeaponRight.getAction(action.DoubleWeaponID); for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List<Bitmap> lstBMP = new List<Bitmap>(); if (j == 0) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } } } return ani; }
public Animation GetAction(JXAction action) { Animation ani = new Animation(); Animation currentHead = head.getAction(action.BodyID); Animation currentBody = body.getAction(action.BodyID); Animation currentLeftHand = leftHand.getAction(action.BodyID); Animation currentRightHand = rightHand.getAction(action.BodyID); if (action.HorseID == 0)// no horse { if (action.OneHandWeaponID == 0 && action.TwoHandWeaponID == 0 && action.DoubleWeaponID == 0) // no weapon { for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List <Bitmap> lstBMP = new List <Bitmap>(); if (j == 0) { lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } else { if (action.DoubleWeaponID == 0)// one or two hand weapon { Animation currentWeapon; if (action.OneHandWeaponID != 0) { currentWeapon = oneHandWeapon.getAction(action.OneHandWeaponID); } else { currentWeapon = twoHandWeapon.getAction(action.TwoHandWeaponID); } for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List <Bitmap> lstBMP = new List <Bitmap>(); if (j == 0) { lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } else// double weapon { Animation currentWeaponLeft = doubleWeaponLeft.getAction(action.DoubleWeaponID); Animation currentWeaponRight = doubleWeaponRight.getAction(action.DoubleWeaponID); for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List <Bitmap> lstBMP = new List <Bitmap>(); if (j == 0) { lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } } } else// horse { Animation currentHorseHead = horseHead.getAction(action.HorseID); Animation currentHorseBack = horseBack.getAction(action.HorseID); Animation currentHorseTail = horseTail.getAction(action.HorseID); if (action.OneHandWeaponID == 0 && action.TwoHandWeaponID == 0 && action.DoubleWeaponID == 0) // no weapon, horse { for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List <Bitmap> lstBMP = new List <Bitmap>(); if (j == 0) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } else { if (action.DoubleWeaponID == 0)// one or two hand weapon, horse { Animation currentWeapon; if (action.OneHandWeaponID != 0) { currentWeapon = oneHandWeapon.getAction(action.OneHandWeaponID); } else { currentWeapon = twoHandWeapon.getAction(action.TwoHandWeaponID); } for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List <Bitmap> lstBMP = new List <Bitmap>(); if (j == 0) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeapon.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } else// double weapon, horse { Animation currentWeaponLeft = doubleWeaponLeft.getAction(action.DoubleWeaponID); Animation currentWeaponRight = doubleWeaponRight.getAction(action.DoubleWeaponID); for (int j = 0; j < 8; j++) { for (int i = 0; i < action.FrameCount; i++) { int index = j * action.FrameCount + i; List <Bitmap> lstBMP = new List <Bitmap>(); if (j == 0) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); } else if (j == 1 || j == 2 || j == 3) { lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); } else if (j == 4) { lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); } else// if (j == 5 || j == 6 || j == 7) { lstBMP.Add(currentHorseTail.GetFrameWithOffset(index)); lstBMP.Add(currentHorseBack.GetFrameWithOffset(index)); lstBMP.Add(currentLeftHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponLeft.GetFrameWithOffset(index)); lstBMP.Add(currentBody.GetFrameWithOffset(index)); lstBMP.Add(currentHead.GetFrameWithOffset(index)); lstBMP.Add(currentHorseHead.GetFrameWithOffset(index)); lstBMP.Add(currentRightHand.GetFrameWithOffset(index)); lstBMP.Add(currentWeaponRight.GetFrameWithOffset(index)); } Bitmap bmp = combine(lstBMP); ani.AddBitmap(bmp); } } } } } return(ani); }