| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 | using System;using System.Collections;using System.Collections.Generic;using System.Net;using System.Net.Http;using ET;using FairyGUI;using UnityEngine;using UnityEngine.Networking;namespace GFGGame{    public static class PoemPhotoSProxy    {        //获取玩家所有相册数据协议        public static async ETTask<bool> ReqAllPhotoInfos()        {            S2C_GetAllAlbumInfo response = null;            response = (S2C_GetAllAlbumInfo)await MessageHelper.SendToServer(new C2S_GetAllAlbumInfo());            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    for (int i = 0; i < response.PictureInfosA.Count; i++)                    {                        PoemPhotoData photoData = new PoemPhotoData();                        photoData.PictureId = response.PictureInfosA[i].PictureId;                        photoData.CreationTime = response.PictureInfosA[i].CreationTime;                        photoData.ToppingStatus = response.PictureInfosA[i].ToppingStatus;                        photoData.LockingStatus = response.PictureInfosA[i].LockingStatus;                        photoData.SourceType = response.PictureInfosA[i].SourceType;                        photoData.PictureTempUrl = response.PictureInfosA[i].PictureTempUrl;                        PoemPhotoDataManager.Instance.Add(photoData, (int)PictureSourceType.PersonalAlbum);                    }                    Timers.inst.StartCoroutine(PictureStorageHelper.Download(PoemPhotoDataManager.Instance.PersonalPhotoInfos));                    for (int i = 0; i < response.PictureInfosB.Count; i++)                    {                        PoemPhotoData photoData = new PoemPhotoData();                        photoData.PictureId = response.PictureInfosB[i].PictureId;                        photoData.CreationTime = response.PictureInfosB[i].CreationTime;                        photoData.ToppingStatus = response.PictureInfosB[i].ToppingStatus;                        photoData.LockingStatus = response.PictureInfosB[i].LockingStatus;                        photoData.SourceType = response.PictureInfosB[i].SourceType;                        photoData.TravelLocationId = response.PictureInfosB[i].TravelLocationId;                        photoData.TravelSuitId = response.PictureInfosB[i].TravelSuitId;                        photoData.SuitResIndex = response.PictureInfosB[i].TravelSuitResourceIndex;                        photoData.PositionIndex = response.PictureInfosB[i].PositionIndex;                        PoemPhotoDataManager.Instance.Add(photoData, (int)PictureSourceType.WanShuiQianShan);                    }                    return true;                }            }            return false;        }        //获取图片的临时上传地址协议        public static async ETTask<object[]> ReqTempPictureUrl()        {            ViewManager.Show<ModalStatusView>("上传中...");            S2C_GetTempPictureUrl response = null;            response = (S2C_GetTempPictureUrl)await MessageHelper.SendToServer(new C2S_GetTempPictureUrl() { PictureType = (int)PictureType.jpg });            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    return new object[] { response.TempPictureUrl, response.PictureId };                }            }            else            {                ViewManager.Hide<ModalStatusView>();                PromptController.Instance.ShowFloatTextPrompt("获取上传地址失败");            }            return null;        }        //保存成功后,添加图片至相册        public static async ETTask<long> ReqAddTophoto(long pictureId)        {            S2C_AddPicture response = null;            response = (S2C_AddPicture)await MessageHelper.SendToServer(new C2S_AddPicture() { PictureId = pictureId });            ViewManager.Hide<ModalStatusView>();            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    PoemPhotoData photoData = new PoemPhotoData();                    photoData.PictureId = response.PictureInfo.PictureId;                    photoData.CreationTime = response.PictureInfo.CreationTime;                    photoData.ToppingStatus = response.PictureInfo.ToppingStatus;                    photoData.LockingStatus = response.PictureInfo.LockingStatus;                    photoData.PictureTempUrl = response.PictureInfo.PictureTempUrl;                    PoemPhotoDataManager.Instance.Add(photoData, (int)PictureSourceType.PersonalAlbum);                    EventAgent.DispatchEvent(ConstMessage.POEM_PHOTO_INFOS_CHANGE);                    PromptController.Instance.ShowFloatTextPrompt("已保存至相册");                    return response.PictureInfo.PictureId;                }            }            PromptController.Instance.ShowFloatTextPrompt("存储数据失败");            return 0;        }        //批量删除玩家相册        public static async ETTask<bool> ReqRemovedPhoto(List<long> pictureIds, int sourceType)        {            S2C_RemovedPictures response = null;            response = (S2C_RemovedPictures)await MessageHelper.SendToServer(new C2S_RemovedPictures() { PictureIds = pictureIds });            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    PoemPhotoDataManager.Instance.Remove(response.PictureIds, sourceType);                    EventAgent.DispatchEvent(ConstMessage.POEM_PHOTO_INFOS_CHANGE);                    return true;                }            }            return false;        }        //修改图片锁定状态        public static async ETTask<bool> ReqChangeLockingState(long pictureId, bool state, int sourceType)        {            S2C_UpPictureLockingStatus response = null;            response = (S2C_UpPictureLockingStatus)await MessageHelper.SendToServer(new C2S_UpPictureLockingStatus() { PictureId = pictureId, Status = state });            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    PoemPhotoDataManager.Instance.ChangeLockingState(response.PictureId, response.Status, sourceType);                    EventAgent.DispatchEvent(ConstMessage.POEM_PHOTO_INFOS_CHANGE);                    return true;                }            }            return false;        }        //修改图片置顶状态        public static async ETTask<bool> ReqChangeToppingState(long pictureId, bool state, int sourceType)        {            S2C_UpPictureToppingStatus response = null;            response = (S2C_UpPictureToppingStatus)await MessageHelper.SendToServer(new C2S_UpPictureToppingStatus() { PictureId = pictureId, Status = state });            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    PoemPhotoDataManager.Instance.ChangeToppingState(response.PictureId, response.Status, sourceType);                    EventAgent.DispatchEvent(ConstMessage.POEM_PHOTO_INFOS_CHANGE);                    return true;                }            }            return false;        }    }}
 |