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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,381 @@
using asap.core;
using DG.Tweening;
using game;
using GameCore;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UniRx;
// 继续
public class FishingChallengeContinueEvent
{
}
// 结算界面
// 显示前往钓鱼按钮的UI
public class EventChallengePanel : MonoBehaviour
{
//
private Button btn_questionmark;
private TMP_Text text_title;
private CanvasGroup canvasGroup;
private TMP_Text text_people;
private TMP_Text text_time;
private Button btn_enter;
private Button btn_close;
// private RewardItemNew reward;
// 数据
private Timer timer;
private int curNum;
private int _challengeState;
private int oldStep;
private int newStep;
private List<ItemData> itemDataList;
private List<EventChallengeHead> success_head_list = new();
// private IDisposable _disposable;
private CompositeDisposable _disposable = new();
private FishingChallengeManager _fishingChallengeManager;
// 处理单元奖励中
private bool _isStageRewardLogic = false;
private void Awake()
{
_fishingChallengeManager = GContext.container.Resolve<FishingChallengeManager>();
// 先全部屏蔽按钮
canvasGroup = transform.Find("root").GetComponent<CanvasGroup>();
canvasGroup.blocksRaycasts = false;
//
btn_questionmark = transform.Find("root/title/btn_questionmark").GetComponent<Button>();
text_title = transform.Find("root/title/text_title").GetComponent<TMP_Text>();
text_people = transform.Find("root/title/info/people/text_people").GetComponent<TMP_Text>();
text_time = transform.Find("root/title/info/time/text_time").GetComponent<TMP_Text>();
btn_enter = transform.Find("root/btn_enter/btn_green").GetComponent<Button>();
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
// reward = transform.Find("root/reward").GetComponent<RewardItemNew>();
_disposable = new CompositeDisposable();
GContext.OnEvent<ShowResidueNumEvent>().Subscribe(ShowResidueNumEvent).AddTo(_disposable);
GContext.OnEvent<FishingChallengeContinueEvent>().Subscribe(OnStageLogicContinue).AddTo(_disposable);
GContext.OnEvent<ChallengeLevelTipsEvent>().Subscribe(OnShowLevelTips).AddTo(_disposable);
_challengeState = _fishingChallengeManager.ChallengeState();
}
private void Start()
{
_fishingChallengeManager.IsFirstOpen = false;
OnAddEvents();
SetTitle();
SetEliminateNumber();
GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("EventChallengePanel");
_ = ShowNewGuide(0.5f);
}
public async Task ShowNewGuide(float delaySeconds)
{
await Awaiters.Seconds(delaySeconds);
var openKey = _fishingChallengeManager.GetOpenEventKey();
if (!string.IsNullOrEmpty(openKey))
{
var isOpen = PlayerPrefs.GetInt(openKey,0);
if (isOpen == 0)
{
isOpen = 1;
PlayerPrefs.SetInt(_fishingChallengeManager.GetOpenEventKey(), isOpen);
var uiName = _fishingChallengeManager.eventChallengeConfig.InfoPanel;
var uiType = new UIType(uiName,5);
_ = UIManager.Instance.ShowUI(uiType);
}
}
}
private void OnAddEvents()
{
btn_enter.onClick.AddListener(Enter);
btn_close.onClick.AddListener(OnClose);
btn_questionmark.onClick.AddListener(() =>
{
var uiName = _fishingChallengeManager.eventChallengeConfig.InfoPanel;
var uiType = new UIType(uiName);
_ = UIManager.Instance.ShowUI(uiType);
});
}
private void SetTitle()
{
if (_challengeState != 2)
{
var timeSpan = _fishingChallengeManager.GetTimeSpan();
var seconds = timeSpan.TotalSeconds;
timer = this.AttachTimer((float)seconds, null,
async (elapsed) =>
{
// var now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
var now = _fishingChallengeManager.GetTimeSpan();
text_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
if (now.TotalMilliseconds < 0)
{
if (canvasGroup.blocksRaycasts)
{
canvasGroup.blocksRaycasts = false;
Settle(); // 活动结束了
// await OnFail();
// await OnSettleFinished(false);
canvasGroup.blocksRaycasts = true;
}
}
}, useRealTime: true);
}
}
private void SetEliminateNumber()
{
// 进入当前界面的时候更新UI
oldStep = _fishingChallengeManager.fishingChallengeData.step;
newStep = _fishingChallengeManager.GetNewStep();
Log($"SetEliminateNumber {oldStep},{newStep}");
var isSuccess = _fishingChallengeManager.IsStepFinished(newStep);
//显示关卡
SetEliminateNumber(isSuccess);
}
private void ShowResidueNumEvent(ShowResidueNumEvent showResidueNumEvent)
{
DOTween.To(() => curNum, x => curNum = x, showResidueNumEvent.num, 0.5f).OnUpdate(() =>
{
text_people.text = $"{curNum}/{_fishingChallengeManager.PlayerFullNumber}";
});
}
private async Task OnFail()
{
// //失败自己跳水动画
var challengeFailEvent = new ChallengeFailEvent() { oldStep = oldStep };
GContext.Publish(challengeFailEvent);
await challengeFailEvent.tcs.Task;
var view = await UIManager.Instance.ShowUI(UITypes.EventChallengeRewardPopupPanel);
if (view)
{
view.GetComponent<EventChallengeRewardPopupPanel>().OnFailed();
}
}
private async Task OnSuccess()
{
Log("OnSuccess");
var view = await UIManager.Instance.ShowUI(UITypes.EventChallengeRewardPopupPanel);
view.GetComponent<EventChallengeRewardPopupPanel>().OnSuccess();
}
private async void SetEliminateNumber(bool isSuccess)
{
Log($"SetEliminateNumber => {isSuccess}");
//剩余人数
curNum = _fishingChallengeManager.GetCurResidualNumber();
text_people.text = $"{curNum}/{_fishingChallengeManager.PlayerFullNumber}";
//显示人物头像
var challengeShowPlayerEvent = new ChallengeShowPlayerEvent { oldStep = oldStep };
GContext.Publish(challengeShowPlayerEvent);
await Awaiters.Seconds(1.0f);
//TODO:LF 未结算,要一直往后走
// var maxScore = _fishingChallengeManager.GetMaxScoreByStep(oldStep);
var oldScore = _fishingChallengeManager.fishingChallengeData.ProcessedScore;
var newScore = _fishingChallengeManager.fishingChallengeData.Score;
// if (oldScore == newScore && newScore = )
// {
// Log("Score Not Change");
// return;
// }
_fishingChallengeManager.OnChallengeSceneEnter();
var levelTipsEvent = new ChallengeLevelTipsEvent
{
oldScore = oldScore,
newScore = newScore,
};
GContext.Publish(levelTipsEvent);
await levelTipsEvent.tcs.Task;
Log($"BeforeSetProcessedScore {oldStep} {newStep}");
//
_fishingChallengeManager.SetProcessedScore(newScore);
_fishingChallengeManager.SetStep(newStep);
if (oldStep != newStep)
{
_fishingChallengeManager.EventTracking();
}
_isStageRewardLogic = _fishingChallengeManager.PlayGetStageReward();
await CheckStageRewardFinished();
// 如果step 没变,不需要 走下面逻辑
// if (newStep == oldStep && newStep != _fishingChallengeManager.GetFullStep())
// {
// return;
// }
//不能点击
// 更新数据
await Awaiters.Seconds(0.5f);
Log($"_challengeState: {_challengeState} isSuccess: {isSuccess}");
//
// 如果需要结算
// 处理奖品逻辑
// 状态有变化了,
// if (_challengeState == 2 || isSuccess)
// {
// Settle();
// }
if (_fishingChallengeManager.IsSettleState())
{
Settle();
}
// 播放动画逻辑
// await OnProcessAni();
await OnSettleFinished(isSuccess);
canvasGroup.blocksRaycasts = true;
}
// 屏蔽按钮
// 递归的层数比较浅,注意深了可能会爆栈
private async void OnShowLevelTips(ChallengeLevelTipsEvent tipsEvent)
{
canvasGroup.blocksRaycasts = false;
await tipsEvent.tcs.Task;
canvasGroup.blocksRaycasts = true;
}
private void OnStageLogicContinue(FishingChallengeContinueEvent evt)
{
Log("OnStageLogicContinue-> ");
_isStageRewardLogic = false;
}
// private int _waitCounts = 5;
private async Task CheckStageRewardFinished()
{
if (!_isStageRewardLogic) return;
while (true) // while true 很恐怖,看看延时几秒关掉可不可以呢
{
if (!_isStageRewardLogic)
return;
await Awaiters.Seconds(1f);
// _waitCounts--;
}
// UIManager.Instance.DestroyUI(UITypes.RewardPopupPanel);
// GContext.Publish(new RewardPanelClose());
// await Awaiters.NextFrame;
}
private async Task OnSettleFinished(bool isSuccess)
{
if (isSuccess)
{
Log($"OnSettleFinished -> true");
await OnSuccess();
_fishingChallengeManager.OnSettleFinished(true);
}
else if (_challengeState == 1 && !_fishingChallengeManager.IsTimeAllow())
{
Log($"OnSettleFinished -> Fail");
await OnFail();
_fishingChallengeManager.OnSettleFinished(false);
}
else
{
Log($"OnSettleFinished Error ---- {_challengeState} {false}");
}
// _fishingChallengeManager.EventTracking();
}
// private async Task OnProcessAni()
// {
// if (oldStep != newStep)
// {
// //跳水动画
// //await PlayAni();
// var cspe = new ChallengePlayAniEvent() { oldStep = oldStep, newStep = newStep };
// GContext.Publish(cspe);
// await cspe.tcs.Task;
// oldStep = newStep;
// }
// }
private void Settle()
{
timer?.Cancel();
timer = null;
text_time.text = LocalizationMgr.GetText("UI_EventRankPopupPanel_13");
//结算
_fishingChallengeManager.OnSettle();
}
private async void Enter()
{
// canvasGroup.blocksRaycasts = false;
// cfg.Tables tables = GContext.container.Resolve<cfg.Tables>();
// var mapData = tables.TbMapData.DataMap[_fishingChallengeManager.challengeMapData.ID];
// ILoadResourceService loadResourceService = GContext.container.Resolve<ILoadResourceService>();
// bool isCanEnter = await loadResourceService.Load(mapData.EnvName);
// if (isCanEnter)
{
EnterMap();
}
// else
// {
// var panel = await UIManager.Instance.ShowUI(UITypes.CloudTransitionPanel);
// panel.GetComponent<CloudTransitionPanel>().SetBtn(true, EnterMap);
// //var panel = await UIManager.Instance.ShowUI(UITypes.FishingDownLoadPopupPanel);
// //panel.GetComponent<FishingDownLoadPopupPanel>().SetBtn(null, EnterMap);
// canvasGroup.blocksRaycasts = true;
// }
}
private void EnterMap()
{
// GContext.container.Resolve<PlayerData>().currentMapId = _fishingChallengeManager.challengeMapData.ID;
OnClose();
}
private void OnClose()
{
//if (itemDataList != null)
//{
// GContext.Publish(new ShowData(itemDataList));
//}
GContext.Publish(new UnloadActToNextAct(transitionPanel: new UIType(_fishingChallengeManager.eventChallengeConfig.MatchPanel)));
btn_enter.onClick.RemoveAllListeners();
btn_close.onClick.RemoveAllListeners();
}
private void OnDestroy()
{
_disposable?.Dispose();
_disposable = null;
timer?.Cancel();
timer = null;
}
private static void Log(object t)
{
Debug.Log($"<color=blue>EventChallengePanel -> {t} </color>");
}
}

