|  | @@ -0,0 +1,134 @@
 | 
	
		
			
				|  |  | +using System.Collections;
 | 
	
		
			
				|  |  | +using UnityEngine;
 | 
	
		
			
				|  |  | +using UI.RoleInfo;
 | 
	
		
			
				|  |  | +using UI.Main;
 | 
	
		
			
				|  |  | +using ET;
 | 
	
		
			
				|  |  | +using FairyGUI;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +namespace GFGGame
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    public class MainBgChooseView : BaseWindow
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        private UI_MainBgChooseUI _ui;
 | 
	
		
			
				|  |  | +        public override void Dispose()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            if (_ui != null)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                _ui.Dispose();
 | 
	
		
			
				|  |  | +                _ui = null;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            base.Dispose();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected override void OnInit()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            base.OnInit();
 | 
	
		
			
				|  |  | +            packageName = UI_MainBgChooseUI.PACKAGE_NAME;
 | 
	
		
			
				|  |  | +            _ui = UI_MainBgChooseUI.Create();
 | 
	
		
			
				|  |  | +            this.viewCom = _ui.target;
 | 
	
		
			
				|  |  | +            isfullScreen = true;
 | 
	
		
			
				|  |  | +            isReturnView = true;
 | 
	
		
			
				|  |  | +            _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("tjbg");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            _ui.m_bgList.itemRenderer = BgListItemRenderer;
 | 
	
		
			
				|  |  | +            _ui.m_bgList.onClickItem.Add(OnClickBgListItem);
 | 
	
		
			
				|  |  | +            _ui.m_btnBack.onClick.Add(OnClickBtnBack);
 | 
	
		
			
				|  |  | +            _ui.m_btnChange.onClick.Add(OnClickBtnChange);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            _ui.m_bgList.numItems = tempRes.Length;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected override void OnShown()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            base.OnShown();
 | 
	
		
			
				|  |  | +            InitMainUIPreview();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        protected override void OnHide()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            base.OnHide();
 | 
	
		
			
				|  |  | +            ReleaseMainUIPreview();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private ValueBarController _valueBarController;
 | 
	
		
			
				|  |  | +        /// <summary>
 | 
	
		
			
				|  |  | +        /// 同步主界面信息
 | 
	
		
			
				|  |  | +        /// </summary>
 | 
	
		
			
				|  |  | +        private void InitMainUIPreview()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            UI_MainUI mainUI = UI_MainUI.Proxy(_ui.m_mainUIShow);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            _valueBarController = new ValueBarController(mainUI.m_valueBar);
 | 
	
		
			
				|  |  | +            _valueBarController.OnShown();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            mainUI.m_type.SetSelectedIndex(1);
 | 
	
		
			
				|  |  | +            mainUI.m_headBar.m_txtLvl.text = "" + GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
 | 
	
		
			
				|  |  | +            RoleInfoManager.Instance.UpdateHead(mainUI.m_headBar.m_comHead, RoleDataManager.headId,
 | 
	
		
			
				|  |  | +    RoleDataManager.headBorderId);
 | 
	
		
			
				|  |  | +            mainUI.m_headBar.m_txtName.text = RoleDataManager.roleName;
 | 
	
		
			
				|  |  | +            mainUI.m_btnXiuFang.m_loaLockIcons.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(XiuFangView).Name, false);
 | 
	
		
			
				|  |  | +            mainUI.m_btnHuanZhuang.m_loaLockIcons.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(DressUpView).Name, false);
 | 
	
		
			
				|  |  | +            mainUI.m_btnCiPai.m_loaLockIcons.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(CardDetailView).Name, false);
 | 
	
		
			
				|  |  | +            mainUI.m_btnZhaiXing.m_loaLockIcons.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(LuckyBoxView).Name, false);
 | 
	
		
			
				|  |  | +            mainUI.m_btnMain.m_loaLockIcons.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StoryChapterListView).Name, false);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            mainUI.m_btnGongGao.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(NoticeView).Name, false);
 | 
	
		
			
				|  |  | +            mainUI.m_btnYouJian.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(MailView).Name, false);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            mainUI.m_list.GetChild("btnHaoYou").visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FriendView).Name, false);
 | 
	
		
			
				|  |  | +            mainUI.m_list.GetChild("btnLeague").visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(LeagueView).Name, false);
 | 
	
		
			
				|  |  | +            mainUI.m_list.GetChild("btnStore").visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StoreView).Name, false);
 | 
	
		
			
				|  |  | +            mainUI.m_list.GetChild("btnTuJian").visible =
 | 
	
		
			
				|  |  | +                FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(FieldGuideView).Name, false);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            mainUI.m_list.ResizeToFit();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            UI_MainUI.ProxyEnd();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private void ReleaseMainUIPreview()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            _valueBarController.OnHide();
 | 
	
		
			
				|  |  | +            _valueBarController.Dispose();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private void OnClickBtnBack()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            Hide();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 背景资源名列表,需要从配置表读
 | 
	
		
			
				|  |  | +        string[] tempRes = { "zjm_1", "zjm_2", "tc_bjbj" };
 | 
	
		
			
				|  |  | +        private void BgListItemRenderer(int index, GObject item)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            UI_bgItem bgItem = UI_bgItem.Proxy(item);
 | 
	
		
			
				|  |  | +            bgItem.m_bgImg.url = ResPathUtil.GetBgImgPath(tempRes[index]);
 | 
	
		
			
				|  |  | +            UI_bgItem.ProxyEnd();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            item.data = tempRes[index];
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private void OnClickBgListItem(EventContext context)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            GObject listItem = context.data as GObject;
 | 
	
		
			
				|  |  | +            string res = (string)listItem.data;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            ChangeBg(res);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private void OnClickBtnChange()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            SceneController.bgTempRes = (string)_ui.m_bgList.GetChildAt(_ui.m_bgList.selectedIndex).data;
 | 
	
		
			
				|  |  | +            Hide();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private void ChangeBg(string res)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            UI_MainUI mainUI = UI_MainUI.Proxy(_ui.m_mainUIShow);
 | 
	
		
			
				|  |  | +            mainUI.m_loaBg.url = ResPathUtil.GetBgImgPath(res);
 | 
	
		
			
				|  |  | +            UI_MainUI.ProxyEnd();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |