| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- using FairyGUI;
- using UI.ActivityMain;
- using System.Collections;
- using System.Collections.Generic;
- using cfg.GfgCfg;
- using ET;
- namespace GFGGame
- {
- public class ActivityMainTipsView : BaseWindow
- {
- private UI_ActivityMainTipsUI _ui;
- private List<AdCfg> activitydata;
- private List<AdCfg> showActivity = new List<AdCfg>();
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_ActivityMainTipsUI.PACKAGE_NAME;
- _ui = UI_ActivityMainTipsUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- modal = true;
- _ui.m_icon.onClick.Add(OnBtnAdJump);
- _ui.m_btnChange.onClick.Add(OnClickChange);
- _ui.m_backBtn.onClick.Add(OnClickChange);
- _ui.m_notTips.onClick.Add(OnClickTips);
- }
- protected override void OnShown()
- {
- base.OnShown();
- if (activitydata == null)
- {
- activitydata = CommonDataManager.Tables.TblAdCfg.DataList;
- }
- _ui.m_t4.Play();
- UpdateInfo();
- }
- protected async override void OnHide()
- {
- if (_ui.m_tipImg.visible)
- {
- ActivityDataManager.Instance.todayActivityTips = 1;
- }
- else
- {
- ActivityDataManager.Instance.todayActivityTips = 0;
- }
- bool result;
- result = await ActivitySProxy.ReqActivityTips(NumericType.IsPropYchmActivity,
- ActivityDataManager.Instance.todayActivityTips);
- base.OnHide();
- }
- private void UpdateView()
- {
- long endTime = 0;
- if (showActivity.Count > 0 && showActivity[0] != null)
- {
- if (showActivity[0].ActivityId != 0)
- {
- ActivityInfo activityInfo =
- ActivityGlobalDataManager.Instance.GetActivityInfo(showActivity[0].ActivityId);
- endTime = activityInfo.EndTime;
- }
- else
- {
- endTime = TimeUtil.DateTimeToTimestamp(showActivity[0].EndTime);
- }
- }
- else
- {
- this.Hide();
- return;
- }
- long curTime = TimeHelper.ServerNow();
- _ui.m_icon.url = ResPathUtil.GetActivityPath(showActivity[0].ActivityNotice, "png");
- _ui.m_activityDesc.visible = false;
- }
- private void UpdateInfo()
- {
- if (showActivity.Count == 0)
- {
- for (int i = 0; i < activitydata.Count; i++)
- {
- AdCfg adCfg = activitydata[i];
- if (adCfg.ActivityId > 0)
- {
- if (ActivityGlobalDataManager.Instance.GetActivityInfo(adCfg.ActivityId) == null) continue;
- ActivityInfo activityInfo =
- ActivityGlobalDataManager.Instance.GetActivityInfo(adCfg.ActivityId);
- if (TimeHelper.ServerNow() < activityInfo.StartTime ||
- TimeHelper.ServerNow() > activityInfo.EndTime) continue;
- }
- if (adCfg.ActivityNotice != null && adCfg.ActivityNotice != "")
- {
- if (adCfg.ActivityId != 0)
- {
- ActivityInfo activityInfo =
- ActivityGlobalDataManager.Instance.GetActivityInfo(adCfg.ActivityId);
- if (TimeHelper.ServerNow() < activityInfo.StartTime ||
- TimeHelper.ServerNow() > activityInfo.EndTime)
- {
- }
- else
- {
- showActivity.Add(adCfg);
- continue;
- }
- }
- if (adCfg.StartTime != "" && adCfg.StartTime != null)
- {
- long startTime = TimeUtil.DateTimeToTimestamp(adCfg.StartTime);
- long endTime = TimeUtil.DateTimeToTimestamp(adCfg.EndTime);
- if (TimeHelper.ServerNow() < startTime || TimeHelper.ServerNow() > endTime)
- {
- continue;
- }
- else
- {
- showActivity.Add(adCfg);
- }
- }
- }
- }
- }
- UpdateView();
- }
- private void OnClickChange()
- {
- _ui.m_t0.Play();
- showActivity.RemoveAt(0);
- if (showActivity.Count == 0)
- {
- this.Hide();
- return;
- }
- UpdateView();
- _ui.m_t1.Play();
- }
- private void OnClickTips()
- {
- if (ActivityDataManager.Instance.todayActivityTips == 0)
- {
- _ui.m_tipImg.visible = true;
- ActivityDataManager.Instance.todayActivityTips = 1;
- }
- else
- {
- _ui.m_tipImg.visible = false;
- ActivityDataManager.Instance.todayActivityTips = 0;
- }
- }
- private void OnBtnAdJump()
- {
- AdCfg adCfg = showActivity[0];
- object[] param = null;
- int jumpIndex = 0;
- if (adCfg.JumpId == nameof(LimitChargeView))
- {
- param = new object[] { adCfg.ActivityId };
- }
- if (adCfg.JumpId == nameof(NewLimitChargeView))
- {
- param = new object[] { adCfg.ActivityId };
- }
- if (adCfg.JumpId == nameof(LuckyBoxView))
- {
- jumpIndex = adCfg.JumpParam[0];
- }
- if (adCfg.JumpId == nameof(ClothingSyntheticView))
- {
- param = new object[] { adCfg.JumpParam[0] };
- }
- if (jumpIndex != 0)
- ViewManager.Show($"GFGGame.{adCfg.JumpId}", jumpIndex);
- else
- ViewManager.Show($"GFGGame.{adCfg.JumpId}", param);
- }
- }
- }
|