From e89c81f45f344186069dc9cfa8b4e232f6f9822d Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期三, 24 十月 2018 17:30:48 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
System/OpenServerActivity/WishingPoolWin.cs | 90 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 88 insertions(+), 2 deletions(-)
diff --git a/System/OpenServerActivity/WishingPoolWin.cs b/System/OpenServerActivity/WishingPoolWin.cs
index 10f61c2..105627d 100644
--- a/System/OpenServerActivity/WishingPoolWin.cs
+++ b/System/OpenServerActivity/WishingPoolWin.cs
@@ -2,6 +2,7 @@
using UnityEngine.UI;
using System.Collections.Generic;
using System;
+using DG.Tweening;
namespace Snxxz.UI
{
@@ -20,6 +21,12 @@
[SerializeField] List<WishItemCell> wishingCells = new List<WishItemCell>();
[SerializeField] GameObject activityOpenObj;
[SerializeField] GameObject activityCloseObj;
+ [Header("鍔ㄧ敾鎺у埗")]
+ [SerializeField] RectTransform handImg;
+ [SerializeField] PositionTween positionTween;
+ [SerializeField] UIAlphaTween alphaTween;
+ [SerializeField] List<Vector2> startPos = new List<Vector2>();
+ [SerializeField] List<Vector2> endPos = new List<Vector2>();
ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
WishingPoolModel wishingModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
@@ -44,6 +51,7 @@
wishingModel.UpdatePoolDataEvent += UpdatePoolItemByIndex;
wishingModel.UpdateWishingDataEvent += UpdateWishItemByIndex;
GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
+ wishingModel.UpdateHandMoveEvent += UpdateHandMove;
}
protected override void OnAfterOpen()
@@ -56,6 +64,7 @@
wishingModel.UpdateWishingDataEvent -= UpdateWishItemByIndex;
GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
+ wishingModel.UpdateHandMoveEvent -= UpdateHandMove;
}
protected override void OnAfterClose()
{
@@ -79,6 +88,31 @@
UpdateDayRemainTime();
activityDayText.text = Language.Get("WishingPool103", operation.GetActivityDay());
totalDayText.text = Language.Get("WishingPool101", Language.Get(StringUtility.Contact("Num_CHS_", operation.totalDays + 1)));
+ handImg.gameObject.SetActive(false);
+ }
+
+ private void UpdateHandMove()
+ {
+ PlayHandMovePos();
+ }
+
+ private void PlayHandMovePos()
+ {
+ positionTween.from = startPos[wishingModel.handStartIndex];
+ positionTween.to = endPos[wishingModel.handEndIndex];
+ positionTween.SetStartState();
+ alphaTween.from = 0;
+ alphaTween.to = 1;
+ alphaTween.SetStartState();
+ handImg.gameObject.SetActive(true);
+ int offset = wishingModel.handStartIndex % 4 - wishingModel.handEndIndex;
+ positionTween.duration = Mathf.Max(2, Mathf.Abs(offset));
+ alphaTween.Play();
+ positionTween.Play(() =>
+ {
+ handImg.gameObject.SetActive(false);
+ });
+
}
#region 璁告効閫昏緫
@@ -107,6 +141,7 @@
private void CheckWishingCell()
{
+ bool isAddWish = false;
for(int i = 0; i < wishingCells.Count; i++)
{
var rect = wishingCells[i].transform as RectTransform;
@@ -128,9 +163,14 @@
// wishingModel.SetWishingPoolData(wishingModel.dragIndex,wellWishItem);
//}
//wishingModel.SetWishingData(i,wellPoolItem);
+ isAddWish = true;
wishingModel.SendRefreshWishInfo(wishingModel.dragIndex,i);
break;
}
+ }
+ if(!isAddWish)
+ {
+ UpdatePoolItem();
}
}
@@ -144,6 +184,7 @@
dragItem.dragBestIcon.SetActive(false);
ItemCellModel cellModel = new ItemCellModel(wellItem.itemId,false,(ulong)wellItem.itemCount,wellItem.isBind);
dragItem.dragItemBasic.Init(cellModel);
+ poolItemCells[wishingModel.dragIndex].gameObject.SetActive(false);
}
else
{
@@ -256,12 +297,57 @@
private void ClickMoneyRefreshWish()
{
- wishingModel.SendRefreshPoolInfo(0);
+ if(!wishingModel.IsBestItem())
+ {
+ CheckMoney();
+ }
+ else
+ {
+ ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("WishingPool106", wishingModel.wishingPrice), (bool isOk) =>
+ {
+ if (isOk)
+ {
+ CheckMoney();
+ }
+ });
+ }
+ }
+
+ private void CheckMoney()
+ {
+ if ((int)UIHelper.GetMoneyCnt(1) < wishingModel.wishingPrice)
+ {
+ WindowCenter.Instance.Open<RechargeTipWin>();
+ }
+ else
+ {
+ ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("WishingPool105", wishingModel.wishingPrice), (bool isOk) =>
+ {
+ if (isOk)
+ {
+ wishingModel.SendRefreshPoolInfo(0);
+ }
+ });
+ }
}
private void ClickFreeRefreshWish()
{
- wishingModel.SendRefreshPoolInfo(1);
+ if (!wishingModel.IsBestItem())
+ {
+ wishingModel.SendRefreshPoolInfo(1);
+ }
+ else
+ {
+ ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("WishingPool106", wishingModel.wishingPrice), (bool isOk) =>
+ {
+ if (isOk)
+ {
+ wishingModel.SendRefreshPoolInfo(1);
+ }
+ });
+ }
+
}
#endregion
--
Gitblit v1.8.0