| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 | using ET;using FairyGUI;using UI.CommonGame;using UI.RoleInfo;using UnityEngine;namespace GFGGame{    public class RoleInfoView : BaseWindow    {        private UI_RoleInfoUI _ui;        public override void Dispose()        {            if (_ui != null)            {                _ui.Dispose();            }            _ui = null;            base.Dispose();        }        protected override void OnInit()        {            base.OnInit();            packageName = UI_RoleInfoUI.PACKAGE_NAME;            _ui = UI_RoleInfoUI.Create();            this.viewCom = _ui.target;            isfullScreen = true;            _ui.m_txtVersion.text = GameGlobal.version;            _ui.m_txtSlogan.maxLength = GlobalCfgArray.globalCfg.maxSloganWordsCount;            _ui.m_btnHelp.onClick.Add(OnClickBtnHelp);            _ui.m_txtSlogan.onFocusOut.Add(OnFocuseOut);            _ui.m_loaChangeName.onClick.Add(OnClickLoaChangeName);            _ui.m_btnBack.onClick.Add(OnBtnBackClick);            _ui.m_btnFieldGuide.onClick.Add(OnBtnFieldGuideClick);            _ui.m_btnSkill.onClick.Add(OnBtnSkillClick);            _ui.m_btnSetting.onClick.Add(OnBtnSettingClick);            _ui.m_comHead.GetChild("comHead").asCom.onClick.Add(OnComHeadClick);            _ui.m_list.itemRenderer = RenderListItem;            _ui.m_list.onClickItem.Add(OnListItemClick);            _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");        }        protected override void AddEventListener()        {            base.AddEventListener();            EventAgent.AddEventListener(ConstMessage.CHANGE_ROLE_NAME, UpdateRoleName);            EventAgent.AddEventListener(ConstMessage.CHANGE_ROLE_HEAD, UpdateHead);            EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);            EventAgent.AddEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateList);        }        protected override void OnShown()        {            base.OnShown();            _ui.m_txtRoleName.text = RoleDataManager.roleName;            _ui.m_txtLvl.text = "" + GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);            RoleLevelCfg roleLevelCfg = RoleLevelCfgArray.Instance.GetCfg(GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl));            if (roleLevelCfg.exp > 0)            {                _ui.m_txtExp.text = string.Format("{0}/{1}", GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp), roleLevelCfg.exp);            }            else            {                _ui.m_txtExp.text = "已满级";            }            _ui.m_txtSlogan.text = RoleDataManager.slogan;            _ui.m_btnFieldGuide.title = string.Format("套装收集度:{0}%", RoleInfoManager.Instance.GetGuideProgress());            UpdateHead();            UpdateList();            UpdateRedDot();        }        protected override void OnHide()        {            base.OnHide();        }        private void OnBtnBackClick()        {            ViewManager.GoBackFrom(typeof(RoleInfoView).FullName);        }        protected override void RemoveEventListener()        {            base.RemoveEventListener();            EventAgent.RemoveEventListener(ConstMessage.CHANGE_ROLE_NAME, UpdateRoleName);            EventAgent.RemoveEventListener(ConstMessage.CHANGE_ROLE_HEAD, UpdateHead);            EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);            EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateList);        }        private void UpdateRoleName()        {            _ui.m_txtRoleName.text = RoleDataManager.roleName;        }        private void UpdateHead()        {            RoleInfoManager.Instance.UpdateHead(_ui.m_comHead, RoleDataManager.headId, RoleDataManager.headBorderId);        }        private void UpdateList()        {            _ui.m_list.numItems = RoleDataManager.photoDatas.Count;        }        private void RenderListItem(int index, GObject obj)        {            long pictureId = RoleDataManager.photoDatas[index];            PoemPhotoData poemPhotoData = pictureId == 0 ? null : PoemPhotoDataManager.Instance.GetPersonalPhotoDataById(pictureId);            UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);            item.m_comPhoto.m_loaPhoto.texture = poemPhotoData == null ? null : poemPhotoData.Ntexture;            item.target.data = index;            UI_ListPhotoItem.ProxyEnd();        }        private void OnListItemClick(EventContext context)        {            GObject obj = context.data as GObject;            int index = (int)obj.data;            ViewManager.Show<PersonalPhotoView>(index, new object[] { typeof(RoleInfoView).FullName, this.viewData });            this.Hide();        }        private void OnClickBtnHelp()        {            if (GameConfig.showGM >= 1)            {                ViewManager.Show(ViewName.GM_PANEL_VIEW);            }            else            {                ViewManager.Show(ViewName.LOG_VIEW);            }        }        private async void OnFocuseOut()        {            _ui.m_txtSlogan.text = await RoleInfoSProxy.ReqModifySlogan(_ui.m_txtSlogan.text);        }        private void OnClickLoaChangeName()        {            ViewManager.Show<ChangeNameView>(null, new object[] { typeof(RoleInfoView).FullName, this.viewData });        }        private void OnBtnFieldGuideClick()        {            this.Hide();            ViewManager.Show<FieldGuideView>(null, new object[] { typeof(RoleInfoView).FullName, this.viewData });        }        private void OnBtnSkillClick()        {            ViewManager.Show<PersonalSkillView>(null, new object[] { typeof(RoleInfoView).FullName, this.viewData });        }        private void OnBtnSettingClick()        {            ViewManager.Show<SettingView>(null, new object[] { typeof(RoleInfoView).FullName, this.viewData });        }        private void OnComHeadClick()        {            GUIUtility.systemCopyBuffer = RoleDataManager.roleName;            ViewManager.Show<ChangeHeadView>(null, new object[] { typeof(RoleInfoView).FullName, this.viewData });        }        private void UpdateRedDot()        {            RedDotController.Instance.SetComRedDot(_ui.m_comHead, RedDotDataManager.Instance.GetHeadRed() || RedDotDataManager.Instance.GetHeadBorderRed(), "", -44, 47);        }    }}
 |