备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2366063066599e04d844bc0bc9978f0b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,115 @@
using asap.core;
using game;
using System;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
using TMPro;
using GameCore;
public class AdvertButton : MonoBehaviour
{
public Button advBtn;
public Button adticketBtn;
public TMP_Text adticket_text;
public Button advBtnGray;
public Button adticketBtnGray;
public TMP_Text adticket_text_gray;
private IDisposable ads;
private AdvertPopupType curOpenAdType = AdvertPopupType.None;
private Action OnBuySuccess;
private IDisposable disposable;
int quantityRequired = 1;
bool isGray = false;
//private void Awake()
//{
// advBtn = transform.Find("btn_green1").GetComponent<Button>();
// adticketBtn = transform.Find("btn_green2").GetComponent<Button>();
//}
private void Start()
{
advBtn.onClick.AddListener(OnClickAds);
adticketBtn.onClick.AddListener(OnClickCoupon);
}
public void SetData(Action onBuySuccess, AdvertPopupType openAdType)
{
this.OnBuySuccess = onBuySuccess;
this.curOpenAdType = openAdType;
}
private void OnEnable()
{
disposable?.Dispose();
OnAdticketChangeEvent();
disposable = GContext.OnEvent<ResAddEvent>().Where(x => x.id == 1006).Subscribe(x =>
{
OnAdticketChangeEvent();
});
}
void OnAdticketChangeEvent()
{
if (isGray) { return; }
int count = GContext.container.Resolve<PlayerShopData>().GetAdticketCount();
advBtn.gameObject.SetActive(count < quantityRequired);
adticketBtn.gameObject.SetActive(count >= quantityRequired);
adticket_text.text = $"{count}/{quantityRequired}";
}
public void SetGray()
{
int count = GContext.container.Resolve<PlayerShopData>().GetAdticketCount();
advBtn.gameObject.SetActive(false);
adticketBtn.gameObject.SetActive(false);
if (advBtnGray != null)
{
advBtnGray.gameObject.SetActive(count < quantityRequired);
}
if (adticketBtnGray != null)
{
adticketBtnGray.gameObject.SetActive(count >= quantityRequired);
adticket_text_gray.text = $"{count}/{quantityRequired}";
}
}
void OnClickCoupon()
{
if (OnBuySuccess == null)
{
return;
}
//消耗广告券 quantityRequired
GContext.container.Resolve<PlayerShopData>().AddAdticket(-quantityRequired);
OnBuySuccess?.Invoke();
}
void OnClickAds()
{
if (OnBuySuccess == null)
{
return;
}
advBtn.enabled = false;
//拉起广告
AdsDispose();
ads = GContext.OnEvent<AdsResult>().Subscribe(SetResult);
GContext.container.Resolve<IAdsService>().ShowRewarded(curOpenAdType);
}
void SetResult(AdsResult adsResult)
{
AdsDispose();
advBtn.enabled = true;
if (adsResult.Result == 0 && adsResult.Type == curOpenAdType)
{
//广告成功
OnBuySuccess?.Invoke();
}
}
void AdsDispose()
{
ads?.Dispose();
ads = null;
}
private void OnDisable()
{
disposable?.Dispose();
disposable = null;
AdsDispose();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f75cfe94920e1754fbb346025ac3ea2f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using cfg;
using UnityEngine;
using UnityEngine.UI;
public class AdvertGiftItem : MonoBehaviour
{
public bool vipFree;
public AdConfig adConfig;
public RewardItemNew rewardItem1;
public RewardItemNew rewardItem2;
public GameObject done;
public GameObject current;
public AdvertButton btn_watch;
public Button btn_free;
public GameObject unlock;
public GameObject unlock2;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 800e6b282fd800e419c5b040fd385fc0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,147 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UniRx;
public class AdvertGiftPanel : MonoBehaviour
{
Tables _tables;
PlayerShopData shopData;
TMP_Text text_time;
AdvertGiftItem[] advertGiftItems;
Timer timer;
private IDisposable ads;
AdConfig curAdConfig;
AdvertGiftItem advertGiftItem;
private AdvertPopupType _curOpenAdType = AdvertPopupType.None;
private void Awake()
{
_tables = GContext.container.Resolve<Tables>();
shopData = GContext.container.Resolve<PlayerShopData>();
text_time = transform.Find("title2/bg_time/text_info").GetComponent<TMP_Text>();
advertGiftItems = transform.GetComponentsInChildren<AdvertGiftItem>();
}
protected void Start()
{
Init();
StartTimer();
}
void Init()
{
var DataList = _tables.TbAdConfig.DataList;
int viplv = GContext.container.Resolve<PlayerData>().vip;
for (int i = 0; i < advertGiftItems.Length; i++)
{
AdConfig adConfig = DataList[i];
var drop = _tables.TbDrop.GetOrDefault(adConfig.Reward);
var itemDropPackage = _tables.TbItemDropPackage.GetOrDefault(adConfig.Reward);
advertGiftItems[i].adConfig = adConfig;
advertGiftItems[i].vipFree = viplv >= adConfig.VipFree;
advertGiftItems[i].btn_watch.SetData(() =>
{
shopData.AddAdvertCount(curAdConfig.Reward);
//广告成功
OnBuySuccess();
}, AdvertPopupType.Shop);
advertGiftItems[i].btn_free.onClick.AddListener(OnBuySuccess);
if (itemDropPackage.ItemDisplay.Count > 0)
{
List<string> CountDisplay = GContext.container.Resolve<PlayerItemData>().ShowItemDropPackage(itemDropPackage);
advertGiftItems[i].rewardItem1.SetData(itemDropPackage.ItemDisplay[0], CountDisplay[0], true);
advertGiftItems[i].rewardItem2.SetData(itemDropPackage.ItemDisplay[1], CountDisplay[1], true);
}
}
}
async void ReStart()
{
await Awaiters.Seconds(0.5f);
StartTimer();
}
void SetState()
{
shopData.ClearAdvertCount();
int adCount = shopData.VIPAdPackData.index;
for (int i = 0; i < advertGiftItems.Length; i++)
{
advertGiftItems[i].current.SetActive(i == adCount);
advertGiftItems[i].done.SetActive(i < adCount);
advertGiftItems[i].unlock.SetActive(i > adCount);
advertGiftItems[i].unlock2.SetActive(i > adCount);
if (i == adCount)
{
advertGiftItem = advertGiftItems[i];
advertGiftItem.btn_free.gameObject.SetActive(advertGiftItem.vipFree);
advertGiftItem.btn_watch.gameObject.SetActive(!advertGiftItem.vipFree);
curAdConfig = advertGiftItems[i].adConfig;
}
}
}
void StartTimer()
{
if (timer != null)
{
timer.Cancel();
timer = null;
}
var newTime = ZZTimeHelper.UtcNow().UtcNowOffset().Date.AddDays(1);
TimeSpan timeSpan = newTime - ZZTimeHelper.UtcNow().UtcNowOffset();
SetState();
timer = this.AttachTimer((float)timeSpan.TotalSeconds, ReStart, (elapsed) =>
{
TimeSpan now = newTime - ZZTimeHelper.UtcNow().UtcNowOffset();
text_time.text = LocalizationMgr.GetFormatTextValue("UI_COMMON_refresh", $"<size=40>{ConvertTools.ConvertTime2(now)}</size>");
}, useRealTime: true);
}
void OnClickGet()
{
advertGiftItem.btn_watch.enabled = false;
//拉起广告
AdsDispose();
ads = GContext.OnEvent<AdsResult>().Subscribe(SetResult);
_curOpenAdType = AdvertPopupType.Shop;
GContext.container.Resolve<IAdsService>().ShowRewarded(_curOpenAdType);
}
void SetResult(AdsResult adsResult)
{
AdsDispose();
advertGiftItem.btn_watch.enabled = true;
if (adsResult.Result == 0 && adsResult.Type == AdvertPopupType.Shop)
{
shopData.AddAdvertCount(curAdConfig.Reward);
//广告成功
OnBuySuccess();
}
}
void AdsDispose()
{
if (ads != null)
{
_curOpenAdType = AdvertPopupType.None;
ads.Dispose();
ads = null;
}
}
private void OnBuySuccess()
{
GContext.container.Resolve<PlayerItemData>().AddItemByDrop(curAdConfig.Reward);
shopData.SetVIPPackNext();
GContext.Publish(new ShowData());
SetState();
shopData.SetAdvRedPoint();
}
protected void OnDestroy()
{
if (timer != null)
{
timer.Cancel();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1178540a5347431488207b304d81371c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,108 @@
using asap.core;
using DG.Tweening;
using GameCore;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class AdvertData
{
public int ID;
public int index;
public int day;
public string cdTime;
public bool isOpen;
}
public class AdvertPanel : MonoBehaviour
{
Button btn_close;
TMP_Text txt_energy, txt_money, txt_ticket;
ulong _curGold;
int _curEnergy;
int _curTicket;
protected CompositeDisposable disposables = new CompositeDisposable();
private void Awake()
{
txt_ticket = transform.Find("top_area/resource/icon_ticket/text_num").GetComponent<TMP_Text>();
txt_energy = transform.Find("top_area/resource/icon_energy/text_num").GetComponent<TMP_Text>();
txt_money = transform.Find("top_area/resource/icon_money/text_num").GetComponent<TMP_Text>();
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
}
private void Start()
{
var playerData = GContext.container.Resolve<PlayerData>();
_curGold = playerData.gold;
_curEnergy = playerData.Energy;
_curTicket = GContext.container.Resolve<PlayerShopData>().GetAdticketCount();
txt_money.text = ConvertTools.GetNumberString2(_curGold);
txt_energy.text = ConvertTools.GetNumberString2(_curEnergy);
txt_ticket.text = ConvertTools.GetNumberString2(_curTicket);
btn_close.onClick.AddListener(() =>
{
GContext.Publish(new RestartShowHomeUIEvent());
UIManager.Instance.DestroyUI(UITypes.AdvertPanel);
});
GContext.OnEvent<ResAddEvent>().Where(x => x.id == 1002).Subscribe(x =>
{
GoldAddAnim();
}).AddTo(disposables);
GContext.OnEvent<ResAddEvent>().Where(x => x.id == 1001).Subscribe(x =>
{
EnergyAddAnim();
}).AddTo(disposables);
GContext.OnEvent<ResAddEvent>().Where(x => x.id == 1006).Subscribe(x =>
{
TicketAddAnim();
}).AddTo(disposables);
}
//private async System.Threading.Tasks.Task WaitForRewardPanel()
//{
// await new WaitForSeconds(0.5f);
// var rewardPanelTask = new RewardPopupData();
// GContext.Publish(rewardPanelTask);
// if (rewardPanelTask.tcs != null)
// {
// await rewardPanelTask.tcs.Task;
// }
//}
void GoldAddAnim()
{
//await WaitForRewardPanel();
DOTween.Kill("txt_money");
txt_money.text = ConvertTools.GetNumberString2(_curGold);
var EndDiamond = GContext.container.Resolve<PlayerData>().gold;
DOTween.To(() => _curGold, x => _curGold = x, EndDiamond, 1f).OnUpdate(() =>
{
txt_money.text = ConvertTools.GetNumberString2(_curGold);
}).SetId("txt_money");
}
void EnergyAddAnim()
{
//await WaitForRewardPanel();
DOTween.Kill("advert_text_energy");
txt_energy.text = ConvertTools.GetNumberString2(_curEnergy);
var EndEnergy = GContext.container.Resolve<PlayerData>().Energy;
DOTween.To(() => _curEnergy, x => _curEnergy = x, EndEnergy, 1f).OnUpdate(() =>
{
txt_energy.text = ConvertTools.GetNumberString2(_curEnergy);
}).SetId("advert_text_energy");
}
void TicketAddAnim()
{
//await WaitForRewardPanel();
DOTween.Kill("text_ticket");
txt_ticket.text = ConvertTools.GetNumberString2(_curTicket);
var Ticket = GContext.container.Resolve<PlayerShopData>().GetAdticketCount();
DOTween.To(() => _curTicket, x => _curTicket = x, Ticket, 1f).OnUpdate(() =>
{
txt_ticket.text = ConvertTools.GetNumberString2(_curTicket);
}).SetId("text_ticket");
}
private void OnDestroy()
{
disposables.Dispose();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cb21725ac23e8d64ca20b1d66146f141
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,166 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class AdvertRewardPanel : MonoBehaviour
{
Tables _tables;
ShopPackManager packM;
Pack pack;
int num;
RewardItemNew[] rewardItems;
//倒计时
GameObject cd;
TMP_Text text_time;
//购买按钮
Button btn_buy;
AdvertButton btn_advert;
PlayerShopData shopData;
Timer timer;
List<ItemData> itemDataGift;
Daily daily;
private void Awake()
{
shopData = GContext.container.Resolve<PlayerShopData>();
_tables = GContext.container.Resolve<Tables>();
rewardItems = transform.Find("reward_panel").GetComponentsInChildren<RewardItemNew>();
cd = transform.Find("reward_panel/cd").gameObject;
text_time = transform.Find("reward_panel/cd/text_time").GetComponent<TMP_Text>();
btn_buy = transform.Find("reward_panel/btn_free/btn_green").GetComponent<Button>();
btn_advert = transform.Find("reward_panel/AdvertBtn").GetComponent<AdvertButton>();
}
private void Start()
{
btn_buy.onClick.AddListener(OnBuySuccess);
btn_advert.SetData(() =>
{
shopData.AddAdvertCount(packM.ID);
//广告成功
OnBuySuccess();
}, AdvertPopupType.Chest);
var id = GContext.container.Resolve<PlayerData>().priceLevel.DailyGiftPackList[0];
packM = shopData.TbPackManagerGetOrDefault(id);
pack = _tables.TbPack.GetOrDefault(packM.PackID[0]);
num = shopData.GetShopPackBuyCount(packM.ID);
SetTimer();
SetRewardItems();
SetBuy();
}
void OnBuySuccess()
{
num += 1;
shopData.AddShopPackDailyBuyCount("DailyGiftDisplay");
shopData.AddShopPackDailyBuyCount(packM.ID, 1);
GContext.Publish(new ShowData(itemDataGift));
GContext.container.Resolve<PlayerItemData>().AddItem(itemDataGift);
//ShowGiftNoticePanel();
GContext.Publish(new ShowData());
SetBuy();
shopData.SetAdvRedPoint();
#if AGG
using (var e = GEvent.GameEvent("item_change", gaSend: false))
{
e.AddContent("item_id", GContext.container.Resolve<PlayerData>().priceLevel.DailyGiftDisplay)
.AddContent("state_info", "get")
.AddContent("get_times", shopData.GetShopPackBuyCount("DailyGiftDisplay"))
.AddContent("change_num", 1);
}
#endif
}
void SetTimer()
{
DateTime now = ZZTimeHelper.UtcNow().UtcNowOffset();
daily = packM.TimeDefinition as Daily;
var DailyGiftPackList = GContext.container.Resolve<PlayerData>().priceLevel.DailyGiftPackList;
int id;
for (int i = 0; i < DailyGiftPackList.Count; i++)
{
id = DailyGiftPackList[i];
ShopPackManager localPackM = shopData.TbPackManagerGetOrDefault(id);
if (localPackM == null) break;
daily = localPackM.TimeDefinition as Daily;
if (TimeSpan.FromSeconds(daily.StartTime) <= now.TimeOfDay && TimeSpan.FromSeconds(daily.EndTime) > now.TimeOfDay)
{
packM = localPackM;
num = shopData.GetShopPackBuyCount(localPackM.ID);
break;
}
}
TimeSpan ts = TimeSpan.FromSeconds(daily.EndTime) - now.TimeOfDay;
text_time.text = ConvertTools.ConvertTime2(0, ts.Hours, ts.Minutes, ts.Seconds);
if (timer == null)
{
timer = this.AttachTimer((float)ts.TotalSeconds, ReStart,
(elapsed) =>
{
now = ZZTimeHelper.UtcNow().UtcNowOffset();
ts = TimeSpan.FromSeconds(daily.EndTime) - now.TimeOfDay;
text_time.text = ConvertTools.ConvertTime2(0, ts.Hours, ts.Minutes, ts.Seconds);
}, useRealTime: true);
}
}
//void ShowGiftNoticePanel()
//{
// int showGiftNoticePanel = PlayerPrefs.GetInt("GiftNoticePanel", 0);
// ISettingService settingService = GContext.container.Resolve<ISettingService>();
// if (showGiftNoticePanel == 0 && !settingService.Notice)
// {
// _ = UIManager.Instance.ShowUI(UITypes.GiftNoticePanel);
// }
//}
void SetRewardItems()
{
itemDataGift = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropIdAndType(pack.DropID);
for (int i = 0; i < rewardItems.Length; i++)
{
if (i < itemDataGift.Count)
{
rewardItems[i].SetData(itemDataGift[i], isCanClick: true);
}
else
{
rewardItems[i].gameObject.SetActive(false);
}
}
}
void SetBuy()
{
var adConfig = _tables.TbAdConfig.DataList[0];
bool vipFree = adConfig.VipFree <= GContext.container.Resolve<PlayerData>().vip;
if (vipFree)
{
btn_buy.gameObject.SetActive(num <= 1);
btn_advert.gameObject.SetActive(false);
}
else
{
btn_buy.gameObject.SetActive(num == 0);
btn_advert.gameObject.SetActive(num == 1);
}
cd.gameObject.SetActive(num > 1);
}
void ReStart()
{
timer.Cancel();
timer = null;
shopData.InitShopPackData();
num = 0;
SetBuy();
SetTimer();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb198a31a0972a74ca90d5e4fe01268c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,59 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class AdvertShopSlot : MonoBehaviour
{
Button btn_buy;
Image bg;
TMP_Text text_num;
TMP_Text text_price;
Button btn_showItem;
ShopToken shopToken;
IAPItemList iAPItemList;
private void Awake()
{
btn_buy = transform.Find("position/btn_purchase/btn_green").GetComponent<Button>();
btn_showItem = transform.Find("position/reward").GetComponent<Button>();
bg = transform.Find("position/bg").GetComponent<Image>();
text_num = transform.Find("position/text_num").GetComponent<TMP_Text>();
text_price = transform.Find("position/btn_purchase/btn_green/Ani_Container/p_text").GetComponent<TMP_Text>();
btn_buy.onClick.AddListener(OnBuy);
btn_showItem.onClick.AddListener(OnShowItemInfo);
}
public void SetData(cfg.ShopToken shopToken)
{
this.shopToken = shopToken;
text_num.text = shopToken.Number.ToString();
iAPItemList = GContext.container.Resolve<Tables>().TbIAPItemList.GetOrDefault(shopToken.IAPID);
SKUDetailDataEvent sKUDetailDataEvent = new SKUDetailDataEvent(iAPItemList);
GContext.Publish(sKUDetailDataEvent);
text_price.text = sKUDetailDataEvent.price;
}
async void OnBuy()
{
List<ItemData> itemData = new List<ItemData>
{
new ItemData { count = shopToken.Number, id = shopToken.TokenID }
};
btn_buy.enabled = false;
ShopBuyTypeData shopBuyTypeData = new ShopBuyTypeData();
shopBuyTypeData.type = ShopBuyType.ShopToken;
shopBuyTypeData.ID = shopToken.ID;
bool Result = await GContext.container.Resolve<PlayerShopData>().OnBuy(shopToken.TokenID,shopBuyTypeData, iAPItemList, itemData);
btn_buy.enabled = true;
}
void OnShowItemInfo()
{
GContext.container.Resolve<PlayerItemData>().ShowItemTips(1006, btn_showItem.transform);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be486304b4d024e489d25b09e2fdbf81
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using asap.core;
using cfg;
using System.Linq;
using UnityEngine;
public class AdvertTicketPanel : MonoBehaviour
{
AdvertShopSlot[] advertShopSlot;
private void Awake()
{
advertShopSlot = GetComponentsInChildren<AdvertShopSlot>();
}
private void Start()
{
var shopTokens = GContext.container.Resolve<Tables>().TbShopToken.DataList;
var advertShopTokens = shopTokens.Where(x => x.Type == 6).ToArray();
for (int i = 0; i < advertShopTokens.Length; i++)
{
if (i == advertShopSlot.Length)
{
break;
}
advertShopSlot[i].SetData(advertShopTokens[i]);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 05f35e8c7c8bd7842b75ddb0ffaf32a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0af2fbd1ee7b4bf1896e676734ba1f13
timeCreated: 1691466774

View File

@@ -0,0 +1,70 @@
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class AlbumAttribute : MonoBehaviour
{
public static string[] AlbumBg =
{
"bg_album_album_white",
"bg_album_album_blue",
"bg_album_album_purple",
"bg_album_album_yellow",
};
public static string[] sp_album_card_title =
{
"sp_album_card_title_white",
"sp_album_card_title_blue",
"sp_album_card_title_purple",
"sp_album_card_title_yellow",
"sp_album_card_title_yellow",
};
public Image bg_album;
public Image icon;
public Image bg_title;
public TMP_Text[] text_names;
public Image bar;
public TMP_Text text_progress;
public Album data;
#if UNITY_EDITOR
private void Reset()
{
if (icon == null)
{
bg_album = transform.Find("bg_album").GetComponent<Image>();
icon = transform.Find("icon_album").GetComponent<Image>();
bg_title = transform.Find("bg_title").GetComponent<Image>();
// text_name = transform.Find("text_name_yellow").GetComponent<TMP_Text>();
bar = transform.Find("bg_bar/bar").GetComponent<Image>();
text_progress = transform.Find("bg_bar/bar/text_progress").GetComponent<TMP_Text>();
}
}
#endif
public void Init(Album _data)
{
data = _data;
GContext.container.Resolve<IUIService>().SetImageSprite(bg_album, AlbumBg[data.Quality - 1], BasePanel.PanelName);
GContext.container.Resolve<IUIService>().SetImageSprite(icon, data.Image, BasePanel.PanelName);
GContext.container.Resolve<IUIService>().SetImageSprite(bg_title, sp_album_card_title[data.Quality - 1], BasePanel.PanelName);
for (int i = 0; i < text_names.Length; i++)
{
text_names[i].gameObject.SetActive(i == data.Quality - 1);
if (data.Quality - 1 == i)
{
text_names[i].text = LocalizationMgr.GetText(data.Title_l10n_key);
}
}
if (data.Quality > text_names.Length)
{
text_names[^1].text = LocalizationMgr.GetText(data.Title_l10n_key);
text_names[^1].gameObject.SetActive(true);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 244716d9642d432aba62f54a1a0613a2
timeCreated: 1691735046

View File

@@ -0,0 +1,196 @@
using System;
using System.Collections.Generic;
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class AlbumExchangePopupPanel : MonoBehaviour
{
public Button btn_close;
public Button btn_mask;
public TMP_Text text_repetitive_card;
List<AlbumExchange> exhangeList = new List<AlbumExchange>();
List<BntState> bntStates = new List<BntState>();
public SelectPicturePopupPanel selectPicturePopupPanel;
List<RewardItem> rewards = new List<RewardItem>();
private List<Timer> timers = new List<Timer>();
#if UNITY_EDITOR
private void Reset()
{
Awake();
}
#endif
private void Awake()
{
btn_close = transform.Find("btn_close").GetComponent<Button>();
btn_mask = transform.Find("mask").GetComponent<Button>();
text_repetitive_card = transform.Find("root/cost/text_repetitive_card").GetComponent<TMP_Text>();
selectPicturePopupPanel = transform.Find("SelectPicturePopupPanel").GetComponent<SelectPicturePopupPanel>();
selectPicturePopupPanel.gameObject.SetActive(false);
selectPicturePopupPanel.albumExchangePopupPanel = this;
for (int i = 1; i <= 3; i++)
{
GameObject go = transform.Find($"root/list_exchange/Item{i}").gameObject;
rewards.Add(transform.Find($"root/list_exchange/Item{i}/reward").GetComponent<RewardItem>());
BntState bntState = new BntState
{
index = i,
openExchangePopupPanel = OpenExchangePopupPanel,
text_num = go.transform.Find("btn_exchange/btn_green_c/Ani_Container/content_cost/cost/p_text_num").GetComponent<TMP_Text>(),
text_num1 = go.transform.Find("exchange_cd/btn_exchange/btn_green_c/Ani_Container/content_cost/cost/p_text_num").GetComponent<TMP_Text>(),
btn_exchange = go.transform.Find("btn_exchange/btn_green_c").GetComponent<Button>(),
btn_exchange_cd = go.transform.Find("exchange_cd/btn_exchange/btn_green_c").GetComponent<Button>(),
text_time = go.transform.Find("exchange_cd/text_time").GetComponent<TMP_Text>(),
exchange_cd = go.transform.Find("exchange_cd").gameObject,
};
bntState.SetButtonClick();
bntStates.Add(bntState);
}
}
private void Start()
{
List<int> exchangeIdList = GContext.container.Resolve<AlbumData>().theme.ExchangeList;
for (int i = 0; i < rewards.Count; i++)
{
AlbumExchange albumExchange = GContext.container.Resolve<Tables>().GetAlbumExchange(exchangeIdList[i]);
exhangeList.Add(albumExchange);
bntStates[i].SetData(exhangeList[i]);
rewards[i].SetData(albumExchange.ItemID);
}
btn_close.onClick.AddListener(OnClickClose);
btn_mask.onClick.AddListener(OnClickClose);
}
void OnClickClose()
{
UIManager.Instance.HideUI(UITypes.AlbumExchangePopupPanel);
}
private void OnEnable()
{
int count = GContext.container.Resolve<AlbumData>().GetPictureRepeatCount();
text_repetitive_card.text = LocalizationMgr.GetFormatTextValue("UI_AlbumExchangePopupPanel_101002", count);
for (int i = 0; i < bntStates.Count; i++)
{
int index = i;
float endTimer = GContext.container.Resolve<AlbumData>().GetExchangeCd(index);
if (endTimer > 0.001f)
{
SetTimer(index, endTimer);
}
else
{
bntStates[index].SetTimeShow(0);
}
}
}
private void OnDisable()
{
foreach (var t in timers)
{
t.Cancel();
}
timers.Clear();
}
//打开兑换弹窗
public void OpenExchangePopupPanel(int index)
{
selectPicturePopupPanel.OpenExchangePopupPanel(index);
}
public void SetTimer(int index, float cd)
{
bntStates[index].SetTimeShow(cd);
Timer timer = this.AttachTimer(cd, () =>
{
GContext.container.Resolve<AlbumData>().RemoveExchangeCd(index);
bntStates[index].SetTimeShow(0);
},
(elapsed) => { bntStates[index].SetTimeText(cd - elapsed); }, useRealTime: true);
timers.Add(timer);
}
class BntState
{
//是否可以兑换
private bool isCanExchange;
public int index;
public TMP_Text text_time;
public Button btn_exchange;
public Button btn_exchange_cd;
public GameObject exchange_cd;
public TMP_Text text_num;
public TMP_Text text_num1;
public Action<int> openExchangePopupPanel;
private float exchangeTime;
public void SetButtonClick()
{
btn_exchange.onClick.AddListener(() =>
{
//打开兑换弹窗
openExchangePopupPanel?.Invoke(index - 1);
});
btn_exchange_cd.onClick.AddListener(() =>
{
if (exchangeTime > 0.001)
{
ToastPanel.Show(LocalizationMgr.GetFormatTextValue("UI_ToastPanel_6",text_time.text));
}
else
{
//打开兑换弹窗
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_7"));
}
});
}
public void SetData(AlbumExchange albumExchange)
{
isCanExchange = albumExchange.PictureRequired <= GContext.container.Resolve<AlbumData>().GetPictureRepeatCount();
text_num.text = albumExchange.PictureRequired.ToString();
text_num1.text = albumExchange.PictureRequired.ToString();
SetBtnShow();
}
public void SetTimeShow(float _exchangeTime)
{
exchangeTime = _exchangeTime;
if (exchangeTime > 0.001f)
{
text_time.gameObject.SetActive(true);
SetTimeText(exchangeTime);
}
else
{
text_time.gameObject.SetActive(false);
}
SetBtnShow();
}
void SetBtnShow()
{
btn_exchange.gameObject.SetActive(isCanExchange && exchangeTime < 0.001);
exchange_cd.gameObject.SetActive(!isCanExchange || exchangeTime > 0.001);
}
public void SetTimeText(float _exchangeTime)
{
exchangeTime = _exchangeTime;
TimeSpan now = TimeSpan.FromSeconds(exchangeTime);
text_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
//text_time.text = ConvertTools.ConvertTime((int)exchangeTime);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3c230b686774457d906456bbbc3a7550
timeCreated: 1691562884

View File

@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using asap.core;
using cfg;
using game;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class AlbumPictureReviewPopupPanel : MonoBehaviour
{
public Button btn_close;
public Button btn_mask;
// public GameObject mask_empty;
public TMP_Text text_left_time;
public TMP_Text text_tips;
public TMP_Text text_disable;
public Button btn_askforfriend;
public Button btn_join;
public PictureItem pictureItem;
int count = 0;
ClubService _socialData;
Picture data;
private void Awake()
{
_socialData = GContext.container.Resolve<ClubService>();
pictureItem = transform.Find("root/album_photo").GetComponent<PictureItem>();
btn_close = transform.Find("btn_close").GetComponent<Button>();
btn_mask = transform.Find("mask").GetComponent<Button>();
text_left_time = transform.Find("root/text_left_time").GetComponent<TMP_Text>();
text_tips = transform.Find("root/text_tips").GetComponent<TMP_Text>();
text_disable = transform.Find("root/text_disable").GetComponent<TMP_Text>();
btn_askforfriend = transform.Find("root/btn_askforfriend/btn_green").GetComponent<Button>();
btn_join = transform.Find("root/btn_join/btn_green").GetComponent<Button>();
}
private void Start()
{
btn_close.onClick.AddListener(OnClickClose);
btn_mask.onClick.AddListener(OnClickClose);
btn_askforfriend.onClick.AddListener(OnClickDown);
btn_join.onClick.AddListener(OnClickJoin);
}
void OnClickClose()
{
UIManager.Instance.HideUI(UITypes.AlbumPictureReviewPopupPanel);
}
async void OnClickJoin()
{
if (GContext.container.Resolve<ClubService>().IsOpenClubJoined)
{
GContext.Publish(new VibrationData(HapticTypes.LightImpact));
btn_join.enabled = false;
//打开俱乐部界面
await UIManager.Instance.ShowUI(UITypes.FishingSocialPanel);
btn_join.enabled = true;
OnClickClose();
}
else
{
GContext.Publish(new VibrationData(HapticTypes.Failure));
ToastPanel.Show(GContext.container.Resolve<FishingEventData>().GetTipforUnlocked(GContext.container.Resolve<ClubService>().socialTipforUnlocked));
}
}
async void OnClickDown()
{
if (GContext.container.Resolve<AlbumData>().GetPhotoRequestCountByDay() < GContext.container.Resolve<Tables>().TbGlobalConfig.PictureGiftedLimitDaily)
{
btn_askforfriend.enabled = false;
//社交求助帖
bool resut = await _socialData.SendGetPhoto(data.ID);
if (resut)
{
int giftToFriendsDay = GContext.container.Resolve<AlbumData>().SetPhotoRequestCountByDay();
int PictureGiftedLimitDaily = GContext.container.Resolve<Tables>().TbGlobalConfig.PictureGiftedLimitDaily;
text_left_time.text = LocalizationMgr.GetFormatTextValue("UI_AlbumPictureReviewPopupPanel_101001",
PictureGiftedLimitDaily - giftToFriendsDay,
PictureGiftedLimitDaily);
//ToastPanel求助成功
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_37"));
GContext.container.Resolve<AlbumData>().UpdatePlayerStatistics();
}
btn_askforfriend.enabled = true;
}
else
{
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_8"));
}
}
public void SetData(Picture _data)
{
data = _data;
gameObject.SetActive(true);
pictureItem.SetData(_data, null);
//pictureAttribute.Init(_data);
SetState();
}
void SetState()
{
count = GContext.container.Resolve<AlbumData>().GetPictureProgress(data.ID);
// mask_empty.SetActive(count <= 0);
// img_card.gameObject.SetActive(count > 0);
//pictureAttribute.text_num.transform.parent.gameObject.SetActive(count > 1);
bool isJoin = _socialData.IsClubJoined();
text_left_time.gameObject.SetActive(false);
text_tips.gameObject.SetActive(false);
btn_askforfriend.gameObject.SetActive(false);
btn_join.gameObject.SetActive(false);
if (!data.IsTradable)
{
text_disable.gameObject.SetActive(true);
return;
}
else
{
text_disable.gameObject.SetActive(false);
}
if (count <= 0)
{
if (isJoin)
{
text_left_time.gameObject.SetActive(true);
int giftToFriendsDay = GContext.container.Resolve<AlbumData>().GetPhotoRequestCountByDay();
int PictureGiftedLimitDaily = GContext.container.Resolve<Tables>().TbGlobalConfig.PictureGiftedLimitDaily;
text_left_time.text = LocalizationMgr.GetFormatTextValue("UI_AlbumPictureReviewPopupPanel_101001",
PictureGiftedLimitDaily - giftToFriendsDay,
PictureGiftedLimitDaily);
btn_askforfriend.gameObject.SetActive(true);
}
else
{
text_tips.gameObject.SetActive(true);
btn_join.gameObject.SetActive(true);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0af57c6d0e554a2681c1a4fb669843ab
timeCreated: 1691492551

View File

@@ -0,0 +1,68 @@
using cfg;
using System;
using UnityEngine;
using UnityEngine.UI;
public class ExchangePictureItem : MonoBehaviour
{
public GameObject selected;
public Button btn_click;
public Action<ExchangePictureItem> action;
public PictureAttribute pictureAttribute;
public int index;
bool isShow;
public ExchangePictureItemData itemData;
public void Awake()
{
pictureAttribute = transform.Find("Item").GetComponent<PictureAttribute>();
btn_click = transform.Find("Item").GetComponent<Button>();
selected = transform.Find("Item/selected").gameObject;
if (isShow)
{
Show();
}
isShow = true;
}
private void Start()
{
btn_click.onClick.AddListener(OnClick);
}
public void SetData(ExchangePictureItemData _data, Action<ExchangePictureItem> _action)
{
itemData = _data;
index = _data.index;
action = _action;
if (isShow)
{
Show();
}
isShow = true;
}
void Show()
{
pictureAttribute.Init(itemData.data);
SetSelected(itemData.isSelect);
}
public void SetSelected(bool isSelect)
{
selected.SetActive(isSelect);
}
public void OnClick()
{
action?.Invoke(this);
}
}
public class ExchangePictureItemData
{
public Picture data;
public int index;
public bool isSelect;
public ExchangePictureItemData(int index, Picture data)
{
this.index = index;
this.data = data;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 43f15a6cf497c074c9f1a3ea40f530a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class ExchangePictureItemGroup : PanelItemBase<ExchangePictureItemGroupData>
{
List<ExchangePictureItem> pictureItems = new List<ExchangePictureItem>();
private void Awake()
{
for (int i = 0; i < 3; i++)
{
GameObject go = transform.Find($"album_photo{i}").gameObject;
pictureItems.Add(go.AddComponent<ExchangePictureItem>());
}
}
public override void OnInit()
{
int count = data.exchangePictureItemDatas.Count;
for (int i = 0; i < 3; i++)
{
if (i < count)
{
pictureItems[i].gameObject.SetActive(true);
pictureItems[i].SetData(data.exchangePictureItemDatas[i], data.action);
}
else
{
pictureItems[i].gameObject.SetActive(false);
}
}
}
}
public class ExchangePictureItemGroupData
{
public List<ExchangePictureItemData> exchangePictureItemDatas = new List<ExchangePictureItemData>();
public Action<ExchangePictureItem> action;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ff8e0195f989e64c8b6ba5f37a7f1a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,273 @@
using System;
using System.Collections.Generic;
using asap.core;
using cfg;
using game;
using GameCore;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class FishingAlbumPanel : BasePanel
{
//赛季名称
public TMP_Text text_season_name;
public Button btn_questionmark;
public Button btn_bottom;
public Button btn_close;
//兑换按钮
public Button btn_exchange;
//赛季背景
public Image bg_season;
//赛季图标
public Image icon_season;
//收集进度Text
public TMP_Text text_progress;
public Image bar;
//剩余时间Text
public TMP_Text text_time;
//奖励数组
public RewardItem[] rewards;
public GameObject albumItem;
List<AlbumItem> albumItems = new List<AlbumItem>();
public Transform content;
private Theme theme;
List<Album> albumList = new List<Album>();
private FishingAlbumPopupPanel fishingAlbumPopupPanel;
List<ItemData> dropPackageList;
public GameObject AlbumInfoPopupPanel;
public Button btn_close_inif;
public Button btn_close_inif_mask;
#if UNITY_EDITOR
private void Reset()
{
Awake();
}
#endif
private void Awake()
{
text_season_name = transform.Find("root/title/text_title").GetComponent<TMP_Text>();
btn_questionmark = transform.Find("root/title/btn_questionmark").GetComponent<Button>();
btn_bottom = transform.Find("root/btn_close/bg_bottom").GetComponent<Button>();
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
btn_exchange = transform.Find("root/btn_reward").GetComponent<Button>();
bg_season = transform.Find("root/bg_title").GetComponent<Image>();
icon_season = transform.Find("root/bg_title/icon_integral").GetComponent<Image>();
text_progress = transform.Find("root/bg_title/bg_bar/text_progress").GetComponent<TMP_Text>();
bar = transform.Find("root/bg_title/bg_bar/bar").GetComponent<Image>();
text_time = transform.Find("root/bg_title/time/text_time").GetComponent<TMP_Text>();
rewards = new RewardItem[3];
rewards[0] = transform.Find("root/bg_title/reward_panel/reward1").GetComponent<RewardItem>();
rewards[1] = transform.Find("root/bg_title/reward_panel/reward2").GetComponent<RewardItem>();
rewards[2] = transform.Find("root/bg_title/reward_panel/reward3").GetComponent<RewardItem>();
content = transform.Find("root/panel_card/ScrollView/Viewport/Content").GetComponent<Transform>();
AlbumInfoPopupPanel = transform.Find("AlbumInfoPopupPanel").gameObject;
btn_close_inif = transform.Find("AlbumInfoPopupPanel/btn_close").GetComponent<Button>();
btn_close_inif_mask = transform.Find("AlbumInfoPopupPanel/mask").GetComponent<Button>();
albumItem = transform.Find("root/panel_card/ScrollView/Viewport/Content/album").gameObject;
theme = GContext.container.Resolve<AlbumData>().theme ?? GContext.container.Resolve<Tables>().TbTheme.DataList[0];
for (int i = 0; i < theme.AlbumList.Count; i++)
{
albumList.Add(GContext.container.Resolve<Tables>().TbAlbum[theme.AlbumList[i]]);
}
dropPackageList = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(theme.CollectionReward);
}
protected override void Start()
{
base.Start();
GContext.OnEvent<RewardPanelClose>().Subscribe(_ => SetProgress()).AddTo(disposables);
AlbumInfoPopupPanel.SetActive(false);
albumItem.SetActive(false);
btn_questionmark.onClick.AddListener(() => AlbumInfoPopupPanel.SetActive(true));
btn_close.onClick.AddListener(OnClickClose);
btn_bottom.onClick.AddListener(OnClickClose);
btn_exchange.onClick.AddListener(OnClickExchange);
btn_close_inif.onClick.AddListener(() => AlbumInfoPopupPanel.SetActive(false));
btn_close_inif_mask.onClick.AddListener(() => AlbumInfoPopupPanel.SetActive(false));
text_season_name.text = LocalizationMgr.GetText(theme.Title_l10n_key);
// bg_season.sprite = ResourceManager.Instance.GetSprite(theme.Season_bg);
// icon_season.sprite = ResourceManager.Instance.GetSprite(theme.Season_icon);
for (int i = 0; i < albumList.Count; i++)
{
var go = Instantiate(albumItem, content);
go.SetActive(true);
go.name = i.ToString();
go.AddComponent<AlbumItem>();
albumItems.Add(go.GetComponent<AlbumItem>());
}
for (int i = 0; i < rewards.Length; i++)
{
if (dropPackageList.Count > i)
{
rewards[i].SetData(dropPackageList[i]);
}
else
{
rewards[i].gameObject.SetActive(false);
}
}
SetTime();
SetProgress();
GContext.Publish(new OnEventTriggerGuide(GetType().Name));
}
void SetAlbumItem()
{
for (int i = 0; i < albumItems.Count; i++)
{
albumItems[i].SetData(i, albumList[i], OnClickAlbumItem);
}
}
bool isShowing = false;
async void OnClickAlbumItem(AlbumItem item)
{
if (isShowing)
{
return;
}
if (fishingAlbumPopupPanel == null)
{
isShowing = true;
GameObject panel = await UIManager.Instance.GetUIAsync(UITypes.FishingAlbumPopupPanel);
fishingAlbumPopupPanel = panel.GetComponent<FishingAlbumPopupPanel>();
fishingAlbumPopupPanel.albumList = albumList;
isShowing = false;
}
fishingAlbumPopupPanel.SetData(item.index);
}
void OnClickClose()
{
UIManager.Instance.DestroyUI(UITypes.FishingAlbumPanel);
}
async void OnClickExchange()
{
btn_exchange.enabled = false;
await UIManager.Instance.ShowUI(UITypes.AlbumExchangePopupPanel);
btn_exchange.enabled = true;
}
//设置赛季倒计时
void SetTime()
{
DateTime endTime = GContext.container.Resolve<AlbumData>().GetAlbumEndTime();
TimeSpan data = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
text_time.text = LocalizationMgr.GetFormatTextValue("UI_FishingAlbumPanel_101002",
data.TotalDays.ToString("00") + "d" + data.Hours.ToString("00") + "h");
// $"剩余时间{data.TotalDays:00}天{data.Hours:00}小时";
}
//设置收集进度
void SetProgress()
{
SetAlbumItem();
int count = albumList.Count;
int fishAlbumProgress = 0;
int allAlbumProgress = 0;
for (int i = 0; i < count; i++)
{
//if ( Instance.Album.GetAlbumProgress(albumList[i].PictureList) >= albumList[i].PictureList.Count)
//{
// fishAlbumProgress++;
//}
fishAlbumProgress += GContext.container.Resolve<AlbumData>().GetAlbumProgress(albumList[i].PictureList);
allAlbumProgress += albumList[i].PictureList.Count;
}
if (fishAlbumProgress >= allAlbumProgress)
{
for (int i = 0; i < rewards.Length; i++)
{
rewards[i].SetReceived(true);
}
}
text_progress.text = $"{fishAlbumProgress}/{allAlbumProgress}";
if (bar)
bar.fillAmount = (float)fishAlbumProgress / allAlbumProgress;
}
private void OnDisable()
{
RestartShowHomeUIEvent restartShowHomeUIEvent = new RestartShowHomeUIEvent();
GContext.Publish(restartShowHomeUIEvent);
}
protected override void OnDestroy()
{
UIManager.Instance.DestroyUI(UITypes.FishingAlbumPopupPanel);
UIManager.Instance.DestroyUI(UITypes.AlbumExchangePopupPanel);
base.OnDestroy();
}
}
public class AlbumItem : MonoBehaviour
{
public Button btn_click;
Action<AlbumItem> action;
public int index;
public AlbumAttribute albumAttribute;
public GameObject done;
public UIRedPoint red;
private void Awake()
{
albumAttribute = transform.GetComponent<AlbumAttribute>();
btn_click = transform.GetComponent<Button>();
done = albumAttribute.bar.transform.Find("done").gameObject;
red = transform.Find("redpoint").GetComponent<UIRedPoint>();
}
private void Start()
{
btn_click.onClick.AddListener(OnClick);
GContext.container.Resolve<AlbumData>().SetAlubmRed(RedPointName.Home_Album_ID, false);
}
public void SetData(int _index, Album _data, Action<AlbumItem> _action)
{
red.SetKey("Album" + _index);
index = _index;
action = _action;
albumAttribute.Init(_data);
int count = GContext.container.Resolve<AlbumData>().GetAlbumProgress(albumAttribute.data.PictureList);
for (int i = 0; i < albumAttribute.data.PictureList.Count; i++)
{
if (GContext.container.Resolve<AlbumData>().IsNewPicture(albumAttribute.data.PictureList[i]))
{
RedPointManager.Instance.SetRedPointState("Album" + index, true);
break;
}
}
if (count >= albumAttribute.data.PictureList.Count)
{
albumAttribute.bar.fillAmount = 1;
albumAttribute.text_progress.text = "";
done.SetActive(true);
}
else
{
done.SetActive(false);
albumAttribute.bar.fillAmount = (float)count / albumAttribute.data.PictureList.Count;
albumAttribute.text_progress.text =
$"{GContext.container.Resolve<AlbumData>().GetAlbumProgress(albumAttribute.data.PictureList)}/{albumAttribute.data.PictureList.Count}";
}
}
public void OnClick()
{
action?.Invoke(this);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2170d55c59b445f3a07516cf101031eb
timeCreated: 1691466784

View File

@@ -0,0 +1,239 @@
using System;
using System.Collections.Generic;
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class FishingAlbumPopupPanel : MonoBehaviour
{
public static string[] AlbumBg =
{
"bg_album_album_white",
"bg_album_album_blue",
"bg_album_album_purple",
"bg_album_album_yellow",
};
public Button btn_close;
public Button btn_mask;
public AlbumAttribute albumAttribute;
public TMP_Text text_progress;
public RewardItem[] rewards;
public GameObject pictureItem;
public Transform content;
public ScrollRect scrollRect;
List<Picture> pictureList = new List<Picture>();
private List<ItemData> dropPackageList;
List<PictureItem> pictureItems = new List<PictureItem>();
public List<Album> albumList = new List<Album>();
public TMP_Text text_page;
public Button btn_left;
public Button btn_right;
public GameObject btn_left_icon;
public GameObject btn_left_icon_gray;
public GameObject btn_right_icon;
public GameObject btn_right_icon_gray;
int currentAlbumIndex = 0;
private void Awake()
{
btn_close = transform.Find("btn_close").GetComponent<Button>();
btn_mask = transform.Find("mask").GetComponent<Button>();
albumAttribute = transform.Find("root/album").GetComponent<AlbumAttribute>();
text_progress = transform.Find("root/reward_panel/text_reward").GetComponent<TMP_Text>();
rewards = new RewardItem[3];
rewards[0] = transform.Find("root/reward_panel/reward1").GetComponent<RewardItem>();
rewards[1] = transform.Find("root/reward_panel/reward2").GetComponent<RewardItem>();
rewards[2] = transform.Find("root/reward_panel/reward3").GetComponent<RewardItem>();
pictureItem = transform.Find("root/panel_card/ScrollView/Viewport/Content/album_photo").gameObject;
content = transform.Find("root/panel_card/ScrollView/Viewport/Content").GetComponent<Transform>();
scrollRect = transform.Find("root/panel_card/ScrollView").GetComponent<ScrollRect>();
text_page = transform.Find("root/text_page").GetComponent<TMP_Text>();
btn_left = transform.Find("btn_close/btn_arrow_left").GetComponent<Button>();
btn_right = transform.Find("btn_close/btn_arrow_right").GetComponent<Button>();
btn_left_icon = transform.Find("btn_close/btn_arrow_left/icon").gameObject;
btn_left_icon_gray = transform.Find("btn_close/btn_arrow_left/icon_gray").gameObject;
btn_right_icon = transform.Find("btn_close/btn_arrow_right/icon").gameObject;
btn_right_icon_gray = transform.Find("btn_close/btn_arrow_right/icon_gray").gameObject;
}
private void Start()
{
pictureItem.SetActive(false);
btn_close.onClick.AddListener(OnClickClose);
btn_mask.onClick.AddListener(OnClickClose);
btn_left.onClick.AddListener(OnLeftClick);
btn_right.onClick.AddListener(OnRightClick);
}
private void OnEnable()
{
GContext.Publish(new OnEventTriggerGuide(GetType().Name));
}
private void OnDisable()
{
GContext.Publish(new OnEventTriggerGuide(GetType().Name));
}
private void Update()
{
//左右滑动屏幕一半距离触发OnLeftClick或OnRightClick
if (Input.GetMouseButtonDown(0))
{
OnBeginDrag();
}
if (Input.GetMouseButtonUp(0))
{
OnEndDrag();
}
}
float beginDragPosX = 0;
void OnBeginDrag()
{
beginDragPosX = Input.mousePosition.x;
}
void OnEndDrag()
{
//滑动屏幕一半距离触发OnLeftClick或OnRightClick
if (Mathf.Abs(Input.mousePosition.x - beginDragPosX) > Screen.width / 4)
{
if (Input.mousePosition.x > beginDragPosX)
{
OnLeftClick();
}
else
{
OnRightClick();
}
}
}
void OnClickClose()
{
UIManager.Instance.HideUI(UITypes.FishingAlbumPopupPanel);
}
public void OnLeftClick()
{
if (currentAlbumIndex > 0)
{
SetData(currentAlbumIndex - 1);
}
}
public void OnRightClick()
{
if (currentAlbumIndex < albumList.Count - 1)
{
SetData(currentAlbumIndex + 1);
}
}
public void SetData(int index)
{
currentAlbumIndex = index;
btn_left_icon.SetActive(index > 0);
btn_left_icon_gray.SetActive(index <= 0);
btn_right_icon.SetActive(index < albumList.Count - 1);
btn_right_icon_gray.SetActive(index >= albumList.Count - 1);
text_page.text = $"{index + 1}/{albumList.Count}";
Album album = albumList[index];
albumAttribute.Init(album);
pictureList.Clear();
foreach (var t in album.PictureList)
{
pictureList.Add(GContext.container.Resolve<Tables>().TbPicture[t]);
}
dropPackageList = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(album.CollectionReward);
gameObject.SetActive(true);
SetItem();
SetReward();
}
void SetItem()
{
int count = pictureItems.Count;
for (int i = 0; i < count; i++)
{
pictureItems[i].gameObject.SetActive(false);
}
for (int i = 0; i < pictureList.Count; i++)
{
if (count <= i)
{
var go = Instantiate(pictureItem, content);
go.SetActive(true);
go.name = i.ToString();
go.AddComponent<PictureItem>().SetData(pictureList[i], OnClickPictureItem);
pictureItems.Add(go.GetComponent<PictureItem>());
}
else
{
pictureItems[i].gameObject.SetActive(true);
pictureItems[i].SetData(pictureList[i], OnClickPictureItem);
}
}
RedPointManager.Instance.SetRedPointState("Album" + currentAlbumIndex, false);
}
void SetReward()
{
for (int i = 0; i < rewards.Length; i++)
{
if (dropPackageList.Count > i)
{
rewards[i].SetData(dropPackageList[i]);
// rewards[i].btn_click.onClick.AddListener(() =>
// {
// //TODO
// });
}
else
{
rewards[i].gameObject.SetActive(false);
}
}
int count = pictureList.Count;
int fishPictureProgress = 0;
for (int i = 0; i < count; i++)
{
if (GContext.container.Resolve<AlbumData>().GetPictureProgress(pictureList[i].ID) > 0)
{
fishPictureProgress++;
}
}
if (fishPictureProgress >= count)
{
for (int i = 0; i < rewards.Length; i++)
{
rewards[i].SetReceived(true);
}
}
text_progress.text = fishPictureProgress >= count
? LocalizationMgr.GetFormatTextValue("UI_FishingAlbumPanel_101003", count, count)
: LocalizationMgr.GetFormatTextValue("UI_FishingAlbumPanel_101003", fishPictureProgress, count);
}
bool isClick = false;
async void OnClickPictureItem(PictureItem item)
{
if (isClick)
{
return;
}
isClick = true;
(await UIManager.Instance.ShowUI(UITypes.AlbumPictureReviewPopupPanel)).GetComponent<AlbumPictureReviewPopupPanel>().SetData(item.pictureAttribute.data);
isClick = false;
}
private void OnDestroy()
{
UIManager.Instance.DestroyUI(UITypes.AlbumPictureReviewPopupPanel);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9f8fb4f6053f4b3d9ded779ea69c9c82
timeCreated: 1691486363

View File

@@ -0,0 +1,108 @@
using System.Collections.Generic;
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class PictureAttribute : MonoBehaviour
{
string[] sp_bg_card_string =
{
"sp_album_card_bg_white",
"sp_album_card_bg_blue",
"sp_album_card_bg_purple",
"sp_album_card_bg_yellow",
"sp_album_card_bg_yellow"
};
[HideInInspector]
public Image img_card;
Image sp_bg_card;
Image bg_title;
public TMP_Text[] text_names;
List<GameObject> starList = new List<GameObject>();
[HideInInspector]
public TMP_Text text_num;
public Picture data;
[HideInInspector]
public GameObject newTag;
bool isShow;
bool newState;
private void Awake()
{
InitPanel();
if (isShow)
{
Show();
}
isShow = true;
}
void InitPanel()
{
img_card = transform.Find("img_card").GetComponent<Image>();
sp_bg_card = transform.Find("sp_bg_card").GetComponent<Image>();
bg_title = transform.Find("bg_title").GetComponent<Image>();
newTag = transform.Find("new")?.gameObject;
text_num = transform.Find("extra_card/text_extra_card").GetComponent<TMP_Text>();
Transform star = transform.Find("star");
int count = star.childCount;
for (int i = 0; i < count; i++)
{
starList.Add(star.GetChild(i).gameObject);
}
}
public void Init(Picture _data)
{
data = _data;
if (isShow)
{
Show();
}
isShow = true;
}
public void SetNewState(bool newState)
{
this.newState = newState;
if (newTag != null)
{
newTag.SetActive(newState);
}
}
void Show()
{
if (newTag != null)
{
newTag.SetActive(newState);
}
GContext.container.Resolve<IUIService>().SetImageSprite(sp_bg_card, sp_bg_card_string[data.Quality - 1], BasePanel.PanelName);
GContext.container.Resolve<IUIService>().SetImageSprite(bg_title, AlbumAttribute.sp_album_card_title[data.Quality - 1], BasePanel.PanelName);
GContext.container.Resolve<IUIService>().SetImageSprite(img_card, data.Image, BasePanel.PanelName);
for (int i = 0; i < text_names.Length; i++)
{
text_names[i].gameObject.SetActive(i == data.Quality - 1);
if (data.Quality - 1 == i)
{
text_names[i].text = LocalizationMgr.GetText(data.Title_l10n_key);
}
}
if (data.Quality > text_names.Length)
{
text_names[^1].text = LocalizationMgr.GetText(data.Title_l10n_key);
text_names[^1].gameObject.SetActive(true);
}
for (int i = 0; i < starList.Count; i++)
{
starList[i].SetActive(i == data.Quality - 1);
}
if (data.Quality > starList.Count)
{
starList[^1].gameObject.SetActive(true);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a2c6dc6e648549899eed3287e3846e2b
timeCreated: 1691652601

View File

@@ -0,0 +1,61 @@
using asap.core;
using cfg;
using GameCore;
using System;
using UnityEngine;
using UnityEngine.UI;
public class PictureItem : MonoBehaviour
{
public Button btn_click;
public GameObject mask_empty;
Action<PictureItem> action;
public PictureAttribute pictureAttribute;
public GameObject effect_kapai_loop;
public GameObject effect_tuowei;
private void Awake()
{
pictureAttribute = transform.Find("Item").GetComponent<PictureAttribute>();
mask_empty = transform.Find("Item/mask_empty").gameObject;
btn_click = transform.Find("Item").GetComponent<Button>();
//Transform star = transform.Find("Item/star");
effect_kapai_loop = transform.Find("effect_kapai_loop").gameObject;
effect_tuowei = transform.Find("effect_tuowei").gameObject;
}
private void Start()
{
btn_click.onClick.AddListener(OnClick);
}
public void SetData(Picture _data, Action<PictureItem> _action, bool isChat = false)
{
effect_kapai_loop.SetActive(!_data.IsTradable);
effect_tuowei.SetActive(!_data.IsTradable);
action = _action;
pictureAttribute.Init(_data);
int count = GContext.container.Resolve<AlbumData>().GetPictureProgress(pictureAttribute.data.ID);
mask_empty.SetActive(count <= 0);
pictureAttribute.img_card.gameObject.SetActive(count > 0);
if (isChat)
{
return;
}
pictureAttribute.text_num.transform.parent.gameObject.SetActive(count > 1);
if (count > 1)
{
pictureAttribute.text_num.text = $"+{count - 1}";
}
bool isNew = GContext.container.Resolve<AlbumData>().IsNewPicture(pictureAttribute.data.ID);
pictureAttribute.SetNewState(isNew);
if (isNew)
{
GContext.container.Resolve<AlbumData>().RemoveNewPicture(pictureAttribute.data.ID);
}
}
public void OnClick()
{
action?.Invoke(this);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9703e8a95f0cfe84796e4d35e9919085
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,176 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SelectPicturePopupPanel : MonoBehaviour
{
List<AlbumExchange> exhangeList = new List<AlbumExchange>();
public AlbumExchangePopupPanel albumExchangePopupPanel;
public Button btn_close_sub;
public Button btn_close_sub1;
public TMP_Text text_title;//UI_SelectPicturePopupPanel_1
PanelScroll scrollRect;
float itemHigh;
public GameObject pictureItem;
public Toggle toggle_all;
public TMP_Text text_check;
public Button btn_exchange;
List<ExchangePictureItemData> exchangePictureItemDatas = new List<ExchangePictureItemData>();
List<ExchangePictureItemGroupData> exchangePictureItemGroupDatas = new List<ExchangePictureItemGroupData>();
List<Picture> pictureList;
//选中卡牌
Dictionary<int, int> selectPicture = new Dictionary<int, int>();
private int selectIndex = -1;
private float _CD = 3600;
private void Awake()
{
btn_close_sub = transform.Find("mask").GetComponent<Button>();
btn_close_sub1 = transform.Find("btn_close").GetComponent<Button>();
text_title = transform.Find("root/text_title").GetComponent<TMP_Text>();
scrollRect = transform.Find("root/panel_card/ScrollView").GetComponent<PanelScroll>();
pictureItem = transform.Find("root/panel_card/ScrollView/Viewport/Content/Item").gameObject;
toggle_all = transform.Find("root/autoselect/checkpoint").GetComponent<Toggle>();
text_check = transform.Find("root/autoselect/text_check").GetComponent<TMP_Text>();
btn_exchange = transform.Find("root/btn_sure/btn_green").GetComponent<Button>();
pictureItem.SetActive(false);
List<int> exchangeIdList = GContext.container.Resolve<AlbumData>().theme.ExchangeList;
for (int i = 0; i < 3; i++)
{
AlbumExchange albumExchange = GContext.container.Resolve<Tables>().GetAlbumExchange(exchangeIdList[i]);
exhangeList.Add(albumExchange);
}
itemHigh = pictureItem.GetComponent<RectTransform>().sizeDelta.y;
}
private void Start()
{
btn_close_sub.onClick.AddListener(() => { gameObject.SetActive(false); });
btn_close_sub1.onClick.AddListener(() => { gameObject.SetActive(false); });
toggle_all.onValueChanged.AddListener(OnToggleChange);
btn_exchange.onClick.AddListener(OnClickExchange);
}
public void OpenExchangePopupPanel(int index)
{
gameObject.SetActive(true);
selectIndex = index;
//设置兑换弹窗数据
SetExchangeItem();
text_check.text = LocalizationMgr.GetFormatTextValue("UI_SelectPicturePopupPanel_2", exhangeList[selectIndex].PictureRequired);
//按钮不置灰
// btn_exchange.interactable = true;
}
void OnToggleChange(bool isOn)
{
selectPicture.Clear();
int count = exchangePictureItemDatas.Count;
//设置兑换弹窗数据
for (int i = 0; i < count; i++)
{
if (i < exhangeList[selectIndex].PictureRequired && isOn)
{
selectPicture[i] = exchangePictureItemDatas[i].data.ID;
}
exchangePictureItemDatas[i].isSelect = i < exhangeList[selectIndex].PictureRequired && isOn;
}
//刷新列表
SetTitle();
scrollRect.Refresh();
}
void SetTitle()
{
text_title.text = $"{LocalizationMgr.GetText("UI_SelectPicturePopupPanel_1")}({selectPicture.Count}/{exhangeList[selectIndex].PictureRequired})";
}
void SetExchangeItem()
{
selectPicture.Clear();
pictureList = new List<Picture>();
exchangePictureItemDatas.Clear();
exchangePictureItemGroupDatas.Clear();
ShowList();
}
void ShowList()
{
pictureList = GContext.container.Resolve<AlbumData>().GetPictureRepeatList();
//Quality从小到大排序
pictureList.Sort((a, b) => { return a.Quality.CompareTo(b.Quality); });
int total = 0;
for (int i = 0; i < pictureList.Count; i++)
{
var curPictureCount = GContext.container.Resolve<AlbumData>().GetPictureProgress(pictureList[i].ID);
for (int j = 1; j < curPictureCount; j++)
{
exchangePictureItemDatas.Add(new ExchangePictureItemData(total, pictureList[i]));
if (total < exhangeList[selectIndex].PictureRequired)
{
exchangePictureItemDatas[total].isSelect = true;
selectPicture[total] = pictureList[i].ID;
}
total++;
}
}
for (int i = 0; i < total; i += 3)
{
ExchangePictureItemGroupData exchangePictureItemGroupData = new ExchangePictureItemGroupData();
for (int j = 0; j < 3; j++)
{
if (i + j < total)
{
exchangePictureItemGroupData.exchangePictureItemDatas.Add(exchangePictureItemDatas[i + j]);
}
}
exchangePictureItemGroupData.action = OnClickPictureItem;
exchangePictureItemGroupDatas.Add(exchangePictureItemGroupData);
}
//滑动列表
scrollRect.Init<ExchangePictureItemGroup, ExchangePictureItemGroupData>(itemHigh, pictureItem, null, exchangePictureItemGroupDatas);
SetTitle();
}
void OnClickPictureItem(ExchangePictureItem item)
{
item.SetSelected(!item.selected.activeSelf);
if (item.selected.activeSelf)
{
exchangePictureItemDatas[item.index].isSelect = true;
selectPicture[item.index] = item.pictureAttribute.data.ID;
}
else
{
exchangePictureItemDatas[item.index].isSelect = false;
selectPicture.Remove(item.index);
}
SetTitle();
}
void OnClickExchange()
{
if (selectPicture.Count == exhangeList[selectIndex].PictureRequired)
{
//减卡牌数
GContext.container.Resolve<AlbumData>().RemovePictureProgress(selectPicture);
gameObject.SetActive(false);
//获得奖励
GContext.container.Resolve<PlayerItemData>().AddItemCount(exhangeList[selectIndex].ItemID, 1);
GContext.Publish(new game.ShowData());
//更新兑换按钮状态
GContext.container.Resolve<AlbumData>().SetExchangeCd(selectIndex, _CD);
albumExchangePopupPanel.SetTimer(selectIndex, _CD);
int count = GContext.container.Resolve<AlbumData>().GetPictureRepeatCount();
albumExchangePopupPanel.text_repetitive_card.text = LocalizationMgr.GetFormatTextValue("UI_AlbumExchangePopupPanel_101002", count);
}
else
{
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_9"));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5cd15c5f9283c354da8a1921fc528353
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8709da8f2813c6144812cbff1401b0ca
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
using asap.core;
using GameCore;
using UnityEngine;
using UnityEngine.UI;
public enum AppearanceOpenType
{
HomePanel,
FishingRodPanel,
//AppearancePanel
}
public class AppearanceBtn : MonoBehaviour
{
Button btn_appearance;
private void Awake()
{
btn_appearance = GetComponent<Button>();
}
private void Start()
{
btn_appearance.onClick.AddListener(async () =>
{
var go = await UIManager.Instance.ShowUI(UITypes.AppearancePanel);
AppearancePanel appearancePanel = go.GetComponent<AppearancePanel>();
appearancePanel.appearanceOpenType = AppearanceOpenType.HomePanel;
GContext.Publish(new HideHomePanelEvent() { IsHideMap = false });
GContext.Publish(new MapShowEvent() { isShow = true });
});
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f9ee3d331c340d645a7671756a64c9a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
using System;
using UnityEngine;
using UnityEngine.UI;
public class AppearanceItem : MonoBehaviour
{
public Button btn_item;
public Image icon;
public RewardItemNew reward;
public GameObject equipped;
public GameObject newGo;
public GameObject unlock;
public GameObject selected;
public int index;
public Action<int> action;
private void Start()
{
btn_item.onClick.AddListener(OnClickItem);
}
void OnClickItem()
{
action?.Invoke(index);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 982fc4db6bdd4cd4d86814e3039d8e54
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,564 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.UI;
public class AppearancePanel : BasePanel
{
[HideInInspector]
public AppearanceOpenType appearanceOpenType;
List<Toggle> toggles = new List<Toggle>();
List<GameObject> selected_tab = new List<GameObject>();
List<GameObject> redpoint = new List<GameObject>();
TMP_Text text_name;
TMP_Text text_title;
Button btn_close;
Button btn_equip;
Button btn_unequip;
GameObject equipped;
GameObject waytoget;
TMP_Text text_waytoget;
Transform content;
GameObject item;
List<AppearanceItem> appearanceItems = new List<AppearanceItem>();
List<RodAccessoriesData> rodAccessoriesDatas;
List<GloveData> gloveDatas;
List<RodSkinData> rodSkinDatas;
int curDataCount;
int curEqIndex;
int skinCount;
int gloveCount;
int accessoriesCount;
int curMainIndex = 0;
int curSubIndex = -1;
Tables tables;
IUIService uiService;
FishingBehaviorB fishingBehavior;
PlayerFishData playerFishData;
GameObject fishingSkinTool;
int rodID;
bool unlockRod;
Button btn_yugan;
Button btn_view;
Image bg_hud_god_image;
Image rawImage;
TMP_Text text_grade_rod;
TMP_Text text_star_rod;
string[] bg_hud_gods = { "bg_hud_god_blue", "bg_hud_god_blue", "bg_hud_god_purple", "bg_hud_god_yellow" };
CanvasGroup root;
Button btn_close_view;
AppearanceRodChangePanel rodChangePanel;
private void Awake()
{
playerFishData = GContext.container.Resolve<PlayerFishData>();
GetFishingBehaviorB getFishingBehavior = new GetFishingBehaviorB();
GContext.Publish(getFishingBehavior);
fishingBehavior = getFishingBehavior.fishingBehavior;
fishingBehavior.gameObject.SetActive(false);
uiService = GContext.container.Resolve<IUIService>();
tables = GContext.container.Resolve<Tables>();
gloveDatas = tables.TbGloveData.DataList;
gloveCount = playerFishData.rodAccessoriesData.GloveIds.Count;
rodAccessoriesDatas = tables.TbRodAccessoriesData.DataList;
root = transform.Find("root").GetComponent<CanvasGroup>();
btn_close_view = transform.Find("btn_close").GetComponent<Button>();
btn_view = transform.Find("root/btn_view").GetComponent<Button>();
text_name = transform.Find("root/name/text_name").GetComponent<TMP_Text>();
text_title = transform.Find("root/bg_title/text_title").GetComponent<TMP_Text>();
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
btn_equip = transform.Find("root/btn_equip/btn_green").GetComponent<Button>();
btn_unequip = transform.Find("root/btn_unequip/btn_green").GetComponent<Button>();
equipped = transform.Find("root/equipped").gameObject;
waytoget = transform.Find("root/waytoget").gameObject;
text_waytoget = transform.Find("root/waytoget/text_waytoget").GetComponent<TMP_Text>();
content = transform.Find("root/layout_item");
item = transform.Find("root/layout_item/item").gameObject;
item.SetActive(false);
for (int i = 0; i < 3; i++)
{
redpoint.Add(transform.Find($"root/tab/redpoint_tab{i + 1}").gameObject);
selected_tab.Add(transform.Find($"root/tab/selected_tab{i + 1}").gameObject);
toggles.Add(transform.Find($"root/tab/normal_tab{i + 1}").GetComponent<Toggle>());
Toggle toggle = toggles[i];
int index = i;
toggle.onValueChanged.AddListener((isOn) =>
{
selected_tab[index].SetActive(isOn);
if (isOn)
{
OnToggleChange(index);
}
});
selected_tab[i].SetActive(i == curMainIndex);
toggle.isOn = i == curMainIndex;
}
btn_yugan = transform.Find("root/btn_yugan").GetComponent<Button>();
bg_hud_god_image = transform.Find("root/btn_yugan/bg").GetComponent<Image>();
rawImage = transform.Find("root/btn_yugan/mask/icon").GetComponent<Image>();
text_grade_rod = transform.Find("root/btn_yugan/text_grade").GetComponent<TMP_Text>();
text_star_rod = transform.Find("root/btn_yugan/bg_star/text_star").GetComponent<TMP_Text>();
OnChangeRod(GContext.container.Resolve<PlayerData>().equipRodID);
rodChangePanel = transform.Find("AppearanceRodChangePanel").GetComponent<AppearanceRodChangePanel>();
rodChangePanel.gameObject.SetActive(false);
rodChangePanel.OnChangeRod = OnChangeRod;
rodChangePanel.rodId = rodID;
LoadFishingSkinTool();
}
protected override void Start()
{
redpoint[1].SetActive(playerFishData.rodAccessoriesData.GloveNewIds.Count > 0);
base.Start();
btn_yugan.onClick.AddListener(() => rodChangePanel.gameObject.SetActive(true));
btn_close.onClick.AddListener(OnClickClose);
btn_equip.onClick.AddListener(OnClickEquip);
btn_unequip.onClick.AddListener(OnClickUnequip);
btn_view.onClick.AddListener(ClickView);
btn_close_view.onClick.AddListener(CloseView);
}
void ClickView()
{
root.alpha = 0;
root.blocksRaycasts = false;
btn_close_view.gameObject.SetActive(true);
}
void CloseView()
{
root.alpha = 1;
root.blocksRaycasts = true;
btn_close_view.gameObject.SetActive(false);
}
async void LoadFishingSkinTool()
{
fishingSkinTool = await Addressables.InstantiateAsync("FishingSkinTool").Task;
}
#region
void OnClickEquip()
{
switch (curMainIndex)
{
case (int)RodSkinType.skin:
EquipSkin(true);
break;
case (int)RodSkinType.glove:
EquipGlove(true);
break;
//case (int)RodSkinType.accessories:
// EquipAccessories(true);
// break;
}
OnEquip();
}
void OnClickUnequip()
{
switch (curMainIndex)
{
case (int)RodSkinType.skin:
EquipSkin(false);
break;
case (int)RodSkinType.glove:
EquipGlove(false);
break;
//case (int)RodSkinType.accessories:
// EquipAccessories(false);
// break;
}
}
void EquipSkin(bool iseq)
{
if (iseq)
{
playerFishData.SetRodSkin(rodID, rodSkinDatas[curSubIndex].ID);
}
else
{
playerFishData.SetRodSkin(rodID, 0);
}
OnSelectSkin();
GContext.Publish(new ChangeSkinEvent(RodSkinType.skin));
}
void EquipGlove(bool iseq)
{
if (iseq)
{
if (playerFishData.rodAccessoriesData.GloveID != gloveDatas[curSubIndex].ID)
{
playerFishData.rodAccessoriesData.GloveID = gloveDatas[curSubIndex].ID;
playerFishData.SaveInitRodAccessoriesData();
OnSelectGlove();
GContext.Publish(new ChangeSkinEvent(RodSkinType.glove));
}
}
}
//void EquipAccessories(bool iseq)
//{
// OnSelectAccessories();
//}
void OnEquip()
{
appearanceItems[curEqIndex].equipped.SetActive(false);
curEqIndex = curSubIndex;
appearanceItems[curEqIndex].equipped.SetActive(true);
}
#endregion
#region
void OnChangeRod(int rodId)
{
rodID = rodId;
unlockRod = !playerFishData.NotRod(rodID);
RodData rodData = tables.TbRodData[rodID];
List<int> SkinList = rodData.SkinList;
rodSkinDatas = new List<RodSkinData>();
skinCount = 0;
int id;
for (int i = 0; i < SkinList.Count; i++)
{
id = SkinList[i];
RodSkinData rodSkinData = tables.TbRodSkinData.GetOrDefault(id);
if (rodSkinData != null)
{
rodSkinDatas.Add(rodSkinData);
if (unlockRod)
{
if (id == rodID || playerFishData.IsSkinUnlocked(id))
{
skinCount++;
}
}
}
}
if (curMainIndex == (int)RodSkinType.skin)
{
ChangeMainIndex();
}
else
{
ChangeRodNotSkin();
}
InitRodData();
}
void ChangeRodNotSkin()
{
int curRodSkinId = playerFishData.GetRodSkin(rodID);
GContext.Publish(new SelectSkinEvent(curRodSkinId));
}
#endregion
#region
void OnToggleChange(int index)
{
if (curMainIndex != index)
{
curMainIndex = index;
ChangeMainIndex();
}
}
/// <summary>
/// 选中页签
/// </summary>
void ChangeMainIndex()
{
curSubIndex = -1;
switch (curMainIndex)
{
case (int)RodSkinType.skin:
curDataCount = rodSkinDatas.Count;
break;
case (int)RodSkinType.glove:
curDataCount = gloveDatas.Count;
break;
//case (int)RodSkinType.accessories:
// curDataCount = rodAccessoriesDatas.Count;
// break;
}
int length = appearanceItems.Count;
for (int i = 0; i < length; i++)
{
appearanceItems[i].gameObject.SetActive(false);
}
if (curDataCount > length)
{
for (int i = length; i < curDataCount; i++)
{
GameObject go = Instantiate(item, content);
AppearanceItem appearanceItem = go.GetComponent<AppearanceItem>();
appearanceItems.Add(appearanceItem);
appearanceItem.index = i;
appearanceItem.action = OnClickItem;
}
}
btn_equip.gameObject.SetActive(false);
btn_unequip.gameObject.SetActive(false);
equipped.gameObject.SetActive(false);
waytoget.gameObject.SetActive(false);
//设置列表
switch (curMainIndex)
{
case (int)RodSkinType.skin:
SetSkin();
break;
case (int)RodSkinType.glove:
SetGlove();
break;
//case (int)RodSkinType.accessories:
// SetAccessories();
// break;
}
redpoint[curMainIndex].SetActive(false);
}
void SetGlove()
{
int index = 0;
bool isUnlock;
bool isEq;
bool isNew;
int gloveID;
int curID = playerFishData.rodAccessoriesData.GloveID;
text_title.text = $"Outfit({gloveCount}/{curDataCount})";
for (int i = 0; i < curDataCount; i++)
{
gloveID = gloveDatas[i].ID;
appearanceItems[i].gameObject.SetActive(true);
appearanceItems[i].reward.icon.gameObject.SetActive(true);
appearanceItems[i].reward.icon_rod.gameObject.SetActive(false);
uiService.SetImageSprite(appearanceItems[i].reward.icon, gloveDatas[i].Icon);
isUnlock = gloveID == tables.TbGlobalConfig.InitGloveID || playerFishData.IsGloveUnlocked(gloveID);
appearanceItems[i].unlock.SetActive(!isUnlock);
isNew = playerFishData.IsNewGlove(gloveID);
appearanceItems[i].newGo.SetActive(isNew);
isEq = curID == gloveID;
appearanceItems[i].equipped.SetActive(isEq);
if (isEq)
{
curEqIndex = i;
index = i;
}
appearanceItems[i].selected.SetActive(false);
}
OnClickItem(index);
playerFishData.RemoveGloveNewId();
}
void SetSkin()
{
text_title.text = $"Outfit({skinCount}/{curDataCount})";
int index = 0;
bool isUnlock;
bool isEq;
int skinId;
bool isNew;
int curRodSkinId = playerFishData.GetRodSkin(rodID);
for (int i = 0; i < curDataCount; i++)
{
appearanceItems[i].gameObject.SetActive(true);
appearanceItems[i].reward.icon.gameObject.SetActive(false);
appearanceItems[i].reward.icon_rod.gameObject.SetActive(true);
uiService.SetImageSprite(appearanceItems[i].reward.icon_rod, rodSkinDatas[i].Avatar);
skinId = rodSkinDatas[i].ID;
appearanceItems[i].selected.SetActive(false);
if (unlockRod)
{
isEq = curRodSkinId == rodSkinDatas[i].ID;
if (isEq)
{
curEqIndex = i;
index = i;
}
isUnlock = skinId == rodID || playerFishData.IsSkinUnlocked(skinId);
appearanceItems[i].unlock.SetActive(!isUnlock);
isNew = playerFishData.IsNewSkin(skinId);
appearanceItems[i].newGo.SetActive(isNew);
appearanceItems[i].equipped.SetActive(isEq);
}
else
{
appearanceItems[i].newGo.SetActive(false);
appearanceItems[i].unlock.SetActive(true);
appearanceItems[i].equipped.SetActive(false);
}
}
OnClickItem(index);
}
//void SetAccessories()
//{
// text_title.text = $"Outfit({accessoriesCount}/{curDataCount})";
// for (int i = 0; i < curDataCount; i++)
// {
// appearanceItems[i].gameObject.SetActive(true);
// uiService.SetImageSprite(appearanceItems[i].icon, rodAccessoriesDatas[i].Icon);
// }
// OnClickItem(0);
//}
#endregion
#region Item
/// <summary>
/// 选中列表中某个元素
/// </summary>
/// <param name="index"></param>
void OnClickItem(int index)
{
if (curSubIndex == index)
{
return;
}
if (curSubIndex >= 0)
{
appearanceItems[curSubIndex].selected.SetActive(false);
}
curSubIndex = index;
appearanceItems[curSubIndex].selected.SetActive(true);
appearanceItems[curSubIndex].newGo.SetActive(false);
if (curDataCount > 0)
{
switch (curMainIndex)
{
case (int)RodSkinType.skin:
OnSelectSkin();
break;
case (int)RodSkinType.glove:
OnSelectGlove();
break;
//case (int)RodSkinType.accessories:
// OnSelectAccessories();
// break;
}
}
}
/// <summary>
/// 选中某个皮肤
/// </summary>
void OnSelectSkin()
{
RodSkinData rodSkinData = rodSkinDatas[curSubIndex];
text_name.text = LocalizationMgr.GetText(rodSkinData.Name_l10n_key);
if (rodSkinData.ID == rodID)
{
text_waytoget.text = LocalizationMgr.GetText("UI_AppearancePanel_2");
}
else
{
text_waytoget.text = LocalizationMgr.GetText("UI_AppearancePanel_1");
}
if (unlockRod)
{
bool idHas = rodSkinData.ID == rodID || playerFishData.IsSkinUnlocked(rodSkinData.ID);
if (!idHas)
{
ShowPack();
}
else
{
int curId = playerFishData.GetRodSkin(rodID);
btn_equip.gameObject.SetActive(curId != rodSkinData.ID);
equipped.gameObject.SetActive(curId == rodSkinData.ID);
waytoget.SetActive(false);
}
}
else
{
ShowPack();
}
GContext.Publish(new SelectSkinEvent(rodSkinData.ID));
}
/// <summary>
/// 选中某个手
/// </summary>
void OnSelectGlove()
{
GloveData gloveData = gloveDatas[curSubIndex];
text_name.text = LocalizationMgr.GetText(gloveData.Name_l10n_key);
bool idHas = gloveData.ID == tables.TbGlobalConfig.InitGloveID || playerFishData.IsGloveUnlocked(gloveData.ID);
if (!idHas)
{
text_waytoget.text = LocalizationMgr.GetText("UI_AppearancePanel_1");
ShowPack();
}
else
{
int curId = playerFishData.rodAccessoriesData.GloveID;
btn_equip.gameObject.SetActive(curId != gloveData.ID);
equipped.gameObject.SetActive(curId == gloveData.ID);
waytoget.SetActive(false);
}
GContext.Publish(new SelectGloveEvent(gloveData.ID));
}
/// <summary>
/// 当没有解锁时
/// </summary>
void ShowPack()
{
btn_equip.gameObject.SetActive(false);
btn_unequip.gameObject.SetActive(false);
equipped.gameObject.SetActive(false);
waytoget.SetActive(true);
}
/// <summary>
/// 选中某个挂件
/// </summary>
//void OnSelectAccessories()
//{
// RodAccessoriesData rodAccessoriesData = rodAccessoriesDatas[curSubIndex];
// text_name.text = LocalizationMgr.GetText(rodAccessoriesData.Name_l10n_key);
// //btn_equip.gameObject.SetActive(curId != rodSkinData.ID);
// //btn_unequip.gameObject.SetActive(curId == rodSkinData.ID);
// GContext.Publish(new SelectAccessoriesEvent(rodAccessoriesData.ID));
//}
#endregion Item
async void OnClickClose()
{
Addressables.Release(fishingSkinTool);
UIManager.Instance.DestroyUI(UITypes.AppearancePanel);
switch (appearanceOpenType)
{
case AppearanceOpenType.FishingRodPanel:
await UIManager.Instance.ShowUI(UITypes.FishingRodPanel);
GContext.Publish(new MapShowEvent() { isShow = false });
break;
default:
GContext.Publish(new RestartShowHomeUIEvent());
GContext.Publish(new ActChangeRodDataEvent(GContext.container.Resolve<PlayerData>().equipRodID));
break;
}
fishingBehavior.gameObject.SetActive(true);
}
public void InitRodData()
{
RodData rod = tables.GetRodData(rodID);
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");
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 40f2a3c284f4f124d93e7b11da52f6c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AppearanceRodChangePanel : MonoBehaviour
{
Button btn_back;
Button mask;
Button btn_confrim;
GameObject item;
Transform Content;
List<SkinRodItemData> rodItemDatas = new List<SkinRodItemData>();
private SkinRodItem currentRodItem;
public Action<int> OnChangeRod;
public int rodId;
private void Awake()
{
mask = transform.Find("root/mask").GetComponent<Button>();
btn_back = transform.Find("root/btn_back/btn_green").GetComponent<Button>();
btn_confrim = transform.Find("root/btn_confrim/btn_green").GetComponent<Button>();
Content = transform.Find("root/ScrollView/Viewport/Content");
item = transform.Find("root/ScrollView/Viewport/Content/item").gameObject;
item.SetActive(false);
}
void Start()
{
InitRodList();
btn_back.onClick.AddListener(() =>
{
gameObject.SetActive(false);
});
mask.onClick.AddListener(() =>
{
gameObject.SetActive(false);
});
btn_confrim.onClick.AddListener(OnClickConfrim);
}
void OnClickConfrim()
{
OnChangeRod?.Invoke(currentRodItem.data.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(dataList[i].ID);
int level = playerFishData.GetRodLevel(_rodData.ID);
int star = playerFishData.GetRodPiece(_rodData.ID);
SkinRodItemData rodItemData = new SkinRodItemData()
{
id = _rodData.ID,
quality = _rodData.Quality,
isLock = isLock,
level = level + 1,
start = star,
isEquiped = dataList[i].ID == rodId,
ascendID = _rodData.AscendID,
};
int skindID = playerFishData.GetRodSkin(_rodData.ID);
if (skindID > 0)
{
var fishRodSkinData = _tables.TbRodSkinData.GetOrDefault(skindID);
if (fishRodSkinData != null)
{
rodItemData.avatar = fishRodSkinData.Avatar;
}
}
rodItemDatas.Add(rodItemData);
}
rodItemDatas.Sort(Sort);
//bool isCheck = true;
for (int i = 0; i < rodItemDatas.Count; i++)
{
GameObject go = Instantiate(item, Content);
go.SetActive(true);
SkinRodItem rodItem = go.AddComponent<SkinRodItem>();
rodItem.Init(rodItemDatas[i]);
rodItem.onClick = OnRodItemClick;
if (rodItemDatas[i].isEquiped)
{
currentRodItem = rodItem;
rodItem.SetSelected(true);
}
}
}
int Sort(SkinRodItemData a, SkinRodItemData b)
{
int levelA = a.isLock ? -1 : a.level;
int levelB = b.isLock ? -1 : b.level;
if (levelA == levelB)
{
return b.quality.CompareTo(a.quality);
}
return levelB.CompareTo(levelA);
}
void OnRodItemClick(SkinRodItem duelRodItem)
{
if (currentRodItem != null)
{
currentRodItem.SetSelected(false);
}
currentRodItem = duelRodItem;
currentRodItem.SetSelected(true);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 206c90f8e67084a44b3d05071f3947fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SkinRodItem : MonoBehaviour
{
Image bg;
Image img_icon;
Button btn_item;
GameObject mask_empty;
TMP_Text text_level;
GameObject selected;
Transform star;
List<GameObject> star_empty_list;
List<Image> star_empty_image;
List<StarItem> starList = new List<StarItem>();
public SkinRodItemData data;
public Action<SkinRodItem> onClick;
private void Awake()
{
bg = transform.Find("rod/bg").GetComponent<Image>();
img_icon = transform.Find("rod/img_map").GetComponent<Image>();
btn_item = GetComponent<Button>();
mask_empty = transform.Find("rod/mask_empty").gameObject;
text_level = transform.Find("rod/text_level").GetComponent<TMP_Text>();
selected = transform.Find("selected").gameObject;
star = transform.Find("rod/star");
star_empty_list = new List<GameObject>();
star_empty_image = new List<Image>();
for (int i = 1; i <= 5; i++)
{
starList.Add(star.Find($"star/star{i}").GetComponent<StarItem>());
star_empty_list.Add(star.Find($"star_empty/star{i}").gameObject);
star_empty_image.Add(star.Find($"star_empty/star{i}/star").GetComponent<Image>());
}
SetSelected(false);
}
private void Start()
{
btn_item.onClick.AddListener(OnBtnItem);
}
public void Init(SkinRodItemData _data)
{
IUIService uIService = GContext.container.Resolve<IUIService>();
data = _data;
mask_empty.SetActive(data.isLock);
text_level.gameObject.SetActive(!data.isLock);
star.gameObject.SetActive(!data.isLock);
if (!data.isLock)
{
SetLevel();
SetStar();
}
uIService.SetImageSprite(bg, Define.sp_rod_card[data.quality - 1], BasePanel.PanelName);
uIService.SetImageSprite(img_icon, data.avatar, BasePanel.PanelName);
}
void OnBtnItem()
{
onClick?.Invoke(this);
}
public void SetLevel()
{
text_level.gameObject.SetActive(!data.isLock);
text_level.text = data.level.ToString();
}
void SetStar()
{
int star = data.start;
var curRodAscend = GContext.container.Resolve<Tables>().TbRodAscend.GetOrDefault(data.ascendID);
PlayerFishData.SetRodStar(star, curRodAscend.MaxAscent, star_empty_list, star_empty_image, starList);
}
public void SetSelected(bool value)
{
selected.SetActive(value);
}
}
public class SkinRodItemData
{
public int id;
public int level;
public int start;
public string avatar;
public bool isEquiped;
public bool isLock;
public int ascendID;
public int quality;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a94807f6071f1f44ab80c64c8e6457bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
using asap.core;
using UniRx;
using UnityEngine;
public class BasePanel : MonoBehaviour
{
protected static string panelName = "HomePanel";
protected string oldPanelName;
public static string PanelName => panelName;
protected CompositeDisposable disposables = new CompositeDisposable();
protected virtual void Start()
{
panelName = GetType().Name;
}
protected virtual void OnDestroy()
{
GContext.container.Resolve<IUIService>()?.ReleaseSpriteDic(GetType().Name);
disposables?.Dispose();
disposables = null;
//if (!string.IsNullOrEmpty(oldPanelName))
//{
// panelName = oldPanelName;
//}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 53dc29189636f6940bb8a794ddc4a2f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 519d53fa10ed8f04e8582900a335d422
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,169 @@
using asap.core;
using DG.Tweening;
using GameCore;
using System;
using System.Threading;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class BPBanner : MonoBehaviour
{
#region Banner
[SerializeField]
TMP_Text txt_exp, txt_level;
[SerializeField]
Image img_expBar;
[SerializeField]
Animation anim_levelCoin;
[SerializeField]
RewardItemNew _tokenItem;
#endregion
BattlePassDataProvider _dataProvider;
public async void RefreshLevelBanner()
{
_dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
_tokenItem.SetData(new ItemData { id = _dataProvider.curPassMain.ExpItem, count = 0 });
_tokenItem.transform.Find("text_num").gameObject.SetActive(false);
var nextLevel = _dataProvider.GetBPNextLevel;
var maxLevel = _dataProvider.BPMaxLevel;
txt_level.text = nextLevel.ToString();
var curExp = _dataProvider.GetBPCurExp();
var levelUpExp = _dataProvider.GetTotalExpFromLevelRange(nextLevel - 1, nextLevel);
//满级了
if (_dataProvider.GetBPCurLevel == maxLevel)
{
txt_exp.text = LocalizationMgr.GetText("UI_FishingRodPanel_Advanced_18");
img_expBar.fillAmount = 1;
return;
}
txt_exp.text = $"{curExp}/{levelUpExp}";
img_expBar.fillAmount = (float)curExp / (float)levelUpExp;
if (_dataProvider.CheckIfPopBuyVipPanel())
{
await UIManager.Instance.ShowUI(UITypes.BattlePassBuyNoticePopupPanel);
_dataProvider.UpdateVipToastLevel();
}
}
public async void ResAnimation(CancellationToken token, float _fillTime, float _levelUpWaitTime)
{
var curNextLevel = int.Parse(txt_level.text);
var newNextLevel = _dataProvider.GetBPNextLevel;
var maxLevel = _dataProvider.BPMaxLevel;
if (curNextLevel == maxLevel)
{
return;
}
try
{
do
{
var levelUpExp = _dataProvider.GetTotalExpFromLevelRange(curNextLevel - 1, curNextLevel);
var addation = 0;
if (_dataProvider.GetBPCurLevel == maxLevel)
{
addation = 1;
}
var curExp = (addation + img_expBar.fillAmount) * levelUpExp + addation;
if (curNextLevel < newNextLevel)
{
img_expBar.DOFillAmount(1f, _fillTime).OnUpdate(
() =>
{
var curExp = img_expBar.fillAmount * levelUpExp;
txt_exp.text = $"{(int)curExp}/{levelUpExp}";
}
).OnComplete(() => anim_levelCoin.Play()).SetId("BPFill1");
await Task.Delay((int)((_fillTime + _levelUpWaitTime) * 1000), token);
if (this == null)
{
return;
}
curNextLevel++;
txt_level.text = (curNextLevel).ToString();
img_expBar.fillAmount = 0f;
curExp = 0;
levelUpExp = _dataProvider.GetTotalExpFromLevelRange(curNextLevel - 1, curNextLevel);
txt_exp.text = $"{(int)curExp}/{levelUpExp}";
}
else
{
var targetExp = _dataProvider.Data.BattlePassRecord.Exp;
//满级了
if (_dataProvider.GetBPCurLevel == maxLevel)
{
levelUpExp = _dataProvider.GetTotalExpFromLevelRange(_dataProvider.BPMaxLevel - 1, _dataProvider.BPMaxLevel);
targetExp += levelUpExp;
}
var curRate = 0f;
var txts = txt_exp.text.Split('/');
var curFillAmount = (float)int.Parse(txts[0]) / (float)int.Parse(txts[1]);
DOTween.To(
() => curFillAmount,
(value) => curRate = value,
(float)targetExp / (float)levelUpExp,
_fillTime
).OnUpdate(
() =>
{
img_expBar.fillAmount = curRate;
var curExp = curRate * levelUpExp;
txt_exp.text = $"{(int)curExp}/{levelUpExp}";
}
);
await Task.Delay((int)(_fillTime * 1000), token);
if (this == null)
{
return;
}
break;
}
} while (curNextLevel <= newNextLevel && curNextLevel <= maxLevel);
}
catch (OperationCanceledException)
{
DOTween.Kill("BPFill1");
DOTween.Kill("BPFill2");
return;
}
finally
{
}
txt_level.text = $"{newNextLevel}";
if (_dataProvider.GetBPCurLevel == maxLevel)
{
txt_exp.text = LocalizationMgr.GetText("UI_FishingRodPanel_Advanced_18");
return;
}
txt_exp.text = $"{(int)(_dataProvider.Data.BattlePassRecord.Exp + (_dataProvider.GetBPCurLevel == maxLevel ? 1000 : 0))}/{_dataProvider.GetTotalExpFromLevelRange(_dataProvider.GetBPNextLevel - 1, _dataProvider.GetBPNextLevel)}";
// txt_level.text = newLevel.ToString();
if (_dataProvider.CheckIfPopBuyVipPanel())
{
await UIManager.Instance.ShowUI(UITypes.BattlePassBuyNoticePopupPanel);
_dataProvider.UpdateVipToastLevel();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2a0a8ab15aba2eb4cae251460691c98a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,127 @@
using asap.core;
using GameCore;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class BPItemSlot : MonoBehaviour
{
#region Field
protected RewardItemNew RewardItem;
// protected Image
// img_bg;
protected GameObject
go_claim,
go_levelLock,
go_vipLock,
go_hasGot;
protected Button
btn_click;
protected bool _isNormal;
protected int _level;
protected CompositeDisposable _disposables = new();
protected BattlePassDataProvider _dataProvider;
#endregion
#region Func
private void Init()
{
RewardItem = transform.GetComponentInChildren<RewardItemNew>();
go_claim = transform.Find("position/claim").gameObject;
go_vipLock = transform.Find("position/lock")?.gameObject;
go_levelLock = transform.Find("position/unlock")?.gameObject;
go_hasGot = transform.Find("position/reward/received").gameObject;
// img_bg = RewardItem.transform.Find("bg").GetComponent<Image>();
btn_click = go_claim?.GetComponent<Button>();
_dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
}
protected virtual void Start()
{
}
public void SetData(bool isNomal, BPRewardSlot.ESlotState state, ItemData itemData)
{
Init();
if (itemData == null)
{
gameObject.SetActive(false);
return;
}
gameObject.SetActive(true);
_level = -1;
_isNormal = isNomal;
// GContext.container.Resolve<IUIService>().SetImageSprite(img_bg, isNomal ? "bg_shop_gift_hook" : "bg_batttlepass_reward");
RewardItem.SetData(itemData, abbr: true);
ChangeState(state);
}
public void SetData(bool isNomal, int level)
{
Init();
_level = level;
_isNormal = isNomal;
var itemData = _dataProvider.GetSlotDropItem(level, isNomal);
// GContext.container.Resolve<IUIService>().SetImageSprite(img_bg, isNomal ? "bg_shop_gift_hook" : "bg_batttlepass_reward");
RewardItem.SetData(itemData, abbr: true);
RefreshSlot();
}
public void RefreshSlot()
{
if (_level != -1)
ChangeState(GContext.container.Resolve<BattlePassDataProvider>().GetSlotState(_level, _isNormal));
else
ChangeState(BPRewardSlot.ESlotState.Normal);
}
public void SetInactive()
{
gameObject.SetActive(false);
}
public virtual void ChangeState(BPRewardSlot.ESlotState state)
{
go_claim.SetActive(false);
go_levelLock?.SetActive(state == BPRewardSlot.ESlotState.LevelLock);
go_hasGot?.SetActive(state == BPRewardSlot.ESlotState.HasGotReward);
switch (state)
{
case BPRewardSlot.ESlotState.CanGetReward:
if (!_isNormal && !_dataProvider.IsUnlockVip)
break;
if (btn_click)
btn_click.enabled = true;
go_claim.SetActive(true);
break;
default:
break;
}
go_vipLock?.SetActive(!_isNormal && !_dataProvider.IsUnlockVip);
}
private void OnDestroy()
{
_disposables?.Dispose();
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 51d6f4f50ae61f04eab641a9b8502275
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,95 @@
using asap.core;
using GameCore;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class BPRewardBar : PanelItemBase<int>
{
#region Field
private BPRewardSlot NormalSlot;
private BPRewardSlot VipSlot;
private GameObject
go_claim,
go_unlock,
go_normal;
private TMP_Text
txt_level;
Transform
btn_buyLevel;
Transform btn_buygrade;
BattlePassDataProvider
_dataProvider;
#endregion
bool isShowBuy;
#region Func
private void Awake()
{
txt_level = transform.Find("grade/text_num").GetComponent<TMP_Text>();
NormalSlot = transform.Find("gift1").GetComponent<BPRewardSlot>();
VipSlot = transform.Find("gift2").GetComponent<BPRewardSlot>();
btn_buyLevel = transform.Find("btn_buygrade").GetComponent<Transform>();
btn_buygrade = transform.parent.parent.Find("buygrade").GetComponent<Transform>();
go_claim = transform.Find("grade/position/claim").gameObject;
go_unlock = transform.Find("grade/position/unlock").gameObject;
go_normal = transform.Find("grade/position/bg").gameObject;
_dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
GContext.OnEvent<BpGetExp>().Subscribe(x =>
{
ChangeState();
}).AddTo(this);
}
public override void OnInit()
{
gameObject.SetActive(true);
txt_level.text = data.ToString();
ChangeState();
NormalSlot.SetData(true, data);
VipSlot.SetData(false, data);
}
private void ChangeState()
{
go_claim.SetActive(false);
go_normal.SetActive(false);
go_unlock.SetActive(false);
if (isShowBuy)
{
btn_buygrade?.gameObject.SetActive(false);
}
isShowBuy = data == _dataProvider.GetBPCurLevel && data != _dataProvider.BPMaxLevel;
if (data == _dataProvider.GetBPCurLevel)
{
go_claim.SetActive(true);
}
else if (data > _dataProvider.GetBPCurLevel)
{
go_unlock.SetActive(true);
}
else
{
go_normal.SetActive(true);
}
}
private void LateUpdate()
{
if (isShowBuy)
{
btn_buygrade?.gameObject.SetActive(true);
btn_buygrade.position = btn_buyLevel.position;
}
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 099b3f3505e2ab34ab3759316318f5b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,98 @@
using asap.core;
using System;
using System.Threading.Tasks;
using UniRx;
using UnityEngine;
public class BPRewardSlot : BPItemSlot
{
public enum ESlotState
{
LevelLock,
Normal,
CanGetReward,
HasGotReward
}
#region Field
[SerializeField]
private GameObject
go_light;
#endregion
#region Func
protected override void Start()
{
base.Start();
btn_click?.OnClickAsObservable().Subscribe(_ => OnClickSlotToGetReward()).AddTo(_disposables);
GContext.OnEvent<GetAllBPRewards>().Subscribe(_ => OnGetAllRewards()).AddTo(_disposables);
GContext.OnEvent<BpGetExp>().Subscribe(_ => OnBuyBpLevel()).AddTo(_disposables);
GContext.OnEvent<BpVipUnlock>().Subscribe(_ => OnUnlockBpVip()).AddTo(_disposables);
}
public void OnBuyBpLevel()
{
RefreshSlot();
}
public void OnGetAllRewards()
{
RefreshSlot();
}
public void OnClickSlotToGetReward()
{
if (btn_click)
btn_click.enabled = false;
var eventData = new GetBattlePassRewardEvent();
if (_isNormal)
eventData.NormalLevels.Add(_level);
else
eventData.VipLevels.Add(_level);
GContext.Publish(eventData);
// await RewardItem.ParticleAttractor();
ChangeState(ESlotState.HasGotReward);
}
public override void ChangeState(ESlotState state)
{
base.ChangeState(state);
go_light.SetActive(false);
switch (state)
{
case ESlotState.CanGetReward:
go_light.SetActive(true);
break;
}
}
private async void OnUnlockBpVip()
{
if (!_isNormal)
{
var particle = transform.Find("position/particle");
go_vipLock?.SetActive(!_dataProvider.IsUnlockVip);
particle.gameObject.SetActive(true);
await new WaitForSeconds(2);
if (this != null)
{
particle.gameObject.SetActive(false);
RefreshSlot();
}
}
}
private void OnDestroy()
{
_disposables?.Dispose();
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fa7cbfc893c9b5c42a3483c86abb1454
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,279 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TMPro;
using tysdk;
using UnityEngine;
using UnityEngine.UI;
public class BPTaskSlot : MonoBehaviour, IComparable<BPTaskSlot>
{
Button btn_go, btn_finish;
GameObject
go_doneBtn,
go_normalBg,
go_finishBg,
go_doneBg;
// TMP_Text text_task_finish_notice;
TMP_Text
txt_expGet,
txt_progress,
text_task;
// TMP_Text text_task_finish;
Image bar;
RewardItemNew
_tokenReward,
_itemReward;
// Image p_icon_item;
// public Transform icon_done;
List<ItemData> itemDatas = new();
bool _isDailyTask;
public int TaskID;
int requiredCount;
string type;
public int State;
private void Init()
{
btn_go = transform.Find("finish_notice/btn_go/btn_green_c").GetComponent<Button>();
btn_finish = transform.Find("finish_notice/btn_finish/btn_green_c").GetComponent<Button>();
go_doneBtn = transform.Find("finish_notice/done").gameObject;
go_normalBg = transform.Find("finish_notice/bg").gameObject;
go_finishBg = transform.Find("finish_notice/bg_finish").gameObject;
go_doneBg = transform.Find("finish_notice/bg_done").gameObject;
txt_progress = transform.Find("finish_notice/btn_go/text_progress").GetComponent<TMP_Text>();
text_task = transform.Find("finish_notice/text_task").GetComponent<TMP_Text>();
bar = transform.Find("finish_notice/bg_bar/bar").GetComponent<Image>();
_tokenReward = transform.Find("finish_notice/icon_exp").GetComponent<RewardItemNew>();
_itemReward = transform.Find("reward").GetComponent<RewardItemNew>();
btn_finish.onClick.AddListener(OnClickFinish);
btn_go.onClick.AddListener(OnClickGo);
gameObject.SetActive(true);
}
public void Start()
{
//but_go.onClick.AddListener(OnClickGo);
}
public void SetData(int taskID, bool isDailyTask)
{
Init();
this.TaskID = taskID;
var tables = GContext.container.Resolve<Tables>();
var task = tables.TbBattlePassTask.Get(taskID);
itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(task.Reward);
_tokenReward.SetData(itemDatas[0]);
_itemReward.SetData(itemDatas[1], isCanClick: true, abbr: true);
_isDailyTask = isDailyTask;
requiredCount = int.Parse(task.Param[0]);
text_task.text = LocalizationMgr.GetFormatTextValue(task.Desc_l10n_key, requiredCount);
type = task.Type.ToString();
RefreshView();
}
public async System.Threading.Tasks.Task ShowReward()
{
await _itemReward.PlayClose();
OnGetReward();
await _itemReward.ParticleAttractor();
}
void RefreshView()
{
var tasks = _isDailyTask ? GContext.container.Resolve<BattlePassDataProvider>().Data.BattleTask.dic_dailyTasks : GContext.container.Resolve<BattlePassDataProvider>().Data.BattleTask.dic_weeklyTasks;
tasks.TryGetValue(TaskID, out var state);
var done = state == -1;
var normal = state < requiredCount && !done;
var finish = state >= requiredCount;
State = finish ? 0 : normal ? 1 : 2;
btn_go.transform.parent.gameObject.SetActive(normal);
btn_finish.transform.parent.gameObject.SetActive(finish);
go_doneBtn.SetActive(done);
go_normalBg.SetActive(normal);
go_finishBg.SetActive(finish);
go_doneBg.SetActive(done);
//Done
if (done)
{
_itemReward.SetReceived(true);
txt_progress.text = requiredCount + "/" + requiredCount;
bar.fillAmount = 1;
}
//Normal
else if (normal)
{
_itemReward.SetReceived(false);
txt_progress.text = state + "/" + requiredCount;
bar.fillAmount = (float)state / requiredCount;
}
//Finish
else if (finish)
{
_itemReward.SetReceived(false);
txt_progress.text = requiredCount + "/" + requiredCount;
bar.fillAmount = 1;
}
}
void OnGetReward()
{
RefreshView();
}
async void OnClickFinish()
{
var task = GContext.container.Resolve<Tables>().TbBattlePassTask.Get(TaskID);
var playerData = GContext.container.Resolve<PlayerItemData>();
var startLevel = GContext.container.Resolve<BattlePassDataProvider>().GetBPCurLevel;
itemDatas = playerData.AddItemByDrop(task.Reward, false);
#if AGG
using (var e = GEvent.GameEvent("bp_task_reward"))
{
e.AddContent("bp_level", startLevel)
.AddContent("task_type", task.Type.ToString())
.AddContent("task_id", task.TaskID)
.AddContent("item_id", itemDatas[1].id)
.AddContent("item_num", itemDatas[1].count)
.AddContent("exp", itemDatas[0].count);
if (itemDatas != null && itemDatas.Count > 0)
{
for (int i = 0; i < itemDatas.Count; i++)
{
if (itemDatas[i].id == 1001)
{
e.AddContent("reward_hook", itemDatas[i].count);
}
else if (itemDatas[i].id == 1002)
{
e.AddContent("reward_cash", itemDatas[i].count);
}
}
}
}
#endif
GContext.container.Resolve<BattlePassDataProvider>().SetTaskDone(TaskID, _isDailyTask);
RefreshView();
_ = _itemReward.ParticleAttractor();
await _tokenReward.ParticleAttractor();
GContext.Publish(new ShowData());
GContext.Publish(new BpGetExp());
}
async void OnClickGo()
{
await Awaiters.NextFrame;
var task = GContext.container.Resolve<Tables>().TbBattlePassTask.Get(TaskID);
switch (task.Type)
{
case ConditionType.ConstructionCount:
OpenConstruction();
return;
case ConditionType.Complete1v1Count:
case ConditionType.ConsumeEnergy:
case ConditionType.OpenFishBoxCount:
GContext.Publish(new RestartShowHomeUIEvent());
break;
case ConditionType.LoginDays:
return;
//case ConditionType.OpenFishBoxCount:
//await UIManager.Instance.ShowUI(UITypes.FishingBoxPanel);
//break;
case ConditionType.ConusumeTicketCount:
await UIManager.Instance.ShowUI(UITypes.FishingTurntablePanel);
break;
case ConditionType.CollectFishCardCount:
case ConditionType.ConsumeDiamondCount:
await UIManager.Instance.ShowUI(UITypes.FishingShopPanel);
GContext.Publish(new LackOfResourceConfirmEvent() { state = 0 });
break;
case ConditionType.CompleteChallengeCount:
//GContext.Publish(new RestartShowHomeUIEvent());
// var FCC = GContext.container.Resolve<FishingChallengeCenter>();
var fishingChallengeManager = GContext.container.Resolve<FishingChallengeManager>();
// int curCount = fishingChallengeManager.number;
// int allCount = fishingChallengeManager.challengeMatchConfig.DailyTimes;
//TODO:LF 结束的状态
var challengeState = fishingChallengeManager.ChallengeState();
if (!fishingChallengeManager.ShouldOpen() && challengeState == 0)
{
var curTime = ZZTimeHelper.UtcNow().UtcNowOffset();
var timer = curTime.AddDays(1).Date - curTime;
ToastPanel.Show( LocalizationMgr.GetFormatTextValue("UI_EventChallangePanel_24", ConvertTools.ConvertTime2(timer)));
return;
}
GContext.Publish(new RestartShowHomeUIEvent());
if (challengeState == 0)
{
//未开始比赛
// await UIManager.Instance.ShowUI(UITypes.EventChallengeFacePopupPanel);
}
else
{
fishingChallengeManager.InChallenge();
return;
}
break;
case ConditionType.UpgradeRodTimes:
await UIManager.Instance.ShowUI(UITypes.FishingRodBagPanel);
break;
default:
GContext.Publish(new RestartShowHomeUIEvent());
break;
}
CloseBPPanel();
}
void CloseBPPanel()
{
UIManager.Instance.DestroyUI(UITypes.BattlePassPanel);
}
async void OpenConstruction()
{
var campData = GContext.container.Resolve<CampDataMM>();
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Loads(campData.AllPrefabs);
if (isCanEnter)
{
//取消自动钓鱼
//ExitAutoFishing();
GContext.Publish(new VibrationData(HapticTypes.LightImpact));
//Building.Enter();
GContext.Publish(new UnloadActToNextAct("BuildAct"));
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(true, () => GContext.Publish(new UnloadActToNextAct("BuildAct")));
//var panel = await UIManager.Instance.ShowUI(UITypes.FishingDownLoadPopupPanel);
//panel.GetComponent<FishingDownLoadPopupPanel>().SetBtn(null, () => GContext.Publish(new UnloadActToNextAct("BuildAct")));
}
}
public int CompareTo(BPTaskSlot slot)
{
int result = this.State.CompareTo(slot.State);
if (result == 0)
{
result = this.State.CompareTo(slot.TaskID);
}
return result;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ed76224ac72411e4593e11f8ea16da43
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,139 @@
using GameCore;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
using TMPro;
using asap.core;
using cfg;
public class BattlePassActivePopupPanel : BasePanel
{
#region Field
[SerializeField]
private Button
btn_buyNormal,
btn_buySpecial,
btn_close;
[SerializeField]
private TMP_Text
txt_title,
txt_normalValue,
txt_specialValue,
txt_spcialUpLevel,
txt_normalCost,
txt_specialCost;
[SerializeField]
RewardItemNew
rewardItem;
[SerializeField]
Transform
tran_vipBar,
tran_nomralBar;
BattlePassDataProvider _dataProvider;
#endregion
#region Func
private void Awake()
{
_dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
}
protected override void Start()
{
base.Start();
var dic_iAPItemList = GContext.container.Resolve<Tables>().TbIAPItemList.DataMap;
var curPassMain = _dataProvider.curPassMain;
// txt_normalValue.text = LocalizationMgr.GetFormatTextValue("UI_FishingShopPanel_2", curPassMain.PrimeValue);
// txt_specialValue.text = LocalizationMgr.GetFormatTextValue("UI_FishingShopPanel_2", curPassMain.DeluxeValue);
// txt_spcialUpLevel.text = LocalizationMgr.GetFormatTextValue("UI_BattlePassPanel_18", _dataProvider.GetUpLevelByExp((int) GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(curPassMain.DeluxeReward).FirstOrDefault(x => x.id == 3003).count));
SKUDetailDataEvent ssde = new SKUDetailDataEvent(dic_iAPItemList[_dataProvider.curPassMain.PrimeIAPID]);
GContext.Publish(ssde);
txt_normalCost.text = ssde.price;
ssde = new SKUDetailDataEvent(dic_iAPItemList[_dataProvider.curPassMain.DeluxeIAPID]);
GContext.Publish(ssde);
txt_specialCost.text = ssde.price;
txt_title.text = LocalizationMgr.GetText("UI_BattlePassPanel_6");
rewardItem.gameObject.SetActive(false);
var dropID = _dataProvider.curPassMain.PrimeReward;
var itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(dropID);
for (int i = 1; i < itemDatas.Count; i++)
{
Instantiate(rewardItem, tran_nomralBar).SetData(itemDatas[i]);
}
dropID = _dataProvider.curPassMain.DeluxeReward;
itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(dropID);
for (int i = 1; i < itemDatas.Count; i++)
{
Instantiate(rewardItem, tran_vipBar).SetData(itemDatas[i]);
}
btn_close.OnClickAsObservable().Subscribe(_ => Close()).AddTo(disposables);
btn_buyNormal.OnClickAsObservable().Subscribe(_ => OnBuy(0)).AddTo(disposables);
btn_buySpecial.OnClickAsObservable().Subscribe(_ => OnBuy(1)).AddTo(disposables);
}
protected void Close()
{
UIManager.Instance.DestroyUI(UITypes.BattlePassActivePopupPanel);
}
/// <summary>
///
/// </summary>
/// <param name="scope">0:Normal 1:Special</param>
async void OnBuy(int scope)
{
var iAPItemID = scope == 0 ? _dataProvider.curPassMain.PrimeIAPID : scope == 1 ? _dataProvider.curPassMain.DeluxeIAPID : -1;
var iAPItemList = GContext.container.Resolve<Tables>().TbIAPItemList.GetOrDefault(iAPItemID);
var dropID = scope == 0 ? _dataProvider.curPassMain.PrimeReward : scope == 1 ? _dataProvider.curPassMain.DeluxeReward : -1;
var itemDatas = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(dropID);
var startLevel = _dataProvider.GetBPCurLevel;
ShopBuyTypeData shopBuyTypeData = new ShopBuyTypeData();
shopBuyTypeData.type = ShopBuyType.None;
bool Result = await GContext.container.Resolve<PlayerShopData>().OnBuy(dropID, shopBuyTypeData, iAPItemList, itemDatas);
if (Result)
{
#if AGG
using ( var e = GEvent.GameEvent("bp_active") )
{
e.AddContent("bp_level", startLevel)
.AddContent("active_type", scope+1);
}
#endif
OnBuySuccess(scope);
}
}
/*async*/ void OnBuySuccess(int scope)
{
GContext.Publish(new BpVipUnlock());
if (scope == 1)
GContext.Publish(new BpGetExp());
Close();
//await WaitForRewardPanel();
}
private async System.Threading.Tasks.Task WaitForRewardPanel()
{
var count = 0;
var rewardInfo = new RewardPopupData();
while (count++ < 5)
{
GContext.Publish(rewardInfo);
if (rewardInfo.isShow)
{
await rewardInfo.tcs.Task;
break;
}
await new WaitForSeconds(0.2f);
}
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dd3da8bf174d476459ad973b9b1c2e1f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,185 @@
using GameCore;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
using System.Collections.Generic;
using asap.core;
using TMPro;
using game;
using tysdk;
public class BattlePassBuyGradePopupPanel : BasePanel
{
#region Field
[SerializeField]
private Button
btn_close;
[SerializeField]
Transform
tran_slotParent;
[SerializeField]
Slider
sld_changeLevel;
[SerializeField]
Button
btn_buy,
btn_downLevel,
btn_upLevel;
[SerializeField]
GameObject
go_vipSlot,
go_normalSlot;
[SerializeField]
TMP_Text
txt_targetLevel,
txt_diamondCost,
txt_upLevel;
//Data
List<BPItemSlot> normalSlot = new();
List<BPItemSlot> vipSlot = new();
int curUpLevel;
int maxUpLevel;
int expGet;
int diamondCost;
float levelUpDelta;
BattlePassDataProvider _dataProvider;
#endregion
#region Func
private void Awake()
{
_dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
}
protected override void Start()
{
base.Start();
ResfreshPanel();
btn_close.OnClickAsObservable().Subscribe(_=>Close()).AddTo(disposables);
btn_downLevel.OnClickAsObservable().Subscribe(_=>OnChangeUpLevel(curUpLevel-1,true)).AddTo(disposables);
btn_upLevel.OnClickAsObservable().Subscribe(_=>OnChangeUpLevel(curUpLevel+1,true)).AddTo(disposables);
sld_changeLevel.OnValueChangedAsObservable().Subscribe(OnSliderMove).AddTo(disposables);
btn_buy.OnClickAsObservable().Subscribe(_=>OnBuy()).AddTo(disposables);
}
protected void Close()
{
UIManager.Instance.DestroyUI(UITypes.BattlePassBuyGradePopupPanel);
}
private void ResfreshPanel()
{
go_normalSlot.gameObject.SetActive(false);
go_vipSlot.gameObject.SetActive(false);
maxUpLevel=_dataProvider.BPMaxLevel-_dataProvider.GetBPCurLevel;
levelUpDelta=(float)1/(float)(maxUpLevel-curUpLevel);
for (int i = 2; i < tran_slotParent.childCount; i++)
{
Destroy(tran_slotParent.GetChild(i).gameObject);
}
for (int i = 0; i < 20; i++)
{
vipSlot.Add( Instantiate(go_vipSlot, tran_slotParent).GetComponent<BPItemSlot>());
}
for (int i = 0; i < 20; i++)
{
normalSlot.Add( Instantiate(go_normalSlot, tran_slotParent).GetComponent<BPItemSlot>());
}
OnChangeUpLevel(_dataProvider.DefaultBuyLevel,true);
}
private void OnChangeUpLevel(int upLevel,bool sliderMove=false)
{
if( upLevel < 1 )
upLevel = 1;
if(upLevel>maxUpLevel)
upLevel = maxUpLevel;
curUpLevel = upLevel;
txt_upLevel.text = LocalizationMgr.GetFormatTextValue("UI_BattlePassPanel_13", curUpLevel);
txt_targetLevel.text = LocalizationMgr.GetFormatTextValue("UI_BattlePassPanel_12", _dataProvider.GetBPCurLevel + curUpLevel);
diamondCost = _dataProvider.GetDiamondCostByUpLevel(upLevel);
var normalItemDatas = _dataProvider.GetRewardsByUpLevel(upLevel,true);
var vipItemDatas = _dataProvider.GetRewardsByUpLevel(upLevel,false);
expGet = diamondCost/_dataProvider.curPassMain.ExpPrice*100;
txt_diamondCost.text = diamondCost.ToString();
if ( sliderMove )
{
sld_changeLevel.value = curUpLevel * levelUpDelta-levelUpDelta/2f;
}
var isVipUnlock = _dataProvider.IsUnlockVip;
for (int i = 0; i<vipSlot.Count; i++)
{
if(i<vipItemDatas.Count)
{
vipSlot[i].SetData(false,BPRewardSlot.ESlotState.Normal,vipItemDatas[i]);
}
else
{
vipSlot[i].SetInactive();
}
}
for ( int i = 0; i < normalSlot.Count; i++ )
{
if ( i < normalItemDatas.Count )
{
normalSlot[i].SetData(true, BPRewardSlot.ESlotState.Normal, normalItemDatas[i]);
}
else
{
normalSlot[i].SetInactive();
}
}
// _dataProvider.DefaultBuyLevel = upLevel;
}
private void OnSliderMove(float value)
{
var upLevel = (int)(value*1000000f)/ (int)(levelUpDelta*1000000f) +1;
if(curUpLevel!=upLevel)
{
OnChangeUpLevel(upLevel);
}
}
private void OnBuy()
{
var curDiamond = GContext.container.Resolve<PlayerData>().diamond;
if ( curDiamond >= diamondCost)
{
GContext.container.Resolve<PlayerData>().AddDiamond(-diamondCost);
#if AGG
using ( var e = GEvent.GameEvent("bp_purchase_level") )
{
e.AddContent("bp_level", _dataProvider.GetBPCurLevel)
.AddContent("purchase_level", curUpLevel)
.AddContent(AFInAppEvents.PRICE, diamondCost);
}
#endif
_dataProvider.SetBPExp(expGet);
GContext.Publish(new BpGetExp());
GContext.Publish(new ResAddEvent(_dataProvider.curPassMain.ExpItem));
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_3"));
Close();
}
else
{
_ = UIManager.Instance.ShowUI(UITypes.LackOfResourceConfirmPopupPanel);
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_59"));
}
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e91e9a1d36f28f44b8f3d251656e8cf3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,73 @@
using asap.core;
using GameCore;
using System.Threading.Tasks;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class BattlePassBuyNoticePopupPanel : BasePanel
{
#region Field
[SerializeField]
private Button
btn_activate,
btn_close;
[SerializeField]
private Transform
tran_slotParent;
[SerializeField]
GameObject
go_slot;
[SerializeField]
TMP_Text
txt_info,
txt_title;
BattlePassDataProvider _dataProvider;
#endregion
#region Func
private void Awake()
{
}
protected override async void Start()
{
base.Start();
btn_close.OnClickAsObservable().Subscribe(_=>Close()).AddTo(disposables);
btn_activate.OnClickAsObservable().Subscribe(_=>ActivateBP()).AddTo(disposables);
_dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
var curLevel = _dataProvider.Data.BattlePassRecord.Level;
txt_title.text = LocalizationMgr.GetFormatTextValue("UI_BattlePassPanel_14", curLevel);
txt_info.text=LocalizationMgr.GetFormatTextValue("UI_BattlePassPanel_15", curLevel);
go_slot.SetActive(false);
var slotDatas = _dataProvider.GetRewardsByLevelRange(1, curLevel, false);
await Task.Yield();
foreach (var data in slotDatas)
{
Instantiate(go_slot, tran_slotParent).GetComponent<BPItemSlot>().SetData(false,BPRewardSlot.ESlotState.Normal,data);
}
}
protected void Close()
{
UIManager.Instance.DestroyUI(UITypes.BattlePassBuyNoticePopupPanel);
}
async void ActivateBP()
{
UIManager.Instance.DestroyUI(UITypes.BattlePassBuyNoticePopupPanel);
await UIManager.Instance.ShowUI(UITypes.BattlePassActivePopupPanel);
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6bb15b74813f9a44e9f75526b668f327
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,172 @@
using asap.core;
using DG.Tweening;
using GameCore;
using System;
using System.Threading;
using System.Threading.Tasks;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class BattlePassPanel : BasePanel
{
[SerializeField, Range(0f, 2f)]
private float
_fillTime,
_levelUpWaitTime
;
BattlePassDataProvider _dataProvider;
PlayerItemData _playerItemData;
CancellationTokenSource _tokenSource;
[SerializeField, Header("===========")]
Button btn_close;
[SerializeField]
Toggle
tog_battlePass,
tog_task;
[SerializeField]
GameObject
go_taskBtn,
go_battlePassBtn;
[SerializeField]
BattlePassRecordPanel recordPanel;
[SerializeField]
BattleTaskPanel taskPanel;
[SerializeField]
TMP_Text txt_timer;
[SerializeField]
Button btn_activateBattlePass;
[SerializeField]
BPBanner bPBanner, bPBanner_bought;
BPBanner curBanner;
protected override async void Start()
{
base.Start();
_dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
_playerItemData = GContext.container.Resolve<PlayerItemData>();
GContext.OnEvent<BpVipUnlock>().Subscribe(_ =>
{
RefreshVipBtn();
recordPanel.BpVipUnlock();
}).AddTo(disposables);
btn_close.OnClickAsObservable().Subscribe(x => Close()).AddTo(disposables);
btn_activateBattlePass.OnClickAsObservable().Subscribe(x => OnActivateBP()).AddTo(disposables);
tog_task.onValueChanged.AddListener(x => SwitchPanel(1));
tog_battlePass.onValueChanged.AddListener(x => SwitchPanel(0));
GContext.OnEvent<ResAddEvent>().Subscribe(x => OnResAnimation(x)).AddTo(disposables);
Refresh();
await Awaiters.NextFrame;
SwitchPanel(0);
_dataProvider.CheckIfGetLastBpRewards();
}
private async void OnActivateBP()
{
if (_dataProvider.IsUnlockVip)
return;
btn_activateBattlePass.enabled = false;
await UIManager.Instance.ShowUI(UITypes.BattlePassActivePopupPanel);
btn_activateBattlePass.enabled = true;
bPBanner_bought.RefreshLevelBanner();
}
private void Close()
{
GContext.Publish(new RestartShowHomeUIEvent());
UIManager.Instance.DestroyUI(UITypes.BattlePassPanel);
}
private void SwitchPanel(int type)
{
if (type == 0)
{
tog_task.enabled = true;
tog_battlePass.enabled = false;
go_battlePassBtn.SetActive(true);
go_taskBtn.SetActive(false);
recordPanel.Open();
taskPanel.Close();
}
else if (type == 1)
{
tog_battlePass.enabled = true;
tog_task.enabled = false;
go_battlePassBtn.SetActive(false);
go_taskBtn.SetActive(true);
recordPanel.Close();
taskPanel.Open();
}
}
public void Refresh()
{
RefreshTimer();
RefreshVipBtn();
curBanner.RefreshLevelBanner();
}
private void RefreshTimer()
{
DateTime curTimer = ZZTimeHelper.UtcNow().UtcNowOffset();
DateTime endTime = GContext.container.Resolve<FishingEventData>().GetEventEndTime(_dataProvider.Data.BattlePassRecord.ID);
SetTimer(endTime - curTimer);
}
private void SetTimer(TimeSpan duration)
{
txt_timer.text = ConvertTools.ConvertTime2(duration);
var timer = Observable.Interval(TimeSpan.FromSeconds(1))
.TakeWhile(seconds => seconds <= duration.TotalSeconds)
.Subscribe(seconds =>
txt_timer.text = ConvertTools.ConvertTime2(duration.Subtract(TimeSpan.FromSeconds(seconds)))
, () => Close())
.AddTo(disposables)
;
}
void RefreshVipBtn()
{
bool isVip = _dataProvider.Data.BattlePassRecord.IsUnlockVip != 0;
bPBanner_bought.gameObject.SetActive(isVip);
bPBanner.gameObject.SetActive(!isVip);
if (isVip)
{
curBanner = bPBanner_bought;
}
else
{
curBanner = bPBanner;
}
}
private void OnResAnimation(ResAddEvent addEvent)
{
if (addEvent.Type == 0)
{
cfg.Item item = GContext.container.Resolve<cfg.Tables>().TbItem.GetOrDefault(addEvent.id);
if (item != null)
{
addEvent.Type = item.Type;
addEvent.SubType = item.SubType;
}
}
if (addEvent.Type == 7 && addEvent.SubType == 3)
{
if (_tokenSource != null)
{
_tokenSource.Cancel();
_tokenSource.Dispose();
}
_tokenSource = new CancellationTokenSource();
curBanner.ResAnimation(_tokenSource.Token, _fillTime, _levelUpWaitTime);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7aa64514365907148a405ff5851e7ef4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,218 @@
using asap.core;
using game;
using GameCore;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class BattlePassRecordPanel : MonoBehaviour
{
[Range(0f, 2f), SerializeField]
private float waveWaitTimer = 1.2f;
[SerializeField]
BPRewardBar pfb_bar;
[SerializeField]
Button btn_buyLevel;
//[SerializeField]
//GameObject buyGO;
[SerializeField]
GameObject
go_cashBox_mask,
go_cashBox;
[SerializeField]
Transform
tran_barParent,
bottom,
mask_content;
[SerializeField]
Button
btn_GetAllReward;
[SerializeField]
PanelScroll
sr_bars;
[SerializeField]
TMP_Text
txt_bpRedeemCount,
txt_cashBox,
text_num_icon_money;
List<int> rewardBarDatas = new();
Dictionary<int, BPRewardBar> dic_bars = new();
BattlePassDataProvider _dataProvider;
PlayerItemData _playerItemData;
CompositeDisposable disposables = new();
private int _curSpeicalIndex;
public void Awake()
{
_dataProvider = GContext.container.Resolve<BattlePassDataProvider>();
_playerItemData = GContext.container.Resolve<PlayerItemData>();
for (int j = 0; j < _dataProvider.BPMaxLevel; j++)
{
rewardBarDatas.Add(j + 1);
}
}
public void Start()
{
btn_buyLevel?.onClick.AddListener(async () => await UIManager.Instance.ShowUI(UITypes.BattlePassBuyGradePopupPanel));
RefreshView();
GContext.OnEvent<GetBattlePassRewardEvent>().Subscribe(OnGetBPReward).AddTo(disposables);
GContext.OnEvent<BpGetExp>().Subscribe(_ => RefreshGetAllBtn()).AddTo(disposables);
txt_bpRedeemCount.text = "100";
text_num_icon_money.text = (_playerItemData.GetExtraCoinMag(_dataProvider.curPassMain.ExpToCash)).ToString();
btn_GetAllReward.OnClickAsObservable().Subscribe(x => OnGetAllReward()).AddTo(disposables);
}
public async void BpVipUnlock()
{
await new WaitForSeconds(waveWaitTimer);
if (this == null)
return;
var go = sr_bars.transform.Find("particle_jiesuo").gameObject;
go.SetActive(true);
await new WaitForSeconds(2f);
if (this != null)
go.SetActive(false);
}
public void Open()
{
gameObject.SetActive(true);
}
public void Close()
{
gameObject.SetActive(false);
}
public void RefreshView()
{
_dataProvider.CheckIfRefreshBattblePass();
pfb_bar.gameObject.SetActive(false);
dic_bars.Clear();
for (int i = tran_barParent.childCount - 1; i >= 2; i--)
{
Destroy(tran_barParent.GetChild(i).gameObject);
}
var pos = _dataProvider.GetBarsDefaultPos() + 1;
if (_dataProvider.GetBPCurLevel == _dataProvider.BPMaxLevel)
{
sr_bars.Init<BPRewardBar, int>(pfb_bar.rectTransform.rect.height, pfb_bar.gameObject, null, rewardBarDatas, _currentIndex: _dataProvider.BPMaxLevel);
sr_bars.verticalNormalizedPosition = 0f;
// sr_bars.JumpToTarget(_dataProvider.BPMaxLevel,maxLevelOffsetY);
}
else
{
sr_bars.Init<BPRewardBar, int>(pfb_bar.rectTransform.rect.height, pfb_bar.gameObject, null, rewardBarDatas, _currentIndex: _dataProvider.GetBarsDefaultPos() - 1);
if (pos <= 3)
{
sr_bars.verticalNormalizedPosition = 1f;
}
else
{
sr_bars.JumpToTarget(pos);
}
}
RefreshGetAllBtn();
sr_bars.onValueChanged.AddListener(OnValueChanged);
bottom.GetComponent<RectTransform>().sizeDelta = tran_barParent.GetComponent<RectTransform>().sizeDelta;
}
private void RefreshGetAllBtn()
{
txt_cashBox.text = ConvertTools.GetNumberString(_playerItemData.GetExtraCoinMag(_dataProvider.GetCashBoxCount()));
go_cashBox_mask.SetActive(_dataProvider.GetBPCurLevel < _dataProvider.BPMaxLevel);
//btn_buyLevel.transform.parent.gameObject.SetActive(_dataProvider.GetBPCurLevel < _dataProvider.BPMaxLevel);
//go_cashBox_mask.SetActive(_dataProvider.GetCashBoxCount() <= 0);
btn_GetAllReward.transform.parent.gameObject.SetActive(_dataProvider.GetAllToGetRewardCount() >= 1);
bottom.localPosition = new Vector3(0, -_dataProvider.GetBPCurLevel * pfb_bar.rectTransform.rect.height, 0);
}
void OnValueChanged(Vector2 pos)
{
mask_content.position = tran_barParent.position;
}
private void OnGetBPReward(GetBattlePassRewardEvent data)
{
List<int> dropIDs = new List<int>();
for (int i = 0; i < data.NormalLevels.Count; i++)
{
dropIDs.Add(_dataProvider.GetSlotDropID(data.NormalLevels[i], true));
_dataProvider.SetLevelRewardGet(data.NormalLevels[i], true);
}
for (int i = 0; i < data.VipLevels.Count; i++)
{
dropIDs.Add(_dataProvider.GetSlotDropID(data.VipLevels[i], false));
_dataProvider.SetLevelRewardGet(data.VipLevels[i], false);
}
var itemDatas = _playerItemData.AddItemByDropList(dropIDs);
GContext.Publish(new ShowData());
_dataProvider.Data.SaveBattlePassRecord();
#if AGG
using (var e = GEvent.GameEvent("bp_level_reward"))
{
e.AddContent("bp_level", _dataProvider.GetBPCurLevel)
.AddContent("drop_id_list", JsonConvert.SerializeObject(dropIDs));
if (itemDatas != null && itemDatas.Count > 0)
{
for (int i = 0; i < itemDatas.Count; i++)
{
if (itemDatas[i].id == 1001)
{
e.AddContent("reward_hook", itemDatas[i].count);
}
else if (itemDatas[i].id == 1002)
{
e.AddContent("reward_cash", itemDatas[i].count);
}
}
}
}
#endif
RefreshGetAllBtn();
}
private async void OnGetAllReward()
{
_dataProvider.GetAllBpRewards();
RefreshGetAllBtn();
GContext.Publish(new ShowData());
GContext.Publish(new GetAllBPRewards());
await new WaitForSeconds(0.2f);
var rewardPanelTask = new RewardPopupData();
GContext.Publish(rewardPanelTask);
if (rewardPanelTask.tcs != null)
{
await rewardPanelTask.tcs.Task;
}
sr_bars.JumpToTarget(_dataProvider.GetBarsDefaultPos() + 1, pfb_bar.rectTransform.rect.height / 3);
// _dataProvider
}
private void OnDestroy()
{
disposables.Dispose();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be2e744d01ade0540887682479def640
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,125 @@
using asap.core;
using System;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UniRx;
using UnityEngine;
public class BattleTaskPanel : BasePanel
{
#region Fields
[SerializeField]
TMP_Text
txt_weeklyTaskTiemr,
txt_dailyTaskTimer;
[SerializeField]
GameObject
go_WTslot,
go_DTslot;
[SerializeField]
Transform
tran_WTbanner,
tran_slotParent;
#endregion
BattlePassDataProvider _dataProviver;
#region Func
private void Awake()
{
_dataProviver = GContext.container.Resolve<BattlePassDataProvider>();
}
protected override void Start()
{
go_DTslot.SetActive(false);
go_WTslot.SetActive(false);
_dataProviver.CheckIfRefreshDailyTask();
_dataProviver.CheckIfRefreshWeekTask();
RefreshView();
}
private void SetDTTimer(TimeSpan duration)
{
txt_dailyTaskTimer.text = ConvertTools.ConvertTime2(duration);
var timer = Observable.Interval(TimeSpan.FromSeconds(1))
.TakeWhile(seconds => seconds <= duration.TotalSeconds)
.Subscribe(seconds =>
txt_dailyTaskTimer.text = ConvertTools.ConvertTime2(duration.Subtract(TimeSpan.FromSeconds(seconds)))
, () => { _dataProviver.Data.RefreshDaiyTask(); RefreshView(); })
.AddTo(disposables)
;
}
private void SetWTTimer(TimeSpan duration)
{
txt_weeklyTaskTiemr.text = ConvertTools.ConvertTime2(duration);
var timer = Observable.Interval(TimeSpan.FromSeconds(1))
.TakeWhile(seconds => seconds <= duration.TotalSeconds)
.Subscribe(seconds =>
txt_weeklyTaskTiemr.text = ConvertTools.ConvertTime2(duration.Subtract(TimeSpan.FromSeconds(seconds)))
, () => { _dataProviver.Data.RefreshWeeklyTask(); RefreshView(); })
.AddTo(disposables)
;
}
private void RefreshView()
{
SetDTTimer(_dataProviver.GetDailyTaskDuration());
SetWTTimer(_dataProviver.GetWeeklyTaskDuration());
var taskSlot = tran_slotParent.GetComponentsInChildren<BPTaskSlot>();
foreach (var slot in taskSlot)
{
if (slot.gameObject != go_DTslot && slot.gameObject != go_WTslot)
{
Destroy(slot.gameObject);
}
}
var dailyTasks = _dataProviver.Data.BattleTask.dic_dailyTasks;
var weeklyTasks = _dataProviver.Data.BattleTask.dic_weeklyTasks;
var slotP = new List<BPTaskSlot>();
foreach (var task in dailyTasks)
{
var slot = Instantiate(go_DTslot, tran_slotParent).GetComponent<BPTaskSlot>();
slot.SetData(task.Key, true);
slotP.Add(slot);
}
slotP.Sort();
foreach (var slot in slotP)
{
slot.transform.SetAsLastSibling();
}
tran_WTbanner.SetAsLastSibling();
slotP.Clear();
foreach (var task in weeklyTasks)
{
var slot = Instantiate(go_WTslot, tran_slotParent).GetComponent<BPTaskSlot>();
slot.SetData(task.Key, false);
slotP.Add(slot);
}
slotP.Sort();
foreach (var slot in slotP)
{
slot.transform.SetAsLastSibling();
}
}
public void Open()
{
gameObject.SetActive(true);
}
public void Close()
{
gameObject.SetActive(false);
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e781129c6d689647865e5e4b3cae157
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f9ed3a7743a967f4b991cec78cf1070c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,116 @@
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class BuffInfoPopup : MonoBehaviour
{
public TMP_Text text_title;
public TMP_Text text_time;
public Image icon;
public TMP_Text text_content;
int buffId;
private void Reset()
{
text_title = transform.Find("text_title").GetComponent<TMP_Text>();
text_time = transform.Find("bg_time/text_time").GetComponent<TMP_Text>();
icon = transform.Find("btn_buff/Ani_Container/icon").GetComponent<Image>();
text_content = transform.Find("text_content").GetComponent<TMP_Text>();
}
public void InitPanel(FishBuff buff)
{
SetBuffPanel(buff);
buffId = buff.ID;
string title = LocalizationMgr.GetText(buff.Title_l10n_key);
string desc = LocalizationMgr.GetText(buff.Desc_l10n_key);
string iconName = buff.Icon;
if (buff.BuffParam is ExtraGold)
{
ExtraGold extraGold = buff.BuffParam as ExtraGold;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, extraGold.Param.ToPercentageString());
}
else if (buff.BuffParam is CollectionTargetExtraPoint)
{
string str = "";
//新目标奖励活动特殊地图 Todo
str = GContext.container.Resolve<FishingEventData>().collectingTargetInit.Title_l10n_key;
str = LocalizationMgr.GetText(str);
CollectionTargetExtraPoint collectionTargetExtraPoint = buff.BuffParam as CollectionTargetExtraPoint;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, collectionTargetExtraPoint.Param.ToPercentageString(), str);
}
else if (buff.BuffParam is SpMapExtraPoint)
{
SpMapExtraPoint spMapExtraPoint = buff.BuffParam as SpMapExtraPoint;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, spMapExtraPoint.Param.ToPercentageString());
}
else if (buff.BuffParam is SuperBomb)
{
SuperBomb superBomb = buff.BuffParam as SuperBomb;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superBomb.CashBonus.ToPercentageString());
}
else if (buff.BuffParam is SuperRob)
{
SuperRob superRob = buff.BuffParam as SuperRob;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superRob.CashBonus.ToPercentageString());
}
else if (buff.BuffParam is SuperHunt)
{
SuperHunt superHunt = buff.BuffParam as SuperHunt;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superHunt.CashBonus.ToPercentageString());
}
else if (buff.BuffParam is CollectionTargetWeight)
{
string str = "";
//新目标奖励活动 Todo
CollectionTargetWeight collectionTargetWeight = buff.BuffParam as CollectionTargetWeight;
CollectingTargetInit collectingTargetInit = GContext.container.Resolve<FishingEventData>().collectingTargetInit;
if (collectingTargetInit != null)
{
EventTargetExtraDrop eventTargetExtraDrop = collectingTargetInit.FishingExtraDrop;
if (eventTargetExtraDrop is ETKeepsake)
{
ETKeepsake eTKeepsake = eventTargetExtraDrop as ETKeepsake;
int fishItemId = eTKeepsake.FishIDList[collectionTargetWeight.TargetFishIndex - 1];
Item item = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(fishItemId);
str = LocalizationMgr.GetText(item.Name_l10n_key);
iconName = collectingTargetInit.BuffIcon;
}
}
title = LocalizationMgr.GetFormatTextValue(buff.Title_l10n_key, str);
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, str);
}
else if (buff.BuffParam is ConstructionCost)
{
ConstructionCost constructionCost = buff.BuffParam as ConstructionCost;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, constructionCost.Param.ToPercentageString());
}
else if (buff.BuffParam is SuperSavingPot)
{
SuperSavingPot superSavingPot = buff.BuffParam as SuperSavingPot;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, superSavingPot.Param.ToPercentageString());
}
else if (buff.BuffParam is Event1v1RodBuff)
{
Event1v1RodBuff event1V1RodBuff = buff.BuffParam as Event1v1RodBuff;
desc = LocalizationMgr.GetFormatTextValue(buff.Desc_l10n_key, event1V1RodBuff.Param.ToPercentageString());
}
text_title.text = title;
text_content.text = desc;
if (!string.IsNullOrEmpty(iconName))
{
GContext.container.Resolve<IUIService>().SetImageSprite(icon, iconName);
}
}
protected virtual void SetBuffPanel(FishBuff buff)
{
}
public void SetBuffTime(string str)
{
text_time.text = str;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ec786ea32f6199946a14e8015ae20da4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine.UI;
public class BuffInfoPopup_2 : BuffInfoPopup
{
public Image text_info_image;
public TMP_Text text_info_text;
protected override void SetBuffPanel(FishBuff buff)
{
IUIService uiService = GContext.container.Resolve<IUIService>();
uiService.SetImageSprite(text_info_image, buff.RemarkIcon[0]);
text_info_text.text = LocalizationMgr.GetText(buff.RemarkDesc_l10n_key);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 20993cbd507d6d04e98f024a64ce33e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine.UI;
public class BuffInfoPopup_3 : BuffInfoPopup
{
public Image icon_1, icon_2;
public TMP_Text text_info1;
public TMP_Text text_info2;
protected override void SetBuffPanel(FishBuff buff)
{
float superCashBonus = 0;
Item item = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(1002);
if (buff.BuffParam is MoreFishingCash)
{
MoreFishingCash moreFishingCash = buff.BuffParam as MoreFishingCash;
IUIService uiService = GContext.container.Resolve<IUIService>();
uiService.SetImageSprite(icon_1, buff.RemarkIcon[0]);
uiService.SetImageSprite(icon_2, buff.RemarkIcon[1]);
text_info1.text = $"{LocalizationMgr.GetText(item.Name_l10n_key)} +{moreFishingCash.Param[0].ToPercentageString()}";
text_info2.text = $"{LocalizationMgr.GetText(item.Name_l10n_key)} +{moreFishingCash.Param[1].ToPercentageString()}";
return;
}
else if (buff.BuffParam is SuperRob)
{
SuperRob superRob = buff.BuffParam as SuperRob;
superCashBonus = superRob.CashBonus;
}
else if (buff.BuffParam is SuperBomb)
{
SuperBomb superBomb = buff.BuffParam as SuperBomb;
superCashBonus = superBomb.CashBonus;
}
else if (buff.BuffParam is SuperHunt)
{
SuperHunt superHunt = buff.BuffParam as SuperHunt;
superCashBonus = superHunt.CashBonus;
}
FishingEventData _fishingEventData = GContext.container.Resolve<FishingEventData>();
text_info1.text = $"{LocalizationMgr.GetText(item.Name_l10n_key)} +{superCashBonus.ToPercentageString()}";
if (_fishingEventData.rankInit != null)
{
item = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(_fishingEventData.rankInit.TokenID);
IUIService uiService = GContext.container.Resolve<IUIService>();
uiService.SetImageSprite(icon_2, item.Icon);
text_info2.text = $"{LocalizationMgr.GetText(item.Name_l10n_key)} +{0}";
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2d231c9d2a08b44ab9425418e7df202
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,86 @@
using asap.core;
using cfg;
using GameCore;
using System;
using UnityEngine;
using UnityEngine.UI;
public class FishingBuffInfoPopupPanel : MonoBehaviour
{
Timer buff_timer;
BuffInfoPopup buffInfoPopup;
Button btn_close;
private void Start()
{
btn_close = transform.Find("btn_close").GetComponent<Button>();
btn_close.onClick.AddListener(Close);
}
public void InitPanel(FishBuff buff)
{
Transform root = transform.Find("root");
for (int i = 0; i < root.childCount; i++)
{
GameObject gameObj = root.GetChild(i).gameObject;
gameObj.SetActive(gameObj.name == buff.RemarkNode);
if (gameObj.name == buff.RemarkNode)
{
buffInfoPopup = gameObj.GetComponent<BuffInfoPopup>();
}
}
if (buffInfoPopup != null)
{
buffInfoPopup.InitPanel(buff);
buff_timer?.Cancel();
buffInfoPopup.SetBuffTime(LocalizationMgr.GetFormatTextValue("UI_COMMON_min", buff.CountDown / 60));
}
}
public void InitPanel(FishBuffTimeData buffTimeData)
{
FishBuff buff = GContext.container.Resolve<Tables>().TbFishBuff.GetOrDefault(buffTimeData.buffID);
Transform root = transform.Find("root");
for (int i = 0; i < root.childCount; i++)
{
GameObject gameObj = root.GetChild(i).gameObject;
gameObj.SetActive(gameObj.name == buff.RemarkNode);
if (gameObj.name == buff.RemarkNode)
{
buffInfoPopup = gameObj.GetComponent<BuffInfoPopup>();
}
}
if (buffInfoPopup != null)
{
buffInfoPopup.InitPanel(buff);
var buffTime = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
buff_timer?.Cancel();
double seconds = buffTime.TotalSeconds;
TimeSpan now = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
buffInfoPopup.SetBuffTime(ConvertTools.ConvertTime2(now));
buff_timer = this.AttachTimer((float)seconds,
() => { Close(); },
(elapsed) =>
{
if (buffTimeData.isEnd)
{
Close();
return;
}
now = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
if (now.TotalSeconds <= 0)
{
Close();
return;
}
buffInfoPopup.SetBuffTime(ConvertTools.ConvertTime2(now));
}, useRealTime: true);
}
}
void Close()
{
UIManager.Instance.DestroyUI(UITypes.FishingBuffInfoPopupPanel);
}
private void OnDestroy()
{
buff_timer?.Cancel();
buff_timer = null;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7337165d2f7f57d4cb1cd722b5ef36c4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,76 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class FishingBuffLayoutPopupPanel : MonoBehaviour
{
RectTransform defaultStyle;
RectTransform targetStyle;
HomeBuffItem btn_buff_prefab;
HomeBuffItem btn_buff_target;
BuffDataCenter buffDataCenter;
FishingData fishingData;
FishBuffTimeData targetBuffTimeData;
Transform content;
List<FishBuffTimeData> fishBuffTimeData;
private void Awake()
{
content = transform.Find("root/ScrollView/Viewport/Content");
defaultStyle = transform.Find("root/ScrollView/Viewport/Content/btn_buff_beilv/Ani_Container/icon").GetComponent<RectTransform>();
targetStyle = transform.Find("root/ScrollView/Viewport/Content/btn_buff_target/Ani_Container/icon").GetComponent<RectTransform>();
btn_buff_prefab = transform.Find("root/ScrollView/Viewport/Content/btn_buff_beilv").GetComponent<HomeBuffItem>();
}
private void Start()
{
btn_buff_prefab.gameObject.SetActive(false);
fishingData = GContext.container.Resolve<FishingData>();
buffDataCenter = GContext.container.Resolve<BuffDataCenter>();
fishBuffTimeData = buffDataCenter.GetGroupBuff();
int mapId = fishingData.MapId;
var mapBuffTimeData = buffDataCenter.GetMapBuffTimeData(mapId);
if (mapBuffTimeData != null)
{
fishBuffTimeData.Add(mapBuffTimeData);
}
targetBuffTimeData = buffDataCenter.GetBuffData<CollectionTargetWeight>();
if (targetBuffTimeData != null)
{
fishBuffTimeData.Add(targetBuffTimeData);
}
ShowBuff();
}
void ShowBuff()
{
fishBuffTimeData = fishBuffTimeData.Where(x => x.isEnd == false).ToList();
fishBuffTimeData.Sort((a, b) => b.SortID.CompareTo(a.SortID));
int dataCount = fishBuffTimeData.Count;
for (int i = 0; i < dataCount; i++)
{
HomeBuffItem homeBuffItem;
var item = Instantiate(btn_buff_prefab.gameObject, content);
homeBuffItem = item.GetComponent<HomeBuffItem>();
if (targetBuffTimeData != null && fishBuffTimeData[i].buffID == targetBuffTimeData.buffID)
{
btn_buff_target = homeBuffItem;
homeBuffItem.InitPanel(fishBuffTimeData[i], "", targetStyle);
CollectingTargetInit targetWeightInit = GContext.container.Resolve<FishingEventData>().collectingTargetInit;
if (targetWeightInit != null)
{
btn_buff_target.InitPanel(targetBuffTimeData, targetWeightInit.BuffIcon, targetStyle);
}
}
else
{
homeBuffItem.InitPanel(fishBuffTimeData[i], "", defaultStyle);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0a134b91d45140f439a31f20cec9d42c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a029d03e987b633479a6ad8057fa1864
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
using UnityEngine;
using System.IO;
using System;
public static class CaptureImageSaver
{
public static string savePath = Application.persistentDataPath + "/fishTravel/"; // 保存到持久化数据路径
public static void SaveImagePersistent(byte[] image, string imageName, Action<bool, string> callback = null)
{
string fullPath = Path.Combine(savePath, imageName);
try
{
// 确保保存路径存在
if (!Directory.Exists(savePath))
{
Directory.CreateDirectory(savePath);
}
// 保存纹理为PNG文件
File.WriteAllBytes(fullPath, image);
callback.Invoke(true, fullPath);
}
catch (System.Exception ex)
{
Debug.LogWarning($"保存图片时出错: {ex.Message} +++ {ex.StackTrace}");
callback.Invoke(false, null);
return;
}
Debug.Log($"{imageName} saved to {fullPath}.");
}
public static void DeleteImagePersistent(string fullPath)
{
try
{
File.Delete(fullPath);
}
catch (System.Exception ex)
{
Debug.LogWarning($"保存图片时出错: {ex.Message} +++ {ex.StackTrace}");
return;
}
Debug.Log($"DeleteImagePersistent to {fullPath}.");
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: de3d65210c7b0cd44a6eca8da71053a8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,44 @@
using asap.core;
using GameCore;
using UnityEngine;
using UnityEngine.UI;
public class ChainPackBtn : MonoBehaviour, IUIRedPoint
{
Button _button;
GameObject redpoint;
private ThanksGivingPackData _data;
private void Awake()
{
_data = GContext.container.Resolve<FishingEventData>().ChainPackWithProgressMigrationData;
_button = GetComponent<Button>();
redpoint = transform.Find("redpoint").gameObject;
if (!_data.IsActive)
{
gameObject.SetActive(false);
return;
}
}
private void Start()
{
_button.onClick.AddListener(OnClickChainPack);
}
private void OnClickChainPack()
{
_data.ShowChainPack();
}
void OnEnable()
{
RedPointManager.Instance.AddRedPoint(_data.RedPointKey, this);
SetRedPointState(_data.DoNeedPackRedPoint);
}
public void SetRedPointState(bool state)
{
redpoint.SetActive(state);
gameObject.SetActive(_data.IsActive);
}
private void OnDisable()
{
RedPointManager.Instance.RemoveRedPoint(_data.RedPointKey);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bdee21256f2c0ac41a4ff1d04a2900a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 676ee66e0e986554aa26792cb70b58de
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,53 @@
using asap.core;
using GameCore;
using System.Collections.Generic;
using UnityEngine;
public class ChallangReward : MonoBehaviour
{
[SerializeField]
private Transform tran_rewardParent;
[SerializeField]
private GameObject go_row;
[SerializeField] private PanelScroll ps;
private List<GameObject> rows = new();
int childCount;
public async void InitAsync(List<ItemData> dropItems)
{
childCount = go_row.transform.childCount;
go_row.gameObject.SetActive(false);
GameObject curParent;
for (int i = 0; i < dropItems.Count; i += childCount)
{
curParent = Instantiate(go_row, tran_rewardParent);
curParent.SetActive(true);
rows.Add(curParent.gameObject);
var count = dropItems.Count - i;
for (int j = 0; j < childCount; j++)
{
curParent.transform.GetChild(j).gameObject.SetActive(j < count);
curParent.transform.GetChild(j).GetChild(0).gameObject.SetActive(false);
}
await Awaiters.NextFrame;
ps.verticalNormalizedPosition = 0f;
for (int j = 0; j < childCount; j++)
{
if (j < count)
{
var item = dropItems[i + j];
curParent.transform.GetChild(j).gameObject.SetActive(true);
var reward = curParent.transform.GetChild(j).GetChild(0).GetComponent<RewardItemNew>();
reward.SetRewardPopupData(item);
reward.gameObject.SetActive(true);
reward.PlayOpen();
cfg.Item itemCfg = GContext.container.Resolve<cfg.Tables>().TbItem.GetOrDefault(item.id);
GContext.Publish(new ResAddEvent(itemCfg.ID, itemCfg.Type, itemCfg.SubType));
}
}
}
await Awaiters.NextFrame;
ps.verticalNormalizedPosition = 0f;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c74971434c5bb02468ce84b90ed75101
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,106 @@
using asap.core;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
using cfg;
using UnityEngine.AddressableAssets;
using game;
using System.Collections.Generic;
using PlayFab.Internal;
public class EventChallengeFacePopupPanel : MonoBehaviour
{
// FishingChallengeCenter FCC;
private FishingChallengeManager _fishingChallengeManager;
Image bg_map;
TMP_Text text_map;
TMP_Text text_map1;
TMP_Text text_map2;
TMP_Text text_title;
TMP_Text text_title1;
TMP_Text text_title2;
TMP_Text text_remaing;
Button btn_enter;
Button btn_close;
private void Awake()
{
// FCC = GContext.container.Resolve<FishingChallengeCenter>();
_fishingChallengeManager = GContext.container.Resolve<FishingChallengeManager>();
bg_map = transform.Find("root/mask_map/img_map").GetComponent<Image>();
text_map = transform.Find("root/text_map").GetComponent<TMP_Text>();
text_map1 = transform.Find("root/text_map/text_map1").GetComponent<TMP_Text>();
text_map2 = transform.Find("root/text_map/text_map2").GetComponent<TMP_Text>();
text_title = transform.Find("root/text_title").GetComponent<TMP_Text>();
text_title1 = transform.Find("root/text_title/text_title1").GetComponent<TMP_Text>();
text_title2 = transform.Find("root/text_title/text_title2").GetComponent<TMP_Text>();
text_remaing = transform.Find("root/text_remaing").GetComponent<TMP_Text>();
btn_enter = transform.Find("root/btn_enter/btn_green").GetComponent<Button>();
btn_close = transform.Find("btn_close").GetComponent<Button>();
}
private void Start()
{
Log("Start");
btn_enter.onClick.AddListener(OnEnterNewMap);
btn_close.onClick.AddListener(OnClose);
Init();
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("EventChallengeFacePopupPanel");
}
private void Init()
{
GContext.container.Resolve<IUIService>().SetImageSprite(bg_map, _fishingChallengeManager.challengeMapData.Bg);
text_map.text = text_map1.text = text_map2.text = LocalizationMgr.GetText(_fishingChallengeManager.challengeMapData.Name_l10n_key);
text_title.gameObject.SetActive(false);
text_remaing.gameObject.SetActive(false);
// text_title.text = text_title1.text = text_title2.text = LocalizationMgr.GetFormatTextValue("UI_EventChallangePanel_7", _fishingChallengeManager.eventChallengeMain.leveL);
//int curCount = _fishingChallengeManager.number;
//int allCount = FCC.challengeMatchConfig.DailyTimes;
//text_remaing.text = LocalizationMgr.GetFormatTextValue("UI_EventChallangePanel_2", $"{allCount - curCount}/{allCount}");
}
async void OnEnterNewMap()
{
var tables = GContext.container.Resolve<Tables>();
var mapData = tables.TbMapData.DataMap[_fishingChallengeManager.challengeMapData.ID];
btn_enter.enabled = false;
var loadResourceService = GContext.container.Resolve<ILoadResourceService>();
var isCanEnter = await loadResourceService.Loads(new List<string>(){
mapData.EnvName, _fishingChallengeManager.PrefabName });
if (isCanEnter)
{
OnEnter();
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(true, OnEnter);
//var panel = await UIManager.Instance.ShowUI(UITypes.FishingDownLoadPopupPanel);
//panel.GetComponent<FishingDownLoadPopupPanel>().SetBtn(null, OnEnter);
btn_enter.enabled = true;
}
}
async void OnEnter()
{
btn_enter.enabled = false;
GContext.Publish(new ShowHomeMapEvent() { mapID = _fishingChallengeManager.challengeMapData.ID });
await new WaitForSeconds(0.5f);
OnClose();
// await UIManager.Instance.ShowUI(UITypes.EventChallengeMatchingPopupPanel);
// GContext.Publish(new EndTransition());
}
void OnClose()
{
UIManager.Instance.DestroyUI(UITypes.EventChallengeFacePopupPanel);
}
private static void Log(object t)
{
Debug.Log($"<color=yellow>EventChallangeFacePopupPanel -> {t} </color>");
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a9d99caa33cb01942af9a104baa4f3f8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
using UnityEngine;
using UnityEngine.UI;
public class EventChallengeHead : MonoBehaviour
{
public RectTransform rectTransform;
public Image icon_head;
public Animation headAni;
public GameObject bg_head_myself;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 75ec543871d5efc419dff84dac769c55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,68 @@
using System.Linq;
using asap.core;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class EventChallengeInfoPopupPanel : MonoBehaviour
{
private TMP_Text _textTitle;
// 数量文字
private TMP_Text _info1_item1_text_num;
private TMP_Text _info1_item2_text_num;
private TMP_Text _info1_item3_text_num;
// 信息
private TMP_Text _info1_text_info;
private TMP_Text _info2_text_info;
private TMP_Text _info3_text_info;
//
private TMP_Text _info3TotalPrizeTextNum;
//
private TMP_Text _textTips;
// public RewardItemNew[] rewardItemNews1;
// public TMP_Text text_title2;
// public RewardItemNew[] rewardItemNews2;
private FishingChallengeManager _fishingChallengeManager;
private void Awake()
{
//
_textTitle = transform.Find("root/text_title").GetComponent<TMP_Text>();
_info1_item1_text_num = transform.Find("root/info1/item/item1/text_num").GetComponent<TMP_Text>();
_info1_item2_text_num = transform.Find("root/info1/item/item2/text_num").GetComponent<TMP_Text>();
_info1_item3_text_num = transform.Find("root/info1/item/item3/text_num").GetComponent<TMP_Text>();
//
_info1_text_info = transform.Find("root/info1/text_info").GetComponent<TMP_Text>();
_info2_text_info = transform.Find("root/info2/text_info").GetComponent<TMP_Text>();
_info3_text_info = transform.Find("root/info3/text_info").GetComponent<TMP_Text>();
//
_info3TotalPrizeTextNum = transform.Find("root/info3/total_prize/reward/text_num").GetComponent<TMP_Text>();
_fishingChallengeManager = GContext.container.Resolve<FishingChallengeManager>();
}
private void Start()
{
//
_info1_item1_text_num.text = "x" + _fishingChallengeManager.GetQualityScore(3);
_info1_item2_text_num.text = "x" + _fishingChallengeManager.GetQualityScore(4);
_info1_item3_text_num.text = "x" + _fishingChallengeManager.GetQualityScore(5);
var itemData = _fishingChallengeManager.GetFinalReward().FirstOrDefault();
if (itemData?.count > 0)
{
_info3TotalPrizeTextNum.text = "x" + ConvertTools.GetNumberString(itemData.count);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 68d16a305a71680419756ae024cfa2ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,234 @@
using asap.core;
using cfg;
using DG.Tweening;
using game;
using GameCore;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
public class EventChallengeMatchingLoadingPanel : MonoBehaviour
{
private FishingChallengeManager _fishingChallengeManager;
//
private Animation _panelAnimation;
private Button _btnMask;
private TMP_Text text_title;
//
private TMP_Text text_info;
//
private TMP_Text text_num;
private TMP_Text _prizeTextNum;
private Image _iconPrize;
private GameObject rootGo;
private GameObject text_match_success;
private GameObject text_match;
private GameObject text_continue;
private Animation player;
private RectTransform region;
private IDisposable _disposable;
private List<EventChallengeHead> headList = new();
//
private int _uiType = 0;
private void Awake()
{
Log("Awake");
_uiType = FishingChallengeAct.CloudType;
_fishingChallengeManager = GContext.container.Resolve<FishingChallengeManager>();
_disposable = GContext.OnEvent<EndTransition>().Subscribe(EndTransition);
_panelAnimation = transform.GetComponent<Animation>();
_btnMask = transform.Find("top").GetComponent<Button>();
_iconPrize = transform.Find("bg/total_prize/icon_prize").GetComponent<Image>();
_prizeTextNum = transform.Find("bg/total_prize/reward/text_num").GetComponent<TMP_Text>();
//
rootGo = transform.Find("root").gameObject;
text_title = transform.Find("root/text_title").GetComponent<TMP_Text>();
text_num = transform.Find("root/challenger/text_num").GetComponent<TMP_Text>();
text_match_success = transform.Find("root/text_match_success").gameObject;
text_match = transform.Find("root/text_match").gameObject;
text_continue = transform.Find("root/text_continue").gameObject;
player = transform.Find("root/player").GetComponent<Animation>();
player.gameObject.SetActive(false);
}
private async void Start()
{
Log("Start");
var itemData = _fishingChallengeManager.GetFinalReward().FirstOrDefault();
if (itemData?.count > 0)
{
_prizeTextNum.text = "x" + ConvertTools.GetNumberString(itemData.count);
}
if (_uiType == 1)
{
rootGo.SetActive(true);
PlayAni();
_btnMask.onClick.AddListener(OnEnter);
// var listItemData = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(_fishingChallengeManager.eventChallengeMain.WinnerReward);
// if (listItemData is { Count: > 0 })
// {
// //var count = listItemData.Sum(itemData => itemData.count);
// // _prizeTextNum.GetComponent<TMP_Text>().text = "x" + ConvertTools.GetNumberString(count);
// }
_btnMask.enabled = false;
text_continue.SetActive(false);
text_match_success.SetActive(false);
text_match.SetActive(true);
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("EventChallengeMatchingPopupPanel");
}
else
{
rootGo.SetActive(false);
await PlayBgAni();
}
}
private async Task PlayBgAni()
{
// 等待开始动画播完
await Awaiters.Seconds(0.68f);
_panelAnimation.Play("loading_loop");
await Awaiters.Seconds(0.1f);
}
private async void PlayAni()
{
Log("PlayAni");
text_num.text = "1";
await PlayBgAni();
_fishingChallengeManager.MatchComplete();
ShowPlay();
await Awaiters.Seconds(1);
SetPlay();
int curPlay = 1;
int allPlay = _fishingChallengeManager.eventChallengeMain.RobotNumber + 1;
float len = player.clip.length;
DOTween.To(() => curPlay, x => curPlay = x, allPlay, len).OnUpdate(() => text_num.text = curPlay.ToString()).SetEase(Ease.InCubic);
await Awaiters.Seconds(len);
text_num.text = allPlay.ToString();
text_match_success.SetActive(true);
text_match.SetActive(false);
text_continue.SetActive(true);
_btnMask.enabled = true;
}
void SetPlay()
{
player.gameObject.SetActive(true);
// await Awaiters.Seconds(0.5f);
}
void ShowPlay()
{
Log("ShowPlay");
var robotAccountList = _fishingChallengeManager.fishingChallengeData.robotAccountList;
Dictionary<int, cfg.Robot> robots = GContext.container.Resolve<cfg.Tables>().TbRobot.DataMap;
IUIService uiService = GContext.container.Resolve<IUIService>();
Transform player = transform.Find("root/player");
EventChallengeHead myHead = player.Find("myself/EventChallengeHead").GetComponent<EventChallengeHead>();
uiService.SetHeadImage(myHead.icon_head, GContext.container.Resolve<IUserService>().AvatarUrl);
myHead.bg_head_myself.SetActive(true);
int residual = player.childCount;
for (int i = 1; i < residual; i++)
{
var head = player.Find($"{i}/EventChallengeHead").GetComponent<EventChallengeHead>();
if (robots.TryGetValue(robotAccountList[i], out cfg.Robot robot))
{
uiService.SetHeadImage(head.icon_head, robot.Avatar);
}
headList.Add(head);
}
}
/// <summary>
/// 随机位置
/// </summary>
/// <param name="region">区域</param>
/// <param name="residual">剩余人数</param>
/// <returns>vector2+scale</returns>
List<Vector3> GetRandomPos(RectTransform region, int residual)
{
var rect = region.rect;
float width = rect.width / 2;
float height = rect.height / 2;
List<Vector3> vector2s = new List<Vector3>();
for (int i = 0; i < residual; i++)
{
//在园内随机位置
Vector3 randomPosition = UnityEngine.Random.insideUnitCircle;
randomPosition.x *= width;
randomPosition.y = -Math.Abs(randomPosition.y) * 2 * height + height;
randomPosition.z = Mathf.Lerp(1, 0.7f, (randomPosition.y + height) / rect.height);
vector2s.Add(randomPosition);
}
vector2s.Sort((a, b) => b.y.CompareTo(a.y));
return vector2s;
}
async void OnEnter()
{
// _panelAnimation.Play("loading_end");
// await Awaiters.Seconds(0.7f);
StartCoroutine(End());
}
private void EndLoad()
{
// load?.Dispose();
// load = null;
// btn_close.onClick.RemoveAllListeners();
// btn_close.gameObject.SetActive(false);
// bg_bar.SetActive(false);
}
public void EndTransition(EndTransition endTransition)
{
if(_uiType == 0)
{
// EndLoad();
StartCoroutine(End());
}
}
private void OnDisable()
{
Dispose();
}
IEnumerator End()
{
_panelAnimation.Play("loading_end");
Dispose();
yield return new WaitForSeconds(0.6f);
if (FishingChallengeAct.CloudType == 1)
{
GContext.Publish(new EventNotifyMatchComplete());
yield return new WaitForSeconds(0.3f);
}
UIManager.Instance.DestroyUI(gameObject.name);
FishingChallengeAct.CloudType = 0;
}
private void Dispose()
{
_disposable?.Dispose();
_disposable = null;
}
private void Log(object message)
{
Debug.Log($"<color=#00ffff> EventChallengeMatchingPopupPanel -> {message} </color>");
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4869788b1c32b33469de00523672d23f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More