649 lines
24 KiB
C#
649 lines
24 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using DG.Tweening;
|
|
using GameCore;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UniRx;
|
|
using game;
|
|
using Game;
|
|
|
|
public class EventBankHeistPanel : BasePanel
|
|
{
|
|
Tables _tables;
|
|
FishingEventData _fishingEventData;
|
|
SmallGameData smallGameData;
|
|
|
|
#if UNITY_EDITOR
|
|
static public int selectionType = 0;
|
|
#endif
|
|
GameObject bg;
|
|
GameObject bg1;
|
|
GameObject bg2;
|
|
Head head;
|
|
Button headButton;
|
|
GameObject exchange;
|
|
|
|
public TMP_Text text_name;
|
|
public Button btn_close;
|
|
public Transform beilvpanel_max;
|
|
public Transform bg_beilvlpanel;
|
|
GameObject beilvpanel;
|
|
public TMP_Text text_beilv;
|
|
public TMP_Text text_beilv1;
|
|
public TMP_Text text_num;
|
|
public TMP_Text text_num1;
|
|
public GameObject luckytime_1;
|
|
public GameObject luckytime_2;
|
|
CanvasGroup canvasGroup;
|
|
HeistSequence heistSequence;
|
|
Dictionary<int, HeistItem> heistItemDataMap;
|
|
BankHeistItem[] bankHeistItems;
|
|
List<BankHeistTargetItem> bankHeistTargetItems;
|
|
List<BankHeistItem> bombBankHeistItems;
|
|
List<int> ItemIDList;
|
|
int curShowCount;
|
|
bool isClick = false;
|
|
int multiple;
|
|
int getGlodCount = 0;
|
|
bool is_double_cash = false;
|
|
float allExtraPoint = 0;
|
|
int gameType = 1;
|
|
List<int> ids;
|
|
Animation panel_card_ani;
|
|
Animation target_ani;
|
|
GameObject Root;
|
|
//int curRankCount;
|
|
int addRankCount;
|
|
string playFabId;
|
|
|
|
float superCashBonus = 0;
|
|
private void Awake()
|
|
{
|
|
_tables = GContext.container.Resolve<Tables>();
|
|
heistItemDataMap = _tables.TbHeistItem.DataMap;
|
|
_fishingEventData = GContext.container.Resolve<FishingEventData>();
|
|
smallGameData = GContext.container.Resolve<SmallGameData>();
|
|
|
|
Root = transform.Find("root").gameObject;
|
|
bg = transform.Find("bg").gameObject;
|
|
bg1 = transform.Find("bg1").gameObject;
|
|
bg2 = transform.Find("bg2").gameObject;
|
|
canvasGroup = transform.GetComponent<CanvasGroup>();
|
|
text_name = transform.Find("root/title/bg/text_name").GetComponent<TMP_Text>();
|
|
btn_close = transform.Find("root/btn_close/bg_bottom").GetComponent<Button>();
|
|
head = transform.Find("root/title/btn_head").GetComponent<Head>();
|
|
headButton = transform.Find("root/title/btn_head").GetComponent<Button>();
|
|
exchange = transform.Find("root/title/btn_head/exchange").gameObject;
|
|
beilvpanel = transform.Find("root/panel_card/text_title/beilvpanel").gameObject;
|
|
beilvpanel_max = transform.Find("root/panel_card/text_title/beilvpanel/bg_beilv_max");
|
|
bg_beilvlpanel = transform.Find("root/panel_card/text_title/beilvpanel/bg_beilv");
|
|
text_beilv = transform.Find("root/panel_card/text_title/beilvpanel/bg_beilv_max/text_beilv").GetComponent<TMP_Text>();
|
|
text_beilv1 = transform.Find("root/panel_card/text_title/beilvpanel/bg_beilv/text_beilv").GetComponent<TMP_Text>();
|
|
bankHeistItems = transform.Find("root/panel_card/ScrollView/Viewport/Content").GetComponentsInChildren<BankHeistItem>();
|
|
luckytime_1 = transform.Find("root/luckytime_1").gameObject;
|
|
luckytime_2 = transform.Find("root/luckytime_2").gameObject;
|
|
//bankHeistTargetItems = transform.Find("root/panel_card/target").GetComponentsInChildren<BankHeistTargetItem>();
|
|
bankHeistTargetItems = new List<BankHeistTargetItem>();
|
|
bombBankHeistItems = new List<BankHeistItem>();
|
|
Transform targets = transform.Find("root/panel_card/target");
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
bankHeistTargetItems.Add(targets.Find($"target{i}").GetComponent<BankHeistTargetItem>());
|
|
}
|
|
text_num = transform.Find("root/panel_card/target/target1/text_num").GetComponent<TMP_Text>();
|
|
text_num1 = transform.Find("root/panel_card/target/target0/text_num").GetComponent<TMP_Text>();
|
|
|
|
panel_card_ani = transform.Find("root/panel_card").GetComponent<Animation>();
|
|
target_ani = transform.Find("root/panel_card/target").GetComponent<Animation>();
|
|
}
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
luckytime_1.SetActive(false);
|
|
luckytime_2.SetActive(false);
|
|
for (int i = 1; i < bankHeistTargetItems.Count; i++)
|
|
{
|
|
bankHeistTargetItems[bankHeistTargetItems.Count - i].SetIcon(heistItemDataMap[i].Icon);
|
|
}
|
|
GContext.OnEvent<ChangeSmallGameTargetEvent>().Subscribe(ChangeSmallGameTarget).AddTo(disposables);
|
|
playFabId = smallGameData.opponentData.playFabID;
|
|
GContext.OnEvent<GetClubPlayInfoEvent>().Where(x => x.id == playFabId).Subscribe(SetAvatar).AddTo(disposables);
|
|
IUserService userService = GContext.container.Resolve<IUserService>();
|
|
PlayInfo clubPlayInfo = userService.GetPlayInfo(playFabId);
|
|
SetAvatar(clubPlayInfo);
|
|
//text_name.text = LocalizationMgr.GetFormatTextValue("UI_EventIslandBombHeistPanel_1", smallGameData.opponentData.playName);
|
|
//head.SetData(smallGameData.opponentData.url);
|
|
btn_close.onClick.AddListener(() =>
|
|
{
|
|
GContext.Publish(new UnloadActToNextAct());
|
|
});
|
|
|
|
//不支持切换、
|
|
headButton.enabled = false;
|
|
exchange.SetActive(false);
|
|
headButton.onClick.AddListener(OnClickHead);
|
|
|
|
#if UNITY_EDITOR
|
|
if (selectionType != 0)
|
|
{
|
|
SetGamePlayGM();
|
|
}
|
|
else
|
|
{
|
|
SetGamePlay();
|
|
}
|
|
#else
|
|
SetGamePlay();
|
|
#endif
|
|
SetHeistItem();
|
|
StartPlayNumAni();
|
|
bg.SetActive(gameType == 1);
|
|
bg1.SetActive(gameType == 2);
|
|
bg2.SetActive(gameType == 3);
|
|
}
|
|
async void StartPlayNumAni()
|
|
{
|
|
canvasGroup.interactable = false;
|
|
Root.SetActive(false);
|
|
await Awaiters.Seconds(0.5f);
|
|
Root.SetActive(true);
|
|
_ = StartCoroutine(PlayNumAni());
|
|
}
|
|
|
|
bool isShowing = false;
|
|
async void OnClickHead()
|
|
{
|
|
if (isClick)
|
|
{
|
|
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_20"));
|
|
}
|
|
else if (!isShowing)
|
|
{
|
|
isShowing = true;
|
|
//选择对象
|
|
await UIManager.Instance.ShowUI(UITypes.EventBankHeistOpponentPopupPanel);
|
|
isShowing = false;
|
|
}
|
|
|
|
}
|
|
void ChangeSmallGameTarget(ChangeSmallGameTargetEvent data)
|
|
{
|
|
playFabId = data.opponentItemData.playFabID;
|
|
//text_name.text = LocalizationMgr.GetFormatTextValue("UI_EventBankHeistPanel_1", data.opponentItemData.playName);
|
|
//head.SetData(data.opponentItemData.url);
|
|
StartCoroutine(PlayNumAni());
|
|
IUserService userService = GContext.container.Resolve<IUserService>();
|
|
PlayInfo clubPlayInfo = userService.GetPlayInfo(playFabId);
|
|
SetAvatar(clubPlayInfo);
|
|
}
|
|
|
|
public void SetAvatar(PlayInfo clubPlayInfo)
|
|
{
|
|
if (clubPlayInfo != null)
|
|
{
|
|
text_name.text = LocalizationMgr.GetFormatTextValue("UI_EventBankHeistPanel_1", clubPlayInfo.name);
|
|
head.SetData(clubPlayInfo.avatarUrl);
|
|
}
|
|
}
|
|
void SetAvatar(GetClubPlayInfoEvent getClubPlayInfoEvent)
|
|
{
|
|
if (getClubPlayInfoEvent.id == playFabId)
|
|
{
|
|
text_name.text = LocalizationMgr.GetFormatTextValue("UI_EventBankHeistPanel_1", getClubPlayInfoEvent.name);
|
|
head.SetData(getClubPlayInfoEvent.avatarUrl);
|
|
}
|
|
}
|
|
#if UNITY_EDITOR
|
|
void SetGamePlayGM()
|
|
{
|
|
List<HeistGamePlay> gamePlays = _tables.TbHeistGamePlay.DataList.FindAll((HeistGamePlay heistGamePlay) =>
|
|
{
|
|
return heistGamePlay.Type == selectionType;
|
|
});
|
|
int weight = 0;
|
|
for (int i = 0; i < gamePlays.Count; i++)
|
|
{
|
|
weight += gamePlays[i].Weight;
|
|
}
|
|
int random = Random.Range(0, weight);
|
|
int curWeight = 0;
|
|
for (int i = 0; i < gamePlays.Count; i++)
|
|
{
|
|
curWeight += gamePlays[i].Weight;
|
|
if (random < curWeight)
|
|
{
|
|
gameType = gamePlays[i].Type;
|
|
ids = gamePlays[i].Sequence;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
void SetGamePlay()
|
|
{
|
|
List<HeistInit> heistInits = _tables.TbHeistInit.DataList;
|
|
if (GContext.container.Resolve<IStageData>().IsRewardSettlement && GContext.container.Resolve<SmallGameData>().HeistGameCount < heistInits.Count)
|
|
{
|
|
gameType = heistInits[GContext.container.Resolve<SmallGameData>().HeistGameCount].Type;
|
|
ids = heistInits[GContext.container.Resolve<SmallGameData>().HeistGameCount].Sequence;
|
|
}
|
|
else
|
|
{
|
|
List<HeistGamePlay> gamePlays = _tables.TbHeistGamePlay.DataList;
|
|
int weight = 0;
|
|
for (int i = 0; i < gamePlays.Count; i++)
|
|
{
|
|
weight += gamePlays[i].Weight;
|
|
}
|
|
int random = Random.Range(0, weight);
|
|
int curWeight = 0;
|
|
for (int i = 0; i < gamePlays.Count; i++)
|
|
{
|
|
curWeight += gamePlays[i].Weight;
|
|
if (random < curWeight)
|
|
{
|
|
gameType = gamePlays[i].Type;
|
|
ids = gamePlays[i].Sequence;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SetHeistItem()
|
|
{
|
|
//按权重随机heistSequence
|
|
List<HeistSequence> heistSequences = new List<HeistSequence>();
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
int id = ids[i];
|
|
HeistSequence heistSequence = _tables.TbHeistSequence.GetOrDefault(id);
|
|
#if UNITY_EDITOR
|
|
if (selectionType == 2 && heistSequence.FinalReward != 201)
|
|
{
|
|
continue;
|
|
}
|
|
#endif
|
|
heistSequences.Add(heistSequence);
|
|
}
|
|
heistSequence = heistSequences[0];
|
|
int weight = 0;
|
|
for (int i = 0; i < heistSequences.Count; i++)
|
|
{
|
|
weight += heistSequences[i].Weight;
|
|
}
|
|
int random = Random.Range(0, weight);
|
|
int curWeight = 0;
|
|
for (int i = 0; i < heistSequences.Count; i++)
|
|
{
|
|
curWeight += heistSequences[i].Weight;
|
|
if (random < curWeight)
|
|
{
|
|
heistSequence = heistSequences[i];
|
|
break;
|
|
}
|
|
}
|
|
#if AGG
|
|
using (var e = GEvent.GameEvent("specialevent_bankheist"))
|
|
{
|
|
e.AddContent("heist_sequence_id", heistSequence.ID);
|
|
}
|
|
#endif
|
|
InitItenIDList();
|
|
for (int i = 0; i < bankHeistItems.Length; i++)
|
|
{
|
|
if (i < ItemIDList.Count)
|
|
{
|
|
bankHeistItems[i].action = OnClickItem;
|
|
}
|
|
else
|
|
{
|
|
bankHeistItems[i].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
void InitItenIDList()
|
|
{
|
|
ItemIDList = new List<int>(heistSequence.ItemList);
|
|
int id;
|
|
Dictionary<int, int> idCountMap = new Dictionary<int, int>();
|
|
for (int i = 0; i < ItemIDList.Count; i++)
|
|
{
|
|
idCountMap[ItemIDList[i]] = 0;
|
|
}
|
|
List<int> idList = new List<int>();
|
|
//if (gameType == 1)
|
|
//{
|
|
//额外道具
|
|
for (int i = 0; i < heistSequence.SpecialItemCount; i++)
|
|
{
|
|
id = ItemIDList[ItemIDList.Count - 1];
|
|
idList.Add(id);
|
|
ItemIDList.Remove(id);
|
|
}
|
|
//}
|
|
|
|
int random;
|
|
//目标道具
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
random = Random.Range(0, idList.Count);
|
|
idList.Insert(random, heistSequence.FinalReward);
|
|
ItemIDList.Remove(heistSequence.FinalReward);
|
|
}
|
|
idCountMap[heistSequence.FinalReward] = 2;
|
|
int insertCount = 0;
|
|
for (int i = heistSequence.SpecialItemCount + 3; i < heistSequence.DrawCount; i++)
|
|
{
|
|
id = ItemIDList[insertCount];
|
|
if (idCountMap[id] < 2)
|
|
{
|
|
idCountMap[id]++;
|
|
random = Random.Range(0, idList.Count);
|
|
idList.Insert(random, id);
|
|
ItemIDList.Remove(id);
|
|
}
|
|
else
|
|
{
|
|
insertCount++;
|
|
i--;
|
|
}
|
|
}
|
|
idList.Add(heistSequence.FinalReward);
|
|
ItemIDList.Remove(heistSequence.FinalReward);
|
|
for (int i = heistSequence.DrawCount; i < heistSequence.ItemList.Count; i++)
|
|
{
|
|
if (ItemIDList.Count == 0)
|
|
{
|
|
break;
|
|
}
|
|
id = ItemIDList[0];
|
|
random = Random.Range(heistSequence.DrawCount, idList.Count);
|
|
idList.Insert(random, id);
|
|
ItemIDList.Remove(id);
|
|
}
|
|
ItemIDList = idList;
|
|
}
|
|
IEnumerator PlayNumAni()
|
|
{
|
|
canvasGroup.interactable = false;
|
|
ItemData itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(heistItemDataMap[3].RewardID);
|
|
int curNum = (int)(itemData.count * smallGameData.opponentData.power * (1 + superCashBonus));
|
|
curNum = Mathf.RoundToInt(curNum * (1 + allExtraPoint));
|
|
|
|
curNum = is_double_cash ? curNum + curNum : curNum;
|
|
|
|
text_num.text = ConvertTools.GetNumberString2(curNum);
|
|
|
|
if (gameType == 3)
|
|
{
|
|
//金砖事件
|
|
itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(heistItemDataMap[4].RewardID);
|
|
int curNum1 = (int)(itemData.count * smallGameData.opponentData.power * (1 + superCashBonus));
|
|
curNum1 = Mathf.RoundToInt(curNum1 * (1 + allExtraPoint));
|
|
curNum1 = is_double_cash ? curNum1 + curNum1 : curNum1;
|
|
luckytime_1.SetActive(true);
|
|
//GContext.Publish(new VibrationData(HapticTypes.Warning));
|
|
float timerAni = luckytime_1.GetComponent<Animation>().GetClip("EventBankHeistPanel_luckytime1").length;
|
|
text_num1.text = ConvertTools.GetNumberString2(curNum1);
|
|
yield return new WaitForSeconds(timerAni);
|
|
luckytime_1.SetActive(false);
|
|
target_ani.Play();// ("EventBankHeistPanel_luckytime1_target");
|
|
timerAni = target_ani.GetClip("EventBankHeistPanel_luckytime1_target").length;
|
|
yield return new WaitForSeconds(timerAni);
|
|
panel_card_ani.Play("EventBankHeistPanel_luckytimeopen");
|
|
timerAni = panel_card_ani.GetClip("EventBankHeistPanel_luckytimeopen").length;
|
|
int curNum2 = curNum1 * multiple;
|
|
yield return new WaitForSeconds(timerAni - 0.2f);
|
|
if (multiple > 1)
|
|
{
|
|
DOTween.To(() => curNum1, x => curNum1 = x, curNum2, 1f).OnUpdate(() =>
|
|
{
|
|
text_num1.text = ConvertTools.GetNumberString2(curNum1);
|
|
});
|
|
}
|
|
}
|
|
else if (gameType == 2)
|
|
{
|
|
//炸弹事件
|
|
luckytime_2.SetActive(true);
|
|
//GContext.Publish(new VibrationData(HapticTypes.Warning));
|
|
float timerAni = luckytime_2.GetComponent<Animation>().GetClip("EventBankHeistPanel_luckytime2").length;
|
|
yield return new WaitForSeconds(timerAni);
|
|
luckytime_2.SetActive(false);
|
|
panel_card_ani.Play("EventBankHeistPanel_commonopen");
|
|
timerAni = panel_card_ani.GetClip("EventBankHeistPanel_commonopen").length;
|
|
yield return new WaitForSeconds(timerAni - 0.2f);
|
|
}
|
|
else if (gameType == 1)
|
|
{
|
|
panel_card_ani.Play("EventBankHeistPanel_commonopen");
|
|
float timerAni = panel_card_ani.GetClip("EventBankHeistPanel_commonopen").length;
|
|
yield return new WaitForSeconds(timerAni - 0.2f);
|
|
}
|
|
if (multiple > 1)
|
|
{
|
|
int lastNum = curNum * multiple;
|
|
DOTween.To(() => curNum, x => curNum = x, lastNum, 1f).OnUpdate(() =>
|
|
{
|
|
text_num.text = ConvertTools.GetNumberString2(curNum);
|
|
});
|
|
yield return new WaitForSeconds(1f);
|
|
}
|
|
canvasGroup.interactable = true;
|
|
}
|
|
private void OnEnable()
|
|
{
|
|
SuperRob superRob = GContext.container.Resolve<BuffDataCenter>().GetWeelyBuffTimeData<SuperRob>();
|
|
if (superRob != null)
|
|
{
|
|
superCashBonus = superRob.CashBonus;
|
|
}
|
|
//bool isRankInit = _fishingEventData.rankInit != null;
|
|
//if (isRankInit)
|
|
//{
|
|
// curRankCount = (int)GContext.container.Resolve<PlayerItemData>().GetItemCount(_fishingEventData.rankInit.TokenID);
|
|
//}
|
|
multiple = GContext.container.Resolve<PlayerData>().GetMagnification();
|
|
beilvpanel.SetActive(multiple > 1);
|
|
if (multiple <= 1)
|
|
{
|
|
return;
|
|
}
|
|
bool isMax = GContext.container.Resolve<PlayerData>().IsMaxMagnification();
|
|
beilvpanel_max.gameObject.SetActive(isMax);
|
|
bg_beilvlpanel.gameObject.SetActive(!isMax);
|
|
text_beilv.text = $"x{multiple}";
|
|
text_beilv1.text = $"x{multiple}";
|
|
}
|
|
void OnClickItem(BankHeistItem heistItemB)
|
|
{
|
|
GContext.Publish(new VibrationData(HapticTypes.Selection));
|
|
int heistID = ItemIDList[curShowCount];
|
|
curShowCount++;
|
|
HeistItem heistItem = heistItemDataMap[heistID];
|
|
heistItemB.SetData(heistItem, multiple);
|
|
isClick = true;
|
|
exchange.SetActive(false);
|
|
switch (heistItem.Type)
|
|
{
|
|
case 0:
|
|
OnClick00(heistItemB);
|
|
break;
|
|
case 1:
|
|
GContext.Publish(new EventUISound("audio_ui_bankheist_open_high"));
|
|
OnClick01(heistItemB);
|
|
break;
|
|
case 2:
|
|
GContext.Publish(new EventUISound("audio_ui_bankheist_open_high"));
|
|
OnClick02(heistItemB);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 翻开普通道具
|
|
/// </summary>
|
|
/// <param name="heistItem"></param>
|
|
void OnClick00(BankHeistItem bankHeistItem)
|
|
{
|
|
HeistItem heistItem = bankHeistItem.heistItem;
|
|
if (gameType == 3 && heistItem.ID == 1)
|
|
{
|
|
return;
|
|
}
|
|
if (heistItem.ID == 1)
|
|
{
|
|
GContext.Publish(new EventUISound("audio_ui_bankheist_open_low"));
|
|
}
|
|
else if (heistItem.ID == 2)
|
|
{
|
|
GContext.Publish(new EventUISound("audio_ui_bankheist_open_mid"));
|
|
}
|
|
else
|
|
{
|
|
GContext.Publish(new EventUISound("audio_ui_bankheist_open_high"));
|
|
}
|
|
|
|
|
|
BankHeistTargetItem bankHeistTargetItem = bankHeistTargetItems[^heistItem.ID];
|
|
bankHeistTargetItem.OnAddItem(bankHeistItem);
|
|
if (bankHeistTargetItem.itemCount >= 3)
|
|
{
|
|
canvasGroup.interactable = false;
|
|
bankHeistTargetItem.Success();
|
|
|
|
if (_fishingEventData.rankInit != null)
|
|
{
|
|
int point = _fishingEventData.rankInit.PointRobbery[heistItem.ID - 1] * multiple;
|
|
point = Mathf.RoundToInt(point);
|
|
addRankCount += point;
|
|
_fishingEventData.AddRankTarget(point);
|
|
}
|
|
ItemData itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(heistItem.RewardID);
|
|
int curNum = (int)(itemData.count * smallGameData.opponentData.power * (1 + superCashBonus));
|
|
curNum = Mathf.RoundToInt(curNum * (1 + allExtraPoint));
|
|
curNum = is_double_cash ? curNum + curNum : curNum;
|
|
|
|
AddGload(curNum, itemData.count);
|
|
Settlement();
|
|
}
|
|
//else
|
|
//{
|
|
bankHeistItem.PlayAni();
|
|
//}
|
|
}
|
|
void AddGload(int curNum, float baseNum)
|
|
{
|
|
baseNum /= GContext.container.Resolve<PlayerItemData>().ExtraCoinMag();
|
|
//GContext.Publish(new ConditionTypeEvent(ConditionType.MaxCashFromRaid, curNum));
|
|
getGlodCount = curNum * multiple;
|
|
GContext.container.Resolve<PlayerItemData>().AddItemCount(1002, getGlodCount, null);
|
|
long Heist = (int)baseNum * multiple * 100 + Random.Range(5, 16);
|
|
smallGameData.SetEnemy(EnemyType.Heist, Heist);
|
|
GContext.Publish(new ConditionTypeEvent(ConditionType.CashFromHeist, getGlodCount));
|
|
|
|
GContext.container.Resolve<SmallGameData>().SaveHeistGameCount();
|
|
GContext.Publish(new ConditionTypeEvent(ConditionType.DoHeist, 1));
|
|
#if AGG
|
|
using (var e = GEvent.GameEvent("special_event"))
|
|
{
|
|
e.AddContent("item_id", 1002)
|
|
.AddContent("special_event_multiple", multiple)
|
|
.AddContent("finish_times", GContext.container.Resolve<SmallGameData>().HeistGameCount)
|
|
.AddContent("reward_cash", getGlodCount)
|
|
.AddContent("event_type", 1);
|
|
}
|
|
#endif
|
|
}
|
|
async void Settlement()
|
|
{
|
|
GContext.Publish(new VibrationData(HapticTypes.MediumImpact));
|
|
UIManager.Instance.DestroyUI(UITypes.EventBankHeistOpponentPopupPanel);
|
|
await Awaiters.Seconds(1f);
|
|
//yield return new WaitForSeconds(2f);
|
|
//Todo
|
|
var go = await UIManager.Instance.GetUIAsync(UITypes.EventBankHeistRewardPanel);
|
|
EventBankHeistRewardPanel eventBankHeistRewardPanel = go.GetComponent<EventBankHeistRewardPanel>();
|
|
eventBankHeistRewardPanel.SetData(getGlodCount, superCashBonus, addRankCount);
|
|
}
|
|
/// <summary>
|
|
/// 翻开特殊奖励
|
|
/// </summary>
|
|
/// <param name="bankHeistItem"></param>
|
|
void OnClick01(BankHeistItem bankHeistItem)
|
|
{
|
|
HeistItem heistItem = bankHeistItem.heistItem;
|
|
bankHeistItem.OnGetAdditional();
|
|
ItemData itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(heistItem.RewardID);
|
|
//if (itemData.id == 1001)
|
|
//{
|
|
// itemData.count *= (1 + GContext.container.Resolve<PlayerData>().curVipData.ShopEnergy);
|
|
//}
|
|
GContext.container.Resolve<PlayerItemData>().AddItemCount(itemData.id, itemData.count * multiple, null);
|
|
}
|
|
//翻开炸弹
|
|
void OnClick02(BankHeistItem bankHeistItem)
|
|
{
|
|
bombBankHeistItems.Add(bankHeistItem);
|
|
bankHeistItem.PlayAni();
|
|
if (bombBankHeistItems.Count >= 3)
|
|
{
|
|
canvasGroup.interactable = false;
|
|
//Todo
|
|
//一系列效果
|
|
for (int i = 0; i < bankHeistItems.Length; i++)
|
|
{
|
|
if (bankHeistItems[i].isMaster)
|
|
{
|
|
int heistID = ItemIDList[curShowCount];
|
|
curShowCount++;
|
|
HeistItem heistItem = heistItemDataMap[heistID];
|
|
bankHeistItems[i].SetData(heistItem, multiple);
|
|
}
|
|
}
|
|
ItemData itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(heistItemDataMap[3].RewardID);
|
|
bool isRankInit = _fishingEventData.rankInit != null;
|
|
if (isRankInit)
|
|
{
|
|
int point = _fishingEventData.rankInit.PointRobbery[3] * multiple;
|
|
point = Mathf.RoundToInt(point);
|
|
addRankCount += point;
|
|
_fishingEventData.AddRankTarget(point);
|
|
}
|
|
for (int i = 1; i < 3; i++)
|
|
{
|
|
ItemData subItemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(heistItemDataMap[i].RewardID);
|
|
itemData.count += subItemData.count;
|
|
}
|
|
int curNum = (int)(itemData.count * smallGameData.opponentData.power * (1 + superCashBonus));
|
|
curNum = Mathf.RoundToInt(curNum * (1 + allExtraPoint));
|
|
curNum = is_double_cash ? curNum + curNum : curNum;
|
|
AddGload(curNum, itemData.count);
|
|
//结算
|
|
ShowAll();
|
|
}
|
|
}
|
|
|
|
async void ShowAll()
|
|
{
|
|
int index;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
index = i * 4;
|
|
bankHeistItems[index].OnSuccess();
|
|
bankHeistItems[index + 1].OnSuccess();
|
|
bankHeistItems[index + 2].OnSuccess();
|
|
bankHeistItems[index + 3].OnSuccess();
|
|
bankHeistTargetItems[i + 1].OnAllShow();
|
|
await Awaiters.Seconds(1f);
|
|
}
|
|
Settlement();
|
|
}
|
|
}
|