using ShadowStudio.Model;
using Studio.Scripts.HttpMessage;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Studio.Scripts
{
public static class HomeProxyExtensions
{
///
/// 根据ArtCallBackData 获取ArtInfo列表
///
///
///
///
public static ArtInfo GetArtInfoByArtCallBackData(this HomeProxy homeProxy,ArtCallBackData backData)
{
ArtInfo artInfo = new ArtInfo();
artInfo.AID = backData.id;
artInfo.ArtId = backData.artID;
artInfo.ArtName = backData.artName;
artInfo.InstaceType = (InstaceType)int.Parse(backData.instanceType);
artInfo.Url = backData.url;
artInfo.Icon = backData.icon;
artInfo.ArtType = (ArtType)Enum.ToObject(typeof(ArtType), (int)Math.Pow(2, int.Parse(backData.artType)));
artInfo.Version = backData.version;
artInfo.Distance = float.Parse(backData.distance);
artInfo.ContainerName = backData.containerName;
artInfo.ImmediateSyn = backData.immediateSyn;
artInfo.Component = backData.component;
artInfo.Description = backData.description;
if (string.IsNullOrEmpty(artInfo.Component))
{
if (artInfo.ArtType == ArtType.Image)
{
artInfo.Component = "PictureComponent";
}
else if (artInfo.ArtType == ArtType.Movies)
{
artInfo.Component = "VideoComponent";
}
}
return artInfo;
}
///
/// 根据artCallBackDatas列表获取artinfo列表
///
///
///
///
public static List GetArtInfoListByArtCallBackDatas(this HomeProxy homeProxy, List artCallBackDatas)
{
List artInfos = new List();
artCallBackDatas.ForEach(artCBD => artInfos.Add(homeProxy.GetArtInfoByArtCallBackData(artCBD)));
return artInfos;
}
}
}