备份CatanBuilding瘦身独立工程
This commit is contained in:
60
Assets/Scripts/Duel/UI/DuelBtnRod.cs
Normal file
60
Assets/Scripts/Duel/UI/DuelBtnRod.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniRx;
|
||||
|
||||
public class DuelBtnRod : MonoBehaviour
|
||||
{
|
||||
Image bg_hud_god_image;
|
||||
Image rawImage;
|
||||
TMP_Text text_grade_rod;
|
||||
TMP_Text text_star_rod;
|
||||
PlayerFishData _playerFishData;
|
||||
Tables _tables;
|
||||
string[] bg_hud_gods = { "bg_hud_god_blue", "bg_hud_god_blue", "bg_hud_god_purple", "bg_hud_god_yellow" };
|
||||
System.IDisposable disposable;
|
||||
private void Awake()
|
||||
{
|
||||
_playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
bg_hud_god_image = transform.Find("bg").GetComponent<Image>();
|
||||
rawImage = transform.Find("mask/icon").GetComponent<Image>();
|
||||
text_grade_rod = transform.Find("text_grade").GetComponent<TMP_Text>();
|
||||
text_star_rod = transform.Find("bg_star/text_star").GetComponent<TMP_Text>();
|
||||
disposable = GContext.OnEvent<ActChangeRodDataEvent>().Subscribe(e =>
|
||||
{
|
||||
InitData();
|
||||
});
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
InitData();
|
||||
}
|
||||
public void InitData()
|
||||
{
|
||||
RodData rod = _tables.GetRodData(GContext.container.Resolve<PlayerData>().equipRodID);
|
||||
text_grade_rod.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePanel_2", _playerFishData.GetRodLevel(rod.ID) + 1);
|
||||
text_star_rod.text = _playerFishData.GetRodPiece(rod.ID).ToString();
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(bg_hud_god_image, bg_hud_gods[rod.Quality - 1], "HomePanel");
|
||||
int skindID = GContext.container.Resolve<PlayerFishData>().GetRodSkin(rod.ID);
|
||||
if (skindID <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var fishRodSkinData = _tables.TbRodSkinData.GetOrDefault(skindID);
|
||||
if (fishRodSkinData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(rawImage, fishRodSkinData.Avatar, "HomePanel");
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
disposable?.Dispose();
|
||||
disposable = null;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelBtnRod.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelBtnRod.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51c69079d8444444190c34a5692695f2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
69
Assets/Scripts/Duel/UI/DuelChatView.cs
Normal file
69
Assets/Scripts/Duel/UI/DuelChatView.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DuelChatView : MonoBehaviour, IDuelChatView
|
||||
{
|
||||
public Animation dialogue;
|
||||
public TMP_Text text_chat;
|
||||
public Animation emoji;
|
||||
public Image image_emoji;
|
||||
IUIService uiService;
|
||||
protected virtual void Awake()
|
||||
{
|
||||
uiService = GContext.container.Resolve<IUIService>();
|
||||
}
|
||||
public void SetDuelFishingEvent(int roleID)
|
||||
{
|
||||
GContext.OnEvent<DuelChatEvent>().Where(x => x.RoleID == roleID).Subscribe(SetMessage).AddTo(this);
|
||||
}
|
||||
void SetMessage(DuelChatEvent duelChatEvent)
|
||||
{
|
||||
EventSoloQuickMessage eventSoloQuickMessage = GContext.container.Resolve<Tables>().TbEventSoloQuickMessage.GetOrDefault(duelChatEvent.MessageID);
|
||||
if (eventSoloQuickMessage != null)
|
||||
{
|
||||
switch (eventSoloQuickMessage.Type)
|
||||
{
|
||||
case 1:
|
||||
Emoji(eventSoloQuickMessage.Emoji);
|
||||
break;
|
||||
case 2:
|
||||
Dialogue(eventSoloQuickMessage.Text_l10n_key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Dialogue(string chat)
|
||||
{
|
||||
if (this == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
emoji.gameObject.SetActive(false);
|
||||
dialogue.gameObject.SetActive(true);
|
||||
dialogue.Play();
|
||||
text_chat.text = LocalizationMgr.GetText(chat);
|
||||
}
|
||||
|
||||
public void Emoji(string chat)
|
||||
{
|
||||
if (this == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
emoji.gameObject.SetActive(true);
|
||||
dialogue.gameObject.SetActive(false);
|
||||
emoji.Play();
|
||||
uiService.SetImageSprite(image_emoji, chat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
11
Assets/Scripts/Duel/UI/DuelChatView.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelChatView.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10af52ad76e126e48a486f0f1f76be1c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
Assets/Scripts/Duel/UI/DuelFishInfo.cs
Normal file
13
Assets/Scripts/Duel/UI/DuelFishInfo.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DuelFishInfo : MonoBehaviour
|
||||
{
|
||||
public Image icon_fish;
|
||||
public Image icon_fish_tag;
|
||||
public GameObject myself;
|
||||
public GameObject enemy;
|
||||
public TextNumHigherAdd text_num_score;
|
||||
public TextNumHigherAdd text_num_enermy_score;
|
||||
public GameObject root;
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelFishInfo.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelFishInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00ee5a3d3cdb11140856e861afe46d49
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Assets/Scripts/Duel/UI/DuelFishProgress.cs
Normal file
63
Assets/Scripts/Duel/UI/DuelFishProgress.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class DuelFishProgress : MonoBehaviour
|
||||
{
|
||||
public GameObject catching;
|
||||
public GameObject nocatched;
|
||||
public GameObject failed;
|
||||
public DuelFishProgressInfo fishInfo;
|
||||
public GameObject finished;
|
||||
IUIService uiService;
|
||||
private void Awake()
|
||||
{
|
||||
uiService = GContext.container.Resolve<IUIService>();
|
||||
}
|
||||
|
||||
public void Catching()
|
||||
{
|
||||
catching.SetActive(true);
|
||||
nocatched.SetActive(false);
|
||||
}
|
||||
public void NoCatched()
|
||||
{
|
||||
catching.SetActive(false);
|
||||
nocatched.SetActive(true);
|
||||
}
|
||||
public void Failed()
|
||||
{
|
||||
catching.SetActive(false);
|
||||
nocatched.SetActive(false);
|
||||
failed.SetActive(true);
|
||||
StartCoroutine(HideFishInfo(failed));
|
||||
}
|
||||
public void ShowFishInfo(FishInfoData data, bool isEnd)
|
||||
{
|
||||
catching.SetActive(false);
|
||||
nocatched.SetActive(false);
|
||||
failed.SetActive(false);
|
||||
fishInfo.gameObject.SetActive(true);
|
||||
Item item = GContext.container.Resolve<Tables>().GetItemData(data.fishItemId);
|
||||
if (item != null)
|
||||
{
|
||||
PlayerFishData.SetFishIcon(fishInfo.icon_fish, item);//鱼头像
|
||||
}
|
||||
fishInfo.text_num_score.SetValue(data.point.ToString(), data.higher);
|
||||
fishInfo.text_num_fishcard.SetValue(data.fishCardAdd.ToString("P0"), data.higherCard);
|
||||
fishInfo.text_num_rod.SetValue(data.fishRodAdd.ToString("P0"), data.higherRod);
|
||||
if (isEnd)
|
||||
{
|
||||
finished.SetActive(true);
|
||||
}
|
||||
StartCoroutine(HideFishInfo(fishInfo.gameObject));
|
||||
}
|
||||
|
||||
IEnumerator HideFishInfo(GameObject hide)
|
||||
{
|
||||
yield return new WaitForSeconds(3f);
|
||||
hide.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelFishProgress.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelFishProgress.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a8038c29a0f50f43b1cf1a773ff2cbe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/Scripts/Duel/UI/DuelFishProgressInfo.cs
Normal file
10
Assets/Scripts/Duel/UI/DuelFishProgressInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DuelFishProgressInfo : MonoBehaviour
|
||||
{
|
||||
public Image icon_fish;
|
||||
public TextNumHigher text_num_score;
|
||||
public TextNumHigher text_num_fishcard;
|
||||
public TextNumHigher text_num_rod;
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelFishProgressInfo.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelFishProgressInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbb4e7ad36cc4834b8c7415c4f56e63e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Scripts/Duel/UI/DuelFishState.cs
Normal file
16
Assets/Scripts/Duel/UI/DuelFishState.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class DuelFishState : MonoBehaviour
|
||||
{
|
||||
public GameObject current;
|
||||
public GameObject failed;
|
||||
public GameObject done;
|
||||
public TMP_Text[] text_num;
|
||||
private void Reset()
|
||||
{
|
||||
current = transform.Find("current").gameObject;
|
||||
failed = transform.Find("failed").gameObject;
|
||||
done = transform.Find("done").gameObject;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelFishState.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelFishState.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 418f1cad18ea4a847b7a5b5c7f8d7f32
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Duel/UI/DuelInfoPopupPanel.meta
Normal file
8
Assets/Scripts/Duel/UI/DuelInfoPopupPanel.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b77606e514639646a93a02bc1010acb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
114
Assets/Scripts/Duel/UI/DuelInfoPopupPanel/DuelInfoPopupPanel.cs
Normal file
114
Assets/Scripts/Duel/UI/DuelInfoPopupPanel/DuelInfoPopupPanel.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DuelInfoPopupPanel : MonoBehaviour
|
||||
{
|
||||
Image icon_rank;
|
||||
Head head;
|
||||
Head head1;
|
||||
TMP_Text text_info;
|
||||
List<Image> icon_ranks;
|
||||
List<TMP_Text> txt_ranks;
|
||||
List<TMP_Text> text_points;
|
||||
DuelRankRewardItem duelRankRewardItem;
|
||||
DuelRankRewardItem duelRankRewardItem1;
|
||||
FishingEventData fishingEventData;
|
||||
IUserService userService;
|
||||
IUIService uiService;
|
||||
private void Awake()
|
||||
{
|
||||
fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
userService = GContext.container.Resolve<IUserService>();
|
||||
uiService = GContext.container.Resolve<IUIService>();
|
||||
icon_rank = transform.Find("root/page1/info1/btn_rank/icon").GetComponent<Image>();
|
||||
head = transform.Find("root/page1/info3/btn_head").GetComponent<Head>();
|
||||
head1 = transform.Find("root/page2/info3/player_info/btn_head").GetComponent<Head>();
|
||||
text_info = transform.Find("root/page1/info1/text_info").GetComponent<TMP_Text>();
|
||||
icon_ranks = new List<Image>();
|
||||
txt_ranks = new List<TMP_Text>();
|
||||
text_points = new List<TMP_Text>();
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
icon_ranks.Add(transform.Find($"root/page3/info1/rank/rank{i}/btn_green/icon_rank").GetComponent<Image>());
|
||||
txt_ranks.Add(transform.Find($"root/page3/info1/rank/rank{i}/btn_green/text_rank").GetComponent<TMP_Text>());
|
||||
text_points.Add(transform.Find($"root/page3/info1/rank/rank{i}/btn_green/text_point").GetComponent<TMP_Text>());
|
||||
}
|
||||
duelRankRewardItem = transform.Find("root/page3/info2/item1").GetComponent<DuelRankRewardItem>();
|
||||
duelRankRewardItem1 = transform.Find("root/page3/info2/item2").GetComponent<DuelRankRewardItem>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
uiService.SetImageSprite(icon_rank, fishingEventData.rankInit.Icon);
|
||||
string title = LocalizationMgr.GetText(fishingEventData.rankInit.Title_l10n_key);
|
||||
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_51", title);
|
||||
|
||||
head.SetData(userService.AvatarUrl);
|
||||
head1.SetData(userService.AvatarUrl);
|
||||
var data = GContext.container.Resolve<Tables>().TbEventSolomain.DataList;
|
||||
for (int i = 0; i < txt_ranks.Count; i++)
|
||||
{
|
||||
txt_ranks[i].text = LocalizationMgr.GetText(data[i].RankText_l10n_key);
|
||||
text_points[i].text = data[i].TrophyRange[0].ToString();
|
||||
uiService.SetImageSprite(icon_ranks[i], data[i].RankIcon);
|
||||
}
|
||||
ShowReward();
|
||||
}
|
||||
void ShowReward()
|
||||
{
|
||||
List<EventSolomain> eventSolomain = GContext.container.Resolve<Tables>().TbEventSolomain.DataList;
|
||||
int count = eventSolomain.Count;
|
||||
int index = count / 2;
|
||||
EventSolomain solomain = eventSolomain[index];
|
||||
uiService.SetImageSprite(duelRankRewardItem.icon_rank, solomain.RankIcon);
|
||||
duelRankRewardItem.text_rank.text = LocalizationMgr.GetText(solomain.RankText_l10n_key);
|
||||
duelRankRewardItem.text_point.text = solomain.TrophyRange[0].ToString();
|
||||
List<ItemData> rewardItemData = GContext.container.Resolve<PlayerItemData>()
|
||||
.GetItemDataByDropId(solomain.SeasonReward);
|
||||
if (rewardItemData != null)
|
||||
{
|
||||
int dataCount = rewardItemData.Count;
|
||||
int rewardCount = duelRankRewardItem.rewardItems.Count;
|
||||
for (int j = 0; j < rewardCount; j++)
|
||||
{
|
||||
if (j < dataCount)
|
||||
{
|
||||
duelRankRewardItem.rewardItems[j].SetData(rewardItemData[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
duelRankRewardItem.rewardItems[j].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
solomain = eventSolomain[index - 1];
|
||||
uiService.SetImageSprite(duelRankRewardItem1.icon_rank, solomain.RankIcon);
|
||||
duelRankRewardItem1.text_rank.text = LocalizationMgr.GetText(solomain.RankText_l10n_key);
|
||||
duelRankRewardItem1.text_point.text = solomain.TrophyRange[0].ToString();
|
||||
rewardItemData = GContext.container.Resolve<PlayerItemData>()
|
||||
.GetItemDataByDropId(solomain.SeasonReward);
|
||||
if (rewardItemData != null)
|
||||
{
|
||||
int dataCount = rewardItemData.Count;
|
||||
int rewardCount = duelRankRewardItem1.rewardItems.Count;
|
||||
for (int j = 0; j < rewardCount; j++)
|
||||
{
|
||||
if (j < dataCount)
|
||||
{
|
||||
duelRankRewardItem1.rewardItems[j].SetData(rewardItemData[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
duelRankRewardItem1.rewardItems[j].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41167a87fe9912c46a393231d1fee416
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/Scripts/Duel/UI/DuelMatchPlayer.cs
Normal file
12
Assets/Scripts/Duel/UI/DuelMatchPlayer.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DuelMatchPlayer : MonoBehaviour
|
||||
{
|
||||
public Image icon_head;
|
||||
public TMP_Text text_name;
|
||||
public TMP_Text text_score;
|
||||
public Image icon_rank;
|
||||
public GameObject fx_ui_matchingPanel_rank;
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelMatchPlayer.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelMatchPlayer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b11238457db2bc2498173bc36d8713a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
228
Assets/Scripts/Duel/UI/DuelRandomMapPanel.cs
Normal file
228
Assets/Scripts/Duel/UI/DuelRandomMapPanel.cs
Normal file
@@ -0,0 +1,228 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using DG.Tweening;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DuelRandomMapPanel : MonoBehaviour
|
||||
{
|
||||
public Transform arrow1;
|
||||
public Transform arrow2;
|
||||
public float StartDelay = 0.5f;
|
||||
public float StartDuration = 0.4f;
|
||||
public int AccNum = 4;
|
||||
public float LoopDuration = 0.2f;
|
||||
/*
|
||||
* 选定阶段
|
||||
在[0, 1]之间选一个参数,然后如下的3个参数都取相同的比例:
|
||||
间隔多少张图:SelectedMapNumRand = [2,5]
|
||||
回弹:最后一张图的回弹比例,必须大于0,[0.2, 0.4]
|
||||
二次回弹:弹回去之后[0, 0.1]
|
||||
回弹速度:在这段时间内,整体速度逐渐变成0
|
||||
*/
|
||||
public int[] SelectedMapNumRand = new[] { 2, 5 };
|
||||
public float[] BackRatioRand = new[] { 0.2f, 0.4f };
|
||||
public float[] SecondBackRatioRand = new[] { 0f, 0.1f };
|
||||
public int[] ArrowRotationRand = new[] { 10, 15 };
|
||||
int MapNum = 2;
|
||||
float BackRatio;
|
||||
float SecondBackRatio;
|
||||
|
||||
FishingDuelManager FDM;
|
||||
RectTransform Content;
|
||||
GameObject img_map;
|
||||
int allCount = 5;
|
||||
float height;
|
||||
IUIService uIService;
|
||||
|
||||
GameObject text_title;
|
||||
TMP_Text text_map;
|
||||
Tables _tables;
|
||||
List<MapData> mapDatas;
|
||||
List<int> newIDs;
|
||||
bool isClose;
|
||||
[HideInInspector]
|
||||
public bool IsStop;
|
||||
private void Awake()
|
||||
{
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
uIService = GContext.container.Resolve<IUIService>();
|
||||
FDM = GContext.container.Resolve<FishingDuelManager>();
|
||||
Content = transform.Find("Viewport/Content").GetComponent<RectTransform>();
|
||||
img_map = transform.Find("Viewport/Content/Item").gameObject;
|
||||
height = img_map.GetComponent<RectTransform>().rect.height;
|
||||
img_map.SetActive(false);
|
||||
|
||||
text_title = transform.Find("title").gameObject;
|
||||
text_map = transform.Find("title/text_map").GetComponent<TMP_Text>();
|
||||
}
|
||||
|
||||
public void StartMap()
|
||||
{
|
||||
float t = Random.Range(0f, 1f);
|
||||
MapNum = Mathf.RoundToInt(SelectedMapNumRand[0] + (SelectedMapNumRand[1] - SelectedMapNumRand[0]) * t);
|
||||
BackRatio = BackRatioRand[0] + (BackRatioRand[1] - BackRatioRand[0]) * t;
|
||||
SecondBackRatio = SecondBackRatioRand[0] + (SecondBackRatioRand[1] - SecondBackRatioRand[0]) * t;
|
||||
|
||||
IsStop = false;
|
||||
text_title.SetActive(false);
|
||||
isClose = false;
|
||||
_tables = GContext.container.Resolve<Tables>();
|
||||
var lastMapID = GContext.container.Resolve<PlayerData>().lastMapId;
|
||||
mapDatas = _tables.TbMapData.DataList;
|
||||
List<int> indexs = new List<int>
|
||||
{
|
||||
0,1
|
||||
};
|
||||
for (int i = 2; i < mapDatas.Count; i++)
|
||||
{
|
||||
if (mapDatas[i].ID <= lastMapID)
|
||||
{
|
||||
indexs.Insert(Random.Range(0, indexs.Count), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (indexs.Count < allCount + MapNum)
|
||||
{
|
||||
indexs.AddRange(indexs);
|
||||
}
|
||||
|
||||
newIDs = indexs;
|
||||
for (int i = 0; i < allCount; i++)
|
||||
{
|
||||
SetMapBg(mapDatas[newIDs[i]].Bg);
|
||||
}
|
||||
SetMapBg(mapDatas[newIDs[0]].Bg);
|
||||
for (int i = 0; i < MapNum - 1; i++)
|
||||
{
|
||||
SetMapBg(mapDatas[newIDs[allCount + i]].Bg);
|
||||
}
|
||||
StartCoroutine(Play());
|
||||
}
|
||||
public void SetClose()
|
||||
{
|
||||
int mapId = FDM.MapId;
|
||||
var mapData = _tables.TbMapData.DataMap[mapId];
|
||||
SetMapBg(mapData.Bg);
|
||||
SetMapBg(mapDatas[newIDs[0]].Bg);
|
||||
text_map.text = LocalizationMgr.GetText(mapData.Name_l10n_key);
|
||||
isClose = true;
|
||||
//Content.DOKill();
|
||||
//Content.anchoredPosition = new Vector2(0, allCount * height);
|
||||
//StartCoroutine(Close());
|
||||
//FDM.SetMapId(mapId);
|
||||
}
|
||||
void SetMapBg(string bg)
|
||||
{
|
||||
GameObject go = Instantiate(img_map, Content);
|
||||
Image image = go.transform.GetChild(0).GetComponent<Image>();
|
||||
go.SetActive(true);
|
||||
uIService.SetImageSprite(image, bg);
|
||||
}
|
||||
public void Stop()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
Content.DOKill();
|
||||
}
|
||||
IEnumerator PlayArrow()
|
||||
{
|
||||
int cur = 1;
|
||||
float acc = (StartDuration - LoopDuration) / AccNum;
|
||||
float time = StartDuration;
|
||||
float arrowTime = time / 4;
|
||||
int ArrowRotation = Random.Range(ArrowRotationRand[0], ArrowRotationRand[1]);
|
||||
arrow1.DOLocalRotate(new Vector3(0, 0, ArrowRotation), arrowTime);
|
||||
arrow2.DOLocalRotate(new Vector3(0, 0, -ArrowRotation), arrowTime);
|
||||
yield return new WaitForSeconds(arrowTime);
|
||||
arrowTime = time / 4;
|
||||
while (cur < AccNum)
|
||||
{
|
||||
cur++;
|
||||
time -= acc;
|
||||
arrowTime = arrowTime + time / 4;
|
||||
ArrowRotation = Random.Range(ArrowRotationRand[0], ArrowRotationRand[1]);
|
||||
arrow1.DOLocalRotate(new Vector3(0, 0, -ArrowRotation), arrowTime);
|
||||
arrow2.DOLocalRotate(new Vector3(0, 0, ArrowRotation), arrowTime);
|
||||
yield return new WaitForSeconds(arrowTime);
|
||||
arrowTime = time / 2;
|
||||
ArrowRotation = Random.Range(ArrowRotationRand[0], ArrowRotationRand[1]);
|
||||
arrow1.DOLocalRotate(new Vector3(0, 0, ArrowRotation), arrowTime);
|
||||
arrow2.DOLocalRotate(new Vector3(0, 0, -ArrowRotation), arrowTime);
|
||||
yield return new WaitForSeconds(arrowTime);
|
||||
arrowTime = time / 4;
|
||||
}
|
||||
while (!IsStop)
|
||||
{
|
||||
arrowTime = LoopDuration / 2;
|
||||
ArrowRotation = Random.Range(ArrowRotationRand[0], ArrowRotationRand[1]);
|
||||
arrow1.DOLocalRotate(new Vector3(0, 0, -ArrowRotation), arrowTime);
|
||||
arrow2.DOLocalRotate(new Vector3(0, 0, ArrowRotation), arrowTime);
|
||||
yield return new WaitForSeconds(arrowTime);
|
||||
arrowTime = LoopDuration / 2;
|
||||
ArrowRotation = Random.Range(ArrowRotationRand[0], ArrowRotationRand[1]);
|
||||
arrow1.DOLocalRotate(new Vector3(0, 0, ArrowRotation), arrowTime);
|
||||
arrow2.DOLocalRotate(new Vector3(0, 0, -ArrowRotation), arrowTime);
|
||||
yield return new WaitForSeconds(arrowTime);
|
||||
}
|
||||
}
|
||||
Coroutine playArrow;
|
||||
IEnumerator Play()
|
||||
{
|
||||
Content.anchoredPosition = Vector2.zero;
|
||||
yield return new WaitForSeconds(StartDelay);
|
||||
int cur = 0;
|
||||
float acc = (StartDuration - LoopDuration) / AccNum;
|
||||
float time = StartDuration;
|
||||
playArrow = StartCoroutine(PlayArrow());
|
||||
while (cur < AccNum)
|
||||
{
|
||||
cur++;
|
||||
Content.DOAnchorPosY(cur * height, time).SetEase(Ease.Linear);
|
||||
yield return new WaitForSeconds(time);
|
||||
time -= acc;
|
||||
}
|
||||
time = LoopDuration * (allCount - cur);
|
||||
Content.DOAnchorPosY(allCount * height, time).SetEase(Ease.Linear);
|
||||
yield return new WaitForSeconds(time);
|
||||
|
||||
time = LoopDuration * allCount;
|
||||
while (!isClose)
|
||||
{
|
||||
Content.anchoredPosition = Vector2.zero;
|
||||
Content.DOAnchorPosY(allCount * height, time).SetEase(Ease.Linear);
|
||||
yield return new WaitForSeconds(time);
|
||||
}
|
||||
StartCoroutine(Close());
|
||||
}
|
||||
IEnumerator Close()
|
||||
{
|
||||
var sequence = DOTween.Sequence();
|
||||
//跑马灯动画
|
||||
float index2 = allCount + MapNum + BackRatio;
|
||||
float time1 = (BackRatio + MapNum) * LoopDuration;
|
||||
float time2 = SecondBackRatio;
|
||||
|
||||
sequence.Append(Content.DOAnchorPosY(index2 * height, time1).SetEase(Ease.Linear));
|
||||
sequence.Append(Content.DOAnchorPosY((allCount + MapNum) * height, time2).SetEase(Ease.InSine));
|
||||
sequence.Play();
|
||||
yield return new WaitForSeconds(time1);
|
||||
StopCoroutine(playArrow);
|
||||
arrow1.DOKill();
|
||||
arrow2.DOKill();
|
||||
arrow1.DOLocalRotate(new Vector3(0, 0, 0), time2);
|
||||
arrow2.DOLocalRotate(new Vector3(0, 0, 0), time2);
|
||||
yield return new WaitForSeconds(time2);
|
||||
IsStop = true;
|
||||
GContext.Publish(new VibrationData(HapticTypes.HeavyImpact));
|
||||
text_title.SetActive(true);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelRandomMapPanel.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelRandomMapPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76fcf748385e5ef488b51ea370f425a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/Scripts/Duel/UI/DuelRankRewardItem.cs
Normal file
33
Assets/Scripts/Duel/UI/DuelRankRewardItem.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DuelRankRewardItem : MonoBehaviour
|
||||
{
|
||||
public GameObject bar_root;
|
||||
public Image bar;
|
||||
public GameObject bg_normal;
|
||||
public GameObject bg_gray;
|
||||
public GameObject bg_next;
|
||||
public List<RewardItemNew> rewardItems;
|
||||
public TMP_Text text_rank;
|
||||
public Image icon_rank;
|
||||
public TMP_Text text_point;
|
||||
private void Reset()
|
||||
{
|
||||
bar_root = transform.Find("bg_bar").gameObject;
|
||||
bar = transform.Find("bg_bar/bar").GetComponent<Image>();
|
||||
bg_normal = transform.Find("bg_normal").gameObject;
|
||||
bg_gray = transform.Find("bg_gray").gameObject;
|
||||
bg_next = transform.Find("bg_next").gameObject;
|
||||
text_rank = transform.Find("rank/text_rank").GetComponent<TMP_Text>();
|
||||
icon_rank = transform.Find("rank/icon_rank").GetComponent<Image>();
|
||||
text_point = transform.Find("rank/text_point").GetComponent<TMP_Text>();
|
||||
rewardItems = new List<RewardItemNew>();
|
||||
for (int i = 1; i < 5; i++)
|
||||
{
|
||||
rewardItems.Add(transform.Find($"reward/reward{i}").GetComponent<RewardItemNew>());
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelRankRewardItem.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelRankRewardItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46df4a5d17420bb449214988814a8c30
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
42
Assets/Scripts/Duel/UI/DuelRodItem.cs
Normal file
42
Assets/Scripts/Duel/UI/DuelRodItem.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DuelRodItem : MonoBehaviour
|
||||
{
|
||||
public RodItem rodItem;
|
||||
public GameObject selected;
|
||||
public Button btn_item;
|
||||
public TMP_Text power_text;
|
||||
public Action<DuelRodItem> onClick;
|
||||
public RodItemData data => rodItem?.data;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (btn_item != null)
|
||||
{
|
||||
btn_item.onClick.AddListener(OnBtnItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void Init(RodItemData _data)
|
||||
{
|
||||
rodItem.Init(_data);
|
||||
if (power_text != null)
|
||||
{
|
||||
power_text.transform.parent.gameObject.SetActive(_data.RodPower > 0);
|
||||
power_text.text = _data.RodPower.ToString();
|
||||
}
|
||||
}
|
||||
void OnBtnItem()
|
||||
{
|
||||
onClick?.Invoke(this);
|
||||
}
|
||||
|
||||
public void SetSelected(bool value)
|
||||
{
|
||||
selected.SetActive(value);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelRodItem.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelRodItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24df3b59efa18184aa7e6162807dce5d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
99
Assets/Scripts/Duel/UI/DuelUIView.cs
Normal file
99
Assets/Scripts/Duel/UI/DuelUIView.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using asap.core;
|
||||
using DG.Tweening;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
|
||||
public class DuelUIView : DuelChatView, IDuelUIView
|
||||
{
|
||||
public TMP_Text text_point;
|
||||
public Animation anim;
|
||||
public Head icon_head;
|
||||
public TMP_Text text_name;
|
||||
public TMP_Text text_add;
|
||||
public DuelFishProgress fishProgress;
|
||||
[HideInInspector]
|
||||
public ReactiveProperty<int> curPTS = new ReactiveProperty<int>();
|
||||
public List<DuelFishState> duelFishStates = new List<DuelFishState>();
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
duelFishStates[0].current.SetActive(true);
|
||||
}
|
||||
public void SetDuelFishingEvent(int roleID, int fishCount)
|
||||
{
|
||||
GContext.OnEvent<DuelFishingEvent>().Where(x => x.RoleID == roleID).Subscribe(e =>
|
||||
{
|
||||
if (e.ItemID > 0)
|
||||
{
|
||||
Fishing(e.ItemID);
|
||||
}
|
||||
else
|
||||
{
|
||||
EndFishing(e.index, e.data, e.isEnd);
|
||||
}
|
||||
}).AddTo(this);
|
||||
for (int i = fishCount; i < duelFishStates.Count; i++)
|
||||
{
|
||||
duelFishStates[i].gameObject.SetActive(false);
|
||||
}
|
||||
SetDuelFishingEvent(roleID);
|
||||
}
|
||||
|
||||
public void EndFishing(int index, FishInfoData data, bool isEnd)
|
||||
{
|
||||
if (index > duelFishStates.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (index > 0)
|
||||
{
|
||||
duelFishStates[index - 1].current.SetActive(false);
|
||||
if (data.point > 0)
|
||||
{
|
||||
PTSAdd(data.point);
|
||||
duelFishStates[index - 1].done.SetActive(true);
|
||||
duelFishStates[index - 1].failed.SetActive(false);
|
||||
fishProgress.ShowFishInfo(data, isEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
duelFishStates[index - 1].done.SetActive(false);
|
||||
duelFishStates[index - 1].failed.SetActive(true);
|
||||
fishProgress.Failed();
|
||||
}
|
||||
if (index < duelFishStates.Count)
|
||||
{
|
||||
duelFishStates[index].current.SetActive(true);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fishProgress.NoCatched();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Fishing(int itemID)
|
||||
{
|
||||
fishProgress.Catching();
|
||||
}
|
||||
|
||||
async void PTSAdd(int add)
|
||||
{
|
||||
text_add.text = $"+{add}";
|
||||
text_add.gameObject.SetActive(true);
|
||||
anim.Play();
|
||||
await Awaiters.Seconds(1);
|
||||
//eventFishingDuelTopArea.text_add.gameObject.SetActive(false);
|
||||
int pts = curPTS.Value;
|
||||
curPTS.Value += add;
|
||||
int newPts = pts + add;
|
||||
DOTween.To(() => pts, x => pts = x, newPts, 1).OnUpdate(() =>
|
||||
{
|
||||
text_point.text = ConvertTools.GetNumberString2(pts);
|
||||
});
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/DuelUIView.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/DuelUIView.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5a4b91bc67c568498851c59851c3868
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
278
Assets/Scripts/Duel/UI/EventFishingDuelArea.cs
Normal file
278
Assets/Scripts/Duel/UI/EventFishingDuelArea.cs
Normal file
@@ -0,0 +1,278 @@
|
||||
using asap.core;
|
||||
using Game;
|
||||
using GameCore;
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniRx;
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using cfg;
|
||||
|
||||
public class EventFishingDuelArea : MonoBehaviour
|
||||
{
|
||||
private UIButton btn_play;
|
||||
Button btn_yugan;
|
||||
public Animation ani;
|
||||
event_fishingduel_rod_change rodPanel;
|
||||
|
||||
Animator btn_play_anim;
|
||||
[HideInInspector]
|
||||
public GameObject DownPanel;
|
||||
Animation text_time_ani;
|
||||
TMP_Text text_time;
|
||||
TMP_Text text_time_red;
|
||||
public TMP_Text text_countdown;
|
||||
GameObject TopArea;
|
||||
Image bar;
|
||||
string doTweenKey = "EventFishingDuelArea";
|
||||
DuelUIView selfView;
|
||||
DuelUIView enemyView;
|
||||
FishingDuelManager FDM;
|
||||
|
||||
Button btn_chat;
|
||||
GameObject chat;
|
||||
GameObject redpoint;
|
||||
Animator toast_start;
|
||||
TMP_Text text_title;
|
||||
public Animation toast_others;
|
||||
public TMP_Text[] toasts;
|
||||
protected CompositeDisposable disposables = new CompositeDisposable();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
FDM = GContext.container.Resolve<FishingDuelManager>();
|
||||
|
||||
TopArea = transform.Find("root/TopArea").gameObject;
|
||||
bar = transform.Find("root/TopArea/bg_bar/bar_myself").GetComponent<Image>();
|
||||
selfView = transform.Find("root/TopArea/SelfView").GetComponent<DuelUIView>();
|
||||
enemyView = transform.Find("root/TopArea/EnemyView").GetComponent<DuelUIView>();
|
||||
|
||||
btn_play = transform.Find("root/DownPanel/btn_play").GetComponent<UIButton>();
|
||||
btn_play_anim = btn_play.GetComponent<Animator>();
|
||||
text_time_ani = transform.Find("root/TopArea/bg_bar/text_time").GetComponent<Animation>();
|
||||
text_time = transform.Find("root/TopArea/bg_bar/text_time/text_time").GetComponent<TMP_Text>();
|
||||
text_time_red = transform.Find("root/TopArea/bg_bar/text_time/text_time_red").GetComponent<TMP_Text>();
|
||||
|
||||
DownPanel = transform.Find("root/DownPanel").gameObject;
|
||||
btn_chat = transform.Find("root/DownPanel/btn_layout/btn_chat").GetComponent<Button>();
|
||||
chat = transform.Find("root/event_fishingduel_chat").gameObject;
|
||||
rodPanel = transform.Find("root/event_fishingduel_rod_change").GetComponent<event_fishingduel_rod_change>();
|
||||
redpoint = transform.Find("root/DownPanel/btn_yugan/redpoint").gameObject;
|
||||
btn_yugan = transform.Find("root/DownPanel/btn_yugan").GetComponent<Button>();
|
||||
toast_start = transform.Find("root/toast_start").GetComponent<Animator>();
|
||||
text_title = transform.Find("root/toast_start/text/text_waiting").GetComponent<TMP_Text>();
|
||||
GContext.OnEvent<RequestSvrTimeEvent>().Subscribe(RequestSvrTimeEvent).AddTo(disposables);
|
||||
redpoint.SetActive(false);
|
||||
rodPanel.gameObject.SetActive(true);
|
||||
SetTopArea(false);
|
||||
}
|
||||
protected void Start()
|
||||
{
|
||||
btn_play.onDown.AddListener(StartAutoTimer);
|
||||
btn_play.onUp.AddListener(StopCoroutineTimer);
|
||||
btn_play.onClick.AddListener(OnClickPlay);
|
||||
//btn_yugan.onClick.AddListener(OnClickRod);
|
||||
btn_chat.onClick.AddListener(() =>
|
||||
{
|
||||
chat.SetActive(!chat.activeSelf);
|
||||
});
|
||||
InitView();
|
||||
SetTopArea(false);
|
||||
//redpoint.SetActive(FDM.InitRodRed());
|
||||
//OnClickRod();
|
||||
MapData mapData = GContext.container.Resolve<Tables>().TbMapData.DataMap[FDM.MapId];
|
||||
rodPanel.text_title.text = LocalizationMgr.GetText(mapData.Name_l10n_key);
|
||||
rodPanel.allTime = FDM.eventSoloConfig.ChooseRodTime;
|
||||
rodPanel.SetTimer();
|
||||
}
|
||||
|
||||
void InitView()
|
||||
{
|
||||
selfView.icon_head.SetData(FDM.SelfModel.PlayerAvatar);
|
||||
selfView.text_name.text = FDM.SelfModel.PlayerName;
|
||||
selfView.text_point.text = "0";
|
||||
selfView.text_add.gameObject.SetActive(false);
|
||||
selfView.curPTS.Subscribe(curPTS =>
|
||||
{
|
||||
SetBar();
|
||||
}).AddTo(disposables);
|
||||
selfView.SetDuelFishingEvent(0, FDM.FishItemIDs.Count);
|
||||
bar.fillAmount = 0.5f;
|
||||
enemyView.icon_head.SetData(FDM.EnemyModel.PlayerAvatar);
|
||||
enemyView.text_name.text = FDM.EnemyModel.PlayerName;
|
||||
enemyView.text_point.text = "0";
|
||||
enemyView.text_add.gameObject.SetActive(false);
|
||||
enemyView.curPTS.Subscribe(curPTS =>
|
||||
{
|
||||
SetBar();
|
||||
}).AddTo(disposables);
|
||||
enemyView.SetDuelFishingEvent(1, FDM.FishItemIDs.Count);
|
||||
|
||||
FDM.SelfModel.RoleID = 0;
|
||||
FDM.EnemyModel.RoleID = 1;
|
||||
FDM.SelfChatModel.RoleID = 0;
|
||||
FDM.EnemyChatModel.RoleID = 1;
|
||||
}
|
||||
|
||||
public void SetBar()
|
||||
{
|
||||
float fillAmount = FDM.FillAmount;
|
||||
if (fillAmount > 0)
|
||||
{
|
||||
DOTween.Kill(doTweenKey);
|
||||
fillAmount = 0.05f + fillAmount * 0.9f;
|
||||
bar.DOFillAmount(fillAmount, 1).SetId(doTweenKey);
|
||||
}
|
||||
}
|
||||
bool Status = true;
|
||||
void RequestSvrTimeEvent(RequestSvrTimeEvent requestSvrTimeEvent)
|
||||
{
|
||||
Status = requestSvrTimeEvent.Status;
|
||||
TopArea.SetActive(Status);
|
||||
}
|
||||
/// <summary>
|
||||
/// 显示Toast
|
||||
/// </summary>
|
||||
/// <param name="index">0== 对手先进 最后一轮, 1==对手完成,2==我完成</param>
|
||||
/// <param name="value"></param>
|
||||
public void ShowToastOthers(int index, string value)
|
||||
{
|
||||
Debug.Log($"ShowToastOthers {index} {value}");
|
||||
if (index < 0 || index >= toasts.Length) return;
|
||||
var toast = toasts[index];
|
||||
toast_others.gameObject.SetActive(true);
|
||||
toast_others.Play($"toast_others_show_{index + 1}");
|
||||
toast.text = value;
|
||||
if (index == 1)
|
||||
{
|
||||
text_time_ani.Play("text_time_top_disappear_lose");
|
||||
StartCoroutine(PlayAppear());
|
||||
}
|
||||
else if (index == 2)
|
||||
{
|
||||
text_time_ani.Play("text_time_top_disappear_win");
|
||||
}
|
||||
}
|
||||
public async void ShowToastOthers(string value)
|
||||
{
|
||||
var toast = toasts[1];
|
||||
toast_others.gameObject.SetActive(true);
|
||||
toast_others.Play("toast_others_close");
|
||||
await Awaiters.Seconds(0.5f);
|
||||
toast_others.Play("toast_others_show_2");
|
||||
toast.text = value;
|
||||
}
|
||||
public void PlayLoop()
|
||||
{
|
||||
text_time_ani.Play("text_time_red_loop");
|
||||
}
|
||||
IEnumerator PlayAppear()
|
||||
{
|
||||
yield return new WaitForSeconds(3f);
|
||||
text_time_ani.Play("text_time_toast_appear");
|
||||
yield return new WaitForSeconds(1f);
|
||||
PlayLoop();
|
||||
}
|
||||
//void OnClickRod()
|
||||
//{
|
||||
// redpoint.SetActive(false);
|
||||
// rodPanel.gameObject.SetActive(true);
|
||||
// SetTopArea(false);
|
||||
//}
|
||||
|
||||
void StartAutoTimer()
|
||||
{
|
||||
btn_play_anim.Play("Pressed", -1, 0);
|
||||
}
|
||||
void StopCoroutineTimer()
|
||||
{
|
||||
btn_play_anim.Play("Normal", -1, 0);
|
||||
}
|
||||
async void OnClickPlay()
|
||||
{
|
||||
GContext.Publish(new EventFishingSound(SoundType.audio_ui_btn_cast));
|
||||
GContext.Publish(new VibrationData(HapticTypes.Selection));
|
||||
GContext.Publish(new VibrationData(HapticTypes.MediumImpact));
|
||||
var go = await UIManager.Instance.ShowUI(UITypes.FishingPanel);
|
||||
if (go != null)
|
||||
{
|
||||
transform.SetAsLastSibling();
|
||||
DownPanel.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTopArea(bool value)
|
||||
{
|
||||
DownPanel.SetActive(value);
|
||||
TopArea.SetActive(value && Status);
|
||||
}
|
||||
public void SetHideBtnPlay()
|
||||
{
|
||||
btn_play.gameObject.SetActive(false);
|
||||
}
|
||||
public void SetTime(TimeSpan timeSpan, bool selfIsLastFish)
|
||||
{
|
||||
if (/*selfIsLastFish || */timeSpan.TotalSeconds > FDM.eventSoloConfig.EndTime)
|
||||
{
|
||||
text_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_second", timeSpan.TotalSeconds.ToString("F0"));
|
||||
text_time_red.text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
text_countdown.text = text_time_red.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_second", timeSpan.TotalSeconds.ToString("F0"));
|
||||
text_time.text = "";
|
||||
}
|
||||
//UI_COMMON_second
|
||||
}
|
||||
public void SetState(int value, int role)
|
||||
{
|
||||
toast_start.gameObject.SetActive(true);
|
||||
if (value == 1)
|
||||
{
|
||||
SetTimer();
|
||||
}
|
||||
else if (value == 2)
|
||||
{
|
||||
if (role == 1)
|
||||
{
|
||||
toast_start.SetBool("end", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
toast_start.Play("duel_toast_late", -1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
void SetTimer()
|
||||
{
|
||||
StartCoroutine(WaitTime());
|
||||
}
|
||||
IEnumerator WaitTime()
|
||||
{
|
||||
int allTime = rodPanel.allTime;
|
||||
while (allTime > 0)
|
||||
{
|
||||
text_title.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_62", allTime);
|
||||
yield return new WaitForSeconds(1);
|
||||
if (FDM.RodState >= 2)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
allTime--;
|
||||
}
|
||||
text_title.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_62", 0);
|
||||
if (FDM.RodState < 2)
|
||||
{
|
||||
//理论上这个时候双方都选好,防止意外强制开始
|
||||
FDM.RodState++;
|
||||
GContext.Publish(new RodStateEvent() { RoleID = 1 });
|
||||
}
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
disposables?.Dispose();
|
||||
disposables = null;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/EventFishingDuelArea.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/EventFishingDuelArea.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e02d3c73ef70b97429e453fc55c107b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
485
Assets/Scripts/Duel/UI/EventFishingDuelPanel.cs
Normal file
485
Assets/Scripts/Duel/UI/EventFishingDuelPanel.cs
Normal file
@@ -0,0 +1,485 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using DG.Tweening;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using System;
|
||||
using UniRx;
|
||||
|
||||
public class EventFishingDuelPanel : BasePanel
|
||||
{
|
||||
Tables tables;
|
||||
Button btn_close;
|
||||
GameObject btn_close_image;
|
||||
Animation anim;
|
||||
|
||||
GameObject MiddlePanel;
|
||||
TMP_Text text_time;
|
||||
Image icon_rank;
|
||||
TMP_Text text_rank;
|
||||
Button btn_questionmark1;
|
||||
Button btn_questionmark;
|
||||
GameObject bg_bar;
|
||||
Image bar;
|
||||
TMP_Text text_progress;
|
||||
Button btn_reward;
|
||||
List<RewardItemNew> rewardItemNews;
|
||||
TMP_Text win_text_num;
|
||||
TMP_Text loss_text_num;
|
||||
TMP_Text middle_text_time;
|
||||
Button icon_ticket;
|
||||
Button btn_confirm;
|
||||
TMP_Text text_num;
|
||||
|
||||
//GameObject effect_beilv_loop;
|
||||
Button btn_beilv;
|
||||
//Image btn_beilv_image;
|
||||
Button btn_beilv_max;
|
||||
//private Image btn_beilv_max_image;
|
||||
|
||||
TMP_Text text_beilv;
|
||||
TMP_Text text_beilv_max;
|
||||
TMP_Text text_beilv_show;
|
||||
|
||||
|
||||
GameObject matchingPanel;
|
||||
DuelMatchPlayer myself;
|
||||
DuelMatchPlayer enemy;
|
||||
GameObject fx_ui_matchingPanel_match_glow_01;
|
||||
TMP_Text match_text_time;
|
||||
Button but_stop;
|
||||
Coroutine matchIng;
|
||||
FishingDuelManager FDM;
|
||||
Sound audio_matchingloop;
|
||||
AudioClip audio_ui_fishingduel_matchingloop;
|
||||
IUIService uiService;
|
||||
Timer timer;
|
||||
FishingEventData fishingEventData;
|
||||
|
||||
Button btn_advert;
|
||||
|
||||
DuelRandomMapPanel randomMapPanel;
|
||||
|
||||
GameObject fishConfrimPanel;
|
||||
|
||||
TicketTips ticket_tips;
|
||||
|
||||
IDisposable disRequestSvrTime;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
uiService = GContext.container.Resolve<IUIService>();
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
btn_close = transform.Find("bottom/btn_close").GetComponent<Button>();
|
||||
btn_close_image = transform.Find("bottom/btn_close/Image").gameObject;
|
||||
GContext.container.Unregister<FishingDuelManager>();
|
||||
FDM = new FishingDuelManager();
|
||||
GContext.container.RegisterInstance(FDM);
|
||||
btn_advert = transform.Find("root/MiddlePanel/bottom/btn_advert").GetComponent<Button>();
|
||||
//====================倍率调整
|
||||
btn_beilv = transform.Find("root/MiddlePanel/bottom/beilv").GetComponent<Button>();
|
||||
btn_beilv_max = transform.Find("root/MiddlePanel/bottom/beilv_max").GetComponent<Button>();
|
||||
|
||||
text_beilv = transform.Find("root/MiddlePanel/bottom/beilv/text_beilv").GetComponent<TMP_Text>();
|
||||
text_beilv_max = transform.Find("root/MiddlePanel/bottom/beilv_max/text_beilv").GetComponent<TMP_Text>();
|
||||
|
||||
|
||||
//====================
|
||||
ticket_tips = transform.Find("root/MiddlePanel/bottom/ticket_tips").GetComponent<TicketTips>();
|
||||
//UI_EventPartnerFishbowlPanel_27
|
||||
anim = transform.Find("root/matchingPanel").GetComponent<Animation>();
|
||||
btn_questionmark1 = transform.Find("root/MiddlePanel/top/title/btn_questionmark").GetComponent<Button>();
|
||||
//===================匹配界面
|
||||
MiddlePanel = transform.Find("root/MiddlePanel").gameObject;
|
||||
text_time = transform.Find("root/MiddlePanel/top/text_time").GetComponent<TMP_Text>();
|
||||
icon_rank = transform.Find("root/MiddlePanel/rank/icon_rank").GetComponent<Image>();
|
||||
text_rank = transform.Find("root/MiddlePanel/rank/text_rank").GetComponent<TMP_Text>();
|
||||
btn_questionmark = transform.Find("root/MiddlePanel/rank/text_rank/btn_questionmark").GetComponent<Button>();
|
||||
bg_bar = transform.Find("root/MiddlePanel/rank/bg_bar").gameObject;
|
||||
bar = transform.Find("root/MiddlePanel/rank/bg_bar/bar").GetComponent<Image>();
|
||||
text_progress = transform.Find("root/MiddlePanel/rank/bg_bar/text_progress").GetComponent<TMP_Text>();
|
||||
btn_reward = transform.Find("root/MiddlePanel/rank/btn_reward").GetComponent<Button>();
|
||||
rewardItemNews = new List<RewardItemNew>();
|
||||
Transform layout_reward = transform.Find("root/MiddlePanel/reward/layout_reward");
|
||||
int layout_reward_count = layout_reward.childCount;
|
||||
for (int i = 0; i < layout_reward_count; i++)
|
||||
{
|
||||
rewardItemNews.Add(layout_reward.GetChild(i).GetComponent<RewardItemNew>());
|
||||
}
|
||||
|
||||
icon_ticket = transform.Find("root/MiddlePanel/bottom/icon_ticket").GetComponent<Button>();
|
||||
|
||||
win_text_num = transform.Find("root/MiddlePanel/reward/info/win/text_num").GetComponent<TMP_Text>();
|
||||
loss_text_num = transform.Find("root/MiddlePanel/reward/info/loss/text_num").GetComponent<TMP_Text>();
|
||||
btn_confirm = transform.Find("root/MiddlePanel/bottom/btn_confirm/btn_green").GetComponent<Button>();
|
||||
middle_text_time = transform.Find("root/MiddlePanel/top/text_time").GetComponent<TMP_Text>();
|
||||
text_num = transform.Find("root/MiddlePanel/bottom/icon_ticket/text_num").GetComponent<TMP_Text>();
|
||||
//================================
|
||||
//=====================匹配中
|
||||
matchingPanel = transform.Find("root/matchingPanel").gameObject;
|
||||
myself = transform.Find("root/matchingPanel/myself").GetComponent<DuelMatchPlayer>();
|
||||
enemy = transform.Find("root/matchingPanel/enermy").GetComponent<DuelMatchPlayer>();
|
||||
match_text_time = transform.Find("root/matchingPanel/text_time").GetComponent<TMP_Text>();
|
||||
but_stop = transform.Find("root/matchingPanel/btn_stop/btn_green").GetComponent<Button>();
|
||||
fx_ui_matchingPanel_match_glow_01 = transform.Find("root/matchingPanel/enermy/fx_ui_matchingPanel_match_glow_01").gameObject;
|
||||
//=================================
|
||||
randomMapPanel = transform.Find("root/matchingPanel/RandomMap").GetComponent<DuelRandomMapPanel>();
|
||||
fishConfrimPanel = transform.Find("root/FishConfirmPanel").gameObject;
|
||||
fishConfrimPanel.SetActive(false);
|
||||
LoadAudio();
|
||||
}
|
||||
async void LoadAudio()
|
||||
{
|
||||
audio_ui_fishingduel_matchingloop = await Addressables.LoadAssetAsync<AudioClip>("audio_ui_fishingduel_matchingloop").Task;
|
||||
}
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
GContext.Publish(new HideHomePanelEvent());
|
||||
//disposable = GContext.OnEvent<RewardPanelClose>().Subscribe(OnRewardPanelClose);
|
||||
ShowPanel(false);
|
||||
btn_close.onClick.AddListener(OnClickClose);
|
||||
|
||||
InitMiddlePanel();
|
||||
|
||||
but_stop.onClick.AddListener(OnClickStop);
|
||||
|
||||
IUserService userService = GContext.container.Resolve<IUserService>();
|
||||
var url = userService.AvatarUrl;
|
||||
|
||||
uiService.SetHeadImage(myself.icon_head, url);
|
||||
myself.text_name.text = userService.DisplayName;
|
||||
myself.icon_rank.sprite = icon_rank.sprite;
|
||||
myself.text_score.text = ConvertTools.GetNumberString2(FDM.duelData.progress);
|
||||
|
||||
btn_beilv.onClick.AddListener(OnclickMagnification);
|
||||
btn_beilv_max.onClick.AddListener(OnclickMagnification);
|
||||
|
||||
SetShowMagnification();
|
||||
btn_reward.onClick.AddListener(() => _ = UIManager.Instance.ShowUI(UITypes.EventFishingDuelRewardPopupPanel));
|
||||
btn_advert.onClick.AddListener(() => _ = UIManager.Instance.ShowUI(UITypes.EventFishingduelShopPopupPanel));
|
||||
Item itemdata = tables.TbItem.GetOrDefault(2051);
|
||||
string nameL = LocalizationMgr.GetText(itemdata.Name_l10n_key);
|
||||
ticket_tips.SetText(LocalizationMgr.GetFormatTextValue("UI_EventPartnerFishbowlPanel_27", nameL));
|
||||
}
|
||||
|
||||
void OnclickMagnification()
|
||||
{
|
||||
FDM.SetMagnification();
|
||||
SetShowMagnification();
|
||||
}
|
||||
void SetShowMagnification()
|
||||
{
|
||||
bool IsMax = FDM.IsMaxMagnification();
|
||||
btn_beilv.gameObject.SetActive(!IsMax);
|
||||
btn_beilv_max.gameObject.SetActive(IsMax);
|
||||
text_beilv.text = text_beilv_max.text = $"x{FDM.magnification}";
|
||||
SetReward();
|
||||
}
|
||||
//void OnRewardPanelClose(RewardPanelClose rewardPanelClose)
|
||||
//{
|
||||
// SetEnergy();
|
||||
//}
|
||||
void SetEnergy()
|
||||
{
|
||||
//获取配置表
|
||||
|
||||
int MatchCost = FDM.magnification;
|
||||
int Energy = FDM.duelData.tickets;
|
||||
if (MatchCost > Energy)
|
||||
{
|
||||
//ConvertTools.GetNumberString
|
||||
text_num.text = $"<color=red>{Energy}/{MatchCost}</color>";
|
||||
}
|
||||
else
|
||||
{
|
||||
text_num.text = $"{Energy}/{MatchCost}";
|
||||
}
|
||||
}
|
||||
void SetReward()
|
||||
{
|
||||
var rewardItemData = FDM.GetReward();
|
||||
if (rewardItemData != null)
|
||||
{
|
||||
int dataCount = rewardItemData.Count;
|
||||
int rewardCount = rewardItemNews.Count;
|
||||
for (int i = 0; i < rewardCount; i++)
|
||||
{
|
||||
if (i < dataCount)
|
||||
{
|
||||
rewardItemData[i].count *= FDM.magnification;
|
||||
rewardItemNews[i].SetData(rewardItemData[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItemNews[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
win_text_num.text = $"+{FDM.eventSolomain.WinTrophy * FDM.magnification}";
|
||||
loss_text_num.text = $"-{FDM.eventSolomain.LoseTrophy * FDM.magnification}";
|
||||
SetEnergy();
|
||||
}
|
||||
void InitMiddlePanel()
|
||||
{
|
||||
DoConsumeBait();
|
||||
icon_ticket.onClick.AddListener(OnClickIcon);
|
||||
btn_confirm.onClick.AddListener(OnClickMaching);
|
||||
btn_questionmark.onClick.AddListener(() => _ = UIManager.Instance.ShowUI(UITypes.EventFishingDuelRankPopupPanel));
|
||||
btn_questionmark1.onClick.AddListener(() => _ = UIManager.Instance.ShowUI(UITypes.EventFishingDuelInfoPopupPanel));
|
||||
uiService.SetImageSprite(icon_rank, FDM.eventSolomain.RankIcon);
|
||||
text_rank.text = LocalizationMgr.GetText(FDM.eventSolomain.RankText_l10n_key);
|
||||
text_progress.text = $"{FDM.duelData.progress}";
|
||||
win_text_num.text = $"+{FDM.eventSolomain.WinTrophy * FDM.magnification}";
|
||||
loss_text_num.text = $"-{FDM.eventSolomain.LoseTrophy * FDM.magnification}";
|
||||
}
|
||||
private void DoConsumeBait()
|
||||
{
|
||||
Debug.Log("NetworkReachability");
|
||||
if (Application.internetReachability == NetworkReachability.NotReachable)
|
||||
{
|
||||
Debug.Log("NetworkReachability.NotReachable");
|
||||
NoInternet();
|
||||
}
|
||||
}
|
||||
|
||||
private async void NoInternet()
|
||||
{
|
||||
GameObject go = await UIManager.Instance.ShowUI(UITypes.NoticeConfirmPopupPanel);
|
||||
var NoticeConfirmPopupPanel = go.GetComponent<NoticeConfirmPopupPanel>();
|
||||
string info = LocalizationMgr.GetText("UI_FishingReconnectPanel_101003");
|
||||
string label = LocalizationMgr.GetText("UI_FishingRewardPanel_101022");
|
||||
string title = LocalizationMgr.GetText("UI_FishingReconnectPanel_101002");
|
||||
NoticeConfirmPopupPanel.Init(1, title, info,
|
||||
onClickLeft: DoConsumeBait,
|
||||
onClose: DoConsumeBait,
|
||||
btn_left_text: label);
|
||||
}
|
||||
void OnClickMaching()
|
||||
{
|
||||
if (FDM.duelData.tickets < FDM.magnification)
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_86"));
|
||||
//var pos = btn_confirm.transform.position;
|
||||
//pos.y += 50;
|
||||
//ticket_tips.SetPos(pos);
|
||||
//ticket_tips.gameObject.SetActive(!ticket_tips.gameObject.activeSelf);
|
||||
//门票不足
|
||||
FDM.SetMaxMagnification();
|
||||
SetShowMagnification();
|
||||
return;
|
||||
}
|
||||
disRequestSvrTime?.Dispose();
|
||||
disRequestSvrTime = GContext.OnEvent<RequestSvrTimeEvent>().Subscribe(RequestSvrTimeEvent);
|
||||
ShowPanel(true);
|
||||
matchIng = StartCoroutine(StartMaching());
|
||||
}
|
||||
void RequestSvrTimeEvent(RequestSvrTimeEvent requestSvrTimeEvent)
|
||||
{
|
||||
if (!requestSvrTimeEvent.Status)
|
||||
{
|
||||
OnClickStop();
|
||||
}
|
||||
}
|
||||
void OnClickIcon()
|
||||
{
|
||||
var pos = icon_ticket.transform.position;
|
||||
pos.y += 40;
|
||||
ticket_tips.SetPos(pos);
|
||||
ticket_tips.gameObject.SetActive(!ticket_tips.gameObject.activeSelf);
|
||||
|
||||
}
|
||||
void OnClickStop()
|
||||
{
|
||||
FDM.CancelMaching();
|
||||
disRequestSvrTime?.Dispose();
|
||||
disRequestSvrTime = null;
|
||||
if (matchIng != null)
|
||||
{
|
||||
StopCoroutine(matchIng);
|
||||
matchIng = null;
|
||||
}
|
||||
randomMapPanel.Stop();
|
||||
ShowPanel(false);
|
||||
}
|
||||
void ShowPanel(bool isMatch)
|
||||
{
|
||||
if (isMatch)
|
||||
{
|
||||
StopTimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTimer();
|
||||
}
|
||||
btn_close.enabled = !isMatch;
|
||||
btn_close_image.SetActive(!isMatch);
|
||||
MiddlePanel.SetActive(!isMatch);
|
||||
matchingPanel.SetActive(isMatch);
|
||||
StopLoopAudio();
|
||||
}
|
||||
void PlayLoopAudio()
|
||||
{
|
||||
StopLoopAudio();
|
||||
audio_matchingloop = GContext.container.Resolve<ISoundService>().GetNewUISound(audio_ui_fishingduel_matchingloop);
|
||||
audio_matchingloop.audioSource.Play();
|
||||
audio_matchingloop.audioSource.loop = true;
|
||||
}
|
||||
void StopLoopAudio()
|
||||
{
|
||||
if (audio_matchingloop)
|
||||
{
|
||||
audio_matchingloop.audioSource.Stop();
|
||||
audio_matchingloop.ReturnPool();
|
||||
audio_matchingloop = null;
|
||||
}
|
||||
}
|
||||
IEnumerator StartMaching()
|
||||
{
|
||||
//anim.Play("eventfishingduelpanel_maprandom");
|
||||
Dictionary<int, Robot> robots = tables.TbRobot.DataMap;
|
||||
List<int> RobotAccountList = FDM.eventSolomain.RobotAccountList;
|
||||
int robotId = RobotAccountList[UnityEngine.Random.Range(0, RobotAccountList.Count)];
|
||||
EventSoloRobot eventSoloRobot = tables.TbEventSoloRobot.GetOrDefault(robotId);
|
||||
List<int> robotList = eventSoloRobot.RobotList;
|
||||
robotId = robotList[UnityEngine.Random.Range(0, robotList.Count)];
|
||||
Robot robot = robots[robotId];
|
||||
SetRobot(robot, eventSoloRobot.Trophy);
|
||||
//等待匹配
|
||||
randomMapPanel.StartMap();
|
||||
PlayLoopAudio();
|
||||
yield return new WaitForSeconds(1);
|
||||
FDM.StartMaching();
|
||||
//anim.Play("eventfishingduelpanel_loop");
|
||||
float time = 0.1f;
|
||||
while (FDM.MachingState < 2)
|
||||
{
|
||||
robotId = RobotAccountList[UnityEngine.Random.Range(0, RobotAccountList.Count)];
|
||||
eventSoloRobot = tables.TbEventSoloRobot.GetOrDefault(robotId);
|
||||
|
||||
robotList = eventSoloRobot.RobotList;
|
||||
robotId = robotList[UnityEngine.Random.Range(0, robotList.Count)];
|
||||
|
||||
robot = robots[robotId];
|
||||
SetRobot(robot, eventSoloRobot.Trophy);
|
||||
yield return new WaitForSeconds(time);
|
||||
}
|
||||
but_stop.gameObject.SetActive(false);
|
||||
disRequestSvrTime?.Dispose();
|
||||
disRequestSvrTime = null;
|
||||
var matchDelayTime = FDM.eventSoloConfig.MatchDelayTime;
|
||||
float machTimeM = UnityEngine.Random.Range(matchDelayTime[0], matchDelayTime[1]);
|
||||
//最后两秒等的越来越长
|
||||
while (machTimeM > 0f)
|
||||
{
|
||||
robotId = RobotAccountList[UnityEngine.Random.Range(0, RobotAccountList.Count)];
|
||||
eventSoloRobot = tables.TbEventSoloRobot.GetOrDefault(robotId);
|
||||
|
||||
robotList = eventSoloRobot.RobotList;
|
||||
robotId = robotList[UnityEngine.Random.Range(0, robotList.Count)];
|
||||
|
||||
robot = robots[robotId];
|
||||
SetRobot(robot, eventSoloRobot.Trophy);
|
||||
machTimeM -= time;
|
||||
yield return new WaitForSeconds(time);
|
||||
}
|
||||
randomMapPanel.SetClose();
|
||||
while (!randomMapPanel.IsStop)
|
||||
{
|
||||
robotId = RobotAccountList[UnityEngine.Random.Range(0, RobotAccountList.Count)];
|
||||
eventSoloRobot = tables.TbEventSoloRobot.GetOrDefault(robotId);
|
||||
|
||||
robotList = eventSoloRobot.RobotList;
|
||||
robotId = robotList[UnityEngine.Random.Range(0, robotList.Count)];
|
||||
|
||||
robot = robots[robotId];
|
||||
SetRobot(robot, eventSoloRobot.Trophy);
|
||||
yield return new WaitForSeconds(time);
|
||||
}
|
||||
fx_ui_matchingPanel_match_glow_01.SetActive(true);
|
||||
|
||||
uiService.SetHeadImage(enemy.icon_head, FDM.EnemyModel.PlayerAvatar);
|
||||
enemy.text_name.text = FDM.EnemyModel.PlayerName;
|
||||
var eventSolomain = FDM.GetEventSolomain(FDM.EnemyModel.RankScore);
|
||||
uiService.SetImageSprite(enemy.icon_rank, eventSolomain.RankIcon);
|
||||
enemy.text_score.text = ConvertTools.GetNumberString2(FDM.EnemyModel.RankScore);
|
||||
StopLoopAudio();
|
||||
yield return new WaitForSeconds(2);
|
||||
anim.Play("eventfishingduelpanel_matchingpanel_end");
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
//PlayLoopAudio();
|
||||
//yield return new WaitForSeconds(2);
|
||||
//StopLoopAudio();
|
||||
ShowFishConfrimPanel();
|
||||
}
|
||||
void SetRobot(Robot robot, int trophy)
|
||||
{
|
||||
int robotTier = FDM.eventSolomain.MatchTierList[UnityEngine.Random.Range(0, FDM.eventSolomain.MatchTierList.Count)];
|
||||
var eventSolomain = tables.TbEventSolomain.DataMap[robotTier];
|
||||
uiService.SetHeadImage(enemy.icon_head, robot.Avatar);
|
||||
enemy.text_name.text = LocalizationMgr.GetText(robot.Name_l10n_key);
|
||||
uiService.SetImageSprite(enemy.icon_rank, eventSolomain.RankIcon);
|
||||
enemy.text_score.text = ConvertTools.GetNumberString2(trophy);
|
||||
}
|
||||
public void OnClickClose()
|
||||
{
|
||||
GContext.container.Unregister<FishingDuelManager>();
|
||||
GContext.Publish(new RestartShowHomeUIEvent());
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelPanel);
|
||||
disRequestSvrTime?.Dispose();
|
||||
disRequestSvrTime = null;
|
||||
}
|
||||
|
||||
void SetTimer()
|
||||
{
|
||||
StopTimer();
|
||||
DateTime endDateTime = fishingEventData.GetEventEndTime(fishingEventData.duelData.eventID)
|
||||
.AddSeconds(-tables.TbEventSoloConfig.SettlementTime);
|
||||
TimeSpan now = endDateTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
text_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_end",
|
||||
ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds));
|
||||
double seconds = now.TotalSeconds;
|
||||
if (seconds < 1)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
timer = this.AttachTimer((float)seconds, Refresh,
|
||||
(elapsed) =>
|
||||
{
|
||||
now = endDateTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
text_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_end",
|
||||
ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds));
|
||||
}, useRealTime: true);
|
||||
}
|
||||
}
|
||||
void StopTimer()
|
||||
{
|
||||
timer?.Cancel();
|
||||
timer = null;
|
||||
}
|
||||
void Refresh()
|
||||
{
|
||||
timer?.Cancel();
|
||||
timer = null;
|
||||
OnClickClose();
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelRankPopupPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelRewardPopupPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingduelShopPopupPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelInfoPopupPanel);
|
||||
}
|
||||
|
||||
public void ShowFishConfrimPanel()
|
||||
{
|
||||
matchingPanel.gameObject.SetActive(false);
|
||||
fishConfrimPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/EventFishingDuelPanel.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/EventFishingDuelPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 923a6137d74c1664bb4ef7b99f242be0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventFishingDuelRankChangePopupPanel : BasePanel
|
||||
{
|
||||
Button closeButton;
|
||||
Button mask;
|
||||
GameObject rankUpPanel;
|
||||
GameObject rankDownPanel;
|
||||
Image icon_rank;
|
||||
TMP_Text text_rank;
|
||||
private void Awake()
|
||||
{
|
||||
mask = transform.Find("mask").GetComponent<Button>();
|
||||
closeButton = transform.Find("btn_close").GetComponent<Button>();
|
||||
rankUpPanel = transform.Find("root_promote").gameObject;
|
||||
rankDownPanel = transform.Find("root_demote").gameObject;
|
||||
closeButton.onClick.AddListener(ClosePanel);
|
||||
mask.onClick.AddListener(ClosePanel);
|
||||
}
|
||||
|
||||
public void SetRank(bool isUp, EventSolomain eventSolomain)
|
||||
{
|
||||
if (isUp)
|
||||
{
|
||||
rankUpPanel.SetActive(true);
|
||||
rankDownPanel.SetActive(false);
|
||||
icon_rank = rankUpPanel.transform.Find("icon_rank").GetComponent<Image>();
|
||||
text_rank = rankUpPanel.transform.Find("text_rank").GetComponent<TMP_Text>();
|
||||
}
|
||||
else
|
||||
{
|
||||
rankUpPanel.SetActive(false);
|
||||
rankDownPanel.SetActive(true);
|
||||
icon_rank = rankDownPanel.transform.Find("icon_rank").GetComponent<Image>();
|
||||
text_rank = rankDownPanel.transform.Find("text_rank").GetComponent<TMP_Text>();
|
||||
}
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(icon_rank, eventSolomain.RankIcon);
|
||||
text_rank.text = LocalizationMgr.GetText(eventSolomain.RankText_l10n_key);
|
||||
}
|
||||
void ClosePanel()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelRankChangePopupPanel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b18b42da9e597c94c9c8b4c8b8416edb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
86
Assets/Scripts/Duel/UI/EventFishingDuelRankPopupPanel.cs
Normal file
86
Assets/Scripts/Duel/UI/EventFishingDuelRankPopupPanel.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventFishingDuelRankPopupPanel : MonoBehaviour
|
||||
{
|
||||
List<Button> buttons;
|
||||
List<Image> icon_ranks;
|
||||
List<TMP_Text> txt_ranks;
|
||||
List<TMP_Text> text_points;
|
||||
List<GameObject> selecteds;
|
||||
List<RewardItemNew> rewardItemNews;
|
||||
List<EventSolomain> data;
|
||||
Button btn_close;
|
||||
FishingDuelManager fishingDuelManager;
|
||||
private void Awake()
|
||||
{
|
||||
fishingDuelManager = GContext.container.Resolve<FishingDuelManager>();
|
||||
buttons = new List<Button>();
|
||||
icon_ranks = new List<Image>();
|
||||
txt_ranks = new List<TMP_Text>();
|
||||
text_points = new List<TMP_Text>();
|
||||
selecteds = new List<GameObject>();
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
buttons.Add(transform.Find($"root/rank{i}/btn_green").GetComponent<Button>());
|
||||
icon_ranks.Add(transform.Find($"root/rank{i}/btn_green/icon_rank").GetComponent<Image>());
|
||||
txt_ranks.Add(transform.Find($"root/rank{i}/btn_green/text_rank").GetComponent<TMP_Text>());
|
||||
text_points.Add(transform.Find($"root/rank{i}/btn_green/text_point").GetComponent<TMP_Text>());
|
||||
selecteds.Add(transform.Find($"root/rank{i}/btn_green/selected").gameObject);
|
||||
}
|
||||
|
||||
rewardItemNews = new List<RewardItemNew>();
|
||||
Transform layout_reward = transform.Find("root/layout_reward");
|
||||
for (int i = 0; i < layout_reward.childCount; i++)
|
||||
{
|
||||
rewardItemNews.Add(layout_reward.GetChild(i).GetComponent<RewardItemNew>());
|
||||
}
|
||||
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
data = GContext.container.Resolve<Tables>().TbEventSolomain.DataList;
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
for (int i = 0; i < buttons.Count; i++)
|
||||
{
|
||||
int index = i;
|
||||
txt_ranks[i].text = LocalizationMgr.GetText(data[i].RankText_l10n_key);
|
||||
text_points[i].text = data[i].TrophyRange[0].ToString();
|
||||
uiService.SetImageSprite(icon_ranks[i], data[i].RankIcon);
|
||||
buttons[i].onClick.AddListener(() => SetRewardPanel(index));
|
||||
if (data[i].RankTier == fishingDuelManager.eventSolomain.RankTier)
|
||||
{
|
||||
SetRewardPanel(index);
|
||||
}
|
||||
}
|
||||
btn_close.onClick.AddListener(() => UIManager.Instance.DestroyUI(UITypes.EventFishingDuelRankPopupPanel));
|
||||
|
||||
}
|
||||
|
||||
void SetRewardPanel(int index)
|
||||
{
|
||||
var rank = data[index];
|
||||
List<ItemData> itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(rank.WinReward);
|
||||
for (int i = 0; i < rewardItemNews.Count; i++)
|
||||
{
|
||||
if (i < itemDatas.Count)
|
||||
{
|
||||
rewardItemNews[i].SetData(itemDatas[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItemNews[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < selecteds.Count; i++)
|
||||
{
|
||||
selecteds[i].SetActive(i == index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81744cc08ed4c3b469901d074cb8fc1f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
193
Assets/Scripts/Duel/UI/EventFishingDuelReportRewardPanel.cs
Normal file
193
Assets/Scripts/Duel/UI/EventFishingDuelReportRewardPanel.cs
Normal file
@@ -0,0 +1,193 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using DG.Tweening;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventFishingDuelReportRewardPanel : MonoBehaviour
|
||||
{
|
||||
protected FishingDuelManager FDM;
|
||||
public FishStatisticsPlayerInfo playerInfo;
|
||||
public GameObject fishInfoPrefab;
|
||||
public Transform fishInfoParent;
|
||||
protected List<DuelFishInfo> duelFishInfos = new List<DuelFishInfo>();
|
||||
Tables tables;
|
||||
IUIService uiService;
|
||||
public GameObject text_winner;
|
||||
public GameObject text_loser;
|
||||
public Animation myself;
|
||||
public Animation enemy;
|
||||
|
||||
public TMP_Text text_info;
|
||||
public GameObject tap_to_skip;
|
||||
public Button btn_confrim;
|
||||
/*
|
||||
* 第一个对局栏目组件延迟播放时间:CardInfoShowDelay = 0.25s
|
||||
后续对局栏目组件的出现间隔时间:CardInfoShowInterval = 0.2s
|
||||
*/
|
||||
public float CardInfoShowDelay = 0.25f;
|
||||
public float CardInfoShowInterval = 0.2f;
|
||||
private void Awake()
|
||||
{
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
uiService = GContext.container.Resolve<IUIService>();
|
||||
FDM = GContext.container.Resolve<FishingDuelManager>();
|
||||
fishInfoPrefab.SetActive(false);
|
||||
SetFish();
|
||||
playerInfo.SetData(FDM);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
bool isWin = FDM.SelfModel.CurrentPTS > FDM.EnemyModel.CurrentPTS;
|
||||
tap_to_skip.SetActive(false);
|
||||
text_winner.SetActive(isWin);
|
||||
text_loser.SetActive(!isWin);
|
||||
PlayShow();
|
||||
}
|
||||
|
||||
void SetFish()
|
||||
{
|
||||
List<int> fishItemIDs = FDM.FishItemIDs;
|
||||
if (fishItemIDs == null || fishItemIDs.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Item item = null;
|
||||
for (int i = 0; i < fishItemIDs.Count; i++)
|
||||
{
|
||||
GameObject gameObject = Instantiate(fishInfoPrefab, fishInfoParent);
|
||||
DuelFishInfo duelFishInfo = gameObject.GetComponent<DuelFishInfo>();
|
||||
item = tables.TbItem[fishItemIDs[i]];
|
||||
PlayerFishData.SetFishIcon(duelFishInfo.icon_fish,item);//鱼头像
|
||||
uiService.SetImageSprite(duelFishInfo.icon_fish_tag, $"icon_fish_rate_tag_{item.Quality}");
|
||||
duelFishInfos.Add(duelFishInfo);
|
||||
duelFishInfo.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayShow()
|
||||
{
|
||||
var fishInfos = FDM.SelfModel.GetShowDatas();
|
||||
int myDataCount = fishInfos.Count;
|
||||
|
||||
var enemyInfos = FDM.EnemyModel.GetShowDatas();
|
||||
int enemyDataCount = enemyInfos.Count;
|
||||
DuelFishingData myData;
|
||||
DuelFishingData enemyData;
|
||||
for (int i = 0; i < duelFishInfos.Count; i++)
|
||||
{
|
||||
enemyData = null;
|
||||
myData = null;
|
||||
if (i < myDataCount && fishInfos[i].isWin)
|
||||
{
|
||||
myData = fishInfos[i];
|
||||
}
|
||||
|
||||
if (i < enemyDataCount && enemyInfos[i].isWin)
|
||||
{
|
||||
enemyData = enemyInfos[i];
|
||||
}
|
||||
|
||||
if (myData != null)
|
||||
{
|
||||
bool isHigh = enemyData == null || myData.point >= enemyData.point;
|
||||
duelFishInfos[i].text_num_score.SetValue(myData.point.ToString(), isHigh);
|
||||
float addMy = (1 + myData.fishCardAdd) * (1 + myData.fishRodAdd) - 1;
|
||||
duelFishInfos[i].text_num_score.SetAddValue(addMy, isHigh);
|
||||
}
|
||||
else
|
||||
{
|
||||
duelFishInfos[i].text_num_score.SetValue("0", false);
|
||||
duelFishInfos[i].text_num_score.SetAddValue(-1, false);
|
||||
}
|
||||
|
||||
if (enemyData != null)
|
||||
{
|
||||
bool isHigh = myData == null || enemyData.point >= myData.point;
|
||||
duelFishInfos[i].text_num_enermy_score.SetValue(enemyData.point.ToString(), isHigh);
|
||||
float addEnemy = (1 + enemyData.fishCardAdd) * (1 + enemyData.fishRodAdd) - 1;
|
||||
duelFishInfos[i].text_num_enermy_score.SetAddValue(addEnemy, isHigh);
|
||||
}
|
||||
else
|
||||
{
|
||||
duelFishInfos[i].text_num_enermy_score.SetValue("0", false);
|
||||
duelFishInfos[i].text_num_enermy_score.SetAddValue(-1, false);
|
||||
}
|
||||
duelFishInfos[i].root.SetActive(false);
|
||||
duelFishInfos[i].gameObject.SetActive(true);
|
||||
}
|
||||
StartCoroutine(ShowFish());
|
||||
}
|
||||
IEnumerator ShowFish()
|
||||
{
|
||||
playerInfo.SetNumShow(FDM.SelfModel.CurrentPTS >= FDM.EnemyModel.CurrentPTS);
|
||||
var fishInfos = FDM.SelfModel.GetShowDatas();
|
||||
int myDataCount = fishInfos.Count;
|
||||
var enemyInfos = FDM.EnemyModel.GetShowDatas();
|
||||
int enemyDataCount = enemyInfos.Count;
|
||||
DuelFishingData myData;
|
||||
DuelFishingData enemyData;
|
||||
yield return new WaitForSeconds(CardInfoShowDelay);
|
||||
int selfCurrentPTS = 0;
|
||||
int enemyCurrentPTS = 0;
|
||||
for (int i = 0; i < duelFishInfos.Count; i++)
|
||||
{
|
||||
enemyData = null;
|
||||
myData = null;
|
||||
if (i < myDataCount && fishInfos[i].isWin)
|
||||
{
|
||||
myData = fishInfos[i];
|
||||
}
|
||||
|
||||
if (i < enemyDataCount && enemyInfos[i].isWin)
|
||||
{
|
||||
enemyData = enemyInfos[i];
|
||||
}
|
||||
|
||||
if (myData != null)
|
||||
{
|
||||
selfCurrentPTS += myData.point;
|
||||
myself.Play();
|
||||
}
|
||||
|
||||
if (enemyData != null)
|
||||
{
|
||||
enemyCurrentPTS += enemyData.point;
|
||||
enemy.Play();
|
||||
}
|
||||
playerInfo.SetNum(selfCurrentPTS, enemyCurrentPTS, CardInfoShowInterval);
|
||||
|
||||
duelFishInfos[i].root.SetActive(true);
|
||||
yield return new WaitForSeconds(CardInfoShowInterval);
|
||||
}
|
||||
|
||||
tap_to_skip.SetActive(true);
|
||||
StartCoroutine(Close());
|
||||
btn_confrim.onClick.AddListener(Join);
|
||||
}
|
||||
IEnumerator Close()
|
||||
{
|
||||
int allTime = 5;
|
||||
while (allTime > 0)
|
||||
{
|
||||
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_61", allTime);
|
||||
yield return new WaitForSeconds(1);
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingDuelRewardPanel);
|
||||
allTime--;
|
||||
}
|
||||
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_61", 0);
|
||||
Join();
|
||||
}
|
||||
|
||||
async void Join()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
await UIManager.Instance.ShowUI(UITypes.EventFishingDuelRewardPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelReportRewardPanel);
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingDuelRewardPanel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32bd004058c0911478afc39bcc4524d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
381
Assets/Scripts/Duel/UI/EventFishingDuelRewardPanel.cs
Normal file
381
Assets/Scripts/Duel/UI/EventFishingDuelRewardPanel.cs
Normal file
@@ -0,0 +1,381 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UniRx;
|
||||
using System.Linq;
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
|
||||
public class EventFishingDuelRewardPanel : BasePanel
|
||||
{
|
||||
Tables tables;
|
||||
FishingDuelManager FDM;
|
||||
Image img_map;
|
||||
TMP_Text text_map;
|
||||
Button btn_claim;
|
||||
Button btn_confirm;
|
||||
GameObject winner_tag_my;
|
||||
GameObject winner_tag;
|
||||
Transform root;
|
||||
|
||||
DuelMatchPlayer myself;
|
||||
DuelMatchPlayer enemy;
|
||||
|
||||
TMP_Text text_change_my;
|
||||
TMP_Text text_change;
|
||||
|
||||
Button btn_chat;
|
||||
GameObject chat;
|
||||
GameObject title_reward;
|
||||
Transform layout_reward;
|
||||
List<RewardItemNew> rewardItemNews;
|
||||
|
||||
bool isWin;
|
||||
IUIService uiService;
|
||||
int trophy_before;
|
||||
|
||||
DuelChatView selfView;
|
||||
DuelChatView enemyView;
|
||||
|
||||
/*
|
||||
* RewardFly起始时间 RewardFlyStartTime = 2s
|
||||
数字滚动起始时间 NumberStartTime= 2.1s
|
||||
RewardFly和数字滚动的持续时间 RewardPlayDuration= 0.7s
|
||||
*/
|
||||
public float NumberStartTime = 2.1f;
|
||||
public float RewardPlayDuration = 0.7f;
|
||||
private void Awake()
|
||||
{
|
||||
FDM = GContext.container.Resolve<FishingDuelManager>();
|
||||
FDM.duelData.progress = FDM.curProgress;
|
||||
trophy_before = FDM.duelData.progress;
|
||||
uiService = GContext.container.Resolve<IUIService>();
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
isWin = FDM.SetProgress();
|
||||
root = transform.Find("root");
|
||||
img_map = root.Find("map/Item/img_map").GetComponent<Image>();
|
||||
text_map = root.Find("map/text_map").GetComponent<TMP_Text>();
|
||||
selfView = root.Find("bubble_chat_myself").GetComponent<DuelChatView>();
|
||||
enemyView = root.Find("bubble_chat_enermy").GetComponent<DuelChatView>();
|
||||
btn_claim = root.Find("btn_claim/btn_green").GetComponent<Button>();
|
||||
btn_confirm = root.Find("btn_confirm/btn_green").GetComponent<Button>();
|
||||
myself = root.Find("myself").GetComponent<DuelMatchPlayer>();
|
||||
enemy = root.Find("enermy").GetComponent<DuelMatchPlayer>();
|
||||
winner_tag_my = root.Find("myself/winner_tag").gameObject;
|
||||
winner_tag = root.Find("enermy/winner_tag").gameObject;
|
||||
text_change_my = root.Find("myself/point_change/text_num").GetComponent<TMP_Text>();
|
||||
text_change = root.Find("enermy/point_change/text_num").GetComponent<TMP_Text>();
|
||||
title_reward = root.Find("title_reward").gameObject;
|
||||
layout_reward = root.Find("layout_reward");
|
||||
rewardItemNews = new List<RewardItemNew>();
|
||||
int layout_reward_count = layout_reward.childCount;
|
||||
for (int i = 0; i < layout_reward_count; i++)
|
||||
{
|
||||
rewardItemNews.Add(layout_reward.GetChild(i).GetComponent<RewardItemNew>());
|
||||
}
|
||||
|
||||
btn_chat = root.Find("btn_chat").GetComponent<Button>();
|
||||
chat = transform.Find("event_fishingduel_chat").gameObject;
|
||||
|
||||
selfView.SetDuelFishingEvent(0);
|
||||
enemyView.SetDuelFishingEvent(1);
|
||||
FDM.SelfChatModel.RoleID = 0;
|
||||
FDM.EnemyChatModel.RoleID = 1;
|
||||
}
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
GContext.OnEvent<RewardPanelClose>().Subscribe(OnRewardPanelClose).AddTo(this);
|
||||
GContext.Publish(new ConditionTypeEvent(ConditionType.Complete1v1Count, 1));
|
||||
btn_chat.onClick.AddListener(() =>
|
||||
{
|
||||
chat.SetActive(!chat.activeSelf);
|
||||
});
|
||||
winner_tag_my.SetActive(isWin);
|
||||
winner_tag.SetActive(!isWin);
|
||||
title_reward.SetActive(isWin);
|
||||
layout_reward.gameObject.SetActive(isWin);
|
||||
btn_claim.gameObject.SetActive(isWin);
|
||||
btn_confirm.gameObject.SetActive(!isWin);
|
||||
btn_claim.onClick.AddListener(Claim);
|
||||
btn_confirm.onClick.AddListener(Claim);
|
||||
Init();
|
||||
FDM.EnemyChatModel.SendMessage(isWin ? (int)RobotDuelChatType.EndDefeat : (int)RobotDuelChatType.EndVictory);
|
||||
MapData mapData = tables.TbMapData.GetOrDefault(FDM.duelData.mapId);
|
||||
if (mapData != null)
|
||||
{
|
||||
uiService.SetImageSprite(img_map, mapData.Bg);
|
||||
text_map.text = LocalizationMgr.GetText(mapData.Name_l10n_key);
|
||||
}
|
||||
}
|
||||
void PlayNumWin()
|
||||
{
|
||||
myself.fx_ui_matchingPanel_rank.SetActive(true);
|
||||
int add = FDM.eventSolomain.WinTrophy * FDM.magnification;
|
||||
int add1 = FDM.enemySolomain.LoseTrophy * FDM.EnemyModel.Mag;
|
||||
text_change_my.text = $"+{add}";
|
||||
text_change.text = $"-{add1}";
|
||||
StartCoroutine(Play(add, add1, true));
|
||||
}
|
||||
void PlayNumLose()
|
||||
{
|
||||
int add = FDM.eventSolomain.LoseTrophy * FDM.magnification;
|
||||
int add1 = FDM.enemySolomain.WinTrophy * FDM.EnemyModel.Mag;
|
||||
text_change_my.text = $"-{add}";
|
||||
text_change.text = $"+{add1}";
|
||||
|
||||
StartCoroutine(Play(add, add1, false));
|
||||
}
|
||||
IEnumerator Play(int add, int add1, bool isWin)
|
||||
{
|
||||
int trophy_before = this.trophy_before;
|
||||
int enemy_before = FDM.EnemyModel.RankScore;
|
||||
yield return new WaitForSeconds(NumberStartTime);
|
||||
float pre = 0;
|
||||
if (isWin)
|
||||
{
|
||||
DOTween.To(() => pre, x => pre = x, 1, RewardPlayDuration).OnUpdate(
|
||||
() =>
|
||||
{
|
||||
text_change_my.text = $"+{(int)(add * (1 - pre))}";
|
||||
text_change.text = $"-{(int)(add1 * (1 - pre))}";
|
||||
myself.text_score.text = ConvertTools.GetNumberString2(trophy_before + (int)(add * pre));
|
||||
enemy.text_score.text = ConvertTools.GetNumberString2(enemy_before - (int)(add1 * pre));
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
DOTween.To(() => pre, x => pre = x, 1, RewardPlayDuration).OnUpdate(
|
||||
() =>
|
||||
{
|
||||
text_change_my.text = $"-{(int)(add * (1 - pre))}";
|
||||
text_change.text = $"+{(int)(add1 * (1 - pre))}";
|
||||
myself.text_score.text = ConvertTools.GetNumberString2(trophy_before - (int)(add * pre));
|
||||
enemy.text_score.text = ConvertTools.GetNumberString2(enemy_before + (int)(add1 * pre));
|
||||
});
|
||||
}
|
||||
}
|
||||
void Init()
|
||||
{
|
||||
//双方基础信息
|
||||
IUserService userService = GContext.container.Resolve<IUserService>();
|
||||
|
||||
var url = userService.AvatarUrl;
|
||||
|
||||
uiService.SetHeadImage(myself.icon_head, url);
|
||||
myself.text_name.text = userService.DisplayName;
|
||||
//uiService.SetImageSprite(myself.icon_rank, FDM.eventSolomain.RankIcon);
|
||||
uiService.SetHeadImage(enemy.icon_head, FDM.EnemyModel.PlayerAvatar);
|
||||
enemy.text_name.text = FDM.EnemyModel.PlayerName;
|
||||
//uiService.SetImageSprite(enemy.icon_rank, FDM.robotSolomain.RankIcon);
|
||||
myself.text_score.text = ConvertTools.GetNumberString2(trophy_before);
|
||||
enemy.text_score.text = ConvertTools.GetNumberString2(FDM.EnemyModel.RankScore);
|
||||
PlayerFishData playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
PlayerData playerData = GContext.container.Resolve<PlayerData>();
|
||||
//胜负显示
|
||||
int trophy_change = FDM.eventSolomain.WinTrophy * FDM.magnification;
|
||||
|
||||
if (isWin)
|
||||
{
|
||||
PlayNumWin();
|
||||
GetReward();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayNumLose();
|
||||
trophy_change = -FDM.eventSolomain.LoseTrophy * FDM.magnification;
|
||||
}
|
||||
|
||||
#if AGG
|
||||
using (var e = GEvent.GameEvent("single_battle"))
|
||||
{
|
||||
int currentRodLevel = playerFishData.GetRodLevel(playerData.equipRodID);
|
||||
int fishCardLevel = playerFishData.GetFishLevelByMap(FDM.MapId);
|
||||
int myStar = GContext.container.Resolve<PlayerFishData>().GetRodPiece(playerData.equipRodID);
|
||||
Dictionary<RodPerkType, string> RodPerkDic = playerFishData.GetRodPerk(playerData.equipRodID, myStar);
|
||||
float rod_points_bonus = FDM.GetCurRodBuff(RodPerkDic, 5);
|
||||
e.AddContent("map_id", FDM.duelData.mapId)
|
||||
.AddContent("tire", FDM.eventSolomain.RankTier)
|
||||
.AddContent("charge_count", GContext.container.Resolve<PlayerShopData>().GetBuyPaymentAmount())
|
||||
.AddContent("multiple", FDM.magnification)
|
||||
.AddContent("result", isWin)
|
||||
.AddContent("rod_id", playerData.equipRodID)
|
||||
.AddContent("rod_level", currentRodLevel)
|
||||
.AddContent("rod_star", myStar)
|
||||
.AddContent("rod_points_bonus", rod_points_bonus)
|
||||
.AddContent("card_level", fishCardLevel)
|
||||
.AddContent("points", FDM.SelfModel.CurrentPTS)
|
||||
.AddContent("trophy_before", trophy_before)
|
||||
.AddContent("trophy_change", trophy_change)
|
||||
.AddContent("trophy_after", FDM.duelData.progress)
|
||||
.AddContent("reward_list", FDM.eventSolomain.WinReward)
|
||||
.AddContent("first_complete", FDM.selfIsLastFish ? 1 : 2)
|
||||
;
|
||||
int allCount = FDM.FishItemIDs.Count;
|
||||
var fishInfos = FDM.SelfModel.DuelFishingDatas;
|
||||
int myDataCount = fishInfos.Count - 1;
|
||||
Dictionary<int, List<int>> items = new Dictionary<int, List<int>>();
|
||||
int fish_count = 0;
|
||||
int slienceTime = 0;
|
||||
List<int> fish_points_list = new List<int>();
|
||||
for (int i = 0; i < allCount; i++)
|
||||
{
|
||||
fish_points_list.Add(0);
|
||||
}
|
||||
for (int i = 0; i < myDataCount && i < allCount; i++)
|
||||
{
|
||||
if (fishInfos[i].fishItemId > 0)
|
||||
{
|
||||
slienceTime += fishInfos[i].slienceTime;
|
||||
if (fishInfos[i].isWin)
|
||||
{
|
||||
Item item = tables.TbItem.GetOrDefault(fishInfos[i].fishItemId);
|
||||
if (!items.TryGetValue(item.Quality, out List<int> fish_time))
|
||||
{
|
||||
fish_time = new List<int>();
|
||||
items[item.Quality] = fish_time;
|
||||
}
|
||||
fish_time.Add(fishInfos[i].fishingTime /*+ fishInfos[i].castingTime*/);
|
||||
fish_count++;
|
||||
fish_points_list[i] = fishInfos[i].point;
|
||||
}
|
||||
}
|
||||
}
|
||||
string fish_id = string.Join(",", FDM.FishItemIDs);
|
||||
|
||||
e.AddContent("cast_time", (float)slienceTime / myDataCount);
|
||||
e.AddContent("fish_count", fish_count)
|
||||
.AddContent("fish_id_sequence", fish_id)
|
||||
.AddContent("fish_points_list", string.Join(",", fish_points_list));
|
||||
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.Value.Count > 0)
|
||||
{
|
||||
e.AddContent("fish_time_" + item.Key, (float)item.Value.Sum() / item.Value.Count);
|
||||
}
|
||||
}
|
||||
|
||||
if (FDM.IsRobot)
|
||||
{
|
||||
int star = FDM.EnemyModel.RodStar;
|
||||
RodPerkDic = playerFishData.GetRodPerk(playerData.equipRodID, star);
|
||||
rod_points_bonus = FDM.GetCurRodBuff(RodPerkDic, 5);
|
||||
fishCardLevel = 0;
|
||||
int mapIndex = (FDM.MapId - 1) % 100;
|
||||
var CardLevelList = FDM.eventSoloRobot.CardLevel;
|
||||
for (int i = 0; i < CardLevelList.Count; i++)
|
||||
{
|
||||
var CardLevel = CardLevelList[i];
|
||||
mapIndex = mapIndex % CardLevel.Count;
|
||||
int cardLevel = CardLevel[mapIndex];
|
||||
fishCardLevel += cardLevel;
|
||||
}
|
||||
|
||||
|
||||
List<int> fish_points_list_robot = new List<int>();
|
||||
for (int i = 0; i < allCount; i++)
|
||||
{
|
||||
fish_points_list_robot.Add(0);
|
||||
}
|
||||
var robotInfos = FDM.EnemyModel.DuelFishingDatas;
|
||||
int dataCount = robotInfos.Count - 1;
|
||||
items = new Dictionary<int, List<int>>();
|
||||
for (int i = 0; i < dataCount && i < allCount; i++)
|
||||
{
|
||||
if (robotInfos[i].fishItemId > 0)
|
||||
{
|
||||
if (robotInfos[i].isWin)
|
||||
{
|
||||
Item item = tables.TbItem.GetOrDefault(robotInfos[i].fishItemId);
|
||||
if (!items.TryGetValue(item.Quality, out List<int> fish_time))
|
||||
{
|
||||
fish_time = new List<int>();
|
||||
items[item.Quality] = fish_time;
|
||||
}
|
||||
fish_time.Add(robotInfos[i].fishingTime /*+ robotInfos[i].castingTime*/);
|
||||
fish_points_list_robot[i] = robotInfos[i].point;
|
||||
}
|
||||
}
|
||||
}
|
||||
e.AddContent("points_robot", FDM.EnemyModel.CurrentPTS)
|
||||
.AddContent("rod_id_robot", FDM.EnemyModel.RodId)
|
||||
.AddContent("rod_level_robot", FDM.EnemyModel.RodLevel)
|
||||
.AddContent("rod_star_robot", star)
|
||||
.AddContent("rod_points_bonus_robot", rod_points_bonus)
|
||||
.AddContent("fish_points_list_robot", string.Join(",", fish_points_list_robot))
|
||||
.AddContent("card_level_robot", fishCardLevel);
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item.Value.Count > 0)
|
||||
{
|
||||
e.AddContent("robot_fish_time_" + item.Key, (float)item.Value.Sum() / item.Value.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetReward()
|
||||
{
|
||||
var rewardItemData = FDM.GetReward();
|
||||
if (rewardItemData != null)
|
||||
{
|
||||
int dataCount = rewardItemData.Count;
|
||||
int rewardCount = rewardItemNews.Count;
|
||||
for (int i = 0; i < rewardCount; i++)
|
||||
{
|
||||
if (i < dataCount)
|
||||
{
|
||||
rewardItemData[i].count *= FDM.magnification;
|
||||
rewardItemNews[i].SetData(rewardItemData[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItemNews[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
GContext.container.Resolve<PlayerItemData>().AddItem(rewardItemData);
|
||||
}
|
||||
}
|
||||
|
||||
void Claim()
|
||||
{
|
||||
CurRewardQCount curRewardQCount = new CurRewardQCount();
|
||||
GContext.Publish(curRewardQCount);
|
||||
if (curRewardQCount.count <= 0)
|
||||
{
|
||||
QuitDuel();
|
||||
}
|
||||
else
|
||||
{
|
||||
GContext.Publish(new ShowData());
|
||||
}
|
||||
}
|
||||
void OnRewardPanelClose(RewardPanelClose e)
|
||||
{
|
||||
QuitDuel();
|
||||
}
|
||||
void QuitDuelToRod()
|
||||
{
|
||||
FDM.OnStopShowUIType = UITypes.FishingRodBagPanel;
|
||||
QuitDuel();
|
||||
}
|
||||
void QuitDuelToFishCard()
|
||||
{
|
||||
FDM.OnStopShowUIType = UITypes.FishingMapPanel;
|
||||
QuitDuel();
|
||||
}
|
||||
void QuitDuel()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelRewardPanel);
|
||||
GContext.Publish(new UnloadActToNextAct());
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/EventFishingDuelRewardPanel.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/EventFishingDuelRewardPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a71a7ed92b407b459122816e4ce7a1a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
137
Assets/Scripts/Duel/UI/EventFishingDuelRewardPopupPanel.cs
Normal file
137
Assets/Scripts/Duel/UI/EventFishingDuelRewardPopupPanel.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventFishingDuelRewardPopupPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
Button btn_mask;
|
||||
TMP_Text text_time;
|
||||
TMP_Text text_points;
|
||||
GameObject item;
|
||||
Image bar;
|
||||
Tables tables;
|
||||
FishingEventData fishingEventData;
|
||||
Timer timer;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
btn_mask = transform.Find("mask").GetComponent<Button>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
text_time = transform.Find("root/text_time").GetComponent<TMP_Text>();
|
||||
text_points = transform.Find("root/info/icon_ticket/text_num").GetComponent<TMP_Text>();
|
||||
bar = transform.Find("root/root_reward/ScrollView/Viewport/Content/bg_bar/bar").GetComponent<Image>();
|
||||
item = transform.Find("root/root_reward/ScrollView/Viewport/Content/item").gameObject;
|
||||
item.SetActive(false);
|
||||
SetData();
|
||||
}
|
||||
async void SetData()
|
||||
{
|
||||
Transform content = transform.Find("root/root_reward/ScrollView/Viewport/Content");
|
||||
List<EventSolomain> eventSolomain = tables.TbEventSolomain.DataList;
|
||||
EventSolomain solomain = eventSolomain[0];
|
||||
float progress = fishingEventData.duelData.progress;
|
||||
text_points.text = ConvertTools.GetNumberString2(fishingEventData.duelData.progress);
|
||||
bar.fillAmount = progress / (float)solomain.TrophyRange[0];
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
int nextIndex = -1;
|
||||
DuelRankRewardItem duelRewardItem = null;
|
||||
for (int i = 0; i < eventSolomain.Count; i++)
|
||||
{
|
||||
GameObject go = Instantiate(item, content);
|
||||
go.SetActive(true);
|
||||
duelRewardItem = go.GetComponent<DuelRankRewardItem>();
|
||||
uiService.SetImageSprite(duelRewardItem.icon_rank, solomain.RankIcon);
|
||||
duelRewardItem.text_rank.text = LocalizationMgr.GetText(solomain.RankText_l10n_key);
|
||||
duelRewardItem.text_point.text = solomain.TrophyRange[0].ToString();
|
||||
List<ItemData> rewardItemData = GContext.container.Resolve<PlayerItemData>()
|
||||
.GetItemDataByDropId(solomain.SeasonReward);
|
||||
|
||||
if (rewardItemData != null)
|
||||
{
|
||||
int dataCount = rewardItemData.Count;
|
||||
int rewardCount = duelRewardItem.rewardItems.Count;
|
||||
for (int j = 0; j < rewardCount; j++)
|
||||
{
|
||||
if (j < dataCount)
|
||||
{
|
||||
duelRewardItem.rewardItems[j].SetData(rewardItemData[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
duelRewardItem.rewardItems[j].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
duelRewardItem.bg_gray.SetActive(progress > solomain.TrophyRange[1]);
|
||||
duelRewardItem.bg_normal.SetActive(false);
|
||||
duelRewardItem.bg_next.SetActive(progress < solomain.TrophyRange[0]);
|
||||
if (progress >= solomain.TrophyRange[0] && progress <= solomain.TrophyRange[1])
|
||||
{
|
||||
duelRewardItem.bg_normal.SetActive(true);
|
||||
nextIndex = i;
|
||||
}
|
||||
if (i < eventSolomain.Count - 1)
|
||||
{
|
||||
duelRewardItem.bar.fillAmount = (progress - solomain.TrophyRange[0]) / (solomain.TrophyRange[1] - solomain.TrophyRange[0]);
|
||||
solomain = eventSolomain[i + 1];
|
||||
}
|
||||
}
|
||||
if (duelRewardItem != null)
|
||||
{
|
||||
duelRewardItem.bar.fillAmount = (progress - solomain.TrophyRange[0]) / (eventSolomain[eventSolomain.Count - 2].TrophyRange[1] - eventSolomain[eventSolomain.Count - 2].TrophyRange[0]);
|
||||
duelRewardItem.bar_root.transform.localScale = new Vector3(1, 0.5f, 1);
|
||||
}
|
||||
if (nextIndex == -1)
|
||||
{
|
||||
nextIndex = eventSolomain.Count - 2;
|
||||
}
|
||||
await Awaiters.NextFrame;
|
||||
content.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -nextIndex * 280);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_mask.onClick.AddListener(OnClickClose);
|
||||
btn_close.onClick.AddListener(OnClickClose);
|
||||
SetTimer();
|
||||
}
|
||||
void OnClickClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelRewardPopupPanel);
|
||||
}
|
||||
void SetTimer()
|
||||
{
|
||||
DateTime endDateTime = fishingEventData.GetEventEndTime(fishingEventData.duelData.eventID)
|
||||
.AddSeconds(-tables.TbEventSoloConfig.SettlementTime);
|
||||
TimeSpan now = endDateTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
text_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_end",
|
||||
ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds));
|
||||
double seconds = now.TotalSeconds;
|
||||
timer = this.AttachTimer((float)seconds, Refresh,
|
||||
(elapsed) =>
|
||||
{
|
||||
now = endDateTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
text_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_end",
|
||||
ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds));
|
||||
}, useRealTime: true);
|
||||
}
|
||||
|
||||
void Refresh()
|
||||
{
|
||||
timer?.Cancel();
|
||||
timer = null;
|
||||
//OnClickClose();
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
timer?.Cancel();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03f81776852e4574294342e7d5f3b52e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
144
Assets/Scripts/Duel/UI/EventFishingDuelSettlementPanel.cs
Normal file
144
Assets/Scripts/Duel/UI/EventFishingDuelSettlementPanel.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventFishingDuelSettlementPanel : MonoBehaviour
|
||||
{
|
||||
FishingEventData fishingEventData;
|
||||
Tables table;
|
||||
Button btn_receive;
|
||||
private EventSolomain solomain;
|
||||
List<RewardItemNew> rewardItems;
|
||||
TMP_Text text_rank;
|
||||
Image icon_rank;
|
||||
List<ItemData> rewardItemData;
|
||||
private void Awake()
|
||||
{
|
||||
fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
table = GContext.container.Resolve<Tables>();
|
||||
btn_receive = transform.Find("root/reward/btn_receive/btn_green").GetComponent<Button>();
|
||||
|
||||
text_rank = transform.Find("root/text_rank").GetComponent<TMP_Text>();
|
||||
icon_rank = transform.Find("root/icon_rank").GetComponent<Image>();
|
||||
Transform layout_reward = transform.Find($"root/layout_reward");
|
||||
int count = layout_reward.childCount;
|
||||
rewardItems = new List<RewardItemNew>();
|
||||
for (int i = 1; i <= count; i++)
|
||||
{
|
||||
rewardItems.Add(transform.Find($"root/layout_reward/reward{i}").GetComponent<RewardItemNew>());
|
||||
}
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
SetReward();
|
||||
btn_receive.onClick.AddListener(OnReveive);
|
||||
}
|
||||
void SetReward()
|
||||
{
|
||||
var data = table.TbEventSolomain.DataList;
|
||||
if (fishingEventData.duelData.preProgress > 0)
|
||||
{
|
||||
for (int i = data.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (fishingEventData.duelData.preProgress >= data[i].TrophyRange[0])
|
||||
{
|
||||
solomain = data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (solomain == null)
|
||||
{
|
||||
solomain = data[0];
|
||||
}
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(icon_rank, solomain.RankIcon);
|
||||
text_rank.text = LocalizationMgr.GetText(solomain.RankText_l10n_key);
|
||||
rewardItemData = GContext.container.Resolve<PlayerItemData>()
|
||||
.GetItemDataByDropId(solomain.SeasonReward);
|
||||
|
||||
if (rewardItemData != null)
|
||||
{
|
||||
int dataCount = rewardItemData.Count;
|
||||
int rewardCount = rewardItems.Count;
|
||||
for (int j = 0; j < rewardCount; j++)
|
||||
{
|
||||
if (j < dataCount)
|
||||
{
|
||||
rewardItems[j].SetData(rewardItemData[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems[j].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void OnReveive()
|
||||
{
|
||||
int preProgress = fishingEventData.duelData.preProgress;
|
||||
int reset = preProgress - table.TbEventSoloConfig.MinTrophy;
|
||||
var data = table.TbEventSolomain.DataList;
|
||||
|
||||
if (reset > 0)
|
||||
{
|
||||
//preProgress = table.TbEventSoloConfig.SettlementTrophy +
|
||||
// (int)(reset * table.TbEventSoloConfig.SettlementTrophyMultiplier);
|
||||
|
||||
var solomain = data[0];
|
||||
if (preProgress > 0)
|
||||
{
|
||||
for (int i = data.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (preProgress >= data[i].TrophyRange[0])
|
||||
{
|
||||
solomain = data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
preProgress -= solomain.SettleDeducTrophy;
|
||||
}
|
||||
//preProgress /= table.TbEventSoloConfig.TrophyMutiple;
|
||||
//preProgress *= table.TbEventSoloConfig.TrophyMutiple;
|
||||
if (preProgress < table.TbEventSoloConfig.MinTrophy)
|
||||
{
|
||||
preProgress = table.TbEventSoloConfig.MinTrophy;
|
||||
}
|
||||
EventSolomain preSolomain = solomain;
|
||||
for (int i = data.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (preProgress >= data[i].TrophyRange[0])
|
||||
{
|
||||
preSolomain = data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if AGG
|
||||
using (var e = GEvent.GameEvent("single_battle_settlement"))
|
||||
{
|
||||
e.AddContent("trophy", fishingEventData.duelData.preProgress)
|
||||
.AddContent("charge_count", GContext.container.Resolve<PlayerShopData>().GetBuyPaymentAmount())
|
||||
.AddContent("trophy_after", preProgress);
|
||||
if (solomain != null)
|
||||
{
|
||||
e.AddContent("tire", solomain.RankTier)
|
||||
.AddContent("reward_list", solomain.SeasonReward);
|
||||
}
|
||||
if (preSolomain != null)
|
||||
{
|
||||
e.AddContent("tier_after", preSolomain.RankTier);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
GContext.container.Resolve<PlayerItemData>().AddItem(rewardItemData);
|
||||
fishingEventData.ClaimReward();
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelSettlementPanel);
|
||||
GContext.Publish(new ShowData());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e505f07685de4984ab0ac1999d513ed9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
122
Assets/Scripts/Duel/UI/EventFishingduelShopPopupPanel.cs
Normal file
122
Assets/Scripts/Duel/UI/EventFishingduelShopPopupPanel.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EventFishingduelShopPopupPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
Button btn_mask;
|
||||
TMP_Text text_time;
|
||||
GameObject item;
|
||||
GameObject item_special_bait1;
|
||||
GameObject item_special_bait2;
|
||||
GameObject item_special_money1;
|
||||
GameObject item_special_money2;
|
||||
GameObject item_special_skin;
|
||||
Tables tables;
|
||||
FishingEventData fishingEventData;
|
||||
Timer timer;
|
||||
List<GameObject> pvpStoreItems = new List<GameObject>();
|
||||
DateTime endTime;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
btn_mask = transform.Find("mask").GetComponent<Button>();
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
text_time = transform.Find("root/text_time").GetComponent<TMP_Text>();
|
||||
item = transform.Find("root/ScrollView/Viewport/Content/Item").gameObject;
|
||||
|
||||
item_special_bait1 = transform.Find("root/ScrollView/Viewport/Content/item_special_bait1").gameObject;
|
||||
item_special_bait2 = transform.Find("root/ScrollView/Viewport/Content/item_special_bait2").gameObject;
|
||||
item_special_money1 = transform.Find("root/ScrollView/Viewport/Content/item_special_money1").gameObject;
|
||||
item_special_money2 = transform.Find("root/ScrollView/Viewport/Content/item_special_money2").gameObject;
|
||||
item_special_skin = transform.Find("root/ScrollView/Viewport/Content/item_special_skin").gameObject;
|
||||
item.SetActive(false);
|
||||
SetData();
|
||||
}
|
||||
void SetData()
|
||||
{
|
||||
for (int i = 0; i < pvpStoreItems.Count; i++)
|
||||
{
|
||||
Destroy(pvpStoreItems[i]);
|
||||
}
|
||||
pvpStoreItems.Clear();
|
||||
endTime = fishingEventData.SetPVPShopTime();
|
||||
Transform content = transform.Find("root/ScrollView/Viewport/Content");
|
||||
List<PvpStore> pvpStores = tables.TbPvpStore.DataList;
|
||||
pvpStores.Sort((a, b) => a.CellId.CompareTo(b.CellId));
|
||||
for (int i = 0; i < pvpStores.Count; i++)
|
||||
{
|
||||
GameObject go;
|
||||
PvpStore pvpStore = pvpStores[i];
|
||||
switch (pvpStore.SpecialRoot)
|
||||
{
|
||||
case "item_special_bait1":
|
||||
go = Instantiate(item_special_bait1, content);
|
||||
break;
|
||||
case "item_special_bait2":
|
||||
go = Instantiate(item_special_bait2, content);
|
||||
break;
|
||||
case "item_special_money1":
|
||||
go = Instantiate(item_special_money1, content);
|
||||
break;
|
||||
case "item_special_money2":
|
||||
go = Instantiate(item_special_money2, content);
|
||||
break;
|
||||
case "item_special_skin":
|
||||
go = Instantiate(item_special_skin, content);
|
||||
break;
|
||||
default:
|
||||
go = Instantiate(item, content);
|
||||
break;
|
||||
}
|
||||
go.SetActive(true);
|
||||
pvpStoreItems.Add(go);
|
||||
PvpStoreItem pvpStoreItem = go.GetComponent<PvpStoreItem>();
|
||||
pvpStoreItem.Init(pvpStore, fishingEventData.IsBuyPVPItem(pvpStore.Id));
|
||||
}
|
||||
SetTimer();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_mask.onClick.AddListener(OnClickClose);
|
||||
btn_close.onClick.AddListener(OnClickClose);
|
||||
}
|
||||
void OnClickClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingduelShopPopupPanel);
|
||||
}
|
||||
void SetTimer()
|
||||
{
|
||||
TimeSpan now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
text_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_refresh",
|
||||
ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds));
|
||||
double seconds = now.TotalSeconds;
|
||||
timer = this.AttachTimer((float)seconds, Refresh,
|
||||
(elapsed) =>
|
||||
{
|
||||
now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
||||
text_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_refresh",
|
||||
ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds));
|
||||
}, useRealTime: true);
|
||||
}
|
||||
|
||||
void Refresh()
|
||||
{
|
||||
timer?.Cancel();
|
||||
timer = null;
|
||||
SetData();
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
timer?.Cancel();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e9e165b378ff8144bc380ed67418589
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
27
Assets/Scripts/Duel/UI/FishConfrimCardInfo.cs
Normal file
27
Assets/Scripts/Duel/UI/FishConfrimCardInfo.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishConfrimCardInfo : MonoBehaviour
|
||||
{
|
||||
public Image icon_fish;
|
||||
public Image icon_tag;
|
||||
public TMP_Text text_name;
|
||||
public TextNumHigher text_num;
|
||||
public TextNumHigher text_num_enemy;
|
||||
public GameObject root;
|
||||
|
||||
public void SetData(Item item, int selflv, int enemylv)
|
||||
{
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
uiService.SetImageSprite(icon_tag, $"icon_fish_rate_tag_{item.Quality}");
|
||||
PlayerFishData.SetFishIcon(icon_fish, item);//鱼头像
|
||||
string lvStr = LocalizationMgr.GetText("UI_PlayerGradePanel_2");
|
||||
text_num.SetValue(string.Format(lvStr, selflv), selflv > enemylv);
|
||||
text_num_enemy.SetValue(string.Format(lvStr, enemylv), selflv < enemylv);
|
||||
text_name.text = LocalizationMgr.GetText(item.Name_l10n_key);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/FishConfrimCardInfo.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/FishConfrimCardInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7028bbc7a6216284e973ca10e61bf691
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Assets/Scripts/Duel/UI/FishConfrimPanel.cs
Normal file
93
Assets/Scripts/Duel/UI/FishConfrimPanel.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FishConfrimPanel : MonoBehaviour
|
||||
{
|
||||
FishingDuelManager FDM;
|
||||
IUIService uIService;
|
||||
FishConfrimPlayerInfo playerInfo;
|
||||
public TMP_Text text_name;
|
||||
public TMP_Text text_name_enemy;
|
||||
GameObject card_info;
|
||||
Transform card_info_content;
|
||||
Button btn_confrim;
|
||||
TMP_Text p_text;
|
||||
public float CardInfoShowDelay = 0.25f;
|
||||
public float CardInfoShowInterval = 0.2f;
|
||||
bool joined = false;
|
||||
List<FishConfrimCardInfo> fishConfrimCardInfos = new List<FishConfrimCardInfo>();
|
||||
private void Awake()
|
||||
{
|
||||
uIService = GContext.container.Resolve<IUIService>();
|
||||
FDM = GContext.container.Resolve<FishingDuelManager>();
|
||||
card_info = transform.Find("card_info_content/card_info").gameObject;
|
||||
card_info.SetActive(false);
|
||||
card_info_content = transform.Find("card_info_content");
|
||||
playerInfo = transform.Find("card_info_content/player_info").GetComponent<FishConfrimPlayerInfo>();
|
||||
playerInfo.SetData(FDM);
|
||||
text_name.text = FDM.SelfModel.PlayerName;
|
||||
text_name_enemy.text = FDM.EnemyModel.PlayerName;
|
||||
btn_confrim = transform.Find("btn_confrim/btn_green").GetComponent<Button>();
|
||||
p_text = transform.Find("btn_confrim/btn_green/Ani_Container/p_text").GetComponent<TMP_Text>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_confrim.transform.parent.gameObject.SetActive(false);
|
||||
List<int> itemIds = FDM.FishItemIDs;
|
||||
Tables tables = GContext.container.Resolve<Tables>();
|
||||
|
||||
for (int i = 0; i < itemIds.Count; i++)
|
||||
{
|
||||
Item item = tables.GetItemData(itemIds[i]);
|
||||
if (item == null) continue;
|
||||
GameObject go = Instantiate(card_info, card_info_content);
|
||||
go.SetActive(true);
|
||||
FishConfrimCardInfo cardInfo = go.GetComponent<FishConfrimCardInfo>();
|
||||
if (cardInfo != null)
|
||||
{
|
||||
cardInfo.SetData(item, FDM.SelfModel.CarLevels[i], FDM.EnemyModel.CarLevels[i]);
|
||||
}
|
||||
cardInfo.root.SetActive(false);
|
||||
fishConfrimCardInfos.Add(cardInfo);
|
||||
}
|
||||
StartCoroutine(Close());
|
||||
}
|
||||
IEnumerator Close()
|
||||
{
|
||||
yield return new WaitForSeconds(CardInfoShowDelay);
|
||||
|
||||
for (int i = 0; i < fishConfrimCardInfos.Count; i++)
|
||||
{
|
||||
fishConfrimCardInfos[i].root.SetActive(true);
|
||||
yield return new WaitForSeconds(CardInfoShowInterval);
|
||||
}
|
||||
btn_confrim.onClick.AddListener(Join);
|
||||
btn_confrim.transform.parent.gameObject.SetActive(true);
|
||||
|
||||
int allTime = FDM.eventSoloConfig.StartTime;
|
||||
while (allTime > 0)
|
||||
{
|
||||
p_text.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_41", allTime);
|
||||
yield return new WaitForSeconds(1);
|
||||
allTime--;
|
||||
}
|
||||
p_text.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_41", 0);
|
||||
Join();
|
||||
}
|
||||
async void Join()
|
||||
{
|
||||
joined = true;
|
||||
StopAllCoroutines();
|
||||
GContext.Publish(new UnloadActToNextAct("FishingDuelAct"));
|
||||
FDM.OnJoin();
|
||||
await Awaiters.Seconds(1f);
|
||||
UIManager.Instance.DestroyUI(UITypes.EventFishingDuelPanel);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/FishConfrimPanel.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/FishConfrimPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cb03cad7d49aaf46bba124d92c73405
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/Scripts/Duel/UI/FishConfrimPlayerInfo.cs
Normal file
15
Assets/Scripts/Duel/UI/FishConfrimPlayerInfo.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using GameCore;
|
||||
using System.Linq;
|
||||
|
||||
public class FishConfrimPlayerInfo : FishPlayerInfo
|
||||
{
|
||||
public override void SetData(FishingDuelManager FDM)
|
||||
{
|
||||
base.SetData(FDM);
|
||||
string lvStr = LocalizationMgr.GetText("UI_PlayerGradePanel_2");
|
||||
int selflv = FDM.SelfModel.CarLevels.Sum();
|
||||
int enemylv = FDM.EnemyModel.CarLevels.Sum();
|
||||
text_num.SetValue(string.Format(lvStr, selflv), selflv > enemylv);
|
||||
text_num_enemy.SetValue(string.Format(lvStr, enemylv), selflv < enemylv);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/FishConfrimPlayerInfo.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/FishConfrimPlayerInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34b54225ce18e2a4e848efc6f93472ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Scripts/Duel/UI/FishPlayerInfo.cs
Normal file
16
Assets/Scripts/Duel/UI/FishPlayerInfo.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishPlayerInfo : MonoBehaviour
|
||||
{
|
||||
public Head selfHead;
|
||||
public Head enemyHead;
|
||||
public TextNumHigher text_num;
|
||||
public TextNumHigher text_num_enemy;
|
||||
public virtual void SetData(FishingDuelManager FDM)
|
||||
{
|
||||
if (FDM == null) return;
|
||||
selfHead.SetData(FDM.SelfModel.PlayerAvatar);
|
||||
enemyHead.SetData(FDM.EnemyModel.PlayerAvatar);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/FishPlayerInfo.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/FishPlayerInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff8837c24b055694982963b4955b4f7d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/Scripts/Duel/UI/FishStatisticsPlayerInfo.cs
Normal file
46
Assets/Scripts/Duel/UI/FishStatisticsPlayerInfo.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
using DG.Tweening;
|
||||
using TMPro;
|
||||
|
||||
public class FishStatisticsPlayerInfo : FishPlayerInfo
|
||||
{
|
||||
TMP_Text num_my;
|
||||
TMP_Text num_enemy;
|
||||
int oldSelfValue;
|
||||
int oldEnermyValue;
|
||||
public void SetNumShow(bool higher)
|
||||
{
|
||||
text_num.SetValue("0", higher);
|
||||
text_num_enemy.SetValue("0", !higher);
|
||||
if (higher)
|
||||
{
|
||||
num_my = text_num.text_num_higher;
|
||||
num_enemy = text_num_enemy.text_num;
|
||||
}
|
||||
else
|
||||
{
|
||||
num_my = text_num.text_num;
|
||||
num_enemy = text_num_enemy.text_num_higher;
|
||||
}
|
||||
}
|
||||
public void SetNum(int selfValue, int enermyValue, float time)
|
||||
{
|
||||
DOTween.Kill("SetNumInfo");
|
||||
if (selfValue > 0 && num_my != null)
|
||||
{
|
||||
DOTween.To(() => oldSelfValue, x => oldSelfValue = x, selfValue, time).OnUpdate(() =>
|
||||
{
|
||||
num_my.text = oldSelfValue.ToString();
|
||||
}).SetId("SetNumInfo");
|
||||
//num_my.text = selfValue.ToString();
|
||||
}
|
||||
if (enermyValue > 0 && num_enemy != null)
|
||||
{
|
||||
DOTween.To(() => oldEnermyValue, x => oldEnermyValue = x, enermyValue, time).OnUpdate(() =>
|
||||
{
|
||||
num_enemy.text = oldEnermyValue.ToString();
|
||||
}).SetId("SetNumInfo");
|
||||
//num_enemy.text = enermyValue.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/FishStatisticsPlayerInfo.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/FishStatisticsPlayerInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1c159d1f7fef534c9bdd9e5b3897d78
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
6
Assets/Scripts/Duel/UI/IDuelChatView.cs
Normal file
6
Assets/Scripts/Duel/UI/IDuelChatView.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
public interface IDuelChatView
|
||||
{
|
||||
void Dialogue(string chat);
|
||||
void Emoji(string chat);
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/IDuelChatView.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/IDuelChatView.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb6b46832bffbe74699f40fb261ea89a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
6
Assets/Scripts/Duel/UI/IDuelUIView.cs
Normal file
6
Assets/Scripts/Duel/UI/IDuelUIView.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
public interface IDuelUIView
|
||||
{
|
||||
void Fishing(int itemID);
|
||||
void EndFishing(int index, FishInfoData data, bool isEnd);
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/IDuelUIView.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/IDuelUIView.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 356fe4d02ea9bae4ca3adc09a23cd808
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
92
Assets/Scripts/Duel/UI/PvpStoreItem.cs
Normal file
92
Assets/Scripts/Duel/UI/PvpStoreItem.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PvpStoreItem : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
protected Button btn_buy;
|
||||
|
||||
[SerializeField]
|
||||
protected RewardItemNew rewardItem;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject go_soldOut;
|
||||
|
||||
[SerializeField]
|
||||
protected TMP_Text btn_buy_text;
|
||||
protected PvpStore pvpStore;
|
||||
protected ItemData itemData;
|
||||
private void Reset()
|
||||
{
|
||||
btn_buy = transform.Find("position/btn_purchase/btn_green").GetComponent<Button>();
|
||||
rewardItem = transform.Find("position/reward").GetComponent<RewardItemNew>();
|
||||
go_soldOut = transform.Find("position/soldout").gameObject;
|
||||
btn_buy_text = transform.Find("position/btn_purchase/btn_green/Ani_Container/p_text").GetComponent<TMP_Text>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_buy.onClick.AddListener(OnBuy);
|
||||
}
|
||||
public void Init(PvpStore pvpStore, bool soldOut)
|
||||
{
|
||||
this.pvpStore = pvpStore;
|
||||
itemData = new ItemData(pvpStore.ItemId, pvpStore.ItemNumber);
|
||||
if (itemData.id == 1002)
|
||||
{
|
||||
itemData.count = GContext.container.Resolve<PlayerItemData>().GetExtraCoinMag(itemData.count);
|
||||
}
|
||||
rewardItem.SetData(itemData);
|
||||
btn_buy_text.text = pvpStore.TokenNumber.ToString();
|
||||
go_soldOut.SetActive(soldOut);
|
||||
btn_buy.gameObject.SetActive(!soldOut);
|
||||
Init();
|
||||
}
|
||||
protected virtual void Init()
|
||||
{
|
||||
|
||||
}
|
||||
void OnBuy()
|
||||
{
|
||||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||||
if (pvpStore.TokenNumber > fishingEventData.PVPToken)
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_87"));
|
||||
//代币不足
|
||||
return;
|
||||
}
|
||||
if (fishingEventData.BuyPVPItem(pvpStore.Id))
|
||||
{
|
||||
fishingEventData.AddPVPToken(-pvpStore.TokenNumber);
|
||||
GContext.Publish(new ResAddEvent(pvpStore.TokenId));
|
||||
itemData.curCount = (ulong)GContext.container.Resolve<PlayerItemData>().GetItemCount(itemData.id);
|
||||
GContext.Publish(new ShowData(itemData));
|
||||
GContext.container.Resolve<PlayerItemData>().AddItem(itemData);
|
||||
GContext.Publish(new ShowData());
|
||||
BuyEnd();
|
||||
var duelData = fishingEventData.duelData;
|
||||
#if AGG
|
||||
using (var e = GEvent.GameEvent("pvp_store"))
|
||||
{
|
||||
e.AddContent("cost_token_id", 2052)
|
||||
.AddContent("cost_token_count", pvpStore.TokenNumber)
|
||||
.AddContent("change_type", pvpStore.Type)
|
||||
.AddContent("item_id", itemData.id)
|
||||
.AddContent("cost_token_count_sum", duelData == null ? 0 : duelData.rePVPToken)
|
||||
.AddContent("available_token", fishingEventData.PVPToken)
|
||||
.AddContent("change_count", itemData.count);
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
protected virtual void BuyEnd()
|
||||
{
|
||||
go_soldOut.SetActive(true);
|
||||
btn_buy.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/PvpStoreItem.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/PvpStoreItem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9801feee5b46b8244b6795b058d4ebe7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/Scripts/Duel/UI/PvpStoreItemBait.cs
Normal file
12
Assets/Scripts/Duel/UI/PvpStoreItemBait.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
|
||||
public class PvpStoreItemBait : PvpStoreItem
|
||||
{
|
||||
protected override void Init()
|
||||
{
|
||||
rewardItem.icon.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/PvpStoreItemBait.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/PvpStoreItemBait.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42491999d4ffcb8409b874358b8da274
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Duel/UI/PvpStoreItemMoney.cs
Normal file
8
Assets/Scripts/Duel/UI/PvpStoreItemMoney.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
public class PvpStoreItemMoney : PvpStoreItem
|
||||
{
|
||||
protected override void Init()
|
||||
{
|
||||
rewardItem.icon.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/PvpStoreItemMoney.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/PvpStoreItemMoney.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f93818682726cf94ab307a6071e3d532
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/Scripts/Duel/UI/PvpStoreItemSkin.cs
Normal file
35
Assets/Scripts/Duel/UI/PvpStoreItemSkin.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
|
||||
public class PvpStoreItemSkin : PvpStoreItem
|
||||
{
|
||||
[SerializeField]
|
||||
protected GameObject owned;
|
||||
protected override void Init()
|
||||
{
|
||||
PlayerFishData playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
Item item = GContext.container.Resolve<Tables>().GetItemData(pvpStore.ItemId);
|
||||
bool alreadyOwned = false;
|
||||
if (item != null && item.Type == 3)
|
||||
{
|
||||
switch (item.SubType)
|
||||
{
|
||||
case 3:
|
||||
alreadyOwned = playerFishData.IsSkinUnlocked(item.RedirectID);
|
||||
break;
|
||||
case 11:
|
||||
alreadyOwned = playerFishData.IsGloveUnlocked(item.RedirectID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
owned.SetActive(alreadyOwned);
|
||||
btn_buy.gameObject.SetActive(!alreadyOwned);
|
||||
}
|
||||
protected override void BuyEnd()
|
||||
{
|
||||
owned.SetActive(true);
|
||||
btn_buy.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/PvpStoreItemSkin.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/PvpStoreItemSkin.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff74bc4231cf3e0499c0977d6d955169
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/Scripts/Duel/UI/TextNumHigher.cs
Normal file
22
Assets/Scripts/Duel/UI/TextNumHigher.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class TextNumHigher : MonoBehaviour
|
||||
{
|
||||
public TMP_Text text_num;
|
||||
public TMP_Text text_num_higher;
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
text_num = transform.Find("text_num").GetComponent<TMP_Text>();
|
||||
text_num_higher = transform.Find("text_num_higher").GetComponent<TMP_Text>();
|
||||
}
|
||||
|
||||
public void SetValue(string num, bool higher)
|
||||
{
|
||||
text_num.text = text_num_higher.text = num;
|
||||
text_num_higher.gameObject.SetActive(higher);
|
||||
text_num.gameObject.SetActive(!higher);
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/TextNumHigher.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/TextNumHigher.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8202397839d93ae409eeef02e3d94773
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/Duel/UI/TextNumHigherAdd.cs
Normal file
32
Assets/Scripts/Duel/UI/TextNumHigherAdd.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using TMPro;
|
||||
|
||||
public class TextNumHigherAdd : TextNumHigher
|
||||
{
|
||||
public TMP_Text text_num_add;
|
||||
public TMP_Text text_num_higher_add;
|
||||
public void SetAddValue(float num, bool higher)
|
||||
{
|
||||
if (higher)
|
||||
{
|
||||
if (num < 0)
|
||||
{
|
||||
text_num_higher_add.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
text_num_higher_add.text = num.ToString("P0");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num < 0)
|
||||
{
|
||||
text_num_add.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
text_num_add.text = num.ToString("P0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/TextNumHigherAdd.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/TextNumHigherAdd.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ce6eac1afa540e4a95c158f068c2838
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/Scripts/Duel/UI/TicketTips.cs
Normal file
26
Assets/Scripts/Duel/UI/TicketTips.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TicketTips : MonoBehaviour
|
||||
{
|
||||
public Button hide;
|
||||
public TMP_Text text_info;
|
||||
public Transform ticket_tips;
|
||||
private void Start()
|
||||
{
|
||||
hide.onClick.AddListener(() =>
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
});
|
||||
|
||||
}
|
||||
public void SetText(string text)
|
||||
{
|
||||
text_info.text = text;
|
||||
}
|
||||
public void SetPos(Vector3 pos)
|
||||
{
|
||||
ticket_tips.position = pos;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/TicketTips.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/TicketTips.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3aa30b865a7f88149bb917e97533ede1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/Scripts/Duel/UI/duel_rod_trait_tips.cs
Normal file
18
Assets/Scripts/Duel/UI/duel_rod_trait_tips.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class duel_rod_trait_tips : MonoBehaviour
|
||||
{
|
||||
public Button close;
|
||||
public GameObject[] tips;
|
||||
public Image[] trait_icons;
|
||||
public TMP_Text[] trait_names;
|
||||
private void Start()
|
||||
{
|
||||
close.onClick.AddListener(() =>
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/duel_rod_trait_tips.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/duel_rod_trait_tips.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eef82a7a40cd8aa4dad826399bb30e2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
73
Assets/Scripts/Duel/UI/event_fishingduel_chat.cs
Normal file
73
Assets/Scripts/Duel/UI/event_fishingduel_chat.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class event_fishingduel_chat : MonoBehaviour
|
||||
{
|
||||
Transform layout_chat;
|
||||
GameObject layout_chat_item;
|
||||
Transform emoji_tips;
|
||||
GameObject emoji_tips_item;
|
||||
Button btnClose;
|
||||
FishingDuelManager FDM;
|
||||
private void Awake()
|
||||
{
|
||||
btnClose = transform.Find("btn_close").GetComponent<Button>();
|
||||
FDM = GContext.container.Resolve<FishingDuelManager>();
|
||||
layout_chat = transform.Find("root/layout_chat");
|
||||
if (layout_chat != null)
|
||||
{
|
||||
layout_chat_item = layout_chat.Find("bubble_chat").gameObject;
|
||||
layout_chat_item.SetActive(false);
|
||||
}
|
||||
|
||||
emoji_tips = transform.Find("root/emoji_tips");
|
||||
if (emoji_tips != null)
|
||||
{
|
||||
emoji_tips_item = emoji_tips.Find("emoji").gameObject;
|
||||
emoji_tips_item.SetActive(false);
|
||||
}
|
||||
btnClose.onClick.AddListener(() => { gameObject.SetActive(false); });
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
List<EventSoloQuickMessage> messages = GContext.container.Resolve<Tables>().TbEventSoloQuickMessage.DataList;
|
||||
for (int i = 0; i < messages.Count; i++)
|
||||
{
|
||||
EventSoloQuickMessage message = messages[i];
|
||||
GameObject item = null;
|
||||
if (message.Type == 1)
|
||||
{
|
||||
item = Instantiate(emoji_tips_item, emoji_tips);
|
||||
item.SetActive(true);
|
||||
Image image = item.transform.Find("icon").GetComponent<Image>();
|
||||
uiService.SetImageSprite(image, message.Emoji);
|
||||
|
||||
}
|
||||
else if (message.Type == 2)
|
||||
{
|
||||
item = Instantiate(layout_chat_item, layout_chat);
|
||||
item.SetActive(true);
|
||||
TMP_Text text = item.transform.Find("text_chat").GetComponent<TMP_Text>();
|
||||
text.text = LocalizationMgr.GetText(message.Text_l10n_key);
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
Button button = item.GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
FDM.SendQuickMessage(message.ID);
|
||||
gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/event_fishingduel_chat.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/event_fishingduel_chat.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 913c1007b5c5da94e9fac5c3eb425386
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
171
Assets/Scripts/Duel/UI/event_fishingduel_rod_change.cs
Normal file
171
Assets/Scripts/Duel/UI/event_fishingduel_rod_change.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using game;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class event_fishingduel_rod_change : MonoBehaviour
|
||||
{
|
||||
public Image[] traits;
|
||||
FishingDuelManager FDM;
|
||||
public Button btn_confrim;
|
||||
public Button btn_questionmark;
|
||||
public GameObject item;
|
||||
public Transform Content;
|
||||
public TMP_Text p_text;
|
||||
public TMP_Text text_title;
|
||||
public duel_rod_trait_tips trait_tips;
|
||||
List<RodItemData> rodItemDatas = new List<RodItemData>();
|
||||
List<DuelRodItem> rodItems = new List<DuelRodItem>();
|
||||
private DuelRodItem currentRodItem;
|
||||
Tables tables;
|
||||
public int allTime;
|
||||
private void Awake()
|
||||
{
|
||||
tables = GContext.container.Resolve<Tables>();
|
||||
FDM = GContext.container.Resolve<FishingDuelManager>();
|
||||
item.SetActive(false);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
List<int> traitID = FDM.TraitID;
|
||||
for (int i = 0; i < traits.Length; i++)
|
||||
{
|
||||
if (i < traitID.Count)
|
||||
{
|
||||
RodAscendPerk rodAscendPerk = tables.TbRodAscendPerk.GetOrDefault(traitID[i]);
|
||||
string iconName = rodAscendPerk.Icon;
|
||||
uiService.SetImageSprite(traits[i], iconName);
|
||||
uiService.SetImageSprite(trait_tips.trait_icons[i], iconName);
|
||||
trait_tips.trait_names[i].text = LocalizationMgr.GetText(rodAscendPerk.Title_l10n_key);
|
||||
}
|
||||
else
|
||||
{
|
||||
traits[i].transform.parent.gameObject.SetActive(false);
|
||||
trait_tips.tips[i].SetActive(false);
|
||||
}
|
||||
}
|
||||
btn_confrim.onClick.AddListener(OnClickConfrim);
|
||||
btn_questionmark.onClick.AddListener(OnClickQuestion);
|
||||
InitRodList();
|
||||
}
|
||||
void OnClickQuestion()
|
||||
{
|
||||
trait_tips.gameObject.SetActive(true);
|
||||
}
|
||||
void OnClickConfrim()
|
||||
{
|
||||
if (currentRodItem.data.isLock)
|
||||
{
|
||||
//弹提示
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_85"));
|
||||
return;
|
||||
}
|
||||
if (GContext.container.Resolve<PlayerData>().equipRodID != currentRodItem.data.config.ID)
|
||||
{
|
||||
GContext.container.Resolve<PlayerData>().SetEquipRodID(currentRodItem.data.config.ID);
|
||||
}
|
||||
GContext.Publish(new ActChangeRodDataEvent(currentRodItem.data.config.ID));
|
||||
FDM.SetRodData(currentRodItem.data.config.ID);
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
void InitRodList()
|
||||
{
|
||||
var _tables = GContext.container.Resolve<Tables>();
|
||||
var dataList = _tables.TbRodData.DataList;
|
||||
int count = dataList.Count;
|
||||
RodData _rodData;
|
||||
PlayerFishData playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_rodData = dataList[i];
|
||||
bool isLock = playerFishData.NotRod(_rodData.ID);
|
||||
int level = playerFishData.GetRodLevel(_rodData.ID);
|
||||
int star = playerFishData.GetRodPiece(_rodData.ID);
|
||||
|
||||
RodItemData rodItemData = new RodItemData()
|
||||
{
|
||||
config = dataList[i],
|
||||
isLock = isLock,
|
||||
level = level + 1,
|
||||
star = star,
|
||||
};
|
||||
if (!isLock)
|
||||
{
|
||||
FDM.GetDuelPerk(rodItemData);
|
||||
}
|
||||
|
||||
int skindID = playerFishData.GetRodSkin(_rodData.ID);
|
||||
|
||||
rodItemData.skin = _tables.TbRodSkinData.GetOrDefault(skindID);
|
||||
|
||||
rodItemDatas.Add(rodItemData);
|
||||
}
|
||||
rodItemDatas.Sort(RodItemData.Sort);
|
||||
for (int i = 0; i < rodItemDatas.Count; i++)
|
||||
{
|
||||
GameObject go = Instantiate(item, Content);
|
||||
go.SetActive(true);
|
||||
DuelRodItem rodItem = go.GetComponent<DuelRodItem>();
|
||||
rodItems.Add(rodItem);
|
||||
rodItem.Init(rodItemDatas[i]);
|
||||
rodItem.onClick = OnRodItemClick;
|
||||
|
||||
}
|
||||
currentRodItem = rodItems[0];
|
||||
currentRodItem.SetSelected(true);
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
if (currentRodItem != null && rodItems.Count > 0)
|
||||
{
|
||||
currentRodItem = rodItems[0];
|
||||
currentRodItem.SetSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
void OnRodItemClick(DuelRodItem duelRodItem)
|
||||
{
|
||||
if (duelRodItem.data.isLock)
|
||||
{
|
||||
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_85"));
|
||||
return;
|
||||
}
|
||||
if (currentRodItem != null)
|
||||
{
|
||||
currentRodItem.SetSelected(false);
|
||||
}
|
||||
currentRodItem = duelRodItem;
|
||||
currentRodItem.SetSelected(true);
|
||||
}
|
||||
|
||||
public void SetTimer()
|
||||
{
|
||||
StartCoroutine(Close());
|
||||
}
|
||||
IEnumerator Close()
|
||||
{
|
||||
while (allTime > 0)
|
||||
{
|
||||
p_text.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_41", allTime);
|
||||
allTime--;
|
||||
yield return new WaitForSeconds(1);
|
||||
}
|
||||
p_text.text = LocalizationMgr.GetFormatTextValue("UI_EventFishingDuelPanel_41", 0);
|
||||
OnClickConfrim();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
p_text.text = LocalizationMgr.GetText("UI_COMMON_confirm");
|
||||
StopAllCoroutines();
|
||||
currentRodItem.SetSelected(false);
|
||||
RestartShowHomeUIEvent restartShowHomeUIEvent = new RestartShowHomeUIEvent();
|
||||
GContext.Publish(restartShowHomeUIEvent);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Duel/UI/event_fishingduel_rod_change.cs.meta
Normal file
11
Assets/Scripts/Duel/UI/event_fishingduel_rod_change.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41e5a4872c066174eb9ff1c4f233bee9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user