Squashes 146 commits from battle-engine-extraction. Net: 2,045 files changed, +11,896 / -158,687 lines. Ships engine passes 4-7 (dead-code cull, view-layer stub, receive-path shrink) plus the Phase-5 AsyncLocal ambient deletion that turns concurrent battles into a type-system property rather than a scope contract. ## What landed **Passes 4-7 (chunks 1-34):** Extended the Phase-4 const-false collapse into a cascading cull across the skill graph, view layer, and receive-path periphery. Six mode flags (IsWatchBattle/IsReplayBattle/IsAdmin/IsAdminWatch/IsPuzzleQuest/ IsAINetwork) became `const false`, every guarded block deleted. Field*.cs subclass ctors + BackGroundBase + ObjectChecker culled to no-ops. Mulligan family reworked to take a mgr param through IMulliganMgr.InitMulligan. Emotion/Recovery/Resource clusters null-stubbed. Prediction/OperationSimulator/ skill filters converted from static ambient reads to per-mgr reads via SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr / ins.BattleMgr / this.BattleMgr. **Phase-5 ambient rip (chunks 35-47):** Deleted BattleAmbient / BattleAmbient- Context / TestBattleScope in full. Every per-battle mutable slot now lives on the mgr instance itself: mgr.InstanceIsForecast / InstanceIsRandomDraw / InstanceRecoveryInfo / InstanceViewerId / InstanceNetworkAgent / GameMgr BattleManagerBase.GetIns() returns null unconditionally; the residual static flags + 3 façades (Certification.ViewerId, Data.BattleRecoveryInfo, ToolboxGame.RealTimeNetworkAgent) are null-tolerant defaults kept for the handful of engine-internal readers that still reference their types. Zero BattleAmbient references anywhere in engine + node + tests. Added pre-seeded GameMgr ctor overload threaded through the mgr chain (BattleManagerBase → SingleBattleMgr / NetworkBattleManagerBase → NetworkStandard- BattleMgr → HeadlessBattleMgr / HeadlessNetworkBattleMgr). Fixtures build a GameMgr, seed it via HeadlessEngineEnv.SeedCharaIds/SeedNetUser, and pass it to the mgr's ctor — no ambient reach. Node side (SVSim.BattleNode/SessionBattleEngine): _ctx replaced with a plain GameMgr field; 34 `using var _ambient = BattleAmbient.Enter(_ctx)` scope wraps ripped from every accessor and mutator; EngineGlobalInit.WirePerSessionGameMgr takes GameMgr as a param and runs from SessionBattleEngine.SetupInternal BEFORE mgr construction. Test side: TestBattleScope deleted; 18 fixture [SetUp]s migrated to `HeadlessEngineEnv.EnsureProcessGlobals()`; MultiInstanceEngineTests rewritten around per-mgr construction (GetIns() → null is the pinned invariant). ## Regression fixes - **chunk-48** (MulliganCtrl): chunk-35's `= null` stubs on card lookups broke the live receive-driven Deal path (BattlePlayerBase.DrawCard NRE'd downstream of NetworkPlayerMulliganCtrl.StartMulliganVfx). Restored the three lookups via `_battlePlayer.BattleMgr.GetBattleCardIdx`. Engine tests were satisfied by the WireMulliganPhase seam; unit tests exposed the live-path gap. ## Ship state - SVSim.BattleEngine.Tests: 56/56 pass, 2 skip - SVSim.UnitTests: 1554/1554 pass (was 1523/31-fail before chunk 48) - Solution build: 0 source warnings (40 pre-existing NU1902 MessagePack CVEs in SVSim.EmulatedEntrypoint, unrelated) - Sequential PVP smoke: verified live (two back-to-back battles, no regression on cleanup/spinup) - Concurrent PVP smoke: verified live Adds tools/engine-port/ClosureAnalyzer/ — the Roslyn transitive-type-closure analyzer needed to make future cascade cleanup safe (per feedback memory "Engine cleanup needs closure tool" from the 2026-06-28 pass-3 failure). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
865 lines
32 KiB
C#
865 lines
32 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
public class GachaPackAreaLayout : MonoBehaviour
|
|
{
|
|
|
|
private readonly Vector3 DEFAULT_PACK_TICKET_POSITION = new Vector3(7f, 40.6f, 0f);
|
|
|
|
private readonly Vector3 LEGEND_PACK_TICKET_POSITION = new Vector3(7f, -179.6f, 0f);
|
|
|
|
[SerializeField]
|
|
private UITexture _packTitleTexture;
|
|
|
|
[SerializeField]
|
|
private UIButton _rateButton;
|
|
|
|
[SerializeField]
|
|
private UITexture _packPosterTexture;
|
|
|
|
[SerializeField]
|
|
private UITexture _packPosterLegendPack;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelPackDescription;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelSpecialPackDescription;
|
|
|
|
[SerializeField]
|
|
private GachaLayoutPurchaseButton _layoutPurchaseTicketButton;
|
|
|
|
[SerializeField]
|
|
private GachaLayoutPurchaseButton _layoutPurchaseRupyButton;
|
|
|
|
[SerializeField]
|
|
private GachaLayoutPurchaseButton _layoutPurchaseCrystalButton;
|
|
|
|
[SerializeField]
|
|
private GachaLayoutPurchaseButton _layoutPurchaseDailyButton;
|
|
|
|
[SerializeField]
|
|
private GachaLayoutPurchaseButton _layoutPurchaseFree10PacksButton;
|
|
|
|
[SerializeField]
|
|
private GachaLayoutPurchaseButton _layoutPurchaseStepupButton;
|
|
|
|
[SerializeField]
|
|
private GachaLayoutEffect _free10PackEffect;
|
|
|
|
[SerializeField]
|
|
private CenteringUIWidget _free10PackCentering;
|
|
|
|
[SerializeField]
|
|
private UITexture _headLineTicketTexture;
|
|
|
|
[SerializeField]
|
|
private GameObject _objPrereleaseLayoutRoot;
|
|
|
|
[SerializeField]
|
|
private GameObject _noLimitPrereleaseRoot;
|
|
|
|
[SerializeField]
|
|
private UIButton _btnPrereleasePurchaseRewards;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelPrereleaseRemainTime;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelPrereleasePurchaseCount;
|
|
|
|
[SerializeField]
|
|
private GameObject _prereleaseRemainTimeRoot;
|
|
|
|
[SerializeField]
|
|
private GachaPackPointLayout _packPointLayout;
|
|
|
|
[SerializeField]
|
|
private UIButton _btnSpecialPackReward;
|
|
|
|
[SerializeField]
|
|
private BannerDialog _prefabDialogPackBanner;
|
|
|
|
[SerializeField]
|
|
private GameObject _objUnrestrictedPrereleaseLayoutRoot;
|
|
|
|
[SerializeField]
|
|
private UIButton _btnUnrestrictedPrereleasePurchaseRewards;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelUnrestrictedPrereleaseRemainTime;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelUnrestrictedPrereleasePurchaseCount;
|
|
|
|
[SerializeField]
|
|
private UITexture _bonusPosterTexture;
|
|
|
|
[SerializeField]
|
|
private GameObject _preReleasePointRoot;
|
|
|
|
[SerializeField]
|
|
private UIGauge _preReleasePointGauge;
|
|
|
|
[SerializeField]
|
|
private UILabel _preReleasePointLabel;
|
|
|
|
[SerializeField]
|
|
private GameObject _appealImage;
|
|
|
|
[SerializeField]
|
|
private UITexture _appealTexture;
|
|
|
|
private DialogBase _dialogPackBanner;
|
|
|
|
private CardDetailUI _cardDetail;
|
|
|
|
private TimerMgr _timerManager;
|
|
|
|
private RepeatTimer _currentTimer;
|
|
|
|
private Action<PackConfig, PackChildGachaInfo> _onClickPurchaseButton;
|
|
|
|
private Action<PackConfig> _onClickExchangePackPoint;
|
|
|
|
private List<string> _packBannerResources = new List<string>();
|
|
|
|
public void SetTimer(TimerMgr timer)
|
|
{
|
|
_timerManager = timer;
|
|
}
|
|
|
|
public void SetCardDetailDialog(CardDetailUI cardDetail)
|
|
{
|
|
_cardDetail = cardDetail;
|
|
}
|
|
|
|
public void SetOnClickPurchaseButton(Action<PackConfig, PackChildGachaInfo> onClickPurchase)
|
|
{
|
|
_onClickPurchaseButton = onClickPurchase;
|
|
}
|
|
|
|
public void SetOnClickExchangePackPoint(Action<PackConfig> onClickExchange)
|
|
{
|
|
_onClickExchangePackPoint = onClickExchange;
|
|
}
|
|
|
|
public void SetToGrayRateButton(bool isGary)
|
|
{
|
|
UIManager.SetObjectToGrey(_rateButton.gameObject, isGary);
|
|
}
|
|
|
|
public void SetTutorialTicketPurchasebutton()
|
|
{
|
|
MyPageMenu.Instance.SetGuideEffect(_layoutPurchaseTicketButton.PurchaseButtonTransform, Vector3.zero, -45f);
|
|
}
|
|
|
|
public void UpdateRupyCount(int rupyCount)
|
|
{
|
|
_layoutPurchaseRupyButton.SetHaveItemLabel(rupyCount);
|
|
}
|
|
|
|
public void UpdateCrystalCount(int crystalCount)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetHaveItemLabel(crystalCount);
|
|
}
|
|
|
|
public void ShowPackLayout(PackConfig packConfig, List<string> resourceList)
|
|
{
|
|
HidePackLayoutObject(packConfig.IsUseLongPoster);
|
|
SetPackLayoutTexture(packConfig);
|
|
SetEventPackInfo(packConfig);
|
|
if (packConfig.IsPrerelease)
|
|
{
|
|
ShowPrereleaseLayout(packConfig);
|
|
return;
|
|
}
|
|
if (packConfig.IsLegendCardPack)
|
|
{
|
|
ShowLegendLayout(packConfig, resourceList);
|
|
return;
|
|
}
|
|
if (packConfig.IsSpecialCardPack)
|
|
{
|
|
ShowSpecialLayout(packConfig);
|
|
return;
|
|
}
|
|
if (packConfig.IsRotationStarterCardPack)
|
|
{
|
|
ShowRotationStarterLayout(packConfig, resourceList);
|
|
return;
|
|
}
|
|
ShowStandardLayout(packConfig, resourceList);
|
|
if (packConfig.IsNeedRemainTime)
|
|
{
|
|
UpdateDetailString(packConfig);
|
|
}
|
|
if (packConfig.IsShowAppealImage)
|
|
{
|
|
_appealImage.SetActive(value: true);
|
|
ResourcesManager resourcesManager = Toolbox.ResourcesManager;
|
|
string path = $"card_pack_{packConfig.PackId}_poster_sub";
|
|
string assetTypePath = resourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.ShopCardPack, isfetch: true);
|
|
_appealTexture.mainTexture = resourcesManager.LoadObject(assetTypePath) as Texture;
|
|
}
|
|
}
|
|
|
|
private void HidePackLayoutObject(bool isLongPoster)
|
|
{
|
|
_labelPackDescription.gameObject.SetActive(value: false);
|
|
_labelSpecialPackDescription.gameObject.SetActive(value: false);
|
|
_packPosterTexture.gameObject.SetActive(!isLongPoster);
|
|
_packPosterLegendPack.gameObject.SetActive(isLongPoster);
|
|
_layoutPurchaseRupyButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseTicketButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseDailyButton.SetActivePurchaseButton(isActive: false);
|
|
_layoutPurchaseDailyButton.SetRibbonActive(active: false);
|
|
_layoutPurchaseCrystalButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseCrystalButton.SetRibbonActive(active: false);
|
|
_layoutPurchaseFree10PacksButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseFree10PacksButton.SetIconActive(active: false, string.Empty);
|
|
_layoutPurchaseFree10PacksButton.SetRemainCountRootVisible(visible: true);
|
|
_layoutPurchaseFree10PacksButton.SetFreePackApealTextVisible(visible: false);
|
|
_layoutPurchaseStepupButton.SetActivePurchaseButton(isActive: false);
|
|
_bonusPosterTexture.gameObject.SetActive(value: false);
|
|
_layoutPurchaseCrystalButton.SetPurchasedVisible(visible: false);
|
|
_layoutPurchaseRupyButton.SetPurchasedVisible(visible: false);
|
|
_layoutPurchaseTicketButton.SetPurchasedVisible(visible: false);
|
|
_layoutPurchaseCrystalButton.SetPurchasedLabel("Shop_0100");
|
|
_layoutPurchaseRupyButton.SetPurchasedLabel("Shop_0100");
|
|
_layoutPurchaseTicketButton.SetPurchasedLabel("Shop_0100");
|
|
_objPrereleaseLayoutRoot.SetActive(value: false);
|
|
_objUnrestrictedPrereleaseLayoutRoot.SetActive(value: false);
|
|
_preReleasePointRoot.SetActive(value: false);
|
|
_packPointLayout.SetActivePackPointLayout(isActive: false);
|
|
_btnSpecialPackReward.gameObject.SetActive(value: false);
|
|
_appealImage.SetActive(value: false);
|
|
}
|
|
|
|
private void SetEventPackInfo(PackConfig packConfig)
|
|
{
|
|
_rateButton.onClick.Clear();
|
|
_rateButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnBtnShowGachaRate(packConfig);
|
|
}));
|
|
UIEventListener.Get(_labelSpecialPackDescription.gameObject).onClick = delegate
|
|
{
|
|
OpenPackBannerDialog(packConfig);
|
|
};
|
|
if (_currentTimer != null)
|
|
{
|
|
_timerManager.Remove(_currentTimer);
|
|
}
|
|
UIEventListener.Get(_packPosterLegendPack.gameObject).onClick = delegate
|
|
{
|
|
OpenPackBannerDialog(packConfig);
|
|
};
|
|
UIEventListener.Get(_packPosterTexture.gameObject).onClick = delegate
|
|
{
|
|
OpenPackBannerDialog(packConfig);
|
|
};
|
|
}
|
|
|
|
private void SetPackLayoutTexture(PackConfig packConfig)
|
|
{
|
|
ResourcesManager resourcesManager = Toolbox.ResourcesManager;
|
|
if (packConfig.IsSpecialLayout || packConfig.IsPrerelease)
|
|
{
|
|
if (packConfig.IsUseLongPoster)
|
|
{
|
|
_packPosterLegendPack.mainTexture = resourcesManager.LoadObject(packConfig.GetPackPosterTexturePath(isFetch: true)) as Texture;
|
|
}
|
|
else
|
|
{
|
|
_packPosterTexture.mainTexture = resourcesManager.LoadObject(packConfig.GetPackPosterTexturePath(isFetch: true)) as Texture;
|
|
_bonusPosterTexture.mainTexture = resourcesManager.LoadObject(packConfig.GetPackBounsPosterTexturePath(isFetch: true)) as Texture;
|
|
_bonusPosterTexture.gameObject.SetActive(value: true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_packPosterTexture.mainTexture = resourcesManager.LoadObject(packConfig.GetPackPosterTexturePath(isFetch: true)) as Texture;
|
|
}
|
|
_packTitleTexture.mainTexture = resourcesManager.LoadObject(packConfig.GetPackTitleLogoTexturePath(isFetch: true)) as Texture;
|
|
if (!packConfig.IsSpecialCardPack)
|
|
{
|
|
_headLineTicketTexture.mainTexture = resourcesManager.LoadObject(packConfig.GetPackIconTexturePath(isFetch: true)) as Texture;
|
|
}
|
|
}
|
|
|
|
private void OpenPackBannerDialog(PackConfig packConfig)
|
|
{
|
|
List<string> packBannerResources = GetPackBannerResources(packConfig);
|
|
if (packBannerResources.Count > 0)
|
|
{
|
|
UIManager.GetInstance().createInSceneCenterLoading();
|
|
Toolbox.ResourcesManager.StartCoroutine_LoadAssetGroupAsync(packBannerResources, delegate
|
|
{
|
|
CreatePackBannerDialog(packConfig);
|
|
UIManager.GetInstance().closeInSceneCenterLoading();
|
|
});
|
|
}
|
|
else
|
|
{
|
|
CreatePackBannerDialog(packConfig);
|
|
}
|
|
}
|
|
|
|
private List<string> GetPackBannerResources(PackConfig packConfig)
|
|
{
|
|
ResourcesManager resourcesManager = Toolbox.ResourcesManager;
|
|
List<PackBannerData> listPackBanner = packConfig.ListPackBanner;
|
|
List<string> list = new List<string>();
|
|
for (int i = 0; i < listPackBanner.Count; i++)
|
|
{
|
|
string assetTypePath = resourcesManager.GetAssetTypePath(listPackBanner[i].BannerFileName, ResourcesManager.AssetLoadPathType.ShopCardPack);
|
|
if (!_packBannerResources.Contains(assetTypePath))
|
|
{
|
|
list.Add(assetTypePath);
|
|
}
|
|
}
|
|
_packBannerResources.AddRange(list);
|
|
return list;
|
|
}
|
|
|
|
private void CreatePackBannerDialog(PackConfig packConfig)
|
|
{
|
|
List<PackBannerData> listPackBanner = packConfig.ListPackBanner;
|
|
if (listPackBanner.Count <= 0 || Data.Load.data._userTutorial.TutorialStep == 41 || _dialogPackBanner != null || packConfig.IsSpecialCardPack)
|
|
{
|
|
return;
|
|
}
|
|
List<string> list = new List<string>();
|
|
foreach (PackBannerData item in listPackBanner)
|
|
{
|
|
list.Add(item.BannerTitle);
|
|
}
|
|
_dialogPackBanner = UIManager.GetInstance().CreateDialogClose();
|
|
_dialogPackBanner.SetSize(DialogBase.Size.M);
|
|
_dialogPackBanner.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
_dialogPackBanner.SetPanelDepth(610);
|
|
BannerDialog bannerDialog = UnityEngine.Object.Instantiate(_prefabDialogPackBanner);
|
|
_dialogPackBanner.SetObj(bannerDialog.gameObject);
|
|
List<Texture> list2 = new List<Texture>();
|
|
for (int i = 0; i < listPackBanner.Count; i++)
|
|
{
|
|
list2.Add(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(listPackBanner[i].BannerFileName, ResourcesManager.AssetLoadPathType.ShopCardPack, isfetch: true)) as Texture);
|
|
}
|
|
bannerDialog.Init(list2, list, _dialogPackBanner);
|
|
}
|
|
|
|
public void ClearPackBannerResources()
|
|
{
|
|
Toolbox.ResourcesManager.RemoveAssetGroup(_packBannerResources);
|
|
_packBannerResources.Clear();
|
|
}
|
|
|
|
private void OnBtnShowGachaRate(PackConfig packConfig)
|
|
{
|
|
|
|
CheckTimeSlipRotationPeriodTask task = new CheckTimeSlipRotationPeriodTask();
|
|
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
|
{
|
|
UIManager.GetInstance().WebViewHelper.OpenGachaRateWebView(packConfig.PackId, (int)packConfig.Category);
|
|
}));
|
|
}
|
|
|
|
private void ShowPurchaseRewardDialog(List<PurchaseRewardInfo> purchaseRewardList)
|
|
{
|
|
_cardDetail.IsShowFlavorTextButton = false;
|
|
_cardDetail.IsShowVoiceButton = false;
|
|
_cardDetail.IsShowEvolutionButton = false;
|
|
DialogBase dialogBase = PurchaseRewardDialog.Create(purchaseRewardList, _cardDetail, useLargeDetailDialog: true, PurchaseRewardDialog.Layout.NORMAL, null, null, isPaging: true);
|
|
dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate
|
|
{
|
|
_cardDetail.IsShowFlavorTextButton = true;
|
|
_cardDetail.IsShowVoiceButton = true;
|
|
_cardDetail.IsShowEvolutionButton = true;
|
|
});
|
|
dialogBase.SetLayer("MyPage");
|
|
dialogBase.SetDepthAndSortingOrder(140, 2);
|
|
}
|
|
|
|
private void ShowStandardLayout(PackConfig packConfig, List<string> resourceList)
|
|
{
|
|
SetStanderdInfoText(packConfig.Description);
|
|
bool flag = false;
|
|
for (int i = 0; i < packConfig.ChildGachaInfoList.Count; i++)
|
|
{
|
|
PackChildGachaInfo gachaInfo = packConfig.ChildGachaInfoList[i];
|
|
switch (gachaInfo.PackType)
|
|
{
|
|
case GachaUI.CardPackType.DAILY:
|
|
if (flag)
|
|
{
|
|
break;
|
|
}
|
|
_layoutPurchaseCrystalButton.SetActiveLayout(isActive: true);
|
|
if (!gachaInfo.IsDailySingle)
|
|
{
|
|
_layoutPurchaseDailyButton.SetActivePurchaseButton(isActive: false);
|
|
_layoutPurchaseCrystalButton.SetActivePurchaseButton(isActive: true);
|
|
if (packConfig.GachaPointData != null && gachaInfo.OverrideIncreaseGachaPoint > packConfig.GachaPointData.IncreaseGachaPoint)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetRibbonActive(active: true);
|
|
}
|
|
break;
|
|
}
|
|
_layoutPurchaseDailyButton.SetBuyCostLabel(gachaInfo.Cost);
|
|
_layoutPurchaseDailyButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseDailyButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseDailyButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
_layoutPurchaseCrystalButton.SetActivePurchaseButton(isActive: false);
|
|
if (packConfig.GachaPointData != null && gachaInfo.OverrideIncreaseGachaPoint > packConfig.GachaPointData.IncreaseGachaPoint)
|
|
{
|
|
_layoutPurchaseDailyButton.SetRibbonActive(active: true);
|
|
}
|
|
break;
|
|
case GachaUI.CardPackType.CRYSTAL_MULTI:
|
|
if (!flag)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetActiveLayout(isActive: true);
|
|
_layoutPurchaseCrystalButton.SetBuyCostLabel(gachaInfo.Cost, "Shop_0058");
|
|
_layoutPurchaseCrystalButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseCrystalButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
}
|
|
break;
|
|
case GachaUI.CardPackType.TICKET_MULTI:
|
|
_layoutPurchaseTicketButton.SetActiveLayout(isActive: true);
|
|
_layoutPurchaseTicketButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseTicketButton.LayoutLocalPosition = DEFAULT_PACK_TICKET_POSITION;
|
|
_layoutPurchaseTicketButton.SetHaveItemLabel(gachaInfo.CostGoodsCount);
|
|
_layoutPurchaseTicketButton.SetBuyCostLabel(gachaInfo.Cost, "Shop_0057");
|
|
if (gachaInfo.CostGoodsCount >= gachaInfo.Cost)
|
|
{
|
|
_layoutPurchaseTicketButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseTicketButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
}
|
|
else
|
|
{
|
|
_layoutPurchaseTicketButton.SetToGrayPurchaseButton(isDisable: true);
|
|
}
|
|
break;
|
|
case GachaUI.CardPackType.RUPY_MULTI:
|
|
_layoutPurchaseRupyButton.SetActiveLayout(isActive: true);
|
|
_layoutPurchaseRupyButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseRupyButton.SetBuyCostLabel(gachaInfo.Cost, "Shop_0059");
|
|
if (PlayerStaticData.UserRupyCount >= gachaInfo.Cost)
|
|
{
|
|
_layoutPurchaseRupyButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseRupyButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
}
|
|
else
|
|
{
|
|
_layoutPurchaseRupyButton.SetToGrayPurchaseButton(isDisable: true);
|
|
}
|
|
break;
|
|
case GachaUI.CardPackType.FREE_PACKS:
|
|
case GachaUI.CardPackType.FREE_PACK_WITH_SKIN:
|
|
{
|
|
flag = true;
|
|
_layoutPurchaseCrystalButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseDailyButton.SetActivePurchaseButton(isActive: false);
|
|
_layoutPurchaseFree10PacksButton.SetActiveLayout(isActive: true);
|
|
_layoutPurchaseFree10PacksButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseFree10PacksButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseFree10PacksButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
_layoutPurchaseFree10PacksButton.SetHaveItemLabel(gachaInfo.AvailableCount / gachaInfo.PackCountBuyPer);
|
|
_layoutPurchaseFree10PacksButton.SetBuyCostLabel(gachaInfo.PackCountBuyPer, (gachaInfo.PackCountBuyPer == 1) ? "Shop_0222" : "Shop_0233");
|
|
bool flag2 = packConfig.Category == PackCategory.FreePackLeaderSkin || packConfig.Category == PackCategory.LeaderSkinPack || packConfig.Category == PackCategory.LegendAndLeaderSkinSinglePack;
|
|
_layoutPurchaseFree10PacksButton.SetRemainLabelVisible(!flag2);
|
|
_layoutPurchaseFree10PacksButton.SetFreePackLeaderSkinVisible(flag2);
|
|
if (packConfig.Category == PackCategory.LeaderSkinPack)
|
|
{
|
|
string freePackLeaderSkinText = Data.SystemText.Get("Shop_0251");
|
|
_layoutPurchaseFree10PacksButton.SetFreePackLeaderSkinText(freePackLeaderSkinText);
|
|
}
|
|
else if (packConfig.Category == PackCategory.LegendAndLeaderSkinSinglePack)
|
|
{
|
|
string freePackLeaderSkinText2 = Data.SystemText.Get("Shop_0252");
|
|
_layoutPurchaseFree10PacksButton.SetFreePackLeaderSkinText(freePackLeaderSkinText2);
|
|
}
|
|
_layoutPurchaseFree10PacksButton.SetIconActive(gachaInfo.IsShowAnniversaryIcon, gachaInfo.AnniversaryIconSpriteName);
|
|
_layoutPurchaseFree10PacksButton.SetPinkRibbon(gachaInfo.IsShowPinkRibbon);
|
|
_layoutPurchaseFree10PacksButton.SetWinterSprite(gachaInfo.IsShowWinterUI);
|
|
_free10PackCentering.Reposition();
|
|
_free10PackEffect.Setup("cmn_frame_glow_1", 0, resourceList);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (packConfig.IsUsePackPointLayout)
|
|
{
|
|
_packPointLayout.SetPackPointLayout(packConfig, delegate
|
|
{
|
|
_onClickExchangePackPoint(packConfig);
|
|
});
|
|
}
|
|
}
|
|
|
|
private void SetStanderdInfoText(string packDescription)
|
|
{
|
|
_labelPackDescription.gameObject.SetActive(value: true);
|
|
_labelPackDescription.text = packDescription;
|
|
}
|
|
|
|
private void ShowPrereleaseLayout(PackConfig packConfig)
|
|
{
|
|
PrereleasePurchaseInfo prereleasePurchaseInfo = packConfig.PrereleasePurchaseInfo;
|
|
_preReleasePointRoot.SetActive(value: true);
|
|
_ = packConfig.GachaPointData;
|
|
_preReleasePointGauge.Value = (float)prereleasePurchaseInfo.PreReleasePointCurent / (float)prereleasePurchaseInfo.PreReleasePointLimit;
|
|
_preReleasePointLabel.text = prereleasePurchaseInfo.PreReleasePointCurent + "/" + prereleasePurchaseInfo.PreReleasePointLimit;
|
|
_noLimitPrereleaseRoot.SetActive(!prereleasePurchaseInfo.IsCountLimitedPrerelease);
|
|
if (prereleasePurchaseInfo.IsCountLimitedPrerelease)
|
|
{
|
|
_objPrereleaseLayoutRoot.SetActive(value: true);
|
|
}
|
|
else
|
|
{
|
|
_objUnrestrictedPrereleaseLayoutRoot.SetActive(value: true);
|
|
if (packConfig.IsUsePackPointLayout)
|
|
{
|
|
_packPointLayout.SetPackPointLayout(packConfig, delegate
|
|
{
|
|
_onClickExchangePackPoint(packConfig);
|
|
});
|
|
}
|
|
}
|
|
SetPrereleasePurchaseButton(packConfig, prereleasePurchaseInfo, packConfig.ChildGachaInfoList[0]);
|
|
SetPrereleasePurchaseRewards(prereleasePurchaseInfo);
|
|
SetPrereleaseInfoText(prereleasePurchaseInfo, packConfig.Description);
|
|
}
|
|
|
|
private void SetPrereleasePurchaseButton(PackConfig packConfig, PrereleasePurchaseInfo purchaseInfo, PackChildGachaInfo gachaInfo)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetActiveLayout(isActive: true);
|
|
_layoutPurchaseCrystalButton.SetBuyCostLabel(gachaInfo.Cost, "Shop_0058");
|
|
ShowStandardLayout(packConfig, null);
|
|
_layoutPurchaseCrystalButton.SetPurchasedLabel("Shop_0206");
|
|
_layoutPurchaseRupyButton.SetPurchasedLabel("Shop_0206");
|
|
_layoutPurchaseTicketButton.SetPurchasedLabel("Shop_0206");
|
|
if (purchaseInfo.TicketRupyCountRemain == 0)
|
|
{
|
|
_layoutPurchaseRupyButton.SetPurchasedMode(isPurchased: true);
|
|
_layoutPurchaseTicketButton.SetPurchasedMode(isPurchased: true);
|
|
}
|
|
else
|
|
{
|
|
_layoutPurchaseRupyButton.SetPurchasedMode(isPurchased: false);
|
|
_layoutPurchaseTicketButton.SetPurchasedMode(isPurchased: false);
|
|
}
|
|
if (!purchaseInfo.IsCountLimitedPrerelease || purchaseInfo.GetAbleBuyPackNum() > 0)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetPurchasedMode(isPurchased: false);
|
|
_layoutPurchaseCrystalButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseCrystalButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
}
|
|
else
|
|
{
|
|
_layoutPurchaseCrystalButton.SetPurchasedMode(isPurchased: true);
|
|
}
|
|
}
|
|
|
|
private void SetPrereleasePurchaseRewards(PrereleasePurchaseInfo purchaseInfo)
|
|
{
|
|
UIButton uIButton = (purchaseInfo.IsCountLimitedPrerelease ? _btnPrereleasePurchaseRewards : _btnUnrestrictedPrereleasePurchaseRewards);
|
|
if (purchaseInfo.RewardsList.Count == 0)
|
|
{
|
|
uIButton.gameObject.SetActive(value: false);
|
|
return;
|
|
}
|
|
uIButton.onClick.Clear();
|
|
uIButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
|
|
ShowPurchaseRewardDialog(purchaseInfo.RewardsList);
|
|
}));
|
|
}
|
|
|
|
private void SetPrereleaseInfoText(PrereleasePurchaseInfo purchaseInfo, string packDescription)
|
|
{
|
|
UILabel obj = (purchaseInfo.IsCountLimitedPrerelease ? _labelPrereleaseRemainTime : _labelUnrestrictedPrereleaseRemainTime);
|
|
UILabel uILabel = (purchaseInfo.IsCountLimitedPrerelease ? _labelPrereleasePurchaseCount : _labelUnrestrictedPrereleasePurchaseCount);
|
|
string showText = purchaseInfo.RemainTime.GetShowText("Shop_0179", "Shop_0178", "Shop_0177");
|
|
_labelPackDescription.gameObject.SetActive(value: true);
|
|
_labelPackDescription.text = packDescription.Replace("{remaining_purchase_time}", showText);
|
|
obj.text = purchaseInfo.RemainTime.GetShowText("Shop_0179", "Shop_0178", "Shop_0177");
|
|
if (purchaseInfo.IsCountLimitedPrerelease)
|
|
{
|
|
uILabel.text = Data.SystemText.Get("Shop_0181", purchaseInfo.CurrentCount.ToString(), purchaseInfo.LimitCount.ToString());
|
|
_prereleaseRemainTimeRoot.SetActive(value: false);
|
|
}
|
|
else
|
|
{
|
|
uILabel.text = Data.SystemText.Get("Shop_0046", purchaseInfo.CurrentCount.ToString());
|
|
}
|
|
}
|
|
|
|
private void ShowSpecialLayout(PackConfig packConfig)
|
|
{
|
|
UpdateDetailString(packConfig);
|
|
SetSpecialPurchaseButton(packConfig, packConfig.ChildGachaInfoList[0], packConfig.OpenCountLimit > packConfig.OpenCount);
|
|
SetSpecialPurchaseRewards(packConfig);
|
|
}
|
|
|
|
private static string ReplaceDetailString(PackConfig packConfig)
|
|
{
|
|
string description = packConfig.Description;
|
|
if (!packConfig.IsNeedRemainTime)
|
|
{
|
|
return description;
|
|
}
|
|
int second = packConfig.RemainTime.Second;
|
|
string newValue;
|
|
if (second < 3600)
|
|
{
|
|
int num = ((second > 0) ? (second / 60 + 1) : 0);
|
|
newValue = Data.SystemText.Get("Shop_0147", num.ToString());
|
|
}
|
|
else if (second < 86400)
|
|
{
|
|
int num2 = second / 3600;
|
|
newValue = Data.SystemText.Get("Shop_0146", num2.ToString());
|
|
}
|
|
else
|
|
{
|
|
int num3 = second / 86400;
|
|
newValue = Data.SystemText.Get("Shop_0145", num3.ToString());
|
|
}
|
|
description = description.Replace("{remaining_purchase_time}", newValue);
|
|
int num4 = (packConfig.OpenCountLimit - packConfig.OpenCount) / 10;
|
|
if (GachaUI.IsTsStepupPackId(packConfig.PackId))
|
|
{
|
|
num4 = packConfig.RemainStepupOpenCount;
|
|
}
|
|
return string.Format(description, num4);
|
|
}
|
|
|
|
private void UpdateDetailString(PackConfig packConfig)
|
|
{
|
|
if (_currentTimer != null)
|
|
{
|
|
_timerManager.Remove(_currentTimer);
|
|
}
|
|
RepeatTimer repeatTimer = new RepeatTimer((float)(60.0 - packConfig.RemainTime.NowUnixTime % 60.0), delegate
|
|
{
|
|
UpdateDetailString(packConfig);
|
|
});
|
|
_timerManager.Add(repeatTimer);
|
|
_currentTimer = repeatTimer;
|
|
if (packConfig.Category == PackCategory.LeaderSkinPack)
|
|
{
|
|
_labelPackDescription.gameObject.SetActive(value: true);
|
|
_labelSpecialPackDescription.gameObject.SetActive(value: false);
|
|
_labelPackDescription.text = ReplaceDetailString(packConfig);
|
|
}
|
|
else
|
|
{
|
|
_labelSpecialPackDescription.gameObject.SetActive(value: true);
|
|
_labelPackDescription.gameObject.SetActive(value: false);
|
|
_labelSpecialPackDescription.text = ReplaceDetailString(packConfig);
|
|
}
|
|
}
|
|
|
|
private void SetSpecialPurchaseButton(PackConfig packConfig, PackChildGachaInfo gachaInfo, bool isPurchasable)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetActiveLayout(isActive: true);
|
|
if (isPurchasable)
|
|
{
|
|
if (GachaUI.IsTsStepupPackId(packConfig.PackId))
|
|
{
|
|
_layoutPurchaseCrystalButton.SetActivePurchaseButton(isActive: false);
|
|
_layoutPurchaseStepupButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseStepupButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseStepupButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
int num = packConfig.TotalStepupOpenCount - packConfig.RemainStepupOpenCount + 1;
|
|
_layoutPurchaseStepupButton.SetInButtonText(Data.SystemText.Get("Shop_0186", num.ToString()));
|
|
}
|
|
else
|
|
{
|
|
_layoutPurchaseCrystalButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseCrystalButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseCrystalButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
_layoutPurchaseStepupButton.SetActivePurchaseButton(isActive: false);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_layoutPurchaseCrystalButton.SetPurchasedVisible(visible: true);
|
|
_layoutPurchaseCrystalButton.SetActivePurchaseButton(isActive: false);
|
|
_layoutPurchaseStepupButton.SetActivePurchaseButton(isActive: false);
|
|
}
|
|
int cost = gachaInfo.Cost * 10;
|
|
_layoutPurchaseCrystalButton.SetBuyCostLabel(cost, "Shop_0112");
|
|
}
|
|
|
|
private void SetSpecialPurchaseRewards(PackConfig packConfig)
|
|
{
|
|
if (packConfig.IsExistSpecialPackPurchaseRewards && packConfig.SpecialPackRewardsList.Count != 0)
|
|
{
|
|
_btnSpecialPackReward.gameObject.SetActive(value: true);
|
|
_btnSpecialPackReward.onClick.Clear();
|
|
_btnSpecialPackReward.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
|
|
ShowPurchaseRewardDialog(packConfig.SpecialPackRewardsList);
|
|
}));
|
|
}
|
|
}
|
|
|
|
private void ShowLegendLayout(PackConfig packConfig, List<string> resourceList)
|
|
{
|
|
SetLegendInfoText(packConfig.Description);
|
|
PackChildGachaInfo packChildGachaInfo = packConfig.CanFreeBuyInfo();
|
|
if (packChildGachaInfo != null)
|
|
{
|
|
SetFreeLegendTicketButton(packConfig, packChildGachaInfo, resourceList);
|
|
}
|
|
else
|
|
{
|
|
SetLegendPurchaseButton(packConfig, packConfig.ChildGachaInfoList[0]);
|
|
}
|
|
}
|
|
|
|
private void SetLegendPurchaseButton(PackConfig packConfig, PackChildGachaInfo gachaInfo)
|
|
{
|
|
_layoutPurchaseFree10PacksButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseTicketButton.SetActiveLayout(isActive: true);
|
|
_layoutPurchaseTicketButton.SetPurchasedMode(isPurchased: false);
|
|
_layoutPurchaseTicketButton.LayoutLocalPosition = LEGEND_PACK_TICKET_POSITION;
|
|
_layoutPurchaseTicketButton.SetHaveItemLabel(gachaInfo.CostGoodsCount);
|
|
_layoutPurchaseTicketButton.SetBuyCostLabel(gachaInfo.Cost, "Shop_0057");
|
|
if (gachaInfo.CostGoodsCount >= gachaInfo.Cost)
|
|
{
|
|
_layoutPurchaseTicketButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseTicketButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
}
|
|
else
|
|
{
|
|
_layoutPurchaseTicketButton.SetToGrayPurchaseButton(isDisable: true);
|
|
}
|
|
}
|
|
|
|
private void SetFreeLegendTicketButton(PackConfig packConfig, PackChildGachaInfo gachaInfo, List<string> resourceList)
|
|
{
|
|
_layoutPurchaseTicketButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseFree10PacksButton.SetActiveLayout(isActive: true);
|
|
_layoutPurchaseFree10PacksButton.SetRemainCountRootVisible(visible: false);
|
|
_layoutPurchaseFree10PacksButton.SetPinkRibbon(gachaInfo.IsShowPinkRibbon);
|
|
_layoutPurchaseFree10PacksButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseFree10PacksButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseFree10PacksButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
_layoutPurchaseFree10PacksButton.SetFreePackLeaderSkinVisible(visible: false);
|
|
_layoutPurchaseFree10PacksButton.SetRemainLabelVisible(visible: true);
|
|
_layoutPurchaseFree10PacksButton.SetHaveItemLabel(gachaInfo.AvailableCount / gachaInfo.PackCountBuyPer);
|
|
_layoutPurchaseFree10PacksButton.SetBuyCostLabel(gachaInfo.PackCountBuyPer, (gachaInfo.PackCountBuyPer == 1) ? "Shop_0222" : "Shop_0233");
|
|
_layoutPurchaseFree10PacksButton.SetIconActive(gachaInfo.IsShowAnniversaryIcon, gachaInfo.AnniversaryIconSpriteName);
|
|
_free10PackCentering.Reposition();
|
|
_free10PackEffect.Setup("cmn_frame_glow_1", 0, resourceList);
|
|
}
|
|
|
|
private void SetLegendInfoText(string packDescription)
|
|
{
|
|
_labelSpecialPackDescription.gameObject.SetActive(value: true);
|
|
_labelSpecialPackDescription.text = packDescription;
|
|
}
|
|
|
|
private void ShowRotationStarterLayout(PackConfig packConfig, List<string> resourceList)
|
|
{
|
|
PackChildGachaInfo packChildGachaInfo = packConfig.CanFreeBuyInfo();
|
|
_layoutPurchaseFree10PacksButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseFree10PacksButton.SetPinkRibbon(packConfig.ChildGachaInfoList[0].IsShowPinkRibbon);
|
|
if (packChildGachaInfo == null)
|
|
{
|
|
SetRotationStarterButton(packConfig, packConfig.ChildGachaInfoList[0], packConfig.OpenCountLimit > packConfig.OpenCount);
|
|
}
|
|
else
|
|
{
|
|
SetFreeRotationStarter(packConfig, packChildGachaInfo, resourceList);
|
|
}
|
|
SetRotationStarterInfoText(packConfig);
|
|
}
|
|
|
|
private void SetRotationStarterInfoText(PackConfig packConfig)
|
|
{
|
|
_labelSpecialPackDescription.gameObject.SetActive(value: true);
|
|
int num = (packConfig.OpenCountLimit - packConfig.OpenCount) / 10;
|
|
_labelSpecialPackDescription.text = string.Format(packConfig.Description, num);
|
|
}
|
|
|
|
private void SetFreeRotationStarter(PackConfig packConfig, PackChildGachaInfo gachaInfo, List<string> resourceList)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetActiveLayout(isActive: false);
|
|
_layoutPurchaseFree10PacksButton.SetActiveLayout(isActive: true);
|
|
_layoutPurchaseFree10PacksButton.SetRemainCountRootVisible(visible: false);
|
|
_layoutPurchaseFree10PacksButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseFree10PacksButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseFree10PacksButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
_layoutPurchaseFree10PacksButton.SetFreePackLeaderSkinVisible(visible: false);
|
|
_layoutPurchaseFree10PacksButton.SetFreePackApealTextVisible(visible: true);
|
|
_layoutPurchaseFree10PacksButton.SetFreePackApealText(Data.SystemText.Get("Shop_0255", gachaInfo.PackCountBuyPer.ToString()));
|
|
_layoutPurchaseFree10PacksButton.SetBuyCostLabel(gachaInfo.PackCountBuyPer, (gachaInfo.PackCountBuyPer == 1) ? "Shop_0222" : "Shop_0233");
|
|
_free10PackEffect.Setup("cmn_frame_glow_1", 0, resourceList);
|
|
}
|
|
|
|
private void SetRotationStarterButton(PackConfig packConfig, PackChildGachaInfo gachaInfo, bool isPurchasable)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetActiveLayout(isActive: true);
|
|
if (isPurchasable)
|
|
{
|
|
_layoutPurchaseCrystalButton.SetActivePurchaseButton(isActive: true);
|
|
_layoutPurchaseCrystalButton.SetToGrayPurchaseButton(isDisable: false);
|
|
_layoutPurchaseCrystalButton.SetOnClickPurchaseButton(delegate
|
|
{
|
|
_onClickPurchaseButton(packConfig, gachaInfo);
|
|
});
|
|
int cost = gachaInfo.Cost * 10;
|
|
_layoutPurchaseCrystalButton.SetBuyCostLabel(cost, "Shop_0112");
|
|
}
|
|
else
|
|
{
|
|
_layoutPurchaseCrystalButton.SetPurchasedVisible(visible: true);
|
|
_layoutPurchaseCrystalButton.SetActivePurchaseButton(isActive: false);
|
|
}
|
|
}
|
|
}
|