public IDirectionalAnimation ToItem(AGSSerializationContext context) { IDirectionalAnimation item = new AGSDirectionalAnimation(); item.Left = Left.ToItem(context); item.Right = Right.ToItem(context); item.Up = Up.ToItem(context); item.Down = Down.ToItem(context); item.UpLeft = UpLeft.ToItem(context); item.UpRight = UpRight.ToItem(context); item.DownLeft = DownLeft.ToItem(context); item.DownRight = DownRight.ToItem(context); return(item); }
public async Task <IDirectionalAnimation> LoadDirectionalAnimationFromFoldersAsync(string baseFolder, string leftFolder = null, string rightFolder = null, string downFolder = null, string upFolder = null, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null) { if (leftFolder == null && rightFolder == null && downFolder == null && upFolder == null) { return(null); } AGSDirectionalAnimation dirAnimation = new AGSDirectionalAnimation(); if (leftFolder != null) { dirAnimation.Left = await LoadAnimationFromFolderAsync(baseFolder + leftFolder, animationConfig, loadConfig); } if (rightFolder != null) { dirAnimation.Right = await LoadAnimationFromFolderAsync(baseFolder + rightFolder, animationConfig, loadConfig); } if (downFolder != null) { dirAnimation.Down = await LoadAnimationFromFolderAsync(baseFolder + downFolder, animationConfig, loadConfig); } if (upFolder != null) { dirAnimation.Up = await LoadAnimationFromFolderAsync(baseFolder + upFolder, animationConfig, loadConfig); } if (dirAnimation.Left != null && dirAnimation.Right == null) { dirAnimation.Right = createLeftRightAnimation(dirAnimation.Left); } if (dirAnimation.Right != null && dirAnimation.Left == null) { dirAnimation.Left = createLeftRightAnimation(dirAnimation.Right); } return(dirAnimation); }
public async Task<IDirectionalAnimation> LoadDirectionalAnimationFromFoldersAsync(string baseFolder, string leftFolder = null, string rightFolder = null, string downFolder = null, string upFolder = null, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null) { if (leftFolder == null && rightFolder == null && downFolder == null && upFolder == null) return null; AGSDirectionalAnimation dirAnimation = new AGSDirectionalAnimation (); if (leftFolder != null) dirAnimation.Left = await LoadAnimationFromFolderAsync(baseFolder + leftFolder, animationConfig, loadConfig); if (rightFolder != null) dirAnimation.Right = await LoadAnimationFromFolderAsync(baseFolder + rightFolder, animationConfig, loadConfig); if (downFolder != null) dirAnimation.Down = await LoadAnimationFromFolderAsync(baseFolder + downFolder, animationConfig, loadConfig); if (upFolder != null) dirAnimation.Up = await LoadAnimationFromFolderAsync(baseFolder + upFolder, animationConfig, loadConfig); if (dirAnimation.Left != null && dirAnimation.Right == null) { dirAnimation.Right = createLeftRightAnimation (dirAnimation.Left); } if (dirAnimation.Right != null && dirAnimation.Left == null) { dirAnimation.Left = createLeftRightAnimation (dirAnimation.Right); } return dirAnimation; }