| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 | using UnityEngine;namespace GFGGame{    public class FightDataManager : SingletonBase<FightDataManager>    {        public byte[] FightRoleRes { get; set; }        public Texture2D RoleTextuex { get; set; }        //角色基础分+部件基础分        private int _score;        public int score        {            get            {                return _score;            }            set            {                _score = value;                EventAgent.DispatchEvent(ConstMessage.DRESS_UP_SCORE_CHANGED, _score);            }        }        //最终得分        private int _totalScore;        public int totalScore        {            get            {                return _totalScore;            }            set            {                _totalScore = value;            }        }        //战斗对象最终得分        private int _targetTotalScore;        public int npcTotalScore        {            get            {                return _targetTotalScore;            }            set            {                _targetTotalScore = value;            }        }        private bool _autoPlay = false;        public bool autoPlay        {            get            {                return _autoPlay;            }            set            {                _autoPlay = value;                if (!_autoPlay) fightSpeed = 1;                StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_AUTO_PLAY, _autoPlay == true ? 1 : 0).Coroutine();            }        }        public int maxFightSpeed = 2;        private int _fightSpeed = 1;        public int fightSpeed        {            get            {                return _fightSpeed;            }            set            {                _fightSpeed = value;                StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_FIGHT_AUTO_PLAY_SPEED, _fightSpeed).Coroutine();            }        }        private int _storyDialogSpeed = 1;        public int dialogSpeed        {            get            {                return _storyDialogSpeed;            }            set            {                _storyDialogSpeed = value;                StorageSProxy.ReqSetClientValue(ConstStorageId.STORAGE_DIALOG_AUTO_PLAY_SPEED, _storyDialogSpeed).Coroutine();            }        }        //根据位置原点和随机范围获取评分位置        public void GetCirclePos(Vector2 pos, int range, out float x, out float y)        {            int numX = UnityEngine.Random.Range(0, 2);            int signX = numX % 2 == 0 ? 1 : -1;            float rangeX = UnityEngine.Random.Range(0, range);            x = pos.x + signX * (rangeX);            int numY = UnityEngine.Random.Range(0, 2);            int signY = numY % 2 == 0 ? 1 : -1;            float rangeY = UnityEngine.Random.Range(0, range);            y = pos.y + signY * (rangeY);        }        public Texture2D GetPrintscreenNTexture(Camera camera)        {            RenderTexture rt = new RenderTexture(UnityEngine.Screen.width, UnityEngine.Screen.height, 0);//渲染一张1920*1080的图            camera.targetTexture = rt;//传到主摄像机上            camera.Render();//渲染            RenderTexture.active = rt;            Texture2D screenShot = new Texture2D(UnityEngine.Screen.width, UnityEngine.Screen.height, TextureFormat.ARGB32, false);            screenShot.ReadPixels(new Rect(0, 0, UnityEngine.Screen.width, UnityEngine.Screen.height), 0, 0);//读像素            screenShot.Apply();            camera.targetTexture = null;            RenderTexture.active = null;            Object.Destroy(rt);            return screenShot;        }        public FightRoleData GetMyFightRoleData()        {            FightRoleData roleData = new FightRoleData();            roleData.cardId = InstanceZonesDataManager.currentCardId;            roleData.itemList = MyDressUpHelper.dressUpObj.itemList;            return roleData;        }        public FightRoleData GetArenaFightRoleData()        {            FightRoleData roleData = new FightRoleData();            return roleData;        }        public FightRobotData GetFightRobotData()        {            FightRobotData robotData = new FightRobotData();            return robotData;        }        public FightRobotData GetArenaRobotData()        {            FightRobotData robotData = new FightRobotData();            return robotData;        }    }}
 |