View File

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

View File

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using asap.core;
using game;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 最终结算界面
/// </summary>
public class EventChallengeRewardPopupPanel : MonoBehaviour
{
// 成功
private Transform _rewardSuccess;
private Transform _successTextNum;
private Transform _successTextInfo;
private Transform _successRewardReceiveBtnPlay;
private Transform _successHead;
private Transform _successTextTitle;
//失败
private Transform _rewardEnd;
private Transform _endTextTitle;
private Transform _endRankTextNum;
private Transform _endHead;
private Transform _endTextInfo;
private Transform _endReceiveBtnPlay;
//
private FishingChallengeManager _fishingChallengeManager;
// private ChallangReward challangRewardSuccess;
private RewardItemNew _rewardItem;
private List<ItemData> _itemDataList;
private void Awake()
{
// 成功
_rewardSuccess = transform.Find("reward_success");
_successTextNum = _rewardSuccess.Find("rank/text_num");
_successTextInfo = _rewardSuccess.Find("text_info");
// _successRewardIcon = _rewardSuccess.Find("reward_layout/reward/icon");
// _successRewardTextNum = _rewardSuccess.Find("reward_layout/reward/text_num");
_successRewardReceiveBtnPlay = _rewardSuccess.Find("receive/btn_play/btn_green");
_successTextTitle = _rewardSuccess.Find("bg_title/text_title");
_successHead = _rewardSuccess.Find("head");
_rewardItem = _rewardSuccess.Find("reward_layout/reward").GetComponent<RewardItemNew>();
// 失败
_rewardEnd = transform.Find("reward_end");
_endTextTitle = _rewardEnd.Find("bg_title/text_title");
_endRankTextNum = _rewardEnd.Find("rank/text_num");
_endHead = _rewardEnd.Find("head");
_endTextInfo = _rewardEnd.Find("text_info");
_endReceiveBtnPlay = _rewardEnd.Find("receive/btn_play/btn_green");
//OnEvent()
_successRewardReceiveBtnPlay.GetComponent<Button>().onClick.AddListener(OnClickSuccessGo);
_endReceiveBtnPlay.GetComponent<Button>().onClick.AddListener(OnClickFailedGo);
//
_fishingChallengeManager = GContext.container.Resolve<FishingChallengeManager>();
}
public void OnSuccess()
{
_rewardSuccess.gameObject.SetActive(true);
_rewardEnd.gameObject.SetActive(false);
_itemDataList = _fishingChallengeManager.itemDataList;
if (_itemDataList != null)
{
_rewardItem.SetData(_itemDataList[0],false,false, true);
}
var uiService = GContext.container.Resolve<IUIService>();
// var robots = GContext.container.Resolve<cfg.Tables>().TbRobot.DataMap;
uiService.SetHeadImage(_successHead.GetComponent<Head>().icon_head, GContext.container.Resolve<IUserService>().AvatarUrl);
var M = _fishingChallengeManager.fishingChallengeData.eliminateNumber[^1] - 1;
// _successTextTitle.GetComponent<TMP_Text>().text = LocalizationMgr.GetFormatTextValue("UI_EventChallengeCrocodilePanel_9");
_successTextInfo.GetComponent<TMP_Text>().text = LocalizationMgr.GetFormatTextValue("UI_EventChallengeCrocodilePanel_10", M);
_successTextNum.GetComponent<TMP_Text>().text = LocalizationMgr.GetFormatTextValue("UI_EventChallengeCrocodilePanel_9", _fishingChallengeManager.Rank);
}
public void OnFailed()
{
_rewardSuccess.gameObject.SetActive(false);
_rewardEnd.gameObject.SetActive(true);
// 失败了没有奖品
// _itemDataList = _fishingChallengeManager.itemDataList;
var uiService = GContext.container.Resolve<IUIService>();
uiService.SetHeadImage(_endHead.GetComponent<Head>().icon_head, GContext.container.Resolve<IUserService>().AvatarUrl);
var step = _fishingChallengeManager.fishingChallengeData.step;
// _endTextTitle.GetComponent<TMP_Text>().text = LocalizationMgr.GetFormatTextValue("UI_EventChallangePanel_13");
_endTextInfo.GetComponent<TMP_Text>().text = LocalizationMgr.GetFormatTextValue("UI_EventChallengeCrocodilePanel_11", step);
_endRankTextNum.GetComponent<TMP_Text>().text = LocalizationMgr.GetFormatTextValue("UI_EventChallengeCrocodilePanel_9", _fishingChallengeManager.Rank);
}
private void Start()
{
}
// Event
private void OnClickSuccessGo()
{
if (_itemDataList != null)
{
GContext.Publish(new ShowData(_itemDataList));
}
_successRewardReceiveBtnPlay.GetComponent<Button>().onClick.RemoveAllListeners();
_endReceiveBtnPlay.GetComponent<Button>().onClick.RemoveAllListeners();
UIManager.Instance.DestroyUI(UITypes.EventChallengeRewardPopupPanel);
// GContext.container.Resolve<PlayerData>().currentMapId = _fishingChallengeManager.challengeMapData.ID;
GContext.Publish(new UnloadActToNextAct());
}
private void OnClickFailedGo()
{
// if (_itemDataList != null)
// {
// GContext.Publish(new ShowData(_itemDataList));
// }
_successRewardReceiveBtnPlay.GetComponent<Button>().onClick.RemoveAllListeners();
_endReceiveBtnPlay.GetComponent<Button>().onClick.RemoveAllListeners();
UIManager.Instance.DestroyUI(UITypes.EventChallengeRewardPopupPanel);
GContext.Publish(new UnloadActToNextAct());
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5640be2dc1914412ba08146fcd6e93f8
timeCreated: 1754572726