| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 | using System;using System.Collections.Generic;using System.IO;using ET;using FairyGUI;using UnityEngine;namespace GFGGame{    public class PoemPhotoDataManager : SingletonBase<PoemPhotoDataManager>    {        /// <summary>        /// 个人相册        /// </summary>        /// <typeparam name="PoemPhotoData"></typeparam>        /// <returns></returns>        public List<PoemPhotoData> PersonalPhotoInfos = new List<PoemPhotoData>();        /// <summary>        /// 万水千山相册        /// </summary>        /// <typeparam name="PoemPhotoData"></typeparam>        /// <returns></returns>        public List<PoemPhotoData> WsqsPhotoInfos = new List<PoemPhotoData>();        public void Clear()        {            PersonalPhotoInfos.Clear();            WsqsPhotoInfos.Clear();        }        public void Add(PoemPhotoData photoData, int sourceType)        {            List<PoemPhotoData> poemPhotoDatas = null;            if (sourceType == (int)PictureSourceType.PersonalAlbum)            {                poemPhotoDatas = PersonalPhotoInfos;            }            else if (sourceType == (int)PictureSourceType.WanShuiQianShan)            {                poemPhotoDatas = WsqsPhotoInfos;            }                        poemPhotoDatas.Add(photoData);            poemPhotoDatas.SortInfos();        }        public void Remove(List<long> pictureIds, int sourceType)        {            List<PoemPhotoData> poemPhotoDatas = null;            if (sourceType == (int)PictureSourceType.PersonalAlbum)            {                poemPhotoDatas = PersonalPhotoInfos;            }            else if (sourceType == (int)PictureSourceType.WanShuiQianShan)            {                poemPhotoDatas = WsqsPhotoInfos;            }            for (int i = 0; i < pictureIds.Count; i++)            {                for (int j = 0; j < poemPhotoDatas.Count; j++)                {                    if (pictureIds[i] == poemPhotoDatas[j].PictureId)                    {                        poemPhotoDatas.RemoveAt(j);                        break;                    }                }            }                        poemPhotoDatas.SortInfos();        }        public void ChangeLockingState(long pictureId, bool state, int sourceType)        {            List<PoemPhotoData> poemPhotoDatas = null;            if (sourceType == (int)PictureSourceType.PersonalAlbum)            {                poemPhotoDatas = PersonalPhotoInfos;            }            else if (sourceType == (int)PictureSourceType.WanShuiQianShan)            {                poemPhotoDatas = WsqsPhotoInfos;            }            for (int i = 0; i < poemPhotoDatas.Count; i++)            {                if (poemPhotoDatas[i].PictureId == pictureId)                {                    poemPhotoDatas[i].LockingStatus = state;                    break;                }            }                        poemPhotoDatas.SortInfos();        }        public void ChangeToppingState(long pictureId, bool state, int sourceType)        {            List<PoemPhotoData> poemPhotoDatas = null;            if (sourceType == (int)PictureSourceType.PersonalAlbum)            {                poemPhotoDatas = PersonalPhotoInfos;            }            else if (sourceType == (int)PictureSourceType.WanShuiQianShan)            {                poemPhotoDatas = WsqsPhotoInfos;            }            for (int i = 0; i < poemPhotoDatas.Count; i++)            {                if (poemPhotoDatas[i].PictureId == pictureId)                {                    poemPhotoDatas[i].ToppingStatus = state;                    break;                }            }                        poemPhotoDatas.SortInfos();        }                public PoemPhotoData GetPersonalPhotoDataById(long pictureId)        {            for (int i = 0; i < PersonalPhotoInfos.Count; i++)            {                if (pictureId == PersonalPhotoInfos[i].PictureId)                {                    return PersonalPhotoInfos[i];                }            }            return null;        }        public NTexture BytesToTexture2D(byte[] bytes)        {            Texture2D texture2D = new Texture2D(UnityEngine.Screen.width, UnityEngine.Screen.height);            texture2D.LoadImage(bytes);            return new NTexture(texture2D);        }    }}
 |