示例#1
0
 /// <summary>
 /// Déplace un objet en avant ou arrière plan.
 /// </summary>
 /// <param name="direction">Avant ou arrière plan</param>
 /// <param name="max">Au premier ou au dernier plan</param>
 public void MoveObjectInPlan(Enums.Direction direction, bool max)
 {
     RunServiceTask(delegate
     {
         _Business.MoveObjectInPlan(direction, max);
     }, Errors.ERROR_STAGE_STR_LOAD, direction.ToString(), max.ToString());
 }
示例#2
0
 public static string BuildName(string Prefix, Enums.Direction Direction)
 {
     cachedAnimationNames.TryGetValue((Prefix, Direction), out var result);
     if (result == null)
     {
         result = Prefix + "_" + Direction.ToString();
         cachedAnimationNames[(Prefix, Direction)] = result;
示例#3
0
        ////Duplicate code!
        public void Load(SpriteSheet sheet, FrameData frameData, string overrideForm)
        {
            string formDirectory = "Forms/" + overrideForm + "/";

            frameData.SetFrameSize(FrameWidth, FrameHeight);
            using (ZipFile zipFile = ZipFile.Read(path))
            {
                foreach (FrameType frameType in Enum.GetValues(typeof(FrameType)))
                {
                    if (FrameTypeHelper.IsFrameTypeDirectionless(frameType) == false)
                    {
                        for (int i = 0; i < 8; i++)
                        {
                            Enums.Direction dir = GraphicsManager.GetAnimIntDir(i);

                            using (MemoryStream ms = new MemoryStream()) {
                                //string fullImageString = formDirectory + GetFrameTypeString(frameType) + "-" + GetDirectionString(dir) + ".png";
                                string fullImageString = formDirectory + frameType.ToString() + "-" + dir.ToString() + ".png";

                                if (zipFile.ContainsEntry(fullImageString))
                                {
                                    zipFile[fullImageString].Extract(ms);

                                    ms.Seek(0, SeekOrigin.Begin);
                                    Bitmap  bitmap       = (Bitmap)Image.FromStream(ms);
                                    Surface sheetSurface = new Surface(bitmap);
                                    sheetSurface.Transparent = true;

                                    //still loads from these
                                    sheet.AddSheet(frameType, dir, sheetSurface);

                                    frameData.SetFrameCount(frameType, dir, bitmap.Width / frameData.FrameWidth);
                                }
                                else
                                {
                                    frameData.SetFrameCount(frameType, dir, 0);
                                }
                            }
                        }
                    }
                    else
                    {
                        using (MemoryStream ms = new MemoryStream()) {
                            //string fullImageString = formDirectory + GetFrameTypeString(frameType) + "-" + GetDirectionString(Enums.Direction.Down) + ".png";
                            string fullImageString = formDirectory + frameType.ToString() + "-Down.png";

                            if (zipFile.ContainsEntry(fullImageString))
                            {
                                zipFile[fullImageString].Extract(ms);

                                ms.Seek(0, SeekOrigin.Begin);
                                Bitmap  bitmap       = (Bitmap)Image.FromStream(ms);
                                Surface sheetSurface = new Surface(bitmap);
                                sheetSurface.Transparent = true;

                                sheet.AddSheet(frameType, Enums.Direction.Down, sheetSurface);

                                frameData.SetFrameCount(frameType, Enums.Direction.Down, bitmap.Width / frameData.FrameWidth);
                            }
                            else
                            {
                                frameData.SetFrameCount(frameType, Enums.Direction.Down, 0);
                            }
                        }
                    }
                }
            }
        }