Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
265 lines
5.4 KiB
C#
265 lines
5.4 KiB
C#
using System;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
public class GachaLayoutPurchaseButton : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private GameObject _layoutRoot;
|
|
|
|
[SerializeField]
|
|
private UIButton _purchaseButton;
|
|
|
|
[SerializeField]
|
|
private UILabel _buyCostLabel;
|
|
|
|
[SerializeField]
|
|
private UILabel _haveItemLabel;
|
|
|
|
[SerializeField]
|
|
private GameObject _purchasedRoot;
|
|
|
|
[SerializeField]
|
|
private UILabel _purchasedLabel;
|
|
|
|
[SerializeField]
|
|
private GameObject _remainLabelRoot;
|
|
|
|
[SerializeField]
|
|
private GameObject _freePackLeaderSkinObj;
|
|
|
|
[SerializeField]
|
|
private GameObject _ribbon;
|
|
|
|
[SerializeField]
|
|
private GameObject _ribbonIcon;
|
|
|
|
[SerializeField]
|
|
private UILabel _ribbonLabel;
|
|
|
|
[SerializeField]
|
|
private GameObject _remainCountRoot;
|
|
|
|
[SerializeField]
|
|
private UILabel _freePackApealText;
|
|
|
|
[SerializeField]
|
|
private UILabel _inButtonLabel;
|
|
|
|
[SerializeField]
|
|
private UISprite _frame;
|
|
|
|
private const string RIBBON_SPRITE_RED = "campaign_title_02";
|
|
|
|
private const string RIBBON_SPRITE_PINK = "campaign_title_04";
|
|
|
|
private const float RIBBON_LABEL_POS_X = 5f;
|
|
|
|
private const float RIBBON_LABEL_POS_X_WITH_ICON = 26.3f;
|
|
|
|
private const int RIBBON_LABEL_WIDTH = 203;
|
|
|
|
private const int RIBBON_LABEL_WIDTH_WITH_ICON = 167;
|
|
|
|
public Vector3 LayoutLocalPosition
|
|
{
|
|
get
|
|
{
|
|
return _layoutRoot.transform.localPosition;
|
|
}
|
|
set
|
|
{
|
|
_layoutRoot.transform.localPosition = value;
|
|
}
|
|
}
|
|
|
|
public Transform PurchaseButtonTransform => _purchaseButton.transform;
|
|
|
|
public void SetActiveLayout(bool isActive)
|
|
{
|
|
_layoutRoot.SetActive(isActive);
|
|
}
|
|
|
|
public void SetActivePurchaseButton(bool isActive)
|
|
{
|
|
_purchaseButton.gameObject.SetActive(isActive);
|
|
}
|
|
|
|
public void SetPurchasedMode(bool isPurchased)
|
|
{
|
|
SetPurchasedVisible(isPurchased);
|
|
SetActivePurchaseButton(!isPurchased);
|
|
}
|
|
|
|
public void SetOnClickPurchaseButton(Action onClick)
|
|
{
|
|
_purchaseButton.onClick.Clear();
|
|
_purchaseButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
onClick.Call();
|
|
}));
|
|
}
|
|
|
|
public void SetToGrayPurchaseButton(bool isDisable)
|
|
{
|
|
UIManager.SetObjectToGrey(_purchaseButton.gameObject, isDisable);
|
|
}
|
|
|
|
public void SetBuyCostLabel(int cost, string staticTextId = null)
|
|
{
|
|
if (!(_buyCostLabel == null))
|
|
{
|
|
string text = cost.ToString();
|
|
if (!string.IsNullOrEmpty(staticTextId))
|
|
{
|
|
text = Data.SystemText.Get(staticTextId, text);
|
|
}
|
|
_buyCostLabel.text = text;
|
|
}
|
|
}
|
|
|
|
public void SetHaveItemLabel(int itemNum)
|
|
{
|
|
if (!(_haveItemLabel == null))
|
|
{
|
|
_haveItemLabel.text = itemNum.ToString();
|
|
}
|
|
}
|
|
|
|
public void SetPurchasedVisible(bool visible)
|
|
{
|
|
if (!(_purchasedRoot == null))
|
|
{
|
|
_purchasedRoot.SetActive(visible);
|
|
}
|
|
}
|
|
|
|
public void SetPurchasedLabel(string textId)
|
|
{
|
|
if (!(_purchasedLabel == null))
|
|
{
|
|
_purchasedLabel.text = Data.SystemText.Get(textId);
|
|
}
|
|
}
|
|
|
|
public void SetRemainLabelVisible(bool visible)
|
|
{
|
|
if (!(_remainLabelRoot == null))
|
|
{
|
|
_remainLabelRoot.SetActive(visible);
|
|
}
|
|
}
|
|
|
|
public void SetFreePackLeaderSkinVisible(bool visible)
|
|
{
|
|
if (!(_freePackLeaderSkinObj == null))
|
|
{
|
|
_freePackLeaderSkinObj.SetActive(visible);
|
|
}
|
|
}
|
|
|
|
public void SetFreePackLeaderSkinText(string text)
|
|
{
|
|
if (_freePackLeaderSkinObj != null)
|
|
{
|
|
_freePackLeaderSkinObj.GetComponent<UILabel>().text = text;
|
|
}
|
|
}
|
|
|
|
public void SetRibbonActive(bool active)
|
|
{
|
|
if (_ribbon != null)
|
|
{
|
|
_ribbon.SetActive(active);
|
|
}
|
|
}
|
|
|
|
public void SetPinkRibbon(bool isPink)
|
|
{
|
|
if (_ribbon != null)
|
|
{
|
|
if (isPink)
|
|
{
|
|
_ribbon.GetComponent<UISprite>().spriteName = "campaign_title_04";
|
|
}
|
|
else
|
|
{
|
|
_ribbon.GetComponent<UISprite>().spriteName = "campaign_title_02";
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SetIconActive(bool active, string iconSprite)
|
|
{
|
|
if (_ribbonIcon != null)
|
|
{
|
|
_ribbonIcon.GetComponent<UISprite>().spriteName = iconSprite;
|
|
_ribbonIcon.SetActive(active);
|
|
if (_ribbonLabel != null)
|
|
{
|
|
float x = (active ? 26.3f : 5f);
|
|
int width = (active ? 167 : 203);
|
|
Vector3 localPosition = _ribbonLabel.gameObject.transform.localPosition;
|
|
localPosition.x = x;
|
|
_ribbonLabel.gameObject.transform.localPosition = localPosition;
|
|
_ribbonLabel.width = width;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SetWinterSprite(bool active)
|
|
{
|
|
if (active)
|
|
{
|
|
if (_ribbon != null)
|
|
{
|
|
_ribbon.GetComponent<UISprite>().spriteName = "campaign_title_02_winter";
|
|
}
|
|
if (_purchaseButton != null)
|
|
{
|
|
_purchaseButton.normalSprite = "btn_free_pack_off_winter";
|
|
_purchaseButton.hoverSprite = "btn_free_pack_off_winter";
|
|
_purchaseButton.pressedSprite = "btn_free_pack_on_winter";
|
|
}
|
|
if (_frame != null)
|
|
{
|
|
_frame.spriteName = "frame_12_winter";
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SetRemainCountRootVisible(bool visible)
|
|
{
|
|
if (_remainCountRoot != null)
|
|
{
|
|
_remainCountRoot.SetActive(visible);
|
|
}
|
|
}
|
|
|
|
public void SetFreePackApealTextVisible(bool visible)
|
|
{
|
|
if (_freePackApealText != null)
|
|
{
|
|
_freePackApealText.gameObject.SetActive(visible);
|
|
}
|
|
}
|
|
|
|
public void SetFreePackApealText(string text)
|
|
{
|
|
if (_freePackApealText != null)
|
|
{
|
|
_freePackApealText.text = text;
|
|
}
|
|
}
|
|
|
|
public void SetInButtonText(string text)
|
|
{
|
|
if (_inButtonLabel != null)
|
|
{
|
|
_inButtonLabel.text = text;
|
|
}
|
|
}
|
|
}
|