|
@@ -20,6 +20,9 @@ namespace GFGGame
|
|
private bool isOpen = false;
|
|
private bool isOpen = false;
|
|
private int _actLuckyBoxId = 0;
|
|
private int _actLuckyBoxId = 0;
|
|
private int _actLimitChargeId = 0;
|
|
private int _actLimitChargeId = 0;
|
|
|
|
+ private List<AdCfg> _adIds = new List<AdCfg>();
|
|
|
|
+ private Vector2 _startPos;
|
|
|
|
+ private Vector2 _endPos;
|
|
private GButton _btnGongGao;
|
|
private GButton _btnGongGao;
|
|
private GButton _btnHaoYou;
|
|
private GButton _btnHaoYou;
|
|
private GButton _btnYouJian;
|
|
private GButton _btnYouJian;
|
|
@@ -160,8 +163,15 @@ namespace GFGGame
|
|
_ui.m_loaRight.target.onClick.Add(MoveLeft);
|
|
_ui.m_loaRight.target.onClick.Add(MoveLeft);
|
|
_ui.m_loaLeft.target.onClick.Add(MoveRight);
|
|
_ui.m_loaLeft.target.onClick.Add(MoveRight);
|
|
|
|
|
|
|
|
+ _ui.m_comListAd.m_listAd.itemRenderer = RenderListAdItem;
|
|
|
|
+ _ui.m_comListAd.m_listAd.SetVirtualAndLoop();
|
|
|
|
+ _ui.m_comListAd.m_listAd.scrollPane.onScrollEnd.Add(OnListAdScrollEnd);
|
|
|
|
+ _ui.m_comListAd.m_listAd.scrollPane.decelerationRate = 0.8f;
|
|
|
|
+
|
|
swipeGesture = new SwipeGesture(_ui.target);
|
|
swipeGesture = new SwipeGesture(_ui.target);
|
|
swipeGesture.onAction.Add(OnSwipe);
|
|
swipeGesture.onAction.Add(OnSwipe);
|
|
|
|
+ swipeGesture.onBegin.Add(OnSwipeBegin);
|
|
|
|
+ swipeGesture.onEnd.Add(OnSwipeEnd);
|
|
swipeGesture.actionDistance = swipeDistance;
|
|
swipeGesture.actionDistance = swipeDistance;
|
|
_ui.m_list.ResizeToFit();
|
|
_ui.m_list.ResizeToFit();
|
|
_ui.m_btnChange.target.onClick.Add(OnBtnChangClick);
|
|
_ui.m_btnChange.target.onClick.Add(OnBtnChangClick);
|
|
@@ -215,7 +225,15 @@ namespace GFGGame
|
|
GameGlobal.lastLoginTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
|
|
GameGlobal.lastLoginTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.OnlineTimeSecs);
|
|
}
|
|
}
|
|
SetPos();
|
|
SetPos();
|
|
-
|
|
|
|
|
|
+ GetAdIds();
|
|
|
|
+ _ui.m_comListAd.target.visible = _ui.m_comListAd.m_listAd.numItems > 0;
|
|
|
|
+ if (_ui.m_comListAd.target.visible)
|
|
|
|
+ {
|
|
|
|
+ Timers.inst.Remove(UpdateAdListTime);
|
|
|
|
+ Timers.inst.Add(3, 0, UpdateAdListTime);
|
|
|
|
+ }
|
|
|
|
+ Timers.inst.Remove(Update);
|
|
|
|
+ Timers.inst.Remove(CheckGuide);
|
|
Timers.inst.AddUpdate(CheckGuide);
|
|
Timers.inst.AddUpdate(CheckGuide);
|
|
Timers.inst.AddUpdate(Update);
|
|
Timers.inst.AddUpdate(Update);
|
|
}
|
|
}
|
|
@@ -228,9 +246,11 @@ namespace GFGGame
|
|
GameObject.Destroy(_sceneObject);
|
|
GameObject.Destroy(_sceneObject);
|
|
_sceneObject = null;
|
|
_sceneObject = null;
|
|
}
|
|
}
|
|
|
|
+ _adIds.Clear();
|
|
_valueBarController.OnHide();
|
|
_valueBarController.OnHide();
|
|
Timers.inst.Remove(Update);
|
|
Timers.inst.Remove(Update);
|
|
Timers.inst.Remove(CheckGuide);
|
|
Timers.inst.Remove(CheckGuide);
|
|
|
|
+ Timers.inst.Remove(UpdateAdListTime);
|
|
}
|
|
}
|
|
|
|
|
|
protected override void RemoveEventListener()
|
|
protected override void RemoveEventListener()
|
|
@@ -300,12 +320,31 @@ namespace GFGGame
|
|
// _sceneObject.transform.position = new Vector2(-GRoot.inst.width / 100f, 0);
|
|
// _sceneObject.transform.position = new Vector2(-GRoot.inst.width / 100f, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ private void OnSwipeBegin()
|
|
|
|
+ {
|
|
|
|
+ Vector2 pos = Input.mousePosition;
|
|
|
|
+ pos.y = Screen.height - pos.y;
|
|
|
|
+
|
|
|
|
+ _startPos = _ui.target.GlobalToLocal(pos);
|
|
|
|
+ }
|
|
|
|
+ private void OnSwipeEnd()
|
|
|
|
+ {
|
|
|
|
+ Vector2 pos = Input.mousePosition;
|
|
|
|
+ pos.y = Screen.height - pos.y;
|
|
|
|
|
|
|
|
+ _endPos = _ui.target.GlobalToLocal(pos);
|
|
|
|
+ }
|
|
private void OnSwipe(EventContext context)
|
|
private void OnSwipe(EventContext context)
|
|
{
|
|
{
|
|
if (!MainDataManager.Instance.CanSwipe) return;
|
|
if (!MainDataManager.Instance.CanSwipe) return;
|
|
if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.MAIN_SECOND_VIEW, false)) return;
|
|
if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.MAIN_SECOND_VIEW, false)) return;
|
|
|
|
|
|
|
|
+ if (_ui.m_comListAd.m_listAd.numItems > 0//滚动广告区域不可切换页面
|
|
|
|
+ && _startPos.x > _ui.m_comListAd.target.x && _startPos.x < (_ui.m_comListAd.target.x + _ui.m_comListAd.target.width)
|
|
|
|
+ && _startPos.y > _ui.m_comListAd.target.y && _startPos.y < (_ui.m_comListAd.target.y + _ui.m_comListAd.target.height)
|
|
|
|
+ && _endPos.x < (_ui.m_comListAd.target.x + _ui.m_comListAd.target.width)
|
|
|
|
+ && _endPos.y > _ui.m_comListAd.target.y && _endPos.y < (_ui.m_comListAd.target.y + _ui.m_comListAd.target.height)) return;
|
|
|
|
+
|
|
SwipeGesture swipeture = (SwipeGesture)context.sender;
|
|
SwipeGesture swipeture = (SwipeGesture)context.sender;
|
|
if (MainDataManager.Instance.ViewType == 0 && swipeture.position.x < 0 &&
|
|
if (MainDataManager.Instance.ViewType == 0 && swipeture.position.x < 0 &&
|
|
swipeture.position.y < -swipeture.position.x && swipeture.position.y > swipeture.position.x)
|
|
swipeture.position.y < -swipeture.position.x && swipeture.position.y > swipeture.position.x)
|
|
@@ -725,7 +764,7 @@ namespace GFGGame
|
|
}
|
|
}
|
|
ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(actLuckyBoxId);
|
|
ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(actLuckyBoxId);
|
|
_ui.m_btnActivityLuckyBox.target.title = activityOpenCfg.themeName;
|
|
_ui.m_btnActivityLuckyBox.target.title = activityOpenCfg.themeName;
|
|
-
|
|
|
|
|
|
+ _ui.m_btnActivityLuckyBox.target.icon = "ui://Main/zjm_tb_" + activityOpenCfg.res;
|
|
long time = TimeUtil.DateTimeToTimestamp(activityOpenCfg.endTime) - TimeHelper.ServerNow();
|
|
long time = TimeUtil.DateTimeToTimestamp(activityOpenCfg.endTime) - TimeHelper.ServerNow();
|
|
_ui.m_btnActivityLuckyBox.m_txtTime.text = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time);
|
|
_ui.m_btnActivityLuckyBox.m_txtTime.text = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time);
|
|
}
|
|
}
|
|
@@ -814,7 +853,62 @@ namespace GFGGame
|
|
RoleInfoManager.Instance.UpdateHead(_ui.m_headBar.m_comHead, RoleDataManager.headId,
|
|
RoleInfoManager.Instance.UpdateHead(_ui.m_headBar.m_comHead, RoleDataManager.headId,
|
|
RoleDataManager.headBorderId);
|
|
RoleDataManager.headBorderId);
|
|
}
|
|
}
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 获取当前开启的滚动广告列表
|
|
|
|
+ /// </summary>
|
|
|
|
+ private void GetAdIds()
|
|
|
|
+ {
|
|
|
|
+ _adIds.Clear();
|
|
|
|
+ for (int i = 0; i < AdCfgArray.Instance.dataArray.Length; i++)
|
|
|
|
+ {
|
|
|
|
+ AdCfg adCfg = AdCfgArray.Instance.dataArray[i];
|
|
|
|
+ if (adCfg.activityId > 0 && ActivityGlobalDataManager.Instance.GetActivityInfo(adCfg.activityId) == null) continue;
|
|
|
|
+ if (!string.IsNullOrEmpty(adCfg.startTime) && !string.IsNullOrEmpty(adCfg.endTime))
|
|
|
|
+ {
|
|
|
|
+ long startTime = TimeUtil.DateTimeToTimestamp(adCfg.startTime);
|
|
|
|
+ long endTime = TimeUtil.DateTimeToTimestamp(adCfg.endTime);
|
|
|
|
+ if (TimeHelper.ServerNow() < startTime || TimeHelper.ServerNow() > endTime) continue;
|
|
|
|
+ }
|
|
|
|
+ _adIds.Add(adCfg);
|
|
|
|
+ }
|
|
|
|
+ _ui.m_comListAd.m_listAd.numItems = _adIds.Count;
|
|
|
|
+ _ui.m_comListAd.m_listAdSelect.numItems = _adIds.Count;
|
|
|
|
+ if (_ui.m_comListAd.m_listAd.numItems > 0)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_comListAd.m_listAd.ScrollToView(0);
|
|
|
|
+ _ui.m_comListAd.m_listAdSelect.selectedIndex = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private void UpdateAdListTime(object param)
|
|
|
|
+ {
|
|
|
|
+ int itemIndex = _ui.m_comListAd.m_listAd.ChildIndexToItemIndex(0) + 1;
|
|
|
|
+ itemIndex = itemIndex == _ui.m_comListAd.m_listAd.numItems ? 0 : itemIndex;
|
|
|
|
+ _ui.m_comListAd.m_listAdSelect.selectedIndex = itemIndex;
|
|
|
|
+ _ui.m_comListAd.m_listAd.scrollPane.ScrollRight(0.8f, true);
|
|
|
|
+ }
|
|
|
|
+ private void RenderListAdItem(int index, GObject obj)
|
|
|
|
+ {
|
|
|
|
+ UI_ListAdItem item = UI_ListAdItem.Proxy(obj);
|
|
|
|
|
|
|
|
+ item.m_loaRes.url = "ui://Main/guanggao_" + _adIds[index].res;
|
|
|
|
+ if (item.m_loaRes.data == null)
|
|
|
|
+ {
|
|
|
|
+ item.m_loaRes.onClick.Add(OnBtnAdJump);
|
|
|
|
+ }
|
|
|
|
+ item.m_loaRes.data = _adIds[index].jumpId;
|
|
|
|
+
|
|
|
|
+ UI_ListAdItem.ProxyEnd();
|
|
|
|
+ }
|
|
|
|
+ private void OnBtnAdJump(EventContext context)
|
|
|
|
+ {
|
|
|
|
+ string jumpId = (context.sender as GObject).data.ToString();
|
|
|
|
+ ViewManager.Show($"GFGGame.{jumpId}");
|
|
|
|
+ }
|
|
|
|
+ private void OnListAdScrollEnd()
|
|
|
|
+ {
|
|
|
|
+ int itemIndex = _ui.m_comListAd.m_listAd.ChildIndexToItemIndex(0);
|
|
|
|
+ _ui.m_comListAd.m_listAdSelect.selectedIndex = itemIndex;
|
|
|
|
+ }
|
|
private void CheckFunOpen()
|
|
private void CheckFunOpen()
|
|
{
|
|
{
|
|
_ui.m_btnXiuFang.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(XiuFangView).Name, false);
|
|
_ui.m_btnXiuFang.m_loaLockIcon.visible = !FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(XiuFangView).Name, false);
|