备份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,26 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class BeilvItem : MonoBehaviour
{
public Button btn;
public GameObject bg_normal;
public GameObject bg_selected;
public GameObject bg_gray;
public TMP_Text text_beilv;
public bool isLock = true;
public bool isShow = false;
public int beilvIndex;
public int beilv;
private void Reset()
{
btn = GetComponent<Button>();
bg_normal = transform.Find("bg_normal").gameObject;
bg_selected = transform.Find("bg_selected").gameObject;
bg_gray = transform.Find("bg_gray").gameObject;
text_beilv = transform.Find("text_beilv").GetComponent<TMP_Text>();
}
}

View File

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

View File

@@ -0,0 +1,83 @@
using asap.core;
using System;
using System.Collections.Generic;
using UnityEngine;
using UniRx;
public abstract class EventButtonResource : MonoBehaviour
{
ILoadResourceService loadResourceService;
bool Checking = false;
IDisposable loadResourceIdis;
string resourceKey;
Animation anim;
public async void CheckResource(List<string> resourceName)
{
if (Checking || resourceName == null || resourceName.Count == 0)
{
return;
}
Checking = true;
loadResourceService = GContext.container.Resolve<ILoadResourceService>();
resourceKey = string.Join(",", resourceName);
Debug.Log("资源Key" + resourceKey);
bool isReady = await loadResourceService.CheckResourceLoadQueue(resourceKey, resourceName);
if (!isReady)
{
anim = GetComponent<Animation>();
gameObject.SetActive(false);
DisposeEvent();
loadResourceIdis = GContext.OnEvent<LoadEventResourceEvent>().Where(_ => _.key == resourceKey).Subscribe(LoadEventResourceEvent);
//会闪一下吗?
}
else
{
anim = null;
LoadEventResource(true);
}
}
void LoadEventResourceEvent(LoadEventResourceEvent loadEvent)
{
Debug.Log($"LoadEventResourceEvent {loadEvent.key} {loadEvent.isSucceeded} ");
DisposeEvent();
LoadEventResource(loadEvent.isSucceeded);
Checking = loadEvent.isSucceeded;
}
void DisposeEvent()
{
loadResourceIdis?.Dispose();
loadResourceIdis = null;
}
void LoadEventResource(bool succeeded)
{
if (gameObject == null)
{
Debug.Log("下载资源回调gameObject 是空");
return;
}
if (succeeded)
{
try
{
if (anim!=null)
{
anim.Play("btn_download_show");
}
OnLoadEventResource();
}
catch (System.Exception e)
{
Debug.LogError($"Load Event Resource Exception! == {gameObject.name} \n {e}");
}
}
else
{
Debug.LogError($"Load Event Resource Failed! == {gameObject.name}");
}
}
protected abstract void OnLoadEventResource();
private void OnDestroy()
{
DisposeEvent();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c65b3d73d9d1ff84ba8eaefd3ce9086f
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 UnityEngine;
using UnityEngine.UI;
using UniRx;
using TMPro;
using System;
public class FishingDownLoadPopupPanel : MonoBehaviour
{
Button btn_close;
ILoadResourceService loadResourceService;
Image bar;
TMP_Text text_info;
IDisposable disposable;
GameObject btn_1;
GameObject btn_2;
Button btn_confrim;
Button btn_back2;
Button btn_confrim2;
public Action OnBack;
public Action OnConfrim;
float progress;
private void Awake()
{
loadResourceService = GContext.container.Resolve<ILoadResourceService>();
btn_close = transform.Find("btn_close").GetComponent<Button>();
bar = transform.Find("root/bg_bar/bar").GetComponent<Image>();
text_info = transform.Find("root/text_info").GetComponent<TMP_Text>();
btn_1 = transform.Find("root/btn_1").gameObject;
btn_2 = transform.Find("root/btn_2").gameObject;
btn_confrim = transform.Find("root/btn_1/btn_confrim/btn_green").GetComponent<Button>();
btn_back2 = transform.Find("root/btn_2/btn_back/btn_green").GetComponent<Button>();
btn_confrim2 = transform.Find("root/btn_2/btn_confrim/btn_green").GetComponent<Button>();
}
public void Start()
{
btn_close.onClick.AddListener(OnClickClose);
btn_confrim.onClick.AddListener(OnClickConfrim);
btn_back2.onClick.AddListener(OnClickBack);
btn_confrim2.onClick.AddListener(OnClickConfrim);
Init();
}
public void SetBtn(Action OnBack, Action OnConfrim)
{
this.OnBack = OnBack;
this.OnConfrim = OnConfrim;
btn_1.SetActive(OnBack == null);
btn_2.SetActive(OnBack != null);
}
void OnClickBack()
{
OnBack?.Invoke();
OnClickClose();
}
async void Init()
{
bool isCanEnter = await loadResourceService.Load(loadResourceService.curName);
text_info.text = LocalizationMgr.GetFormatTextValue("UI_FishingDownLoadPopupPanel_1", 0);
if (isCanEnter)
{
bar.fillAmount = 1;
}
else
{
bar.fillAmount = 0;
disposable = GContext.OnEvent<LoadProgressEvent>().Subscribe(OnLoadProgress);
}
}
void OnClickConfrim()
{
if (progress > 1)
{
OnConfrim?.Invoke();
}
OnClickClose();
}
void OnClickClose()
{
OnBack = null;
OnConfrim = null;
UIManager.Instance.DestroyUI(UITypes.FishingDownLoadPopupPanel);
}
private const long byte2mb = 1024 * 1024;
void OnLoadProgress(LoadProgressEvent e)
{
if (e.name == loadResourceService.curName)
{
progress = e.progress;
float curprogress = e.progress;
if (curprogress > 1)
{
curprogress = 1f;
}
var progressStr = $"\n{(curprogress * e.totalDownloadSize / byte2mb).ToString("0.0")}MB/{(e.totalDownloadSize / byte2mb).ToString("0.0")}MB ({curprogress.ToPercentageString()})";
text_info.text = LocalizationMgr.GetFormatTextValue("UI_FishingDownLoadPopupPanel_1", progressStr);
bar.fillAmount = curprogress;
}
}
private void OnDestroy()
{
disposable?.Dispose();
disposable = null;
}
}

View File

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

View File

@@ -0,0 +1,72 @@
using asap.core;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
//专用目标奖励活动礼包按钮
public class GiftButton : EventButtonResource
{
public Button btn_gift;
public TMP_Text text_time;
public Image bg;
public Image icon;
public GameObject redpoint;
UIType uIType;
string iconName;
private void Reset()
{
btn_gift = GetComponent<Button>();
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
bg = transform.Find("bg").GetComponent<Image>();
icon = transform.Find("icon").GetComponent<Image>();
redpoint = transform.Find("redpoint").gameObject;
}
private void Start()
{
btn_gift.onClick.AddListener(OnClickTargetGift);
}
public void Init(UIType uIType, string icon)
{
this.uIType = uIType;
iconName = icon;
CheckResource(new List<string>() { uIType.Name, iconName });
}
async void OnClickTargetGift()
{
var collectingTargetInit = GContext.container.Resolve<FishingEventData>().collectingTargetInit;
if (collectingTargetInit != null)
{
btn_gift.enabled = false;
//ExitAutoFishing();
//退出自动钓鱼
bool isCanEnter = await GContext.container.Resolve<ILoadResourceService>().Load(collectingTargetInit.GiftPrefab);
if (isCanEnter)
{
await UIManager.Instance.ShowUI(uIType);
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(false, () =>
{
_ = UIManager.Instance.ShowUI(uIType);
});
}
btn_gift.enabled = true;
}
}
public void SetTime(string value)
{
text_time.text = value;
}
protected override void OnLoadEventResource()
{
IUIService uiService = GContext.container.Resolve<IUIService>();
uiService.SetImageSprite(icon, iconName);
gameObject.SetActive(true);
}
}

View File

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

View File

@@ -0,0 +1,110 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class HomeBeilvPanel : MonoBehaviour
{
public Button btn_close;
public List<BeilvItem> beilv_special;
public List<BeilvItem> beilv_normal;
public Action<BeilvItem> OnBeilvClick;
PlayerData playerData;
Tables _tables;
public void Init()
{
playerData = GContext.container.Resolve<PlayerData>();
_tables = GContext.container.Resolve<Tables>();
for (int i = 0; i < beilv_special.Count; i++)
{
BeilvItem index = beilv_special[i];
beilv_special[i].btn.onClick.AddListener(() =>
{
OnClick(index);
});
}
for (int i = 0; i < beilv_normal.Count; i++)
{
BeilvItem index = beilv_normal[i];
beilv_normal[i].btn.onClick.AddListener(() =>
{
OnClick(index);
});
}
btn_close.onClick.AddListener(() =>
{
gameObject.SetActive(false);
});
}
public void OnShow()
{
var DataList = _tables.TbEnergyDef.DataList;
int normalCount = beilv_normal.Count;
int Mag;
int energy = playerData.Energy;
int index = 0;
var buffTimeData = GContext.container.Resolve<BuffDataCenter>().GetWeelyBuffTimeData<SuperEnergyMag>();
bool isSuperEnergy = buffTimeData != null;
for (int i = 0; i < DataList.Count; i++)
{
int demandEnergy = DataList[i].Energy;
if (isSuperEnergy)
{
demandEnergy = DataList[i].FishBuffEnergy;
}
Mag = DataList[i].Mag;
if (i < normalCount)
{
beilv_normal[i].beilvIndex = i;
beilv_normal[i].beilv = Mag;
beilv_normal[i].text_beilv.text = $"x{Mag}";
beilv_normal[i].isLock = energy < demandEnergy;
beilv_normal[i].isShow = true;
}
if (DataList[i].Energy == -1 && index < beilv_special.Count)
{
beilv_special[index].beilvIndex = i;
beilv_special[index].beilv = Mag;
beilv_special[index].text_beilv.text = $"x{Mag}";
beilv_special[index].isLock = energy < demandEnergy;
beilv_special[index].isShow = isSuperEnergy;
index++;
}
}
SetSelect();
}
void SetSelect()
{
int normalCount = _tables.TbEnergyDef.DataList.Where(x => x.Energy != -1).Count();
for (int i = 0; i < beilv_normal.Count; i++)
{
if (beilv_normal[i].isShow)
{
beilv_normal[i].bg_selected.gameObject.SetActive(playerData.magnification == i);
beilv_normal[i].bg_normal.SetActive(!beilv_normal[i].isLock);
beilv_normal[i].bg_gray.SetActive(beilv_normal[i].isLock);
}
beilv_normal[i].gameObject.SetActive(beilv_normal[i].isShow);
}
for (int i = 0; i < beilv_special.Count; i++)
{
if (beilv_special[i].isShow)
{
beilv_special[i].bg_selected.gameObject.SetActive(playerData.magnification - normalCount == i);
beilv_special[i].bg_normal.SetActive(!beilv_special[i].isLock);
beilv_special[i].bg_gray.SetActive(beilv_special[i].isLock);
}
beilv_special[i].gameObject.SetActive(beilv_special[i].isShow);
}
}
public void OnClick(BeilvItem beilv)
{
OnBeilvClick?.Invoke(beilv);
}
}

View File

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

View File

@@ -0,0 +1,119 @@
using asap.core;
using cfg;
using GameCore;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnAdvert : MonoBehaviour, IUIRedPoint
{
public const string redKey = "Home.Advert";
PlayerShopData shopData;
Button btn_advert;
TMP_Text text_time;
GameObject redpoint;
GameObject text_task;
Timer timer;
private void Awake()
{
shopData = GContext.container.Resolve<PlayerShopData>();
btn_advert = GetComponent<Button>();
redpoint = transform.Find("redpoint").gameObject;
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
text_task = transform.Find("text_task").gameObject;
gameObject.SetActive(shopData.IsOpenAdPack());
}
private void Start()
{
btn_advert.onClick.AddListener(OnClickAdvert);
}
void OnEnable()
{
RedPointManager.Instance.AddRedPoint(redKey, this);
SetRedPointState(RedPointManager.Instance.GetRedPointState(redKey));
}
private async void OnClickAdvert()
{
GameObject go = await UIManager.Instance.ShowUILoad(UITypes.AdvertPanel);
if (go != null)
{
GContext.Publish(new HideHomePanelEvent());
}
}
public void SetRedPointState(bool state)
{
redpoint.SetActive(state);
if (!state && shopData.IsOpenAdPack() && shopData.IsShowVIPAdTimer())
{
StartTimer();
return;
}
if (timer != null)
{
timer.Cancel();
timer = null;
}
SetState(true);
}
void StartTimer()
{
DateTime now = ZZTimeHelper.UtcNow().UtcNowOffset();
var id = GContext.container.Resolve<PlayerData>().priceLevel.DailyGiftPackList[0];
var packM = shopData.TbPackManagerGetOrDefault(id);
var pack = GContext.container.Resolve<Tables>().TbPack.GetOrDefault(packM.PackID[0]);
var daily = packM.TimeDefinition as Daily;
var DailyGiftPackList = GContext.container.Resolve<PlayerData>().priceLevel.DailyGiftPackList;
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;
break;
}
}
if (shopData.GetShopPackBuyCount(packM.ID) < 2)
{
SetState(true);
return;
}
SetState(false);
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, EndTimer,
(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 EndTimer()
{
SetRedPointState(RedPointManager.Instance.GetRedPointState(redKey));
}
void SetState(bool value)
{
text_time.gameObject.SetActive(!value);
text_task.SetActive(value);
}
private void OnDisable()
{
RedPointManager.Instance.RemoveRedPoint(redKey);
}
private void OnDestroy()
{
if (timer != null)
{
timer.Cancel();
timer = null;
}
}
}

View File

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

View File

@@ -0,0 +1,207 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnAquarium : MonoBehaviour
{
GameObject btn_guild_gray;
Button btn_fishingBox;
GameObject redpoint;
public CanvasGroup homeCanvasGroup;
FishingEventData fishingEventData;
AquariumManagerData data;
List<AquariumSlotData> slotDatas;
List<AquariumResultData> aquariumResultDatas;
bool isred;
DateTime refreshTime;
private void Awake()
{
fishingEventData = GContext.container.Resolve<FishingEventData>();
btn_guild_gray = transform.Find("icon_gray").gameObject;
redpoint = transform.Find("redpoint").gameObject;
btn_fishingBox = GetComponent<Button>();
bool IsAquariumOpen = fishingEventData.IsAquariumOpen;
btn_guild_gray.SetActive(!IsAquariumOpen);
if (IsAquariumOpen)
{
Synchrodata();
}
}
private void Start()
{
btn_fishingBox.onClick.AddListener(OnClickGoTo);
//btn_fishingBox.onClick.AddListener(OnClickGoTo);
}
public void Synchrodata()
{
//测试
//PlayFabMgr.Instance.UpdateUserDataValue(AquariumManager.AquariumEventDataKey, "");
//从服务器拿数据
string dataStr = PlayFabMgr.Instance.GetLocalData(AquariumManager.AquariumEventDataKey);
if (string.IsNullOrEmpty(dataStr))
{
ShowRed();
}
else
{
data = Newtonsoft.Json.JsonConvert.DeserializeObject<AquariumManagerData>(dataStr);
var nowTime = ZZTimeHelper.UtcNow().UtcNowOffset();
refreshTime = nowTime.Date.AddDays(1);
if (nowTime.Date.DayOfYear != data.refreshDay)
{
data.adCount = 0;
data.refreshCount = 0;
data.refreshDay = nowTime.Date.DayOfYear;
}
if (data.isHome || data.slotDatas == null)
{
IsHome(nowTime);
}
else
{
slotDatas = new List<AquariumSlotData>();
int count = data.slot - data.aquariumHurtDatas.Count;
if (count > 0)
{
for (int i = 0; i < count; i++)
{
AquariumHurtData aquariumHurtData = new AquariumHurtData();
data.aquariumHurtDatas.Add(aquariumHurtData);
}
}
count = data.slot - data.aquariumResultDatas.Count;
if (count > 0)
{
for (int i = 0; i < count; i++)
{
AquariumResultData aquariumResultData = new AquariumResultData();
data.aquariumResultDatas.Add(aquariumResultData);
}
}
aquariumResultDatas = data.aquariumResultDatas;
for (int i = 0; i < data.slot; i++)
{
var slotData = data.slotDatas[i];
if (!slotData.IsResult() && !aquariumResultDatas[slotData.index].IsResult())
{
slotDatas.Add(slotData);
}
}
}
}
}
void IsHome(DateTime dateTime)
{
bool isRefresh = refreshTime < dateTime;
if (data.refreshCount < GContext.container.Resolve<Tables>().TbAquariumConfig.RefreshTime || isRefresh)
{
ShowRed();
}
}
void ShowRed()
{
isred = true;
redpoint.SetActive(true);
}
async void FishingBox()
{
if (GContext.container.Resolve<FishingBoxDataProvier>().IsUnclocked)
{
GameObject go = await UIManager.Instance.ShowUILoad(UITypes.FishingBoxPanel);
if (go != null)
{
GContext.Publish(new HideHomePanelEvent());
}
}
else
{
var dataProvider = GContext.container.Resolve<FishingBoxDataProvier>();
ToastPanel.Show(fishingEventData.GetTipforUnlocked(dataProvider.EventTipID));
}
}
void OnClickGoTo()
{
if (!fishingEventData.IsAquariumOpen)
{
ToastPanel.Show(fishingEventData.GetTipforUnlocked(fishingEventData.OpenAquariumID));
return;
}
//homeCanvasGroup.blocksRaycasts = false;
//ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
//bool isCanEnter = await loadResourceService.Load("FishingAquariumAct");
//homeCanvasGroup.blocksRaycasts = true;
//if (isCanEnter)
//{
EnterGame();
//}
//else
//{
// var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
// panel.GetComponent<CloudTransitionPanel>().SetBtn(true, EnterGame);
//}
}
void EnterGame()
{
homeCanvasGroup.blocksRaycasts = false;
if (data != null && !data.isHome && data.slotDatas != null)
{
FishingAquariumAct.CloudType = 3;
}
else
{
FishingAquariumAct.CloudType = 1;
}
GContext.Publish(new UnloadActToNextAct("FishingAquariumAct", UITypes.AquariumCloudPanel, 0.75f));
homeCanvasGroup.blocksRaycasts = true;
}
private void Update()
{
if (!fishingEventData.IsAquariumOpen || data == null || isred)
{
return;
}
DateTime dateTime = ZZTimeHelper.UtcNow();
if (data.isHome || data.slotDatas == null)
{
IsHome(dateTime.UtcNowOffset());
return;
}
for (int i = 0; i < slotDatas.Count; i++)
{
var slotData = slotDatas[i];
var HatchTime = slotData.FishHatchTime();
var FishGrowthTime = slotData.FishGrowthTime();
bool isHatch = HatchTime < dateTime;
if (isHatch)
{
//鱼鱼
bool growth = FishGrowthTime < dateTime;
//检查是否受伤
//正常的成长时间 自然时间+加速成长-总恢复时间
float normalH = (float)(dateTime - HatchTime).TotalHours + slotData.accelerationGrowth - slotData.allRecoveryTime;
float injuryH = slotData.injuryGrowthTime;
//受伤时的成长进度大于正常的成长进度=还没恢复
if (growth && injuryH < normalH)
{
//成熟并且没有受伤
ShowRed();
return;
}
}
}
}
}

View File

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

View File

@@ -0,0 +1,94 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using GameCore;
using asap.core;
using System;
using UniRx;
using DG.Tweening;
using cfg;
public class HomeBtnBargain: MonoBehaviour
{
private Image _bar;
private TMP_Text _textTime;
private Button _btn;
private BargainPackData _bpd;
private IDisposable _timer;
private Tables _tables;
private void Awake()
{
_bar = transform.Find("bar").GetComponent<Image>();
_textTime = transform.Find("text_time").GetComponent<TMP_Text>();
_btn = GetComponent<Button>();
_bpd = GContext.container.Resolve<BargainPackData>();
if (!_bpd.IsPackActivated)
gameObject.SetActive(false);
GContext.OnEvent<BargainPackProgressEvent>().Subscribe(UpdateBar).AddTo(this);
_tables = GContext.container.Resolve<Tables>();
}
private void Start()
{
_btn.onClick.AddListener(async () => { await UIManager.Instance.ShowUI(UITypes.GiftBargainPopupPanel); });
}
private void OnEnable()
{
_textTime.text = ConvertTools.ConvertTime2(_bpd.RemainingTime);
_timer = Observable.Interval(TimeSpan.FromSeconds(1.0f))
.Subscribe(_ =>
{
_textTime.text = ConvertTools.ConvertTime2(_bpd.RemainingTime);
if (_bpd.RemainingTime.TotalSeconds <= 0 || _bpd.PurchaseCount >= _bpd.MaxCount)
gameObject.SetActive(false);
});
_bar.fillAmount = _bpd.Progress / (float)_bpd.NextTarget;
// Debug.Log($"<color=red>[Bargain] OnEnable: {_bpd.Progress / (float)_bpd.NextTarget}</color>");
}
private void OnDisable()
{
_timer?.Dispose();
}
private void UpdateBar(BargainPackProgressEvent e)
{
// Debug.Log($"<color=red>[Bargain] CurrentProgress: {_bpd.Progress}, {_bpd.DiscountLvl}</color>");
SpecialPack spp = _tables.TbSpecialPack[_bpd.PackID];
int curDiscountLvl = _bpd.DiscountLvl;
int originProgress = _bpd.Progress - e.addProgress;
if (e.type == 0)
{
while (originProgress < 0 && curDiscountLvl >= 0)
{
originProgress += spp.EventItemRequire[curDiscountLvl];
curDiscountLvl--;
}
_bar.fillAmount = originProgress / (float)_bpd.NextTarget;
// Debug.Log($"<color=red>[Bargain] UpdateBarType0: {originProgress / (float)_bpd.NextTarget}</color>");
}
else
{
float f = _bar.fillAmount;
if (originProgress >= 0)
{
_bar.DOFillAmount(f + e.addProgress / (float)_bpd.NextTarget, 0.5f);
// Debug.Log($"<color=red>[Bargain] UpdateBarType1: {f + e.addProgress / (float)_bpd.NextTarget}</color>");
}
else
{
PlayBarAnimation();
}
}
}
private async System.Threading.Tasks.Task PlayBarAnimation()
{
_bar.DOFillAmount(1, 0.5f);
// Debug.Log($"<color=red>[Bargain] UpdateBarType1: 1</color>");
await System.Threading.Tasks.Task.Delay(500);
_bar.fillAmount = 0;
// Debug.Log($"<color=red>[Bargain] UpdateBarType1: 0</color>");
await System.Threading.Tasks.Task.Delay(500);
_bar.DOFillAmount(_bpd.Progress / (float)_bpd.NextTarget, 0.5f);
// Debug.Log($"<color=red>[Bargain] UpdateBarType1: To {_bpd.Progress / (float)_bpd.NextTarget}</color>");
await System.Threading.Tasks.Task.Delay(500);
}
}

View File

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

View File

@@ -0,0 +1,135 @@
using asap.core;
using DataCenter;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnChains : EventButtonResource
{
// Start is called before the first frame update
// TODO: 未实现释放,上一个管理器也是如此,记得注意
private OfferChainsChestManager _offerChainsChestManager;
// UI
private Image _iconImage;
private GameObject _redpoint;
private Button _btnEnter;
private TMP_Text _textTime;
private Timer _timer;
private CompositeDisposable _disposables = new();
private void Awake()
{
_offerChainsChestManager = GContext.container.Resolve<OfferChainsChestManager>();
_iconImage = transform.Find("icon_task").GetComponent<Image>();
_redpoint = transform.Find("redpoint").gameObject;
_btnEnter = transform.GetComponent<Button>();
_textTime = transform.Find("text_time").GetComponent<TMP_Text>();
GContext.OnEvent<OfferChainsRefreshEvent>().Subscribe(OnRefreshByEvent).AddTo(_disposables);
}
private void OnEnable()
{
_offerChainsChestManager.CheckInit();
//
if (!_offerChainsChestManager.CheckOpen())
{
gameObject.SetActive(false);
return;
}
_redpoint.SetActive(_offerChainsChestManager.IsFirstOpen);
List<string> resList = new List<string>
{
_offerChainsChestManager.OfferChainsChestMain.Icon,
_offerChainsChestManager.OfferChainsChestMain.UIPanel
};
CheckResource(resList);
}
private void StopCountDown()
{
_timer?.Cancel();
_timer = null;
}
private void StartCountDown()
{
StopCountDown();
var timeSpan = _offerChainsChestManager.GetTimeRemain();
_textTime.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
var seconds = timeSpan.TotalSeconds;
_timer = this.AttachTimer((float)seconds, null,
elapsed =>
{
var now = _offerChainsChestManager.GetTimeRemain();
_textTime.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
if (now.TotalMilliseconds < 0)
{
OnCountDownFinished();
_textTime.text = LocalizationMgr.GetText("UI_EventRankPopupPanel_13");
}
}, useRealTime: true);
}
private void OnCountDownFinished()
{
gameObject.SetActive(false);
StopCountDown();
_offerChainsChestManager.Settle();
}
void Start()
{
_btnEnter.onClick.AddListener(OnBtnEnter);
StartCountDown();
}
private void OnDestroy()
{
_btnEnter.onClick.RemoveAllListeners();
StopCountDown();
_disposables?.Dispose();
_disposables = null;
}
//OnBtnEvent
private void OnBtnEnter()
{
Log("OnBtnEnter");
// 进入游戏场景
StartEnter();
}
//
private void StartEnter()
{
_timer?.Cancel();
_timer = null;
_offerChainsChestManager.OnEnterGameAct();
_redpoint.SetActive(_offerChainsChestManager.IsFirstOpen);
}
private void OnRefreshByEvent(OfferChainsRefreshEvent evt)
{
if (_offerChainsChestManager.IsFinished())
{
gameObject.SetActive(false);
}
}
private static void Log(object message)
{
Debug.Log($"<color=orange>HomeBtnChains => {message} </color>");
}
protected override void OnLoadEventResource()
{
if (_offerChainsChestManager.CheckOpen())
{
gameObject.SetActive(true);
var iconName = _offerChainsChestManager.OfferChainsChestMain.Icon;
GContext.container.Resolve<IUIService>().SetImageSprite(_iconImage, iconName);
}
}
}

View File

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

View File

@@ -0,0 +1,290 @@
using asap.core;
using DG.Tweening;
using game;
using GameCore;
using System;
using System.Collections;
using PlayFab.Internal;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.PlayerLoop;
using UnityEngine.UI;
public class FishingChallengeAddEvent { }
public class HomeBtnChallenge : EventButtonResource
{
// 管理器
private FishingChallengeManager _fishingChallengeManager;
// UIElement;
private Transform _bubbleTips;
private TMP_Text _textTips;
private TMP_Text _textTime;
// private Transform _bgText;
// 剩余人数
private TMP_Text _textNum;
private Transform _barBg;
private Image _bar;
//
private Button _btnEnter;
private GameObject _redpoint;
private Image _iconImage;
// 数据
private int _challengeStep;
private int _challengeUIStep;
private int _challengeState;
//
private Timer _timer; // 定时器
private CompositeDisposable _disposables = new();
private readonly float _fillTime = 0.4f;//进度条充满时间
private void Awake()
{
Log("Awake-> ");
_fishingChallengeManager = GContext.container.Resolve<FishingChallengeManager>();
_btnEnter = GetComponent<Button>();
_redpoint = transform.Find("redpoint").gameObject;
_bubbleTips = transform.Find("bubble_tips");
_textTips = transform.Find("bubble_tips/text_tips").GetComponent<TMP_Text>();
_barBg = transform.Find("bar_bg");
// _bgText = transform.Find("bg_text");
_iconImage = transform.Find("icon").GetComponent<Image>();
_textNum = transform.Find("text_num").GetComponent<TMP_Text>();
_textTime = transform.Find("text_time").GetComponent<TMP_Text>();
GContext.OnEvent<HideHomePanelEvent>().Subscribe(OnHideHomePanelEvent).AddTo(_disposables);
GContext.OnEvent<FishingChallengeAddEvent>().Subscribe(ChallengePlayAni).AddTo(_disposables);
_bar = transform.Find("bar").GetComponent<Image>();
}
private void OnHideHomePanelEvent(HideHomePanelEvent e)
{
Destroy(this);
}
private void OnEnable()
{
Log("OnEnable -> ");
_fishingChallengeManager.CheckInit();
if (!_fishingChallengeManager.ShouldOpen())
{
gameObject.SetActive(false);
return;
}
_challengeUIStep = _fishingChallengeManager.fishingChallengeData.uiStep;
_challengeStep = _fishingChallengeManager.GetNewStep(); // 当前界面仅仅计算,不更新到 Manager
_challengeState = _fishingChallengeManager.ChallengeState();
//更新界面
_redpoint.SetActive(_fishingChallengeManager.IsFirstOpen);
InitViewByState();
CheckResource(new System.Collections.Generic.List<string>(){ "FishingChallengeAct", _fishingChallengeManager.eventChallengeConfig.Icon });
}
private void Start()
{
Log("Start -> ");
_btnEnter.onClick.AddListener(OnEnter);
// InitViewByState();
UpdateView();
}
private void UpdateView()
{
switch (_challengeState)
{
// 未匹配
case 0:
break;
// 匹配中
case 1:
{
_textNum.text = $"{_fishingChallengeManager.GetCurResidualNumber()}/{_fishingChallengeManager.eventChallengeMain.RobotNumber + 1}";
var newStep = _challengeStep;
bool hasReward = _fishingChallengeManager.IfHasReward();
_redpoint.SetActive(hasReward); // 如果跨段了会有奖励红点
var eliminateScore = _fishingChallengeManager.GetOriEliminateListScore();
if (_challengeUIStep > eliminateScore.Count - 1)
{
_bar.fillAmount = 1;
_bubbleTips.gameObject.SetActive(true);
_textTips.text = LocalizationMgr.GetText("UI_COMMON_completed");
return;
}
_bar.fillAmount = _fishingChallengeManager.GetFillAmount(_fishingChallengeManager.PreScore,true);
break;
}
case 2:
break;
}
}
private void InitViewByState()
{
if (_challengeState == 3)
{
return;
}
_barBg.gameObject.SetActive(_challengeState != 0);
_bar.gameObject.SetActive(_challengeState != 0);
_bubbleTips.gameObject.SetActive(_challengeState == 0);
var timeSpan = _fishingChallengeManager.GetTimeSpan();
_textTime.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
var seconds = timeSpan.TotalSeconds;
_timer = this.AttachTimer((float)seconds, null,
elapsed =>
{
var now = _fishingChallengeManager.GetTimeSpan();
_textTime.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
if (now.TotalMilliseconds < 0)
{
_timer?.Cancel();
_timer = null;
_textTime.text = LocalizationMgr.GetText("UI_EventRankPopupPanel_13");
// InChallenge();
}
}, useRealTime: true);
UpdateView();
}
private void ChallengePlayAni(FishingChallengeAddEvent e)
{
var newStep = _challengeStep;
if (newStep != _challengeUIStep)
{
StartCoroutine(PlayPre());
}
else if (_fishingChallengeManager.PreScore != _fishingChallengeManager.fishingChallengeData.Score)
{
StartCoroutine(PlayScorePre());
}
}
private IEnumerator PlayScorePre()
{
Log("PlayScorePre");
var newStep = _challengeStep;
var eliminateScore = _fishingChallengeManager.GetOriEliminateListScore();
// var listEliminateScore = _fishingChallengeManager.GetEliminateListScore();
if (newStep > eliminateScore.Count - 1)
{
_bar.fillAmount = 1;
_bubbleTips.gameObject.SetActive(true);
yield return null;
_textTips.text = LocalizationMgr.GetText("UI_COMMON_completed");
yield break;
}
if ((float)(_fishingChallengeManager.fishingChallengeData.Score - _fishingChallengeManager.PreScore) / eliminateScore[newStep] > 0.05f)
{
var isSuccess = _fishingChallengeManager.IsStepFinished(newStep);
if (!isSuccess)
{
_bar.fillAmount = _fishingChallengeManager.GetFillAmount(_fishingChallengeManager.PreScore,true);
var endFillAmount = _fishingChallengeManager.GetFillAmount(_fishingChallengeManager.fishingChallengeData.Score,false);
_fishingChallengeManager.PreScore = _fishingChallengeManager.fishingChallengeData.Score;
_bar.DOFillAmount(endFillAmount,_fillTime);
yield return new WaitForSeconds(_fillTime);
}
else
{
_bar.fillAmount = 1;
_bubbleTips.gameObject.SetActive(true);
yield return null;
_textTips.text = LocalizationMgr.GetText("UI_COMMON_completed");
}
}
}
private IEnumerator PlayPre()
{
Log("PlayPre");
var newStep = _challengeStep;
var step = newStep - _challengeUIStep;
// 当前先走到最后
var firstDuration = _fillTime * (1 - _bar.fillAmount);
_bar.DOFillAmount(1, firstDuration);
yield return new WaitForSeconds(firstDuration);
// 中间是完整的
if (step > 1)
{
for (var i = 0; i < step -1 ; i++)
{
// text_stage.text = LocalizationMgr.GetFormatTextValue("UI_EventChallangePanel_20", _challengeUIStep + i + 1);
_bar.fillAmount = 0;
_bar.DOFillAmount(1, _fillTime);
yield return new WaitForSeconds(_fillTime);
}
}
_fishingChallengeManager.SetUIStep(newStep);
var isSuccess = _fishingChallengeManager.IsStepFinished(newStep);
if (!isSuccess)
{
// text_stage.text = LocalizationMgr.GetFormatTextValue("UI_EventChallangePanel_20", newStep + 1);
_bar.fillAmount = 0;
var endFillAmount = _fishingChallengeManager.GetFillAmount(_fishingChallengeManager.fishingChallengeData.Score,true);
_fishingChallengeManager.PreScore = _fishingChallengeManager.fishingChallengeData.Score;
_bar.DOFillAmount(endFillAmount, _fillTime);
yield return new WaitForSeconds(_fillTime);
}
else
{
//UpdateView();
_bar.fillAmount = 1;
_bubbleTips.gameObject.SetActive(true);
// await Awaiters.NextFrame;
yield return null;
_textTips.text = LocalizationMgr.GetText("UI_COMMON_completed");
}
// reward.Play("bubble_task_out");
}
private void OnEnter()
{
Log("OnEnter");
// if (true)
// {
// GContext.Publish(new TargetAddData(1002, 0, 100));
// return;
// }
//未开始比赛
// if (_challengeState == 0)
// {
// FishingChallengeAct.CloudType = 1;
// var uiName = _fishingChallengeManager.eventChallengeConfig.MatchPanel;
// var uiType = new UIType(uiName);
// _ = UIManager.Instance.ShowUI(uiType);
// GContext.Publish(new EndTransition());
// }
// else
// {
// InChallenge();
// }
InChallenge();
}
private void InChallenge()
{
_timer?.Cancel();
_timer = null;
_fishingChallengeManager.InChallenge();
}
private void OnDestroy()
{
_btnEnter.onClick.RemoveAllListeners();
_timer?.Cancel();
_timer = null;
_disposables?.Dispose();
_disposables = null;
}
private static void Log(object message)
{
Debug.Log($"<color=orange>HomeBtnChallenge => {message} </color>");
}
protected override void OnLoadEventResource()
{
var iconName = _fishingChallengeManager.eventChallengeConfig.Icon;
GContext.container.Resolve<IUIService>().SetImageSprite(_iconImage, iconName);
gameObject.SetActive(true);
}
}

View File

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

View File

@@ -0,0 +1,89 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnEventPack : MonoBehaviour
{
private EventPackData _epd;
private FishingEvent _currentEvent;
private Tables _tables;
private TMP_Text _timeText;
private Button _btn;
private EventPackManager _epm;
private IDisposable _timer;
private TimeSpan RemainingTime
{
get
{
return DateTime.Parse((_currentEvent.TimeDefinition as LimitedTime).EndTime)
- ZZTimeHelper.UtcNow();
}
}
private void Awake()
{
_btn = GetComponent<Button>();
_timeText = transform.Find("text_time").GetComponent<TMP_Text>();
_tables = GContext.container.Resolve<Tables>();
_epd = GContext.container.Resolve<EventPackData>();
//Debug.Log($"button: {_epd.CurrentEventID}");
if (_epd.CurrentEventID == 0)
{
gameObject.SetActive(false);
return;
}
_currentEvent = _tables.TbFishingEvent.DataMap[_epd.CurrentEventID];
var et = DateTime.Parse((_currentEvent.TimeDefinition as LimitedTime).EndTime);
var st = DateTime.Parse((_currentEvent.TimeDefinition as LimitedTime).StartTime);
if (ZZTimeHelper.UtcNow() < st || ZZTimeHelper.UtcNow() >= et)
{
gameObject.SetActive(false);
return;
}
}
private void Start()
{
//Debug.Log("<color=red>get epd</color>");
//_epd.UpdateData();
if (_epd == null || _epd.CurrentEventID == 0)
{
gameObject.SetActive(false);
return;
}
if (GContext.container.Resolve<IUserService>().CreateTotalSeconds()
< int.Parse(_currentEvent.ConditionList[0].Param[0]) * 3600
|| GContext.container.Resolve<PlayerData>().lv
< int.Parse(_currentEvent.ConditionList[1].Param[0]))
{
gameObject.SetActive(false);
return;
}
_epm = _tables.TbEventPackManager.DataMap[_currentEvent.RedirectID];
gameObject.SetActive(RemainingTime.TotalSeconds > 0);
//Debug.Log(_epd.PurchaseCount);
if (RemainingTime.TotalSeconds <= 0 || _epd.PurchaseCount >= _epm.MaxCount)
gameObject.SetActive(false);
_btn.onClick.AddListener(() => _ = UIManager.Instance.ShowUI(UITypes.GiftPopupPanel_9));
}
private void OnEnable()
{
_timeText.text = ConvertTools.ConvertTime2(TimeSpan.FromSeconds(RemainingTime.TotalSeconds));
_timer = Observable.Interval(TimeSpan.FromSeconds(1.0))
.Subscribe(_ =>
{
_timeText.text = ConvertTools.ConvertTime2(RemainingTime);
if (RemainingTime.TotalSeconds <= 0 || _epd.PurchaseCount >= _epm.MaxCount)
gameObject.SetActive(false);
});
}
private void OnDisable()
{
_timer?.Dispose();
}
}

View File

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

View File

@@ -0,0 +1,71 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnFishingDuel : MonoBehaviour
{
GameObject redpoint;
Button btn_enter;
FishingEventData fishingEventData;
private void Awake()
{
fishingEventData = GContext.container.Resolve<FishingEventData>();
btn_enter = GetComponent<Button>();
redpoint = transform.Find("redpoint").gameObject;
Tables tables = GContext.container.Resolve<Tables>();
int fishingEventID = fishingEventData.GetEvent(5, 1);
fishingEventData.SoloCheckClaimReward();
if (fishingEventID == -1 || fishingEventData.duelData == null)
{
gameObject.SetActive(false);
return;
}
DateTime endDateTime = fishingEventData.GetEventEndTime(fishingEventID)
.AddSeconds(-tables.TbEventSoloConfig.SettlementTime);
TimeSpan all = endDateTime - ZZTimeHelper.UtcNow().UtcNowOffset();
double seconds = all.TotalSeconds - 1;
if (seconds < 1)
{
gameObject.SetActive(false);
return;
}
int redDot = GContext.container.Resolve<FishingEventData>().GetRedDotPVP(fishingEventID);
redpoint.SetActive(fishingEventData.duelData.tickets > redDot);
StartCoroutine(AttachTimer((float)seconds));
}
IEnumerator AttachTimer(float time)
{
yield return new WaitForSeconds(time);
gameObject.SetActive(false);
}
private void Start()
{
btn_enter.onClick.AddListener(OnEnter);
}
async void OnEnter()
{
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Load(FishingDuelManager.EventPkDuel);
if (isCanEnter)
{
_ = UIManager.Instance.ShowUI(UITypes.EventFishingDuelPanel);
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(false, () =>
{
_ = UIManager.Instance.ShowUI(UITypes.EventFishingDuelPanel);
}
);
//var panel = await UIManager.Instance.ShowUI(UITypes.FishingDownLoadPopupPanel);
//panel.GetComponent<FishingDownLoadPopupPanel>().SetBtn(null, () => _ = UIManager.Instance.ShowUI(UITypes.EventFishingDuelPanel));
}
}
}

View File

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

View File

@@ -0,0 +1,75 @@
using asap.core;
using GameCore;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnGiftAds : MonoBehaviour
{
Button btn_enter;
TMP_Text text_time;
TriggerPackData triggerPackData;
TriggerPackBuyData triggerPack;
private void Awake()
{
triggerPackData = GContext.container.Resolve<TriggerPackData>();
btn_enter = GetComponent<Button>();
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
var triggerPackDic = triggerPackData.GetTriggerPackList(5);
if (triggerPackDic.Count <= 0)
{
gameObject.SetActive(false);
return;
}
triggerPack = triggerPackDic[0];
TimeSpan now = triggerPackData.GetCurTriggerPackEndTime(triggerPack);
if (now.TotalSeconds < 0)
{
gameObject.SetActive(false);
return;
}
}
void OnEnable()
{
SetEndTime();
}
private void Start()
{
btn_enter.onClick.AddListener(OnClick);
}
async void OnClick()
{
btn_enter.enabled = false;
await UIManager.Instance.ShowUILoad(UITypes.AdsPackPanel);
btn_enter.enabled = true;
}
void SetEndTime()
{
DateTime curTime = ZZTimeHelper.UtcNow().UtcNowOffset();
DateTime endTime = GlobalUtils.TryParseDateTime(triggerPack.time, curTime);
TimeSpan now = endTime - curTime;
double seconds = now.TotalSeconds;
if (seconds < 1)
{
gameObject.SetActive(false);
}
else
{
this.AttachTimer((float)seconds,
() => { gameObject.SetActive(false); },
(elapsed) =>
{
if (triggerPack.index > 0)
{
gameObject.SetActive(false);
return;
}
now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
text_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
}, useRealTime: true);
}
}
}

View File

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

View File

@@ -0,0 +1,41 @@
using System;
using asap.core;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
namespace game
{
public class HomeBtnHexMap : MonoBehaviour
{
private Button _btnEnter;
private void Awake()
{
_btnEnter = transform.GetComponent<Button>();
}
void Start()
{
_btnEnter.onClick.AddListener(OnBtnEnter);
}
private void OnBtnEnter()
{
Log("OnBtnEnter");
// 进入游戏场景
StartEnter();
}
private void StartEnter()
{
var fcm = GContext.container.Resolve<FishingChallengeManager>();
fcm.InitHexMap();
}
private static void Log(object message)
{
Debug.Log($"<color=orange>HomeBtnHexMap => {message} </color>");
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a6a5de28b7ef4cfebf2c400477064c58
timeCreated: 1757571871

View File

@@ -0,0 +1,68 @@
using asap.core;
using GameCore;
using System;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnOneOnePack : MonoBehaviour, IUIRedPoint
{
public const string redKey = "Home.OneOne";
Image redpoint;
Button btn_enter;
TMP_Text text_time;
FishingEventData fishingEventData;
private void Awake()
{
fishingEventData = GContext.container.Resolve<FishingEventData>();
btn_enter = GetComponent<Button>();
redpoint = transform.Find("redpoint").GetComponent<Image>();
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
if (fishingEventData.Pack1A1Data == null || fishingEventData.Pack1A1Data.index >= 2)
{
gameObject.SetActive(false);
return;
}
}
void OnEnable()
{
SetEndTime();
RedPointManager.Instance.AddRedPoint(redKey, this);
redpoint.enabled = RedPointManager.Instance.GetRedPointState(redKey);
}
private void Start()
{
btn_enter.onClick.AddListener(async () => await UIManager.Instance.GetUIAsync(UITypes.GiftPopupPanel_10));
}
public void SetRedPointState(bool state)
{
redpoint.enabled = state;
}
private void OnDisable()
{
RedPointManager.Instance.RemoveRedPoint(redKey);
}
void SetEndTime()
{
DateTime endTime = fishingEventData.GetEvent1A1EndTime();
TimeSpan now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
double seconds = now.TotalSeconds;
if (seconds < 1)
{
gameObject.SetActive(false);
}
else
{
this.AttachTimer((float)seconds,
() => { gameObject.SetActive(false); },
(elapsed) =>
{
now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
text_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
}, useRealTime: true);
}
}
}

View File

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

View File

@@ -0,0 +1,80 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnOneTwoPack : MonoBehaviour, IUIRedPoint
{
public const string redKey = "Home.OneTwo";
Image redpoint;
Button btn_enter;
TMP_Text text_time;
FishingEventData fishingEventData;
int packCount;
private void Awake()
{
fishingEventData = GContext.container.Resolve<FishingEventData>();
btn_enter = GetComponent<Button>();
redpoint = transform.Find("redpoint").GetComponent<Image>();
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
Pack1A2Data Pack1A2Data = fishingEventData.Pack1A2Data;
if (Pack1A2Data == null)
{
gameObject.SetActive(false);
return;
}
EventPackManager eventPackManager = fishingEventData.Get1A2EventPackManager();
List<int> packIDs = eventPackManager.VIPPackList[Pack1A2Data.vipLevel];
packCount = packIDs.Count;
if (packCount <= Pack1A2Data.index)
{
gameObject.SetActive(false);
return;
}
}
void OnEnable()
{
SetEndTime();
RedPointManager.Instance.AddRedPoint(redKey, this);
redpoint.enabled = RedPointManager.Instance.GetRedPointState(redKey);
}
private void Start()
{
btn_enter.onClick.AddListener(async () => await UIManager.Instance.GetUIAsync(UITypes.GiftPopupPanel_11));
}
public void SetRedPointState(bool state)
{
redpoint.enabled = state;
}
private void OnDisable()
{
RedPointManager.Instance.RemoveRedPoint(redKey);
}
void SetEndTime()
{
DateTime endTime = fishingEventData.GetEvent1A2EndTime();
TimeSpan now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
double seconds = now.TotalSeconds;
if (seconds < 1)
{
gameObject.SetActive(false);
}
else
{
this.AttachTimer((float)seconds,
() => { gameObject.SetActive(false); },
(elapsed) =>
{
now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
text_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
}, useRealTime: true);
}
}
}

View File

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

View File

@@ -0,0 +1,206 @@
using System;
using asap.core;
using DataCenter;
using GameCore;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnPartnerGather : MonoBehaviour
{
private EventPartnerGatherManager _gatherManager;
// if (!_data.IsEventActivated)
// {
// gameObject.SetActive(false);
// return;
// }
// UI组件
private Image _iconImage;
private GameObject _redpoint;
private Button _btnEnter;
private TMP_Text _textTime;
private Timer _timer;
private CompositeDisposable _disposables = new();
private void Awake()
{
// 尝试解析管理器
try
{
_gatherManager = GContext.container.Resolve<EventPartnerGatherManager>();
}
catch (Exception e)
{
Log($"Failed to resolve EventPartnerGatherManager: {e.Message}");
gameObject.SetActive(false);
return;
}
// 查找UI组件使用安全检查
var iconTransform = transform.Find("icon_task");
if (iconTransform != null)
_iconImage = iconTransform.GetComponent<Image>();
var redpointTransform = transform.Find("redpoint");
if (redpointTransform != null)
_redpoint = redpointTransform.gameObject;
_btnEnter = transform.GetComponent<Button>();
var timeTransform = transform.Find("text_time");
if (timeTransform != null)
_textTime = timeTransform.GetComponent<TMP_Text>();
// 订阅事件
if (_disposables == null)
_disposables = new CompositeDisposable();
GContext.OnEvent<EventPartnerGatherRefreshEvent>().Subscribe(OnRefreshByEvent).AddTo(_disposables);
}
private void OnEnable()
{
// 检查管理器是否存在
if (_gatherManager == null)
{
Log("Manager not available");
gameObject.SetActive(false);
return;
}
//
_gatherManager.CheckForOnEnable();
if (!_gatherManager.CheckOpen())
{
gameObject.SetActive(false);
return;
}
var iconName = _gatherManager.EventPartnerMain2Data.Icon;
GContext.container.Resolve<IUIService>().SetImageSprite(_iconImage, iconName);
_redpoint.SetActive(_gatherManager.IsFirstOpen);
//UpdateTimeDisplay();
// 设置图标(后续从配置读取)
// var iconName = _gatherManager.GetIconName();
// if (_iconImage != null)
// GContext.container.Resolve<IUIService>().SetImageSprite(_iconImage, iconName);
// 显示红点
if (_redpoint != null)
_redpoint.SetActive(_gatherManager.IsFirstOpen);
}
private void Start()
{
//BindEvents;
_btnEnter.onClick.AddListener(OnBtnEnter);
_gatherManager.CheckInit();
if (!_gatherManager.CheckOpen())
{
gameObject.SetActive(false);
return;
}
var iconName = _gatherManager.EventPartnerMain2Data.Icon;
GContext.container.Resolve<IUIService>().SetImageSprite(_iconImage, iconName);
_redpoint.SetActive(_gatherManager.IsFirstOpen);
if (_gatherManager != null)
StartCountDown();
}
private void StartCountDown()
{
StopCountDown();
var timeSpan = _gatherManager.GetRemainingTime();
UpdateTimeDisplay(timeSpan);
var seconds = timeSpan.TotalSeconds;
_timer = this.AttachTimer((float)seconds, null,
elapsed =>
{
var now = _gatherManager.GetRemainingTime();
UpdateTimeDisplay(now);
if (now.TotalMilliseconds < 0)
{
OnCountDownFinished();
}
}, useRealTime: true);
}
private void UpdateTimeDisplay(TimeSpan timeSpan)
{
if (_textTime == null) return;
if (timeSpan.TotalMilliseconds > 0)
{
_textTime.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
}
else
{
_textTime.text = LocalizationMgr.GetText("UI_EventRankPopupPanel_13");
}
}
private void StopCountDown()
{
_timer?.Cancel();
_timer = null;
}
private void OnCountDownFinished()
{
gameObject.SetActive(false);
StopCountDown();
}
private void OnBtnEnter()
{
Log("OnBtnEnter");
// 停止计时器
StopCountDown();
// 进入游戏场景
_gatherManager.EnterGatherScene();
// 更新红点
if (_redpoint != null)
_redpoint.SetActive(false);
}
private void OnRefreshByEvent(EventPartnerGatherRefreshEvent evt)
{
// 刷新显示
if (!_gatherManager.CheckOpen())
{
gameObject.SetActive(false);
}
}
private void OnDestroy()
{
if (_btnEnter != null)
_btnEnter.onClick.RemoveAllListeners();
StopCountDown();
_disposables?.Dispose();
_disposables = null;
}
private static void Log(object message)
{
Debug.Log($"<color=cyan>HomeBtnPartnerGather => {message}</color>");
}
}

View File

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

View File

@@ -0,0 +1,61 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using GameCore;
using asap.core;
using System;
using UniRx;
using DG.Tweening;
public class HomeBtnPiggyBank : MonoBehaviour
{
private Image _bar;
private TMP_Text _textTime;
private Button _btn;
private PiggyBankPackData _pbpd;
private IDisposable _timer;
private void Awake()
{
_bar = transform.Find("bar").GetComponent<Image>();
_textTime = transform.Find("text_time").GetComponent<TMP_Text>();
_btn = GetComponent<Button>();
_pbpd = GContext.container.Resolve<PiggyBankPackData>();
if (!_pbpd.IsPackActivated)
gameObject.SetActive(false);
GContext.OnEvent<PiggyBankProgressEvent>().Subscribe(UpdateBar).AddTo(this);
}
private void Start()
{
_btn.onClick.AddListener(OpenPanel);
}
private async void OpenPanel()
{
await UIManager.Instance.ShowUI(UITypes.GiftPiggyBankPopupPanel);
}
private void OnEnable()
{
_textTime.text = ConvertTools.ConvertTime2(_pbpd.RemainingTime);
_timer = Observable.Interval(TimeSpan.FromSeconds(1.0f))
.Subscribe(_ =>
{
_textTime.text = ConvertTools.ConvertTime2(_pbpd.RemainingTime);
if (_pbpd.RemainingTime.TotalSeconds <= 0 || _pbpd.PurchaseCount >= _pbpd.MaxCount)
gameObject.SetActive(false);
});
_bar.fillAmount = (float)_pbpd.Progress / (float)_pbpd.Target;
}
private void OnDisable()
{
_timer?.Dispose();
}
private void UpdateBar(PiggyBankProgressEvent e)
{
//Debug.Log($"update bar {e.type}");
if (e.type == 0)
_bar.fillAmount = ((float)_pbpd.Progress - (float)e.addProgress) / (float)_pbpd.Target;
else
{
float f = _bar.fillAmount;
_bar.DOFillAmount(f + (float)e.addProgress / (float)_pbpd.Target, 0.5f);
}
}
}

View File

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

View File

@@ -0,0 +1,153 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
namespace game
{
public class HomeBtnPinball : EventButtonResource
{
[SerializeField] private TMP_Text textTimer;
Button btn;
private DateTime endDateTime;
EventPinballDataManager m_DataManager;
#region
void Awake()
{
btn = GetComponent<Button>();
}
// Start is called before the first frame update
void Start()
{
m_DataManager = GContext.container.Resolve<EventPinballDataManager>();
m_DataManager.Init();
// 红点处理
if (m_DataManager != null)
{
if (m_DataManager.IsRedDotDisplayed()) RedPointManager.Instance.SetRedPointState(RedPointName.Home_Pinball, true);
else RedPointManager.Instance.SetRedPointState(RedPointName.Home_Pinball, false);
}
else RedPointManager.Instance.SetRedPointState(RedPointName.Home_Pinball, false);
// 活动倒计时处理
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
int fishingEventID = fishingEventData.GetEvent(4, 6);
if (fishingEventID < 0)
{
gameObject.SetActive(false);
return;
}
Tables tables = GContext.container.Resolve<Tables>();
FishingEvent fishingEvent = tables.TbFishingEvent[fishingEventID];
endDateTime = DateTime.Parse((fishingEvent.TimeDefinition as LimitedTime)?.EndTime);
TimeSpan all = GetRemainingTime(endDateTime);
double seconds = all.TotalSeconds - 1;
if (seconds < 1)
{
gameObject.SetActive(false);
return;
}
StartCoroutine(AttachTimer((float)seconds));
textTimer.text = ConvertTools.ConvertTime2(all);
Observable.Interval(TimeSpan.FromSeconds(1.0f)).Subscribe(_ =>
{
TimeSpan tmpAll = GetRemainingTime(endDateTime);
textTimer.text = ConvertTools.ConvertTime2(tmpAll);
if (tmpAll.TotalSeconds <= 0)
gameObject.SetActive(false);
}).AddTo(this);
btn.onClick.AddListener(async () =>
{
EventPinballMain eventPinballMain = m_DataManager.ContinueGame();
string actName = "FishingPinballAct";
List<string> resList = new List<string>();
resList.Add(actName);
if (eventPinballMain != null)
{
resList.AddRange(eventPinballMain.Addressable);
if (!string.IsNullOrEmpty(eventPinballMain.Bgm))
{
resList.Add(eventPinballMain.Bgm);
}
}
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Loads(resList);
if (isCanEnter)
{
GContext.Publish(new UnloadActToNextAct(actName));
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(true, () => GContext.Publish(new UnloadActToNextAct(actName)));
}
});
EventPinballMain eventPinballMain = m_DataManager.ContinueGame();
string actName = "FishingPinballAct";
List<string> resList = new List<string>
{
actName,
eventPinballMain.Icon
};
if (eventPinballMain != null)
{
resList.AddRange(eventPinballMain.Addressable);
if (!string.IsNullOrEmpty(eventPinballMain.Bgm))
{
resList.Add(eventPinballMain.Bgm);
}
}
CheckResource(resList);
}
#endregion
private TimeSpan GetRemainingTime(DateTime endDateTime)
{
return endDateTime - ZZTimeHelper.UtcNow();
}
IEnumerator AttachTimer(float time)
{
yield return new WaitForSeconds(time);
gameObject.SetActive(false);
}
protected override void OnLoadEventResource()
{
TimeSpan all = GetRemainingTime(endDateTime);
double seconds = all.TotalSeconds - 1;
if (seconds > 1)
{
EventPinballMain eventPinballMain = m_DataManager.ContinueGame();
if (eventPinballMain != null)
{
Image btn_icon = transform.Find("icon").GetComponent<Image>();
GContext.container.Resolve<IUIService>().SetImageSprite(btn_icon, eventPinballMain.Icon, "HomePanel");
}
gameObject.SetActive(true);
}
}
}
}

View File

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

View File

@@ -0,0 +1,130 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using asap.core;
using GameCore;
using TMPro;
using System;
using cfg;
using UniRx;
namespace game
{
public class HomeBtnPotion : EventButtonResource
{
[SerializeField] private TMP_Text textTimer;
Button btn_potion;
Image icon;
string iconUrl;
private DateTime endDateTime;
#region
void Awake()
{
btn_potion = GetComponent<Button>();
icon = transform.Find("icon").GetComponent<Image>();
}
// Start is called before the first frame update
void Start()
{
EventPotionDataManager eventPotionDataManager = GContext.container.Resolve<EventPotionDataManager>();
eventPotionDataManager.Init();
// 红点处理
if (eventPotionDataManager != null)
{
if (eventPotionDataManager.IsRedDotDisplayed()) RedPointManager.Instance.SetRedPointState(RedPointName.Home_Potion, true);
else RedPointManager.Instance.SetRedPointState(RedPointName.Home_Potion, false);
}
else RedPointManager.Instance.SetRedPointState(RedPointName.Home_Potion, false);
// 活动倒计时处理
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
int fishingEventID = fishingEventData.GetEvent(4, 5);
if (fishingEventID < 0)
{
gameObject.SetActive(false);
return;
}
Tables tables = GContext.container.Resolve<Tables>();
FishingEvent fishingEvent = tables.TbFishingEvent[fishingEventID];
endDateTime = DateTime.Parse((fishingEvent.TimeDefinition as LimitedTime)?.EndTime);
EventPotionMain potion = tables.TbEventPotionMain[fishingEvent.RedirectID];
iconUrl = potion.Icon;
TimeSpan all = GetRemainingTime(endDateTime);
double seconds = all.TotalSeconds - 1;
if (seconds < 1)
{
gameObject.SetActive(false);
return;
}
StartCoroutine(AttachTimer((float)seconds));
textTimer.text = ConvertTools.ConvertTime2(all);
Observable.Interval(TimeSpan.FromSeconds(1.0f)).Subscribe(_ =>
{
TimeSpan tmpAll = GetRemainingTime(endDateTime);
textTimer.text = ConvertTools.ConvertTime2(tmpAll);
if (tmpAll.TotalSeconds <= 0)
gameObject.SetActive(false);
}).AddTo(this);
btn_potion.onClick.AddListener(async () =>
{
List<string> resList = new List<string>
{
"FishingPotionAct",// 公共包
potion.Prefab// 场景
};
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Loads(resList);
if (isCanEnter)
{
GContext.Publish(new UnloadActToNextAct("FishingPotionAct"));
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(true, () => GContext.Publish(new UnloadActToNextAct("FishingPotionAct")));
}
});
List<string> resList = new List<string>
{
"FishingPotionAct",// 公共包
potion.Prefab,// 场景
iconUrl// icon
};
CheckResource(resList);
}
#endregion
private TimeSpan GetRemainingTime(DateTime endDateTime)
{
return endDateTime - ZZTimeHelper.UtcNow();
}
IEnumerator AttachTimer(float time)
{
yield return new WaitForSeconds(time);
gameObject.SetActive(false);
}
protected override void OnLoadEventResource()
{
TimeSpan all = GetRemainingTime(endDateTime);
double seconds = all.TotalSeconds - 1;
if (seconds > 1)
{
GContext.container.Resolve<IUIService>().SetImageSprite(icon, iconUrl);
gameObject.SetActive(true);
}
}
}
}

View File

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

View File

@@ -0,0 +1,377 @@
using asap.core;
using cfg;
using DG.Tweening;
using game;
using GameCore;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnRank : MonoBehaviour
{
Animation reward;
RectTransform layout;
Transform layout_bar;
Transform layout_reward;
GameObject rank_bar;
GameObject rank_reward;
RewardItemNew rank_rewardItem;
FishingEventData _fishingEventData;
PlayerItemData playerItemData;
Tables tables;
int curCount;
List<Image> bars;
List<RewardItemNew> rewards;
float time = 0.3f;
float width = 190f;
private void Awake()
{
tables = GContext.container.Resolve<Tables>();
playerItemData = GContext.container.Resolve<PlayerItemData>();
_fishingEventData = GContext.container.Resolve<FishingEventData>();
reward = transform.Find("reward").GetComponent<Animation>();
layout = reward.transform.Find("bg_bar/ScrollView/Viewport/layout").GetComponent<RectTransform>();
layout_bar = reward.transform.Find("bg_bar/ScrollView/Viewport/layout/layout_bar");
layout_reward = reward.transform.Find("bg_bar/ScrollView/Viewport/layout/layout_reward");
rank_bar = layout_bar.Find("bar1").gameObject;
rank_bar.SetActive(false);
rank_reward = layout_reward.Find("reward1").gameObject;
rank_reward.SetActive(false);
width = rank_bar.GetComponent<RectTransform>().rect.width;
rank_rewardItem = reward.transform.Find("btn_reward/reward").GetComponent<RewardItemNew>();
}
public void Init(int curCount)
{
var rankInit = _fishingEventData.rankInit;
var TargetList = rankInit.TargetList;
bool isUp = _fishingEventData.preRankTarget != null;
if (!isUp && _fishingEventData.rankTarget.TokenRequired <= curCount)
{
return;
}
var maxCollectingTarget = tables.TbRankTargets.GetOrDefault(TargetList[^1]);
var itemData = playerItemData.GetItemDataOne(maxCollectingTarget.DropID);
if (itemData != null)
{
rank_rewardItem.SetData(itemData);
}
this.curCount = curCount;
reward.gameObject.SetActive(true);
if (isUp)
{
SetUpData();
}
else
{
StartCoroutine(SetData());
}
}
/// <summary>
/// 有升级
/// </summary>
/// <returns></returns>
void SetUpData()
{
bars = new List<Image>();
rewards = new List<RewardItemNew>();
//分析几种情况
int dataCount = _fishingEventData.preRankTarget.Count;
if (dataCount < 3)
{
StartCoroutine(SetData1());
}
else
{
StartCoroutine(SetData2());
}
}
IEnumerator SetData2()
{
int dataCount = _fishingEventData.preRankTarget.Count;
int endCount = _fishingEventData.GetCurRankTarget();
RankTargets rankTarget = _fishingEventData.rankTarget;
var TargetList = _fishingEventData.rankInit.TargetList;
for (int i = 0; i < dataCount; i++)
{
AddItem(_fishingEventData.preRankTarget[i]);
}
AddItem(rankTarget);
//rewards[^1].canvasGroup.alpha = 0;
//显示间隔
yield return new WaitForSeconds(0.5f);
int index = 1;
for (int i = 0; i < dataCount - 2; i += 2)
{
if (i > 0)
{
layout.DOAnchorPosX(-i * width, time);
yield return new WaitForSeconds(time);
rewards[i - 1].canvasGroup.alpha = 0;
rewards[i - 2].canvasGroup.alpha = 0;
}
for (int j = 0; j < 2; j++)
{
index = i + j;
bars[index].DOFillAmount(1, time);
yield return new WaitForSeconds(time);
rewards[index].SetReceived(true);
rewards[index].ani.Play("rank_reward_change");
yield return new WaitForSeconds(time);
}
}
var last = _fishingEventData.preRankTarget[index + 1];
if (last.TaskID <= TargetList[^3])
{
layout.DOAnchorPosX(-(index + 1) * width, time);
yield return new WaitForSeconds(time);
rewards[index].canvasGroup.alpha = 0;
rewards[index - 1].canvasGroup.alpha = 0;
for (int i = index + 1; i < dataCount; i++)
{
bars[i].DOFillAmount(1, time);
yield return new WaitForSeconds(time);
rewards[i].SetReceived(true);
rewards[i].ani.Play("rank_reward_change");
yield return new WaitForSeconds(time);
}
if (dataCount > index + 2)
{
layout.DOAnchorPosX(-(index + 2) * width, time);
yield return new WaitForSeconds(time);
rewards[index + 1].canvasGroup.alpha = 0;
}
bars[dataCount].DOFillAmount(endCount / (float)rankTarget.TokenRequired, time);
}
else if (last.TaskID == TargetList[^1])
{
bars[index + 1].DOFillAmount(1, time);
yield return new WaitForSeconds(time);
rank_rewardItem.SetReceived(true);
rank_rewardItem.ani.Play("rank_reward_change");
}
else if (last.TaskID == TargetList[^2])
{
layout.anchoredPosition = Vector2.left * index * width;
yield return new WaitForSeconds(time);
rewards[index - 1].canvasGroup.alpha = 0;
for (int i = index + 1; i < dataCount; i++)
{
bars[i].DOFillAmount(1, time);
yield return new WaitForSeconds(time);
rewards[i].SetReceived(true);
rewards[i].ani.Play("rank_reward_change");
}
if (dataCount > index + 2)
{
rank_rewardItem.SetReceived(true);
rank_rewardItem.ani.Play("rank_reward_change");
}
else
{
bars[dataCount].DOFillAmount(endCount / (float)rankTarget.TokenRequired, time);
}
}
yield return new WaitForSeconds(time);
TaskOut();
}
/// <summary>
/// 有升级没有二次位移
/// </summary>
/// <returns></returns>
IEnumerator SetData1()
{
List<RankTargets> preRankTarget = _fishingEventData.preRankTarget;
int dataCount = preRankTarget.Count;
int endCount = _fishingEventData.GetCurRankTarget();
RankTargets rankTarget = _fishingEventData.rankTarget;
var last = preRankTarget[0];
var TargetList = _fishingEventData.rankInit.TargetList;
if (last.TaskID <= TargetList[^3])
{
for (int i = 0; i < 3; i++)
{
AddItem(last);
last = tables.TbRankTargets.GetOrDefault(last.NextTarget);
}
//显示间隔
yield return new WaitForSeconds(0.5f);
for (int i = 0; i < dataCount; i++)
{
bars[i].DOFillAmount(1, time);
yield return new WaitForSeconds(time);
rewards[i].SetReceived(true);
}
bars[dataCount].DOFillAmount(endCount / (float)rankTarget.TokenRequired, time);
}
else
{
var pre = tables.TbRankTargets.GetOrDefault(TargetList[^3]);
for (int i = 0; i < 3; i++)
{
AddItem(pre);
pre = tables.TbRankTargets.GetOrDefault(pre.NextTarget);
}
if (last.TaskID == TargetList[^1])
{
for (int i = 0; i < 2; i++)
{
bars[i].fillAmount = 1;
rewards[i].SetReceived(true);
}
//显示间隔
yield return new WaitForSeconds(0.5f);
bars[2].DOFillAmount(1, time);
yield return new WaitForSeconds(time);
rank_rewardItem.SetReceived(true);
}
else if (last.TaskID == TargetList[^2])
{
bars[0].fillAmount = 1;
rewards[0].SetReceived(true);
//显示间隔
yield return new WaitForSeconds(0.5f);
for (int i = 1; i < dataCount + 1; i++)
{
bars[i].DOFillAmount(1, time);
yield return new WaitForSeconds(time);
rewards[i].SetReceived(true);
}
if (dataCount == 2)
{
rank_rewardItem.SetReceived(true);
}
else
{
bars[dataCount + 1].DOFillAmount(endCount / (float)rankTarget.TokenRequired, time);
}
}
}
yield return new WaitForSeconds(time);
TaskOut();
}
void AddItem(RankTargets last)
{
Image image = Instantiate(rank_bar, layout_bar).GetComponent<Image>();
image.gameObject.SetActive(true);
image.fillAmount = 0;
bars.Add(image);
RewardItemNew rank_reward1 = Instantiate(rank_reward, layout_reward).GetComponent<RewardItemNew>();
rank_reward1.gameObject.SetActive(true);
rewards.Add(rank_reward1);
var itemData = playerItemData.GetItemDataOne(last.DropID);
rank_reward1.SetData(itemData);
}
/// <summary>
/// 没有升级的情况
/// </summary>
/// <returns></returns>
IEnumerator SetData()
{
var TargetList = _fishingEventData.rankInit.TargetList;
RankTargets rankTarget = _fishingEventData.rankTarget;
int endCount = _fishingEventData.GetCurRankTarget();
int curIndex = TargetList.IndexOf(rankTarget.TaskID);
ItemData itemData;
RankTargets rankTarge1;
RankTargets rankTarge2;
RankTargets rankTarge3;
Image rank_bar1 = Instantiate(rank_bar, layout_bar).GetComponent<Image>();
Image rank_bar2 = Instantiate(rank_bar, layout_bar).GetComponent<Image>();
Image rank_bar3 = Instantiate(rank_bar, layout_bar).GetComponent<Image>();
rank_bar1.gameObject.SetActive(true);
rank_bar2.gameObject.SetActive(true);
rank_bar3.gameObject.SetActive(true);
RewardItemNew rank_reward1 = Instantiate(rank_reward, layout_reward).GetComponent<RewardItemNew>();
RewardItemNew rank_reward2 = Instantiate(rank_reward, layout_reward).GetComponent<RewardItemNew>();
RewardItemNew rank_reward3 = Instantiate(rank_reward, layout_reward).GetComponent<RewardItemNew>();
rank_reward1.gameObject.SetActive(true);
rank_reward2.gameObject.SetActive(true);
rank_reward3.gameObject.SetActive(true);
if (rankTarget.NextTarget <= 0)
{
//最后一个
rankTarge1 = tables.TbRankTargets.GetOrDefault(TargetList[^2]);
rankTarge2 = tables.TbRankTargets.GetOrDefault(TargetList[^1]);
rankTarge3 = tables.TbRankTargets.GetOrDefault(TargetList[^1]);
rank_bar1.fillAmount = 1;
rank_bar2.fillAmount = 1;
rank_bar3.fillAmount = curCount / (float)rankTarget.TokenRequired;
}
else if (rankTarget.TaskID == TargetList[0])
{
//第一个
rankTarge1 = rankTarget;
rankTarge2 = tables.TbRankTargets.GetOrDefault(rankTarget.NextTarget);
rankTarge3 = tables.TbRankTargets.GetOrDefault(rankTarge2.NextTarget);
rank_bar1.fillAmount = curCount / (float)rankTarget.TokenRequired;
rank_bar2.fillAmount = 0;
rank_bar3.fillAmount = 0;
}
else
{
rankTarge1 = tables.TbRankTargets.GetOrDefault(TargetList[curIndex - 1]);
rankTarge2 = rankTarget;
rankTarge3 = tables.TbRankTargets.GetOrDefault(rankTarget.NextTarget);
rank_bar1.fillAmount = 1;
rank_bar2.fillAmount = curCount / (float)rankTarget.TokenRequired;
rank_bar3.fillAmount = 0;
}
itemData = playerItemData.GetItemDataOne(rankTarge1.DropID);
rank_reward1.SetData(itemData);
itemData = playerItemData.GetItemDataOne(rankTarge2.DropID);
rank_reward2.SetData(itemData);
itemData = playerItemData.GetItemDataOne(rankTarge3.DropID);
rank_reward3.SetData(itemData);
if (curCount >= rankTarget.TokenRequired)
{
rank_bar1.fillAmount = 1;
rank_bar2.fillAmount = 1;
rank_bar3.fillAmount = 1;
rank_rewardItem.SetReceived(true);
rank_reward1.SetReceived(true);
rank_reward2.SetReceived(true);
rank_reward3.SetReceived(true);
reward.Play("bubble_task_out");
yield break;
}
yield return new WaitForSeconds(0.5f);
if (rankTarget.NextTarget <= 0)
{
rank_bar3.DOFillAmount(endCount / (float)rankTarget.TokenRequired, time);
}
else if (rankTarget.TaskID == TargetList[0])
{
rank_bar1.DOFillAmount(endCount / (float)rankTarget.TokenRequired, time);
}
else
{
rank_bar2.DOFillAmount(endCount / (float)rankTarget.TokenRequired, time);
}
yield return new WaitForSeconds(time);
reward.Play("bubble_task_out");
}
void TaskOut()
{
reward.Play("bubble_task_out");
GContext.Publish(new ShowData());
}
private void OnDisable()
{
reward.Stop();
reward.gameObject.SetActive(false);
GContext.Publish(new ShowData());
}
}

View File

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

View File

@@ -0,0 +1,70 @@
using asap.core;
using cfg;
using GameCore;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
public class HomeBtnRod : MonoBehaviour
{
Button btn_yugan;
Image bg_hud_god_image;
Image rawImage;
TMP_Text text_grade_rod;
TMP_Text text_star_rod;
PlayerFishData _playerFishData;
Tables _tables;
string[] bg_hud_gods = { "bg_hud_god_blue", "bg_hud_god_blue", "bg_hud_god_purple", "bg_hud_god_yellow" };
IDisposable disposable;
RodData rod;
private void Awake()
{
_playerFishData = GContext.container.Resolve<PlayerFishData>();
_tables = GContext.container.Resolve<Tables>();
btn_yugan = GetComponent<Button>();
bg_hud_god_image = transform.Find("bg").GetComponent<Image>();
rawImage = transform.Find("mask/icon").GetComponent<Image>();
text_grade_rod = transform.Find("text_grade").GetComponent<TMP_Text>();
text_star_rod = transform.Find("bg_star/text_star").GetComponent<TMP_Text>();
}
private void Start()
{
btn_yugan.onClick.AddListener(async () =>
{
await UIManager.Instance.ShowUI(UITypes.FishingRodBagPanel);
});
}
private void OnEnable()
{
btn_yugan.gameObject.SetActive(_playerFishData.IsOpenRod);
if (_playerFishData.IsOpenRod)
{
rod = _tables.GetRodData(GContext.container.Resolve<PlayerData>().equipRodID);
text_grade_rod.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePanel_2", _playerFishData.GetRodLevel(rod.ID) + 1);
text_star_rod.text = _playerFishData.GetRodPiece(rod.ID).ToString();
GContext.container.Resolve<IUIService>().SetImageSprite(bg_hud_god_image, bg_hud_gods[rod.Quality - 1], "HomePanel");
int skindID = _playerFishData.GetRodSkin(rod.ID);
var fishRodSkinData = _tables.TbRodSkinData.GetOrDefault(skindID);
if (fishRodSkinData != null)
{
GContext.container.Resolve<IUIService>().SetImageSprite(rawImage, fishRodSkinData.Avatar, "HomePanel");
}
}
disposable = GContext.OnEvent<ChangeLanguageEvent>().Subscribe(OnChangeLanguage);
}
void OnChangeLanguage(ChangeLanguageEvent changeLanguageEvent)
{
text_grade_rod.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePanel_2", _playerFishData.GetRodLevel(rod.ID) + 1);
}
private void OnDisable()
{
if (disposable != null)
{
disposable.Dispose();
disposable = null;
}
}
}

View File

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

View File

@@ -0,0 +1,40 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
using System;
using asap.core;
using GameCore;
using cfg;
public class HomeBtnRodSelection : MonoBehaviour
{
//private Image _icon;
private TMP_Text _textTimer;
private Button _btn;
private readonly RodSelectionPackData _rspd = GContext.container.Resolve<RodSelectionPackData>();
private TbItem _item;
private void Awake()
{
//_icon = transform.Find("icon").GetComponent<Image>();
_textTimer = transform.Find("text_time").GetComponent<TMP_Text>();
_btn = GetComponent<Button>();
_item = GContext.container.Resolve<Tables>().TbItem;
gameObject.SetActive( _rspd.IsPackActivated );
}
public void Start()
{
_textTimer.text = ConvertTools.ConvertTime2(_rspd.RemainingTime);
Observable.Interval(TimeSpan.FromSeconds(1.0f))
.Subscribe(_ => { _textTimer.text = ConvertTools.ConvertTime2(_rspd.RemainingTime);
gameObject.SetActive( _rspd.IsPackActivated );
})
.AddTo(this);
_btn.onClick.AddListener(() => UIManager.Instance.ShowUI(UITypes.GiftRodSelectionPopupPanel));
//GContext.OnEvent<GiftRodSelectEvent>()
// .Subscribe(e => { UIManager.Instance.SetImageSprite(_icon, _item[e.RodID].Icon); })
// .AddTo(this);
//GContext.Publish(new GiftRodSelectEvent(_rspd.RodID));
//UIManager.Instance.SetImageSprite(_icon, _item[_rspd.RodID].Icon);
}
}

View File

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

View File

@@ -0,0 +1,141 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
namespace game
{
public class HomeBtnScratchTicket : EventButtonResource
{
[SerializeField] private TMP_Text textTimer;
Button btn;
private DateTime endDateTime;
private EventScratchTicketDataManager m_DataManager;
#region
void Awake()
{
btn = GetComponent<Button>();
}
// Start is called before the first frame update
void Start()
{
m_DataManager = GContext.container.Resolve<EventScratchTicketDataManager>();
m_DataManager.Init();
// 红点处理
if (m_DataManager != null)
{
m_DataManager.GetChainPackData();
if (m_DataManager.IsRedDotDisplayed()) RedPointManager.Instance.SetRedPointState(RedPointName.Home_ScratchTicket, true);
else RedPointManager.Instance.SetRedPointState(RedPointName.Home_ScratchTicket, false);
}
else RedPointManager.Instance.SetRedPointState(RedPointName.Home_ScratchTicket, false);
// 活动倒计时处理
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
int fishingEventID = fishingEventData.GetEvent(7, 3);
if (fishingEventID < 0)
{
gameObject.SetActive(false);
return;
}
Tables tables = GContext.container.Resolve<Tables>();
FishingEvent fishingEvent = tables.TbFishingEvent[fishingEventID];
endDateTime = DateTime.Parse((fishingEvent.TimeDefinition as LimitedTime)?.EndTime);
TimeSpan all = GetRemainingTime(endDateTime);
double seconds = all.TotalSeconds - 1;
if (seconds < 1)
{
gameObject.SetActive(false);
return;
}
StartCoroutine(AttachTimer((float)seconds));
textTimer.text = ConvertTools.ConvertTime2(all);
Observable.Interval(TimeSpan.FromSeconds(1.0f)).Subscribe(_ =>
{
TimeSpan tmpAll = GetRemainingTime(endDateTime);
textTimer.text = ConvertTools.ConvertTime2(tmpAll);
if (tmpAll.TotalSeconds <= 0)
gameObject.SetActive(false);
}).AddTo(this);
btn.onClick.AddListener(async () =>
{
string actName = "FishingScratchTicketAct";
List<string> resList = new List<string>();
resList.Add(actName);
EventScratchMain eventScratchMain = m_DataManager.ContinueGame();
resList.AddRange(eventScratchMain.Addressable);
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Loads(resList);
if (isCanEnter)
{
GContext.Publish(new UnloadActToNextAct(actName));
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(true, () => GContext.Publish(new UnloadActToNextAct(actName)));
}
});
EventScratchMain eventScratchMain = m_DataManager.ContinueGame();
string actName = "FishingScratchTicketAct";
List<string> resList = new List<string>
{
actName,
eventScratchMain.Icon
};
resList.AddRange(eventScratchMain.Addressable);
CheckResource(resList);
}
#endregion
private TimeSpan GetRemainingTime(DateTime endDateTime)
{
return endDateTime - ZZTimeHelper.UtcNow();
}
IEnumerator AttachTimer(float time)
{
yield return new WaitForSeconds(time);
gameObject.SetActive(false);
}
protected override void OnLoadEventResource()
{
TimeSpan all = GetRemainingTime(endDateTime);
double seconds = all.TotalSeconds - 1;
if (seconds > 1)
{
EventScratchMain eventScratchMain = m_DataManager.ContinueGame();
if (eventScratchMain != null)
{
Image btn_icon = transform.Find("icon").GetComponent<Image>();
GContext.container.Resolve<IUIService>().SetImageSprite(btn_icon, eventScratchMain.Icon);
}
gameObject.SetActive(true);
}
}
}
}

View File

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

View File

@@ -0,0 +1,38 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UniRx;
using System;
using GameCore;
using asap.core;
public class HomeBtnSelectionPack : MonoBehaviour
{
private TMP_Text _textTime;
private SelectionPackData _selectionPackData;
private Button _btn;
private void Awake()
{
_textTime = transform.Find("text_time").GetComponent<TMP_Text>();
_btn = GetComponent<Button>();
_selectionPackData = GContext.container.Resolve<SelectionPackData>();
if (!_selectionPackData.IsPackActivated )
gameObject.SetActive( false );
}
// Start is called before the first frame update
private void Start()
{
_btn.onClick.AddListener(async () => { await UIManager.Instance.ShowUI(UITypes.GiftSelectionPanel); });
}
private void OnEnable()
{
_textTime.text = ConvertTools.ConvertTime2(_selectionPackData.RemainingTime);
Observable.Interval(TimeSpan.FromSeconds(1.0f))
.Subscribe(_ => {
_textTime.text = ConvertTools.ConvertTime2(_selectionPackData.RemainingTime);
if (_selectionPackData.RemainingTime.TotalSeconds <= 0
|| _selectionPackData.PurchaseCount >= _selectionPackData.MaxPurchaseCount)
gameObject.SetActive(false); })
.AddTo(this);
}
}

View File

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

View File

@@ -0,0 +1,119 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnWashing : MonoBehaviour
{
[SerializeField] private TMP_Text textTimer;
Button btn_washing;
private DateTime endDateTime;
void Awake()
{
btn_washing = GetComponent<Button>();
EventWashingDataManager eventWashingDataManager = GContext.container.Resolve<EventWashingDataManager>();
eventWashingDataManager.Init();
eventWashingDataManager.InitGameData();
// 更换图片
var data = eventWashingDataManager.GetCurrentEventWashing();
if (data != null)
{
Image icon = transform.Find("icon").GetComponent<Image>();
GContext.container.Resolve<IUIService>().SetImageSprite(icon, data.IconID);
}
// 红点处理
if (eventWashingDataManager != null)
{
if (eventWashingDataManager.IsRedDotDisplayed()) RedPointManager.Instance.SetRedPointState(RedPointName.Home_Washing, true);
else RedPointManager.Instance.SetRedPointState(RedPointName.Home_Washing, false);
}
else RedPointManager.Instance.SetRedPointState(RedPointName.Home_Washing, false);
// 活动倒计时处理
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
int fishingEventID = fishingEventData.GetEvent(4, 4);
if (fishingEventID < 0)
{
gameObject.SetActive(false);
return;
}
Tables tables = GContext.container.Resolve<Tables>();
FishingEvent fishingEvent = tables.TbFishingEvent[fishingEventID];
endDateTime = DateTime.Parse((fishingEvent.TimeDefinition as LimitedTime)?.EndTime);
//endDateTime = fishingEventData.GetEventEndTime(fishingEventID);
//TimeSpan all = endDateTime - ZZTimeHelper.UtcNow();
TimeSpan all = GetRemainingTime(endDateTime);
double seconds = all.TotalSeconds - 1;
if (seconds < 1)
{
gameObject.SetActive(false);
return;
}
StartCoroutine(AttachTimer((float)seconds));
textTimer.text = ConvertTools.ConvertTime2(all);
Observable.Interval(TimeSpan.FromSeconds(1.0f)).Subscribe(_ =>
{
TimeSpan tmpAll = GetRemainingTime(endDateTime);
textTimer.text = ConvertTools.ConvertTime2(tmpAll);
if (tmpAll.TotalSeconds <= 0)
gameObject.SetActive(false);
}).AddTo(this);
}
private TimeSpan GetRemainingTime(DateTime endDateTime)
{
return endDateTime - ZZTimeHelper.UtcNow();
}
IEnumerator AttachTimer(float time)
{
yield return new WaitForSeconds(time);
gameObject.SetActive(false);
}
// Start is called before the first frame update
void Start()
{
btn_washing.onClick.AddListener(async () =>
{
EventWashingDataManager eventWashingDataManager = GContext.container.Resolve<EventWashingDataManager>();
eventWashingDataManager.Init();
string res = eventWashingDataManager.GetPreLoadStepResName();
List<string> resList = new List<string>();
resList.Add("FishingYachtAct");// 公共包
resList.Add("audio_eventwashing_bgm");// 音效包
resList.Add("Garage"); // 场景
resList.Add(res); // 步骤,游戏
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Loads(resList);
if (isCanEnter)
{
GContext.Publish(new UnloadActToNextAct("FishingYachtAct"));
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(true, () => GContext.Publish(new UnloadActToNextAct("FishingYachtAct")));
}
});
}
}

View File

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

View File

@@ -0,0 +1,286 @@
using asap.core;
using cfg;
using DG.Tweening;
using game;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
public class HomeBubbleTask : MonoBehaviour
{
Button btn_bubble_task;
Image bg_bar;
Image bg_bar1;
Image bg_bar2;
[HideInInspector]
public Image bar;
Image bar1;
Image bar2;
RectTransform _rect;
RectTransform _rect1;
RectTransform _rect2;
GameObject info_1;
GameObject info_2;
RectTransform bar_rect;
RectTransform bar_rect_1;
RectTransform bar_rect_2;
RewardItemNew rewardItemBubble;
RewardItemNew rewardItem_1;
RewardItemNew rewardItem_2;
[HideInInspector]
public TMP_Text text_progress;
TMP_Text text_time;
private CollectingTargetReward collectingTarget;
FishingEventData _fishingEventData;
Tables _tables;
BubbleTaskInfo_2 bubbleTaskInfo;
public float barTimer = 0.38f;
public float animationTimer = 0.667f;
public float changeDelayTimer = 0.616f;
float showTime = 0.16f; //显示时间
private void Awake()
{
showTime = animationTimer - changeDelayTimer;
bubbleTaskInfo = GetComponent<BubbleTaskInfo_2>();
_fishingEventData = GContext.container.Resolve<FishingEventData>();
_tables = GContext.container.Resolve<Tables>();
btn_bubble_task = transform.GetComponent<Button>();
bg_bar = transform.Find("bg_bar").GetComponent<Image>();
bg_bar1 = transform.Find("info_1/bg_bar").GetComponent<Image>();
bg_bar2 = transform.Find("info_2/bg_bar").GetComponent<Image>();
bar = transform.Find("bg_bar/bar").GetComponent<Image>();
bar1 = transform.Find("info_1/bg_bar/bar").GetComponent<Image>();
bar2 = transform.Find("info_2/bg_bar/bar").GetComponent<Image>();
_rect = transform.Find("bg_bar/bar").GetComponent<RectTransform>();
bar_rect = transform.Find("bg_bar").GetComponent<RectTransform>();
info_1 = transform.Find("info_1").gameObject;
info_2 = transform.Find("info_2").gameObject;
_rect1 = transform.Find("info_1/bg_bar/bar").GetComponent<RectTransform>();
_rect2 = transform.Find("info_2/bg_bar/bar").GetComponent<RectTransform>();
bar_rect_1 = transform.Find("info_1/bg_bar").GetComponent<RectTransform>();
bar_rect_2 = transform.Find("info_2/bg_bar").GetComponent<RectTransform>();
rewardItemBubble = transform.Find("info_1/btn_reward").GetComponent<RewardItemNew>();
rewardItem_1 = transform.Find("info_2/btn_reward_1").GetComponent<RewardItemNew>();
rewardItem_2 = transform.Find("info_2/btn_reward_2").GetComponent<RewardItemNew>();
text_progress = transform.Find("bg_bar/text_progress").GetComponent<TMP_Text>();
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
}
void Start()
{
btn_bubble_task.onClick.AddListener(OnClickTarget);
}
async void OnClickTarget()
{
var collectingTargetInit = _fishingEventData.collectingTargetInit;
if (collectingTargetInit != null)
{
//ExitAutoFishing();
//退出自动钓鱼
btn_bubble_task.enabled = false;
bool isCanEnter = await _fishingEventData.IsDownLoadPkg();
if (isCanEnter)
{
await UIManager.Instance.ShowUI(UITypes.FishingTargetPopupPanel);
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(false, () =>
{
_ = UIManager.Instance.ShowUI(UITypes.FishingTargetPopupPanel);
});
}
btn_bubble_task.enabled = true;
}
}
public void SetCollectingTargetTime(string timeStr)
{
text_time.text = timeStr;
}
public void PlayEventTargetAdd(CollectingTargetReward collecting, int curCount, int endCount)
{
//Vector3 startPos = fishingData.image_extra_pos;
this.collectingTarget = collecting;
int curValue = curCount;
bar.DOFillAmount(endCount / (float)collectingTarget.TokenRequired, barTimer);
DOTween.To(() => curValue, x => curValue = x, endCount, barTimer).OnUpdate(() =>
{
text_progress.text = $"{curValue}/{collectingTarget.TokenRequired}";
}).OnComplete(() =>
{
//require.transform.localScale = Vector3.one;
if (_fishingEventData.preCollectingTarget != null)
{
TargetUp();
}
});
//进度条增加
}
public void CollectingTargetNext()
{
collectingTarget = _fishingEventData.collectingTarget;
if (collectingTarget != null)
{
var collectingTargetInit = _fishingEventData.collectingTargetInit;
bubbleTaskInfo.SetInfo(collectingTargetInit);
if (_fishingEventData.preCollectingTarget != null)
{
return;
}
else
{
List<ItemData> itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(collectingTarget.DropID);
if (itemData != null && itemData.Count > 0)
{
SetCollectingTargetRewardIcon(itemData);
}
int curCount = _fishingEventData.GetCurCollectingTarget();
if (curCount >= collectingTarget.TokenRequired)
{
curCount = collectingTarget.TokenRequired;
text_progress.text = LocalizationMgr.GetText("UI_EventRankPopupPanel_15");
}
else
{
text_progress.text = $"{curCount}/{collectingTarget.TokenRequired}";
}
bar.fillAmount = curCount / (float)collectingTarget.TokenRequired;
}
}
}
void TargetUp()
{
if (_fishingEventData.preCollectingTarget == null || _fishingEventData.preCollectingTarget.Count == 0)
{
collectingTarget = _fishingEventData.collectingTarget;
PlayUpEndAni();
}
else
{
collectingTarget = _fishingEventData.preCollectingTarget.Dequeue();
PlayUpAni();
}
}
void ChangeReward()
{
List<ItemData> itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataByDropId(collectingTarget.DropID);
if (itemData is { Count: > 0 })
{
//await Awaiters.Seconds(0.1f);
SetCollectingTargetRewardIcon(itemData);
}
}
async void PlayUpAni()
{
int endCount = collectingTarget.TokenRequired;
btn_bubble_task.GetComponent<Animation>().Play("bubble_task");
await Awaiters.Seconds(changeDelayTimer);
ChangeReward();
bar.fillAmount = 0;
await Awaiters.Seconds(showTime);
if (this == null)
{
return;
}
bar.DOFillAmount(1, barTimer);
int curValue = 0;
DOTween.To(() => curValue, x => curValue = x, endCount, barTimer).OnUpdate(() =>
{
text_progress.text = $"{curValue}/{collectingTarget.TokenRequired}";
})
.OnComplete(() =>
{
TargetUp();
});
}
async void PlayUpEndAni()
{
int endCount = _fishingEventData.GetCurCollectingTarget();
if (endCount >= collectingTarget.TokenRequired)
{
btn_bubble_task.GetComponent<Animation>().Play("bubble_task_final");
text_progress.text = LocalizationMgr.GetText("UI_EventRankPopupPanel_15");
}
else
{
btn_bubble_task.GetComponent<Animation>().Play("bubble_task");
await Awaiters.Seconds(changeDelayTimer);
ChangeReward();
bar.fillAmount = 0;
await Awaiters.Seconds(showTime);
if (this == null)
{
return;
}
bar.DOFillAmount(endCount / (float)collectingTarget.TokenRequired, barTimer);
int curValue = 0;
DOTween.To(() => curValue, x => curValue = x, endCount, barTimer).OnUpdate(() =>
{
text_progress.text = $"{curValue}/{collectingTarget.TokenRequired}";
});
}
GContext.Publish(new ShowData());
}
int showCount = 0;
public void SetCollectingTargetRewardIcon(List<ItemData> itemDatas)
{
if (itemDatas != null)
{
int count = itemDatas.Count;
if (showCount != count)
{
info_1.SetActive(count == 1);
info_2.SetActive(count != 1);
showCount = count;
if (count == 1)
{
bar_rect.sizeDelta = bar_rect_1.sizeDelta;
bg_bar.sprite = bg_bar1.sprite;
bar.sprite = bar1.sprite;
_rect.sizeDelta = _rect1.sizeDelta;
}
else
{
bar_rect.sizeDelta = bar_rect_2.sizeDelta;
bg_bar.sprite = bg_bar2.sprite;
bar.sprite = bar2.sprite;
_rect.sizeDelta = _rect2.sizeDelta;
}
}
if (count == 1)
{
rewardItemBubble.SetData(itemDatas[0], isCanClick: false);
}
else
{
rewardItem_1.SetData(itemDatas[0], isCanClick: false);
rewardItem_2.SetData(itemDatas[1], isCanClick: false);
}
}
}
}

View File

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

View File

@@ -0,0 +1,107 @@
using asap.core;
using GameCore;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class HomeBuffItem : MonoBehaviour
{
Button btn_buff;
TMP_Text buff_time;
Image buff_icon;
Timer buff_timer;
public FishBuffTimeData buffTimeData;
cfg.FishBuff buff;
//buff_tips tips_buff;
private void Init()
{
btn_buff = GetComponent<Button>();
btn_buff.onClick.AddListener(OnClick);
}
public void InitPanel(FishBuffTimeData buffTimeData, string iconName, RectTransform rectTransform)
{
this.buffTimeData = buffTimeData;
buff_time = transform.Find("Ani_Container/text_time").GetComponent<TMP_Text>();
buff_icon = transform.Find("Ani_Container/icon").GetComponent<Image>();
if (rectTransform != null)
{
RectTransform rect = buff_icon.GetComponent<RectTransform>();
rect.anchoredPosition = rectTransform.anchoredPosition;
rect.sizeDelta = rectTransform.sizeDelta;
}
InitBuff(iconName);
}
async void OnClick()
{
GameObject go = await UIManager.Instance.ShowUI(UITypes.FishingBuffInfoPopupPanel);
FishingBuffInfoPopupPanel fishingBuffInfoPopupPanel = go.GetComponent<FishingBuffInfoPopupPanel>();
fishingBuffInfoPopupPanel.InitPanel(buffTimeData);
//item_tips _common_tips = await item_tips.Show();
//if (_common_tips == null)
//{
// return;
//}
//tips_buff = _common_tips.ShowBuff(transform.position, buff);
}
async void PlayBuff()
{
buffTimeData.isEnd = buffTimeData.addDown == 0;
if (buffTimeData.isEnd)
{
btn_buff.gameObject.SetActive(false);
GContext.Publish(new EventHomeBuffPanelRefresh());
}
await Awaiters.Seconds(1f);
GContext.Publish(new BuffChangeEvent());
}
void InitBuff(string iconName)
{
if (btn_buff == null)
{
Init();
}
btn_buff.gameObject.SetActive(buffTimeData != null);
if (buffTimeData != null)
{
buff = GContext.container.Resolve<cfg.Tables>().TbFishBuff.GetOrDefault(buffTimeData.buffID);
if (string.IsNullOrEmpty(iconName))
{
GContext.container.Resolve<IUIService>().SetImageSprite(buff_icon, buff.Icon);
}
else
{
GContext.container.Resolve<IUIService>().SetImageSprite(buff_icon, iconName);
}
var buffTime = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
buff_timer?.Cancel();
buffTime.Add(TimeSpan.FromSeconds(-buffTimeData.addDown));
buff_time.text = ConvertTools.ConvertTime2(buffTime);
double seconds = buffTime.TotalSeconds;
buff_timer = this.AttachTimer((float)seconds,
() => { PlayBuff(); },
(elapsed) =>
{
if (buffTimeData.isEnd)
{
buff_timer?.Cancel();
PlayBuff();
return;
}
TimeSpan now = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
now.Add(TimeSpan.FromSeconds(-buffTimeData.addDown));
buff_time.text = ConvertTools.ConvertTime2(now);
}, useRealTime: true);
}
}
private void OnDestroy()
{
buff_timer?.Cancel();
buff_timer = null;
}
}

View File

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

View File

@@ -0,0 +1,378 @@
using asap.core;
using cfg;
using DG.Tweening;
using GameCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class GetBuffPosEvent
{
public Vector3 Pos;
}
public class HomeBuffPanel : MonoBehaviour
{
RectTransform defaultStyle;
RectTransform targetStyle;
HomeBuffItem btn_buff_prefab;
HomeBuffItem btn_buff_target;
HomeBuffItem btn_buff;
Animation anim;
Button btn_open;
Transform buffRoot;
List<HomeBuffItem> homeBuffItems = new List<HomeBuffItem>();
int curCount;
BuffDataCenter buffDataCenter;
FishingData fishingData;
List<FishBuffTimeData> fishBuffTimeData;
FishBuffTimeData targetBuffTimeData;
IDisposable _disposable;
float buffShowTime = 2f; // Buff显示时间
float buffFlyTime = 0.5f; // Buff飞行时间
private void Awake()
{
fishingData = GContext.container.Resolve<FishingData>();
defaultStyle = transform.Find("style/defaultStyle").GetComponent<RectTransform>();
targetStyle = transform.Find("style/targetStyle").GetComponent<RectTransform>();
btn_buff_prefab = transform.Find("layout_buff/buffRoot/btn_buff_prefab").GetComponent<HomeBuffItem>();
btn_buff = transform.Find("buff/btn_buff_beilv").GetComponent<HomeBuffItem>();
anim = GetComponent<Animation>();
btn_open = transform.Find("layout_buff").GetComponent<Button>();
buffRoot = transform.Find("layout_buff/buffRoot");
}
private void Start()
{
btn_open.onClick.AddListener(OpenPanel);
}
private void OnEnable()
{
_disposable?.Dispose();
_disposable = GContext.OnEvent<EventHomeBuffPanelRefresh>().Subscribe(_ => RefreshPanel());
btn_buff_prefab.gameObject.SetActive(false);
buffDataCenter = GContext.container.Resolve<BuffDataCenter>();
ShowBuff();
SetCollectionTargetWeightBuffShow();
}
public async void OpenPanel()
{
await UIManager.Instance.ShowUI(new UIType("FishingBuffLayoutPopupPanel"));
}
bool isShowBuff = false;
async void PlayAnim()
{
fishBuffTimeData = fishBuffTimeData.Where(x => x.isEnd == false).ToList();
//fishBuffTimeData.Sort((a, b) => b.SortID.CompareTo(a.SortID));
var fishData = fishBuffTimeData.Where(x => !x.isNew).ToList();
if (fishData.Count == 0)
{
btn_buff.gameObject.SetActive(false);
btn_open.gameObject.SetActive(true);
anim.Play();
return;
}
var item = Instantiate(btn_buff_prefab.gameObject, buffRoot);
var homeBuffItem = item.GetComponent<HomeBuffItem>();
homeBuffItems.Add(homeBuffItem);
if (targetBuffTimeData != null && fishData[0].buffID == targetBuffTimeData.buffID)
{
btn_buff_target = homeBuffItem;
homeBuffItem.gameObject.SetActive(false);
homeBuffItem.InitPanel(fishData[0], "", targetStyle);
ShowBuffTarget();
}
else
{
homeBuffItem.InitPanel(fishData[0], "", defaultStyle);
}
await Awaiters.Seconds(buffShowTime);
//播放动画
btn_buff.gameObject.SetActive(false);
btn_open.gameObject.SetActive(true);
anim.Play();
}
public async Task BuffShow()
{
HomeBuffPopupPanel homeBuffPopupPanel = null;
try
{
if (isShowBuff)
{
return;
}
var showFishBuffIds = buffDataCenter.showFishBuffIds;
if (showFishBuffIds.Count == 0)
{
return;
}
isShowBuff = true;
for (int i = 0; i < showFishBuffIds.Count; i++)
{
FishBuffTimeData newBuffTimeData = showFishBuffIds[i];
if (btn_buff_prefab == null)
{
return;
}
HomeBuffItem newHomeBuffItem = null;
if (curCount == 0 || (!newBuffTimeData.isNew && curCount == 1))
{
btn_buff.gameObject.SetActive(false);
btn_open.gameObject.SetActive(false);
newHomeBuffItem = btn_buff;
}
else
{
int showCount = 0;
if (!newBuffTimeData.isNew)
{
for (int j = homeBuffItems.Count - 1; j >= 0; j--)
{
if (homeBuffItems[j].gameObject.activeSelf)
{
if (homeBuffItems[j].buffTimeData.buffID == newBuffTimeData.buffID)
{
newHomeBuffItem = homeBuffItems[j];
break;
}
showCount++;
if (showCount >= 4)
{
homeBuffItems[j].gameObject.SetActive(false);
break;
}
}
}
}
else
{
if (curCount == 1)
{
PlayAnim();
}
for (int j = homeBuffItems.Count - 1; j >= 0; j--)
{
if (homeBuffItems[j].gameObject.activeSelf)
{
showCount++;
homeBuffItems[j].gameObject.SetActive(showCount < 4);
}
}
}
if (newHomeBuffItem == null)
{
var item = Instantiate(btn_buff_prefab.gameObject, buffRoot);
newHomeBuffItem = item.GetComponent<HomeBuffItem>();
homeBuffItems.Add(newHomeBuffItem);
}
}
newHomeBuffItem.InitPanel(newBuffTimeData, "", defaultStyle);
Transform Ani_ContainerSou = newHomeBuffItem.transform.Find("Ani_Container");
if (newBuffTimeData.isNew)
{
curCount++;
Ani_ContainerSou.gameObject.SetActive(false);
}
Transform Ani_Container = Instantiate(Ani_ContainerSou.gameObject, newHomeBuffItem.transform).transform;
newBuffTimeData.isNew = false;
var go = await UIManager.Instance.ShowUI(UITypes.HomeBuffPopupPanel);
homeBuffPopupPanel = go.GetComponent<HomeBuffPopupPanel>();
if (homeBuffPopupPanel != null)
{
homeBuffPopupPanel.Init(newBuffTimeData);
await Awaiters.Seconds(buffShowTime);
homeBuffPopupPanel.Hide();
}
if (newHomeBuffItem != null)
{
newHomeBuffItem.gameObject.SetActive(true);
Ani_Container.gameObject.SetActive(true);
}
else if (btn_buff_prefab == null)
{
UIManager.Instance.DestroyUI(UITypes.HomeBuffPopupPanel);
return;
}
GetBuffPosEvent getBuffPosEvent = new GetBuffPosEvent();
GContext.Publish(getBuffPosEvent);
Ani_Container.position = getBuffPosEvent.Pos;
Ani_Container.localScale = Vector3.one * 1.660156f / newHomeBuffItem.transform.localScale.x;
Ani_Container.DOScale(Vector3.one, buffFlyTime);
Ani_Container.DOLocalMove(Vector3.zero, buffFlyTime);
newBuffTimeData.addDown = 0;
await Awaiters.Seconds(buffFlyTime);
if (btn_buff_prefab == null)
{
UIManager.Instance.DestroyUI(UITypes.HomeBuffPopupPanel);
return;
}
Ani_ContainerSou.gameObject.SetActive(true);
Ani_Container.gameObject.SetActive(false);
}
showFishBuffIds.Clear();
if (homeBuffPopupPanel != null)
{
homeBuffPopupPanel.Close();
}
isShowBuff = false;
}
catch (Exception e)
{
if (homeBuffPopupPanel != null)
{
homeBuffPopupPanel.Close();
}
Debug.LogError(e);
}
}
void ShowBuff(int showCount = 4)
{
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);
}
fishBuffTimeData = fishBuffTimeData.Where(x => x.isEnd == false).ToList();
fishBuffTimeData.Sort((a, b) => b.SortID.CompareTo(a.SortID));
var fishBuffData = fishBuffTimeData.Where(x => !x.isNew).ToList();
int dataCount = fishBuffData.Count;
if (dataCount < showCount)
{
showCount = dataCount;
}
curCount = showCount;
int itemsCount = homeBuffItems.Count;
if (showCount == 1)
{
btn_buff.gameObject.SetActive(true);
btn_open.gameObject.SetActive(false);
var homeBuffItem = btn_buff;
if (targetBuffTimeData != null && fishBuffData[0].buffID == targetBuffTimeData.buffID)
{
btn_buff_target = homeBuffItem;
homeBuffItem.gameObject.SetActive(false);
homeBuffItem.InitPanel(fishBuffData[0], "", targetStyle);
}
else
{
homeBuffItem.InitPanel(fishBuffData[0], "", defaultStyle);
}
return;
}
else
{
for (int i = 0; i < itemsCount; i++)
{
homeBuffItems[i].gameObject.SetActive(false);
}
//anim.Play();
btn_open.gameObject.SetActive(curCount > 0);
btn_buff.gameObject.SetActive(false);
}
for (int i = 0; i < showCount; i++)
{
HomeBuffItem homeBuffItem;
if (itemsCount > i)
{
homeBuffItem = homeBuffItems[i];
}
else
{
var item = Instantiate(btn_buff_prefab.gameObject, buffRoot);
homeBuffItem = item.GetComponent<HomeBuffItem>();
homeBuffItems.Add(homeBuffItem);
}
if (targetBuffTimeData != null && fishBuffData[i].buffID == targetBuffTimeData.buffID)
{
btn_buff_target = homeBuffItem;
homeBuffItem.gameObject.SetActive(false);
homeBuffItem.InitPanel(fishBuffData[i], "", targetStyle);
}
else
{
homeBuffItem.gameObject.SetActive(true);
homeBuffItem.InitPanel(fishBuffData[i], "", defaultStyle);
}
}
}
async void SetCollectionTargetWeightBuffShow()
{
if (fishingData.isAddTargetBuff)
{
await Awaiters.Until(() => fishingData.isShowTargetPanel);
fishingData.isShowTargetPanel = false;
fishingData.isAddTargetBuff = false;
await Awaiters.Seconds(2.5f);
Transform Ani_Container = btn_buff_prefab.transform.Find("Ani_Container");
if (btn_buff_target != null)
{
Ani_Container = btn_buff_target.transform.Find("Ani_Container");
}
GetBuffPosEvent getBuffPosEvent = new GetBuffPosEvent();
GContext.Publish(getBuffPosEvent);
Ani_Container.position = getBuffPosEvent.Pos;
Ani_Container.DOLocalMove(Vector3.zero, 1);
}
ShowBuffTarget();
}
void ShowBuffTarget()
{
if (btn_buff_target != null)
{
CollectingTargetInit targetWeightInit = GContext.container.Resolve<FishingEventData>().collectingTargetInit;
if (targetWeightInit != null)
{
btn_buff_target.InitPanel(targetBuffTimeData, targetWeightInit.BuffIcon, targetStyle);
}
}
GContext.Publish(new BuffChangeEvent());
}
private void RefreshPanel()
{
if (isShowBuff)
{
return;
}
ShowBuff();
ShowBuffTarget();
}
private void OnDisable()
{
_disposable?.Dispose();
_disposable = null;
}
}
public class EventHomeBuffPanelRefresh
{
}

View File

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

View File

@@ -0,0 +1,60 @@
using asap.core;
using UnityEngine;
using UniRx;
using System;
using GameCore;
using UnityEngine.UI;
using TMPro;
using cfg;
using Game;
public class HomeBuffPopupPanel : MonoBehaviour
{
Image icon_buff;
TMP_Text text_info;
BuffDataCenter buffDataCenter;
FishingData fishingData;
GameObject root;
Animation _ani;
IDisposable disposable;
private void Awake()
{
_ani = GetComponent<Animation>();
root = transform.Find("root").gameObject;
buffDataCenter = GContext.container.Resolve<BuffDataCenter>();
fishingData = GContext.container.Resolve<FishingData>();
icon_buff = transform.Find("root/icon_buff").GetComponent<Image>();
text_info = transform.Find("root/bg/text_info").GetComponent<TMP_Text>();
disposable = GContext.OnEvent<GetBuffPosEvent>().Subscribe(GetBuffPosEvent);
}
void GetBuffPosEvent(GetBuffPosEvent getBuffPosEvent)
{
getBuffPosEvent.Pos = icon_buff.transform.position;
}
public void Init(FishBuffTimeData fishBuffTimeData)
{
var buff = GContext.container.Resolve<cfg.Tables>().TbFishBuff.GetOrDefault(fishBuffTimeData.buffID);
if (buff != null)
{
GContext.container.Resolve<IUIService>().SetImageSprite(icon_buff, buff.Icon);
text_info.text = LocalizationMgr.GetText(buff.Title_l10n_key);
GContext.Publish(new EventUISound(buff.Audio));
}
root.SetActive(true);
_ani.Play("buff_show");
}
public void Hide()
{
root.SetActive(false);
}
public void Close()
{
UIManager.Instance.DestroyUI(UITypes.HomeBuffPopupPanel);
}
private void OnDisable()
{
disposable?.Dispose();
disposable = null;
}
}

View File

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

View File

@@ -0,0 +1,131 @@
using asap.core;
using game;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class HomeBuildBtn : MonoBehaviour, IUIRedPoint
{
string key;
public GameObject redPoint;
public GameObject redpoint_big;
public GameObject bubble_tips;
public TMP_Text text_redpoint_big;
public Button btn_building;
public CanvasGroup homeCanvasGroup;
CampDataMM campData;
private void Awake()
{
campData = GContext.container.Resolve<CampDataMM>();
}
private void Start()
{
btn_building.onClick.AddListener(OnBuildingClick);
}
private void OnEnable()
{
if (campData.IsCanSkyscraper)
{
SetKey(RedPointName.Home_Skyscraper);
}
else
{
SetKey(RedPointName.Home_Build);
}
}
private void OnDisable()
{
if (!string.IsNullOrEmpty(key))
{
RedPointManager.Instance.RemoveRedPoint(key);
key = "";
}
}
public void SetKey(string _key)
{
if (!string.IsNullOrEmpty(key))
{
RedPointManager.Instance.RemoveRedPoint(key);
}
key = _key;
RedPointManager.Instance.AddRedPoint(key, this);
SetRedPointState(RedPointManager.Instance.GetRedPointState(key));
}
public void SetRedPointState(bool state)
{
int count = RedPointManager.Instance.GetRedPointCount(key);
if (count > 1)
{
redpoint_big.SetActive(true);
if (count > 99)
{
text_redpoint_big.text = "99+";
}
else
{
text_redpoint_big.text = count.ToString();
}
state = false;
}
else
{
redpoint_big.SetActive(false);
}
redPoint.SetActive(state);
if (state && !campData.IsCanSkyscraper)
{
bubble_tips.SetActive(campData.GoBuilding());
}
}
void OnBuildingClick()
{
homeCanvasGroup.blocksRaycasts = false;
if (campData.IsCanSkyscraper)
{
InfiniteBuildingAct();
}
else
{
InBuildAct();
}
}
async void InfiniteBuildingAct()
{
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Load("InfiniteBuildingAct");
if (isCanEnter)
{
GContext.Publish(new UnloadActToNextAct("InfiniteBuildingAct"));
}
else
{
var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
panel.GetComponent<CloudTransitionPanel>().SetBtn(true, () => GContext.Publish(new UnloadActToNextAct("InfiniteBuildingAct")));
//var panel = await UIManager.Instance.ShowUI(UITypes.FishingDownLoadPopupPanel);
//panel.GetComponent<FishingDownLoadPopupPanel>().SetBtn(null, () => GContext.Publish(new UnloadActToNextAct("InfiniteBuildingAct")));
}
homeCanvasGroup.blocksRaycasts = true;
}
async void InBuildAct()
{
ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
bool isCanEnter = await loadResourceService.Loads(campData.AllPrefabs);
if (isCanEnter)
{
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")));
}
homeCanvasGroup.blocksRaycasts = true;
}
}

View File

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

View File

@@ -0,0 +1,223 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections.Generic;
using UniRx;
using UnityEngine;
public class GetGiftBtnPosEvent
{
public Vector3 Pos;
public float width;
}
/// <summary>
/// 其他礼包
/// </summary>
public class HomeGiftBtnPanel : MonoBehaviour
{
GiftButton ct_giftButton;
GameObject btn_gift_piggybank;
GameObject btn_gift_bargain;
GameObject btn_gift9;
GameObject btn_gift10;
GameObject btn_gift11;
Transform _minibp;
Tables _tables;
bool CollectingTarget = false;
FishingEventData fishingEventData;
protected CompositeDisposable disposables = new CompositeDisposable();
private void Awake()
{
GContext.OnEvent<TargetEvent>()
.Where(_ => (_.type == 3 && _.subType == 8) || _.type == 9 || _.type == 6)
.Subscribe(FishingEvent).AddTo(disposables);
GContext.OnEvent<HideHomePanelEvent>().Subscribe(OnHideHomePanelEvent).AddTo(disposables);
}
private void OnHideHomePanelEvent(HideHomePanelEvent e)
{
Destroy(this);
}
public void Init()
{
fishingEventData = GContext.container.Resolve<FishingEventData>();
btn_gift9 = transform.Find("btn_gift9").gameObject;
btn_gift10 = transform.Find("btn_gift10").gameObject;
btn_gift11 = transform.Find("btn_gift11").gameObject;
btn_gift_piggybank = transform.Find("btn_gift_piggybank").gameObject;
btn_gift_bargain = transform.Find("btn_gift_bargain").gameObject;
_minibp = transform.Find("MiniBPGroup");
_tables = GContext.container.Resolve<Tables>();
ct_giftButton = transform.Find("btn_gift7").GetComponent<GiftButton>();
ct_giftButton.gameObject.SetActive(false);
int eventID38 = fishingEventData.GetEvent(3, 8);
Show1A1(eventID38);
int eventID6 = fishingEventData.GetEvent(6, 1);
Show1A2(eventID6);
SetPiggyBankShow();
SetBarginPackShow();
}
#region GiftPopupPanel_7
public void InitCollectingTarget()
{
var pack = GContext.container.Resolve<FishingEventData>().IsShowCTGift();
CollectingTarget = pack != null;
if (CollectingTarget)
{
ct_giftButton.Init(UITypes.GiftPopupPanel_7, GContext.container.Resolve<FishingEventData>().collectingTargetInit.GiftIcon);
}
else
{
ct_giftButton.gameObject.SetActive(false);
}
}
public void SetCollectingTargetTime(string timeStr)
{
if (CollectingTarget && ct_giftButton != null)
{
ct_giftButton.SetTime(timeStr);
}
}
public void HideTarget()
{
if (ct_giftButton != null)
{
ct_giftButton.gameObject.SetActive(false);
}
}
#endregion
#region
//猪猪银行活动礼包
async void SetPiggyBankShow()
{
var fishingData = GContext.container.Resolve<FishingData>();
if (fishingData.isAddPiggyBank)
{
CanvasGroup canvasGroup = btn_gift_piggybank.GetComponent<CanvasGroup>();
canvasGroup.alpha = 0;
await Awaiters.Until(() => fishingData.isShowTargetPanel);
fishingData.isShowTargetPanel = false;
fishingData.isAddPiggyBank = false;
if (GContext.container.Resolve<PiggyBankPackData>().IsPackActivated)
{
Transform Ani_Container = btn_gift_piggybank.transform.Find("icon");
GetGiftBtnPosEvent getBuffPosEvent = new GetGiftBtnPosEvent();
getBuffPosEvent.Pos = Ani_Container.position;
getBuffPosEvent.width = Ani_Container.GetComponent<RectTransform>().rect.width;
await Awaiters.Seconds(2f);
GContext.Publish(getBuffPosEvent);
await Awaiters.Seconds(0.66f);
canvasGroup.alpha = 1;
}
}
}
#endregion
#region
//砍价礼包活动礼包
public async void SetBarginPackShow()
{
var fishingData = GContext.container.Resolve<FishingData>();
if (fishingData.isAddBarginPack)
{
CanvasGroup canvasGroup = btn_gift_bargain.GetComponent<CanvasGroup>();
canvasGroup.alpha = 0;
await Awaiters.Until(() => fishingData.isShowTargetPanel);
fishingData.isShowTargetPanel = false;
fishingData.isAddBarginPack = false;
//if (GContext.container.Resolve<BarginPackData>().IsPackActivated)
{
Transform Ani_Container = btn_gift_bargain.transform.Find("icon");
GetGiftBtnPosEvent getBuffPosEvent = new GetGiftBtnPosEvent();
getBuffPosEvent.Pos = Ani_Container.position;
getBuffPosEvent.width = Ani_Container.GetComponent<RectTransform>().rect.width;
await Awaiters.Seconds(2f);
GContext.Publish(getBuffPosEvent);
await Awaiters.Seconds(0.66f);
canvasGroup.alpha = 1;
}
}
}
#endregion
void FishingEvent(TargetEvent targetEvent)
{
if (targetEvent.type == 3)
{
Show1A1(targetEvent.id);
}
else if (targetEvent.type == 6)
{
switch (targetEvent.subType)
{
case 1:
Show1A2(targetEvent.id);
break;
}
}
else if (targetEvent.type == 9)
{
ShowMiniBP(targetEvent.subType);
}
}
#region 1+1
void Show1A1(int eventid)
{
if (fishingEventData.Pack1A1Data != null && fishingEventData.Pack1A1Data.lastID == eventid && fishingEventData.Pack1A1Data.index < 2)
{
btn_gift10.SetActive(true);
return;
}
btn_gift10.SetActive(false);
var _epd = GContext.container.Resolve<EventPackData>();
if (_epd != null && _epd.CurrentEventID == eventid)
{
btn_gift9.SetActive(true);
return;
}
btn_gift9.SetActive(false);
}
#endregion
#region 1+2
void Show1A2(int eventid)
{
Pack1A2Data Pack1A2Data = fishingEventData.Pack1A2Data;
if (fishingEventData.Pack1A2Data == null || Pack1A2Data.lastID != eventid)
{
btn_gift11.SetActive(false);
return;
}
EventPackManager eventPackManager = fishingEventData.Get1A2EventPackManager();
List<int> packIDs = eventPackManager.VIPPackList[Pack1A2Data.vipLevel];
if (packIDs.Count <= Pack1A2Data.index)
{
btn_gift11.SetActive(false);
return;
}
btn_gift11.SetActive(true);
}
#region
void ShowMiniBP(int subType)
{
int count = _minibp.childCount;
for (int i = 0; i < count; i++)
{
HomeBtnMiniBP homeBtnMiniBP = _minibp.GetChild(i).GetComponent<HomeBtnMiniBP>();
if (homeBtnMiniBP != null&& homeBtnMiniBP.Type == (MiniBattlePassType)subType)
{
homeBtnMiniBP.SetShow();
}
}
}
#endregion
#endregion
void OnDestroy()
{
disposables?.Dispose();
disposables = null;
}
}

View File

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

View File

@@ -0,0 +1,85 @@
using asap.core;
using cfg;
using DG.Tweening;
using GameCore;
using System;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class HomeGiftButtonPopupPanel : MonoBehaviour
{
Image icon_buff;
Transform root;
//TMP_Text text_info;
IDisposable disposable;
Item item;
private void Awake()
{
//text_info = transform.Find("root/bg/text_info").GetComponent<TMP_Text>();
icon_buff = transform.Find("icon_pig/root/icon_buff").GetComponent<Image>();
disposable = GContext.OnEvent<GetGiftBtnPosEvent>().Subscribe(GetBuffPosEvent);
int activateItemId = GContext.container.Resolve<FishingEventData>().curActivateItemId;
item = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(activateItemId);
if (item != null)
{
//text_info.text = LocalizationMgr.GetText(item.Name_l10n_key);
string icon = item.Icon;
if (item.SubType == 21)
{
BargainPackData barginPackData = GContext.container.Resolve<BargainPackData>();
if (barginPackData.IsWithinEventTime)
{
icon = barginPackData.ActiveItemImg;
}
}
else if (item.SubType == 22)
{
PiggyBankPackData piggyBankPackData = GContext.container.Resolve<PiggyBankPackData>();
if (piggyBankPackData.IsWithinEventTime)
{
icon = piggyBankPackData.ActiveItemImg;
}
}
root = transform.Find(icon);
if (root != null)
{
root.gameObject.SetActive(true);
icon_buff = root.Find("root/icon_buff").GetComponent<Image>();
}
//GContext.container.Resolve<IUIService>().SetImageSprite(icon_buff, icon);
}
}
void GetBuffPosEvent(GetGiftBtnPosEvent getBuffPosEvent)
{
icon_buff.transform.DOMove(getBuffPosEvent.Pos, 0.66f);
icon_buff.rectTransform.DOSizeDelta(new Vector2(getBuffPosEvent.width, getBuffPosEvent.width), 0.66f);
}
private void Start()
{
Close();
}
async void Close()
{
await Awaiters.Seconds(2.7f);
UIManager.Instance.DestroyUI(UITypes.HomeGiftButtonPopupPanel);
if (item != null)
{
if (item.SubType == 21)
{
await UIManager.Instance.ShowUI(UITypes.GiftBargainPopupPanel);
}
else if (item.SubType == 22)
{
await UIManager.Instance.ShowUI(UITypes.GiftPiggyBankPopupPanel);
}
}
}
private void OnDisable()
{
disposable?.Dispose();
disposable = null;
}
}

View File

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

View File

@@ -0,0 +1,377 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 触发礼包
/// </summary>
public class HomeLeftPanel : MonoBehaviour
{
Button but_shop;
Button btn_gift1;//新手礼包2
Image image_gift1;
TMP_Text text_time1;
Button btn_gift3;//转盘礼包
TMP_Text text_time3;
Button btn_gift4;//
TMP_Text text_time4;
Button btn_gift5;//地图礼包
TMP_Text text_time5;
Button btn_gift6;//新手礼包1 第一次体力不足
TMP_Text text_time6;
Button btn_gift8;//体力不足礼包4
TMP_Text text_time8;
Button btn_gift2;//礼包链
Image image_gift2;
Button btn_debug;
public HomePanel homePanel;
TMP_Text text_chainGiftPack;
Timer chainGiftPackTimer;
int triggerPackListCount1 = -1;//新手礼包2
int triggerPackListCount6 = -1;//新手礼包1 第一次体力不足
int triggerPackListCount8 = -1;//体力不足礼包
int triggerPackListCount51 = -1;//转盘礼包
int triggerPackListCount52 = -1;//
int triggerPackListCount53 = -1;//地图礼包
int gift1ID;
int gift6ID;
int gift8ID;
int gift51ID;
int gift52ID;
int gift53ID;
public List<TriggerPackBuyData> triggerPackList1;
public List<TriggerPackBuyData> triggerPackList6;
public List<TriggerPackBuyData> triggerPackList8;
public List<TriggerPackBuyData> triggerPackList51;
public List<TriggerPackBuyData> triggerPackList52;
public List<TriggerPackBuyData> triggerPackList53;
protected CompositeDisposable disposables = new CompositeDisposable();
IDisposable disRequestSvrTime;
TriggerPackData triggerPackData;
private void Awake()
{
but_shop = transform.Find("btn_shop").GetComponent<Button>();
btn_gift1 = transform.Find("btn_gift1").GetComponent<Button>();
image_gift1 = transform.Find("btn_gift1/icon").GetComponent<Image>();
btn_gift2 = transform.Find("btn_gift2").GetComponent<Button>();
image_gift2 = transform.Find("btn_gift2/icon").GetComponent<Image>();
btn_gift3 = transform.Find("btn_gift3").GetComponent<Button>();
btn_gift4 = transform.Find("btn_gift4").GetComponent<Button>();
btn_gift5 = transform.Find("btn_gift5").GetComponent<Button>();
btn_gift6 = transform.Find("btn_gift6").GetComponent<Button>();
btn_gift8 = transform.Find("btn_gift8").GetComponent<Button>();
text_chainGiftPack = transform.Find("btn_gift2/text_time").GetComponent<TMP_Text>();
text_time1 = transform.Find("btn_gift1/text_time").GetComponent<TMP_Text>();
text_time3 = transform.Find("btn_gift3/text_time").GetComponent<TMP_Text>();
text_time4 = transform.Find("btn_gift4/text_time").GetComponent<TMP_Text>();
text_time5 = transform.Find("btn_gift5/text_time").GetComponent<TMP_Text>();
text_time6 = transform.Find("btn_gift6/text_time").GetComponent<TMP_Text>();
text_time8 = transform.Find("btn_gift8/text_time").GetComponent<TMP_Text>();
btn_debug = transform.Find("btn_debug").GetComponent<Button>();
}
private void Start()
{
GContext.OnEvent<TriggerPackEvent>().Subscribe(TriggerPackEvent).AddTo(disposables);
btn_debug.onClick.AddListener(() => homePanel.OnPushPanelOrScene(UITypes.DeBugPanel));
but_shop.onClick.AddListener(() =>
{
homePanel.OnPushPanelOrScene(UITypes.FishingShopPanel);
});
btn_gift2.onClick.AddListener(() =>
{
ShowGiftUI(btn_gift2, UITypes.GiftChainCommon_SubmarinePanel);
});
btn_gift1.onClick.AddListener(() =>
{
ShowGiftUI(btn_gift1, UITypes.CommerceNoviceGiftPopupPanel);
});
//转盘券
btn_gift3.onClick.AddListener(() =>
{
ShowGiftUI(btn_gift3, UITypes.GiftPopupPanel_3);
});
btn_gift4.onClick.AddListener(() =>
{
ShowGiftUI(btn_gift4, UITypes.GiftPopupPanel_4);
});
//钓鱼券
btn_gift5.onClick.AddListener(() =>
{
ShowGiftUI(btn_gift5, UITypes.MapPackPanel);
});
//破冰
btn_gift6.onClick.AddListener(() =>
{
ShowGiftUI(btn_gift6, UITypes.GiftPopupPanel_6);
});
//体力不足
//btn_gift8.onClick.AddListener(() =>
//{
// ShowGiftUI(btn_gift8, UITypes.GiftPopupPanel_8);
//});
//开始计时
SetTriggerPackTimer();
GContext.container.Resolve<PlayerData>().RecoveryEnergy();
}
async void ShowGiftUI(Button btn, UIType GiftPopupPanel)
{
// 退出自动钓鱼
//homePanel.ExitAutoFishing();
btn.enabled = false;
await UIManager.Instance.ShowUILoad(GiftPopupPanel);
btn.enabled = true;
}
void SystemSwitch()
{
triggerPackData = GContext.container.Resolve<TriggerPackData>();
gift1ID = 0;
triggerPackList1 = triggerPackData.GetTriggerPackList(2);
triggerPackListCount1 = triggerPackList1.Count;
if (triggerPackListCount1 > 0)
{
triggerPackList1.Sort((a, b) => a.time.CompareTo(b.time));
TriggerPackBuyData _noticeGift = triggerPackList1[0];
gift1ID = _noticeGift.ID;
}
btn_gift1.gameObject.SetActive(triggerPackListCount1 > 0);
gift6ID = 0;
triggerPackList6 = triggerPackData.GetTriggerPackList(1);
triggerPackListCount6 = triggerPackList6.Count;
if (triggerPackListCount6 > 0)
{
triggerPackList6.Sort((a, b) => a.time.CompareTo(b.time));
gift6ID = triggerPackList6[0].ID;
}
btn_gift6.gameObject.SetActive(triggerPackListCount6 > 0);
gift8ID = 0;
triggerPackList8 = triggerPackData.GetTriggerPackList(4);
triggerPackListCount8 = triggerPackList8.Count;
if (triggerPackListCount8 > 0)
{
triggerPackList8.Sort((a, b) => a.time.CompareTo(b.time));
gift8ID = triggerPackList8[0].ID;
}
btn_gift8.gameObject.SetActive(false);// triggerPackListCount8 > 0);
gift51ID = 0;
triggerPackList51 = triggerPackData.GetTriggerPackList(51);
triggerPackListCount51 = triggerPackList51.Count;
if (triggerPackListCount51 > 0)
{
triggerPackList51.Sort((a, b) => a.time.CompareTo(b.time));
gift51ID = triggerPackList51[0].ID;
}
btn_gift3.gameObject.SetActive(triggerPackListCount51 > 0);
gift52ID = 0;
triggerPackList52 = triggerPackData.GetTriggerPackList(52);
triggerPackListCount52 = triggerPackList52.Count;
if (triggerPackListCount52 > 0)
{
triggerPackList52.Sort((a, b) => a.time.CompareTo(b.time));
gift52ID = triggerPackList52[0].ID;
}
btn_gift4.gameObject.SetActive(triggerPackListCount52 > 0);
gift53ID = 0;
triggerPackList53 = triggerPackData.GetTriggerPackList(53);
triggerPackListCount53 = triggerPackList53.Count;
if (triggerPackListCount53 > 0)
{
triggerPackList53.Sort((a, b) => a.time.CompareTo(b.time));
gift53ID = triggerPackList53[0].ID;
}
btn_gift5.gameObject.SetActive(triggerPackListCount53 > 0);
but_shop.gameObject.SetActive(GContext.container.Resolve<PlayerShopData>().IsShopOpen);
btn_gift2.gameObject.SetActive(GContext.container.Resolve<PlayerShopData>().IsOpenChainGiftPack());
SetChainGiftPackTimer();
}
void TriggerPackEvent(TriggerPackEvent triggerPackEvent)
{
SystemSwitch();
PlayerFishData playerFishData = GContext.container.Resolve<PlayerFishData>();
CurRewardQCount curRewardQCount = new CurRewardQCount();
GContext.Publish(curRewardQCount);
if (curRewardQCount.count <= 0)
{
int faceCount = GContext.container.Resolve<IFaceUIService>().GetFaceUICount();
if (faceCount == 0)
{
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("HomePanel");
}
else
{
GContext.container.Resolve<IFaceUIService>().ShowFaceUI();
}
}
}
public void SetChainGiftPackTimer()
{
if (GContext.container.Resolve<PlayerShopData>().IsOpenChainGiftPack())
{
if (chainGiftPackTimer == null)
{
DateTime endTime = GContext.container.Resolve<PlayerShopData>().GetChainEndTime();
TimeSpan now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
double seconds = now.TotalSeconds;
chainGiftPackTimer = this.AttachTimer((float)seconds, InitChainGiftPack,
(elapsed) =>
{
now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
text_chainGiftPack.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
}, useRealTime: true);
btn_gift2.gameObject.SetActive(true);
GContext.container.Resolve<IUIService>().SetImageSprite(image_gift2, GContext.container.Resolve<PlayerShopData>().chainPackM.Icon);
}
}
else
{
btn_gift2.gameObject.SetActive(false);
chainGiftPackTimer?.Cancel();
chainGiftPackTimer = null;
}
}
void InitChainGiftPack()
{
chainGiftPackTimer?.Cancel();
chainGiftPackTimer = null;
btn_gift2.gameObject.SetActive(false);
GContext.container.Resolve<FishingEventData>().GetEventAndInit(3, 10);
}
private System.Threading.CancellationTokenSource tokenSource;
void OnApplicationPause(bool is_pause)
{
if (is_pause)
{
tokenSource?.Cancel();
tokenSource = null;
GContext.container.Resolve<PlayerData>().StopRecoveryEnergy();
disRequestSvrTime?.Dispose();
disRequestSvrTime = GContext.OnEvent<RequestSvrTimeEvent>().Subscribe(RequestSvrTimeEvent);
}
}
void RequestSvrTimeEvent(RequestSvrTimeEvent e)
{
if (e.Status)
{
disRequestSvrTime?.Dispose();
disRequestSvrTime = null;
Debug.Log("RequestSvrTimeEvent AllRefresh");
GContext.container.Resolve<PlayerShopData>().InitShopPackData();
GContext.container.Resolve<PlayerData>().RecoveryEnergy();
SetTriggerPackTimer();
}
}
public async void SetTriggerPackTimer()
{
tokenSource = new System.Threading.CancellationTokenSource();
SystemSwitch();
DateTime dateTime = ZZTimeHelper.UtcNow().UtcNowOffset();
DateTime dateTime1 = dateTime.AddDays(1).Date;
try
{
var token = tokenSource.Token;
while (!token.IsCancellationRequested && dateTime.Ticks < dateTime1.Ticks)
{
UpdateTriggerTimer();
await System.Threading.Tasks.Task.Delay(1000);
dateTime = dateTime.AddSeconds(1);
}
if (!token.IsCancellationRequested)
{
Refresh();
SetTriggerPackTimer();
}
}
catch (Exception e)
{
Debug.LogError(e);
}
}
void Refresh()
{
GContext.container.Resolve<PlayerShopData>().InitShopPackData();
GContext.container.Resolve<TriggerPackData>().InitPackData();
}
public void UpdateTriggerTimer()
{
var list = GContext.container.Resolve<TriggerPackData>().triggerPackList;
int count = list.Count;
if (count > 0)
{
TriggerPackBuyData stateEvent;
for (int i = count - 1; i >= 0; i--)
{
stateEvent = list[i];
TimeSpan timeSpan = GContext.container.Resolve<TriggerPackData>().GetCurTriggerPackEndTime(stateEvent);
if (timeSpan.TotalSeconds <= 0)
{
continue;
}
if (stateEvent.ID == gift1ID)
{
text_time1.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
}
else if (stateEvent.ID == gift51ID)
{
text_time3.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
}
else if (stateEvent.ID == gift52ID)
{
text_time4.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
}
else if (stateEvent.ID == gift53ID)
{
text_time5.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
}
else if (stateEvent.ID == gift6ID)
{
text_time6.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
}
else if (stateEvent.ID == gift8ID)
{
text_time8.text = ConvertTools.ConvertTime2(timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
}
}
}
}
private void OnDestroy()
{
disposables?.Dispose();
disposables = null;
tokenSource?.Cancel();
tokenSource = null;
GContext.container?.Resolve<PlayerData>()?.StopRecoveryEnergy();
}
}

View File

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

View File

@@ -0,0 +1,89 @@
using asap.core;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class HomeMapBtn : MonoBehaviour, IUIRedPoint
{
string key = "Home.Map";
public GameObject redPoint;
public GameObject redpoint_big;
public TMP_Text text_redpoint_big;
Button _btn;
void Awake()
{
_btn = GetComponent<Button>();
RedPointManager.Instance.AddRedPoint(key, this);
}
void Start()
{
_btn.onClick.AddListener(OnClick);
}
async void OnClick()
{
var _playerFishData = GContext.container.Resolve<PlayerFishData>();
if (_playerFishData.IsOpenMap)
{
GameObject go = await UIManager.Instance.ShowUI(UITypes.FishingMapPanel);
if (go != null)
{
GContext.Publish(new HideHomePanelEvent());
}
}
else
{
var _fishingEventData = GContext.container.Resolve<FishingEventData>();
ToastPanel.Show(_fishingEventData.GetTipforUnlocked(_playerFishData.MapTipforUnlocked));
}
}
private void OnEnable()
{
SetRedPointState(RedPointManager.Instance.GetRedPointState(key));
}
public void SetRedPointState(bool state)
{
string subKey = HomeBtnMiniBP.redKey + MiniBattlePassType.Fishcard;
state |= RedPointManager.Instance.GetRedPointState(subKey);
if (redpoint_big != null && text_redpoint_big != null)
{
if (!state)
{
redpoint_big.SetActive(false);
}
else
{
int count = RedPointManager.Instance.GetRedPointCount(key);
count += RedPointManager.Instance.GetRedPointCount(subKey);
if (count > 1)
{
redpoint_big.SetActive(true);
if (count > 99)
{
text_redpoint_big.text = "99+";
}
else
{
text_redpoint_big.text = count.ToString();
}
state = false;
}
else
{
redpoint_big.SetActive(false);
}
}
}
if (redPoint != null)
{
redPoint.SetActive(state);
}
}
private void OnDestroy()
{
RedPointManager.Instance.RemoveRedPoint(key);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1e92c76970c29c94589167130b66dfc0
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: 74eb141da35cccf4da33a318f489e039
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System.Collections.Generic;
public partial class HomePanel
{
bool AquariumUpdate()
{
var _dataProvider = GContext.container.Resolve<FishingBoxDataProvier>();
Dictionary<int, int> FishingBoxs = _dataProvider.Data.FishingBoxs;
foreach (var item in FishingBoxs)
{
if (item.Value > 0)
{
UIManager.Instance.ShowUI(UITypes.AquariumUpdatePopupPanel);
return true;
}
}
return false;
}
}

View File

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

View File

@@ -0,0 +1,45 @@
using asap.core;
using System;
using UnityEngine;
using UniRx;
public class HomeRightPanel : MonoBehaviour
{
protected CompositeDisposable disposables = new CompositeDisposable();
private void Awake()
{
GContext.OnEvent<TargetEvent>()
.Where(_ => (_.type == 8 && _.subType > 3)
|| (_.type == 10 && _.subType == 1)
|| (_.type == 4 && _.subType == 1)
)
.Subscribe(FishingEvent).AddTo(disposables);
GContext.OnEvent<HideHomePanelEvent>().Subscribe(OnHideHomePanelEvent).AddTo(disposables);
}
private void OnHideHomePanelEvent(HideHomePanelEvent e)
{
Destroy(this);
}
void FishingEvent(TargetEvent targetEvent)
{
if (targetEvent.type == 8)
{
transform.Find("btn_luckycards").gameObject.SetActive(true);
}
else if (targetEvent.type == 10 && targetEvent.subType == 1)
{
transform.Find("btn_challenge").gameObject.SetActive(true);
}
else if (targetEvent.type == 4 && targetEvent.subType == 1)
{
transform.Find("btn_sanddig").gameObject.SetActive(true);
}
}
void OnDestroy()
{
disposables?.Dispose();
disposables = null;
}
}

View File

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

View File

@@ -0,0 +1,58 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections;
using UnityEngine;
public class HomeSupplyDropPanel : MonoBehaviour
{
PlayerData playerData;
Tables _tables;
SupplyDropPopupPanel supplyDropPanel;
int ShowSupplyDropIndex = -1;
int allCount = 0;
public void Init()
{
_tables = GContext.container.Resolve<Tables>();
playerData = GContext.container.Resolve<PlayerData>();
supplyDropPanel = transform.Find("SupplyDropPopupPanel/root").GetComponent<SupplyDropPopupPanel>();
supplyDropPanel.Init();
allCount = supplyDropPanel.detailsItems.Count;
var DataList = _tables.TbEnergyDef.DataList;
for (int i = 0; i < DataList.Count; i++)
{
if (DataList[i].SupplyDrop > 0)
{
ShowSupplyDropIndex = i;
break;
}
}
}
public bool Show()
{
if (ShowSupplyDropIndex == -1)
{
return false;
}
StopCoroutine("Hide");
if (playerData.magnification >= ShowSupplyDropIndex && playerData.magnification < ShowSupplyDropIndex + allCount)
{
gameObject.SetActive(true);
supplyDropPanel.Show(playerData.magnification - ShowSupplyDropIndex);
StartCoroutine("Hide");
return true;
}
else
{
gameObject.SetActive(false);
return false;
}
}
IEnumerator Hide()
{
yield return new WaitForSeconds(2f);
gameObject.SetActive(false);
}
}

View File

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

View File

@@ -0,0 +1,52 @@
using asap.core;
using UnityEngine;
using UniRx;
using System;
using GameCore;
using UnityEngine.UI;
using cfg;
using Game;
public class HomeTargetBuffPopupPanel : MonoBehaviour
{
Image icon_buff;
IDisposable disposable;
private void Awake()
{
icon_buff = transform.Find("root/icon_buff").GetComponent<Image>();
disposable = GContext.OnEvent<GetBuffPosEvent>().Subscribe(GetBuffPosEvent);
}
void GetBuffPosEvent(GetBuffPosEvent getBuffPosEvent)
{
getBuffPosEvent.Pos = icon_buff.transform.position;
}
private void Start()
{
var targetWeightInit = GContext.container.Resolve<FishingEventData>().collectingTargetInit;
if (targetWeightInit != null)
{
GContext.container.Resolve<IUIService>().SetImageSprite(icon_buff, targetWeightInit.BuffIcon);
}
FishBuffTimeData buffData = GContext.container.Resolve<BuffDataCenter>().GetBuffData<CollectionTargetWeight>();
if (buffData != null)
{
FishBuff fishBuff = GContext.container.Resolve<Tables>().TbFishBuff.GetOrDefault(buffData.buffID);
if (fishBuff != null)
{
GContext.Publish(new EventUISound(fishBuff.Audio));
}
}
Close();
}
async void Close()
{
await Awaiters.Seconds(2.5f);
await Awaiters.NextFrame;
UIManager.Instance.DestroyUI(UITypes.HomeTargetBuffPopupPanel);
}
private void OnDisable()
{
disposable?.Dispose();
disposable = null;
}
}

View File

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

View File

@@ -0,0 +1,203 @@
using GameCore;
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class NoticeConfirmPopupPanel : MonoBehaviour
{
TMP_Text text_info;
TMP_Text text_title;
GameObject btn_1;
Button btn_confirm;
GameObject btn_2;
Button btn_click1;
TMP_Text btn_clickleft_text;
Button btn_click2;
TMP_Text btn_clickright_text;
Button btn_close;
Action onConfirm;
Action onClickLeft;
Action onClickRight;
Action onClose;
Animator animator;
class NoticeInfo
{
public int type;
public string title;
public string info;
public Action onClickLeft = null;
public Action onClickRight = null;
public Action onClose = null;
public string btn_left_text = "";
public string btn_right_text = "";
}
private static Queue<NoticeInfo> noticeQuene = new Queue<NoticeInfo>();
private static NoticeInfo currentNotice = null;
//private string defaultLBtnText;
//private string defaultRBtnText;
private void Awake()
{
animator = GetComponent<Animator>();
text_info = transform.Find("root/text_info").GetComponent<TMP_Text>();
text_title = transform.Find("root/text_title").GetComponent<TMP_Text>();
btn_1 = transform.Find("root/btn_1").gameObject;
btn_confirm = transform.Find("root/btn_1/btn_confrim/btn_green").GetComponent<Button>();
btn_2 = transform.Find("root/btn_2").gameObject;
btn_click1 = transform.Find("root/btn_2/btn_back/btn_green").GetComponent<Button>();
btn_clickleft_text = transform.Find("root/btn_2/btn_back/btn_green/Ani_Container/p_text").GetComponent<TMP_Text>();
btn_click2 = transform.Find("root/btn_2/btn_confrim/btn_green").GetComponent<Button>();
btn_clickright_text = transform.Find("root/btn_2/btn_confrim/btn_green/Ani_Container/p_text").GetComponent<TMP_Text>();
btn_close = transform.Find("btn_close").GetComponent<Button>();
//defaultLBtnText = btn_clickleft_text.text;
//defaultRBtnText = LocalizationMgr.GetText("UI_COMMON_cancel");// btn_clickright_text.text;
}
private void Start()
{
btn_confirm.onClick.AddListener(OnClickConfirm);
btn_click1.onClick.AddListener(OnClick1);
btn_click2.onClick.AddListener(OnClick2);
btn_close.onClick.AddListener(OnClickClose);
}
private void OnEnable()
{
UIManager.UnblockInput();
}
private void OnDisable()
{
UIManager.RestoreInputBlock();
}
private void Update()
{
if(UIManager.isInputBlocked())
{
UIManager.UnblockInput();
}
}
private void OnDestroy()
{
currentNotice = null;
}
void OnClickConfirm()
{
onConfirm?.Invoke();
OnClose();
}
void OnClick2()
{
onClickRight?.Invoke();
OnClose();
}
void OnClick1()
{
onClickLeft?.Invoke();
OnClose();
}
void OnClickClose()
{
onClose?.Invoke();
OnClose();
}
void ClearAction()
{
onConfirm = null;
onClickRight = null;
onClickLeft = null;
onClose = null;
}
void OnClose()
{
lock (noticeQuene)
{
ClearAction();
if (noticeQuene.TryDequeue(out currentNotice))
{
animator.Play("popup_common_show", 0, 0);
ShowCurrentNotice();
}
else
{
UIManager.Instance.HideUI(UITypes.NoticeConfirmPopupPanel);
}
}
}
///
/// </summary>
/// <param name="type">显示几个按钮</param>
/// <param name="info"></param>
/// <param name="onClickLeft">左边点击</param>
/// <param name="onClickRight">右边点击</param>
public void Init(int type, string title, string info, Action onClickLeft = null, Action onClickRight = null, Action onClose = null, string btn_left_text = "", string btn_right_text = "")
{
var notice = new NoticeInfo()
{
type = type,
title = title,
info = info,
onClickLeft = onClickLeft,
onClickRight = onClickRight,
onClose = onClose,
btn_left_text = btn_left_text,
btn_right_text = btn_right_text
};
lock (noticeQuene)
{
if (currentNotice == null)
{
currentNotice = notice;
ShowCurrentNotice();
}
else
{
noticeQuene.Enqueue(notice);
}
}
}
private void ShowCurrentNotice()
{
gameObject.SetActive(true);
text_title.text = currentNotice.title;
if (currentNotice.btn_left_text != "")
{
btn_clickleft_text.text = currentNotice.btn_left_text;
}
else
{
btn_clickleft_text.text = LocalizationMgr.GetText("UI_COMMON_confirm");
}
if (currentNotice.btn_right_text != "")
{
btn_clickright_text.text = currentNotice.btn_right_text;
}
else
{
btn_clickright_text.text = LocalizationMgr.GetText("UI_COMMON_cancel");
}
btn_1.SetActive(currentNotice.type == 1);
btn_2.SetActive(currentNotice.type == 2);
text_info.text = currentNotice.info;
onConfirm = currentNotice.onClickLeft;
onClickLeft = currentNotice.onClickLeft;
onClickRight = currentNotice.onClickRight;
onClose = currentNotice.onClose;
transform.SetAsLastSibling();
}
}

View File

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

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SupplyDropDetailsItem : MonoBehaviour
{
public Image icon;
public TMP_Text text_title;
public List<RewardItemNew> rewardItems;
public List<GameObject> lines;
private void Reset()
{
icon = transform.Find("icon").GetComponent<Image>();
text_title = transform.Find("bg_bet/text_title").GetComponent<TMP_Text>();
rewardItems = new List<RewardItemNew>()
{
transform.Find("reward/reward1").GetComponent<RewardItemNew>(),
transform.Find("reward/reward2").GetComponent<RewardItemNew>(),
transform.Find("reward/reward3").GetComponent<RewardItemNew>(),
transform.Find("reward/reward4").GetComponent<RewardItemNew>() };
lines = new List<GameObject>()
{
transform.Find("reward/line1").gameObject,
transform.Find("reward/line2").gameObject,
transform.Find("reward/line3").gameObject
};
}
}

View File

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

View File

@@ -0,0 +1,94 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SupplyDropInfoPopupPanel : MonoBehaviour
{
Button _btnClose;
Button btnMask;
SupplyDropPopupPanel supplyDropPanel;
List<GameObject> selects;
int indexCurrent = 0;
int ShowSupplyDropIndex = 6;
int allCount = 0;
Button btn_right;
Button btn_left;
private void Awake()
{
_btnClose = transform.Find("btn_close").GetComponent<Button>();
btnMask = transform.Find("mask").GetComponent<Button>();
supplyDropPanel = transform.Find("root").GetComponent<SupplyDropPopupPanel>();
supplyDropPanel.Init();
selects = new List<GameObject>();
btn_right = transform.Find("root/btn_right").GetComponent<Button>();
btn_left = transform.Find("root/btn_left").GetComponent<Button>();
allCount = supplyDropPanel.detailsItems.Count;
Transform sliding = transform.Find("root/Sliding");
int count = sliding.childCount;
for (int i = 0; i < count; i++)
{
GameObject obj = sliding.GetChild(i).Find("Select").gameObject;
selects.Add(obj);
obj.SetActive(false);
}
var _tables = GContext.container.Resolve<Tables>();
var playerData = GContext.container.Resolve<PlayerData>();
var DataList = _tables.TbEnergyDef.DataList;
for (int i = 0; i < DataList.Count; i++)
{
if (DataList[i].SupplyDrop > 0)
{
ShowSupplyDropIndex = i;
break;
}
}
if (playerData.magnification >= ShowSupplyDropIndex && playerData.magnification < ShowSupplyDropIndex + allCount)
{
indexCurrent = playerData.magnification - ShowSupplyDropIndex;
}
Show();
}
private void Start()
{
_btnClose.onClick.AddListener(OnClickClose);
btnMask.onClick.AddListener(OnClickClose);
btn_right.onClick.AddListener(OnClickRight);
btn_left.onClick.AddListener(OnClickLeft);
}
void OnClickRight()
{
indexCurrent++;
if (indexCurrent >= allCount)
{
indexCurrent = 0;
}
Show();
}
void OnClickLeft()
{
indexCurrent--;
if (indexCurrent < 0)
{
indexCurrent = allCount - 1;
}
Show();
}
void Show()
{
supplyDropPanel.Show(indexCurrent);
for (int i = 0; i < selects.Count; i++)
{
selects[i].SetActive(i == indexCurrent);
}
}
void OnClickClose()
{
UIManager.Instance.DestroyUI(UITypes.SupplyDropInfoPopupPanel);
}
}

View File

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

View File

@@ -0,0 +1,13 @@
using TMPro;
using UnityEngine;
public class SupplyDropIntroItem : MonoBehaviour
{
public TMP_Text text_title;
public TMP_Text text_num;
private void Reset()
{
text_title = transform.Find("text_title").GetComponent<TMP_Text>();
text_num = transform.Find("text_num").GetComponent<TMP_Text>();
}
}

View File

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

View File

@@ -0,0 +1,103 @@
using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using UnityEngine;
public class SupplyDropPopupPanel : MonoBehaviour
{
//[NonSerialized]
public List<SupplyDropIntroItem> introItem;
//[NonSerialized]
public List<SupplyDropDetailsItem> detailsItems;
PlayerItemData playerItemData;
Tables _tables;
public void Init()
{
playerItemData = GContext.container.Resolve<PlayerItemData>();
Transform content = transform.Find("content");
Transform supplyDrop = transform.Find("supplydrop");
int count = content.childCount;
introItem = new List<SupplyDropIntroItem>(count);
detailsItems = new List<SupplyDropDetailsItem>(count);
for (int i = 1; i <= count; i++)
{
introItem.Add(content.Find($"content{i}").GetComponent<SupplyDropIntroItem>());
detailsItems.Add(supplyDrop.Find($"supplydrop{i}").GetComponent<SupplyDropDetailsItem>());
}
_tables = GContext.container.Resolve<Tables>();
var DataList = _tables.TbSupplyDrop.DataList;
IUIService uIService = GContext.container.Resolve<IUIService>();
SupplyDropDetailsItem detailsItem;
for (int i = 0; i < DataList.Count; i++)
{
var item = DataList[i];
introItem[i].text_num.text = $"x{item.ID}";
introItem[i].text_title.text = LocalizationMgr.GetText(item.Name_l10n_key);
detailsItem = detailsItems[i];
detailsItem.text_title.text = $"x{item.ID}";
//uIService.SetImageSprite(detailsItem[i].icon, item.Icon);
ShowRewardItems(detailsItem, item.DropID, item.ID);
}
}
void ShowRewardItems(SupplyDropDetailsItem detailsItem, List<int> dropId, int id)
{
List<RewardItemNew> rewardItems = detailsItem.rewardItems;
List<GameObject> lines = detailsItem.lines;
for (int j = 0; j < rewardItems.Count; j++)
{
var rewardItem = rewardItems[j];
if (dropId.Count > j)
{
rewardItem.gameObject.SetActive(true);
if (j == 0)
{
SupplyDropGameplayCash supplyDropGameplayCash = _tables.TbSupplyDropGameplayCash.DataMap[id];
int max = playerItemData.GetExtraCoinMag(supplyDropGameplayCash.MaxRewardDisplay);
rewardItem.text_num.text =LocalizationMgr.GetFormatTextValue("UI_SupplydropPopupPanel_3",ConvertTools.GetNumberString(max));
}
else if (j == 1)
{
SupplyDropGameplayLure supplyDropGameplayLure = _tables.TbSupplyDropGameplayLure.DataMap[id];
int max = supplyDropGameplayLure.MaxRewardDisplay;
rewardItem.text_num.text = LocalizationMgr.GetFormatTextValue("UI_SupplydropPopupPanel_3", ConvertTools.GetNumberString(max));
}
else
{
List<ItemData> itemData = playerItemData.GetItemDataByDropId(dropId[j]);
rewardItem.SetData(itemData[0]);
if (itemData.Count > 1)
{
float min = itemData[0].count;
float max = itemData[^1].count;
for (int i = 1; i < itemData.Count; i++)
{
if (itemData[i].count < min)
{
min = itemData[i].count;
}
max += itemData[i].count;
}
rewardItem.text_num.text = $"{ConvertTools.GetNumberString((int)min)}-{ConvertTools.GetNumberString((int)max)}";
}
}
}
else
{
rewardItem.gameObject.SetActive(false);
lines[j - 1].SetActive(false);
}
}
}
public void Show(int index)
{
for (int i = 0; i < detailsItems.Count; i++)
{
detailsItems[i].gameObject.SetActive(i == index);
}
}
}

View File

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