Files
JJBB/Assets/Project/Script/GUI/StroyCopy/RealmTestingCopy.cs
2024-08-23 15:49:34 +08:00

186 lines
5.6 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GCGame.Table;
using System;
using Module.Log;
// 诸界试炼
// 该副本部分数据来源于testDfCopy
// 本关卡的难度枚举不与之前的公用!
public class RealmTestingCopy : TestingCopyBase {
public UIImgText recomandCombat;
public Text minCombat; // 最第战斗力 id:8123
// 进入剩余次数,
// 足够8124
// 不足8125
// 当前已通关 8126
public Text curDisplayLevel;
public Button leftBtn;
public Button rightBtn;
public Button helpBtn;
public Image bg;
public GameObject _BestPassedLevelObj; // 控制最高通关的显示
public Text remainTimeText; // 今日剩余次数,不同于基类(艺术字)
public Text maxPassText; // 最高通关
private int maxPass = 0; //
private void Awake()
{
helpBtn.onClick.AddListener(OnHelpBtnClick);
leftBtn.onClick.AddListener(OnLeftBtnClick);
rightBtn.onClick.AddListener(OnRightBtnClick);
_TestingCopyTab = TableManager.GetTestingCopyByID(_FubenId, 0);
if (_TestingCopyTab == null)
{
LogModule.ErrorLog("Can't find id in testingCopy, id is : " + _FubenId);
return;
}
}
public override void InitTestingCopyBaseInfoById()
{
_TestingCopyTab = TableManager.GetTestingCopyByID(_FubenId, 0);
if (_TestingCopyTab == null)
{
LogModule.ErrorLog("Can't find id in testingCopy, id is : " + _FubenId);
return;
}
_CurSelectedDiffcultyType = 0;
maxPass = 0;
_BestPassedLevelObj.SetActive(false);
OnDiffcultChange();
HideAllDiffcultyBtn();
SetChallengeBtn();
}
#region
private void OnHelpBtnClick()
{
MessageHelpLogic.ShowHelpMessage(49);
}
private void OnLeftBtnClick()
{
if(_CurSelectedDiffcultyType > 0)
{
--_CurSelectedDiffcultyType;
OnDiffcultChange();
}
}
private void OnRightBtnClick()
{
if (_CurSelectedDiffcultyType < maxPass || _CurSelectedDiffcultyType < 1)
{
++_CurSelectedDiffcultyType;
OnDiffcultChange();
}
}
#endregion
private void OnDiffcultChange()
{
//SetRule();
InitRewContainer();
// 规则
Tab_TestingDfCopy tab = TableManager.GetTestingDfCopyByID(_CurSelectedDiffcultyType + 1, 0);
_RuleText.text = tab.DDesc;
// 当前显示的难度
curDisplayLevel.text = tab.Name;
// 推荐战力,最低限制战力
recomandCombat.text = tab.Combat.ToString();
minCombat.text = StrDictionary.GetClientDictionaryString("#{8123}", tab.LimitCombat);
// 背景
LoadAssetBundle.Instance.SetImageSprite(bg, tab.BGName);
// 设置左右按钮状态
leftBtn.interactable = _CurSelectedDiffcultyType > 0;
rightBtn.interactable = _CurSelectedDiffcultyType < maxPass || _CurSelectedDiffcultyType < 1;
}
// 设置奖励
public override void InitRewContainer()
{
Tab_TestingDfCopy tab = TableManager.GetTestingDfCopyByID(_CurSelectedDiffcultyType + 1, 0);
if(tab == null)
{
LogModule.ErrorLog("No config !!!");
return;
}
int someId = tab.AwardId;
Tab_CopySceneReward copySceneRew = TableManager.GetCopySceneRewardByID(someId, 0);
if (copySceneRew == null)
{
return;
}
rewItemList = new List<TestingRewardItemInfo>();
for (int index = 0; index < copySceneRew.getRewardCountCount(); index++)
{
rewItemList.Add(new TestingRewardItemInfo(copySceneRew.GetRewardItemIDbyIndex(index), copySceneRew.GetRewardCountbyIndex(index), true));
}
_RewContainer.InitContentItem(rewItemList);
}
#region
public override void OnPacketRet(RetTestingCopyInfo packet)
{
this._RemainChallengeTimes = packet._RemainTimes;
maxPass = packet._UnLockDiffcultyLevel;
Tab_TestingDfCopy tab = TableManager.GetTestingDfCopyByID(maxPass + 1, 0);
if(maxPass != 0)
{
if (tab != null)
{
_BestPassedLevelObj.SetActive(true);
maxPassText.text = StrDictionary.GetClientDictionaryString("#{8126}", tab.Name);
}
else
{
_BestPassedLevelObj.SetActive(false);
}
}
// 总的可挑战次数
Tab_Fuben tabFuben = TableManager.GetFubenByID(_FubenId, 0);
_RemainTimeObj.SetActive(false);
if (tabFuben != null && tabFuben.ChallengeTimes != -1)
{
_RemainTimeObj.SetActive(true);
if (packet._RemainTimes <= 0)
{
remainTimeText.text = StrDictionary.GetClientDictionaryString("#{8125}", packet._RemainTimes, tabFuben.ChallengeTimes);
}
else
{
remainTimeText.text = StrDictionary.GetClientDictionaryString("#{8124}", packet._RemainTimes, tabFuben.ChallengeTimes);
}
}
if(maxPass > _CurSelectedDiffcultyType)
{
_CurSelectedDiffcultyType = maxPass;
OnDiffcultChange();
}
}
#endregion
}