|
@@ -4,6 +4,8 @@ using UI.RoleInfo;
|
|
|
using UI.Main;
|
|
|
using ET;
|
|
|
using FairyGUI;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -28,20 +30,27 @@ namespace GFGGame
|
|
|
this.viewCom = _ui.target;
|
|
|
isfullScreen = true;
|
|
|
isReturnView = true;
|
|
|
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("tjbg");
|
|
|
+ _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bg_grsz");
|
|
|
|
|
|
_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_btnChange.target.onClick.Add(OnClickBtnChange);
|
|
|
|
|
|
- _ui.m_bgList.numItems = tempRes.Length;
|
|
|
+ _ui.m_bgList.numItems = MainBackgroundCfgArray.Instance.dataArray.Length;
|
|
|
+ _ui.m_btnRule.onClick.Add(OnBtnRuleClick);
|
|
|
+ _ui.m_btnSaveDressUpBg.target.onClick.Add(OnBtnSaveDressUpBgClick);
|
|
|
+ _ui.m_btnGoShop.onClick.Add(OnBtnGoShopClick);
|
|
|
+
|
|
|
+ PicAdaption();
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
+ SetDefaultSelectedBg();
|
|
|
InitMainUIPreview();
|
|
|
+ UpdateSaveDressUpBgToggleState();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -72,7 +81,7 @@ namespace GFGGame
|
|
|
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);
|
|
|
|
|
@@ -99,28 +108,28 @@ namespace GFGGame
|
|
|
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]);
|
|
|
+ bgItem.m_bgImg.url = ResPathUtil.GetBgImgPath(MainBackgroundCfgArray.Instance.dataArray[index].res);
|
|
|
+ bgItem.m_name.text = MainBackgroundCfgArray.Instance.dataArray[index].name;
|
|
|
UI_bgItem.ProxyEnd();
|
|
|
|
|
|
- item.data = tempRes[index];
|
|
|
+ item.data = MainBackgroundCfgArray.Instance.dataArray[index].id;
|
|
|
}
|
|
|
|
|
|
private void OnClickBgListItem(EventContext context)
|
|
|
{
|
|
|
GObject listItem = context.data as GObject;
|
|
|
- string res = (string)listItem.data;
|
|
|
+ string res = MainBackgroundCfgArray.Instance.GetCfg((int)listItem.data).res;
|
|
|
|
|
|
ChangeBg(res);
|
|
|
}
|
|
|
|
|
|
private void OnClickBtnChange()
|
|
|
{
|
|
|
- SceneController.bgTempRes = (string)_ui.m_bgList.GetChildAt(_ui.m_bgList.selectedIndex).data;
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("主界面背景已更换");
|
|
|
+ RoleDataManager.mainBgID = (int)_ui.m_bgList.GetChildAt(_ui.m_bgList.selectedIndex).data;
|
|
|
Hide();
|
|
|
}
|
|
|
|
|
@@ -130,5 +139,86 @@ namespace GFGGame
|
|
|
mainUI.m_loaBg.url = ResPathUtil.GetBgImgPath(res);
|
|
|
UI_MainUI.ProxyEnd();
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 预览图适配
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task PicAdaption()
|
|
|
+ {
|
|
|
+ await Task.Delay(5);
|
|
|
+ float orginHeight = _ui.m_frame.height;
|
|
|
+ float curHeight = _ui.m_heightAdaptHelper.size.y;
|
|
|
+
|
|
|
+ if (orginHeight != curHeight)
|
|
|
+ {
|
|
|
+ float rate = curHeight * 1.0f / orginHeight;
|
|
|
+
|
|
|
+ _ui.m_frame.scale *= rate;
|
|
|
+ _ui.m_mainUIShow.scale *= rate;
|
|
|
+ // 预览图居中
|
|
|
+ _ui.m_mainUIShow.y = _ui.m_frame.y +
|
|
|
+ ((_ui.m_frame.height * _ui.m_frame.scale.y) - (_ui.m_mainUIShow.height * _ui.m_mainUIShow.scale.y)) / 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnBtnRuleClick()
|
|
|
+ {
|
|
|
+ ViewManager.Show<MainBgChooseTipsView>();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetDefaultSelectedBg()
|
|
|
+ {
|
|
|
+ _ui.m_bgList.selectedIndex = 0;
|
|
|
+ string res = MainBackgroundCfgArray.Instance.dataArray[0].res;
|
|
|
+ ChangeBg(res);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnBtnSaveDressUpBgClick()
|
|
|
+ {
|
|
|
+ // 小月卡
|
|
|
+ float endTime = GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardGoldEndTime);
|
|
|
+ if (endTime > TimeHelper.ServerNow())
|
|
|
+ {
|
|
|
+ if (RoleDataManager.saveDressUpBgToMainBg == 0)
|
|
|
+ {
|
|
|
+ AlertSystem.Show("特权开启后换装背景将用于主界面,是否前往更换?")
|
|
|
+ .SetLeftButton(true)
|
|
|
+ .SetRightButton(true, "确认", (object data) =>
|
|
|
+ {
|
|
|
+ RoleInfoSProxy.ReqSaveChangeGearSwitch(1);
|
|
|
+ ViewManager.Show<DressUpView>(null, true);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ AlertSystem.Show("特权关闭后仅可使用三个默认背景,是否确认关闭?")
|
|
|
+ .SetLeftButton(true)
|
|
|
+ .SetRightButton(true, "确认", (object data) =>
|
|
|
+ {
|
|
|
+ RoleInfoSProxy.ReqSaveChangeGearSwitch(0);
|
|
|
+ RoleDataManager.mainBgID = MainBackgroundCfgArray.Instance.dataArray[0].id;
|
|
|
+ UpdateSaveDressUpBgToggleState();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("该功能尚未开启~");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnBtnGoShopClick()
|
|
|
+ {
|
|
|
+ ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_MONTH_CARD, ConstStoreSubId.STORE_MONTH_GOLD_CARD });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateSaveDressUpBgToggleState()
|
|
|
+ {
|
|
|
+ UI_ButtonToggle2 buttonToggle2 = UI_ButtonToggle2.Proxy(_ui.m_btnSaveDressUpBg.target);
|
|
|
+ buttonToggle2.m_type.SetSelectedIndex(RoleDataManager.saveDressUpBgToMainBg);
|
|
|
+ UI_ButtonToggle2.ProxyEnd();
|
|
|
+ }
|
|
|
}
|
|
|
}
|