123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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
- {
- /// <summary>
- /// 根据ArtCallBackData 获取ArtInfo列表
- /// </summary>
- /// <param name="homeProxy"></param>
- /// <param name="backData"></param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 根据artCallBackDatas列表获取artinfo列表
- /// </summary>
- /// <param name="homeProxy"></param>
- /// <param name="artCallBackDatas"></param>
- /// <returns></returns>
- public static List<ArtInfo> GetArtInfoListByArtCallBackDatas(this HomeProxy homeProxy, List<ArtCallBackData> artCallBackDatas)
- {
- List<ArtInfo> artInfos = new List<ArtInfo>();
- artCallBackDatas.ForEach(artCBD => artInfos.Add(homeProxy.GetArtInfoByArtCallBackData(artCBD)));
- return artInfos;
- }
- }
- }
|