Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
176 lines
5.9 KiB
C#
176 lines
5.9 KiB
C#
using System;
|
|
using System.Collections;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
public class StorySectionBtn : MonoBehaviour
|
|
{
|
|
public const string BTN_IMAGE_NAME_SUFFIX_OFF = "{0}_off";
|
|
|
|
public const string BTN_IMAGE_NAME_SUFFIX_ON = "{0}_on";
|
|
|
|
private const int POS_Y_NAME_LABEL = 14;
|
|
|
|
private const int POS_Y_NAME_LABEL_COMPLETE = 0;
|
|
|
|
private const int PROLOGUE_SECTION_ID = 0;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelSectionNo;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelSectionName;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelSectionClearClassNum;
|
|
|
|
[SerializeField]
|
|
private Transform _labelSectionCenterRoot;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelSectionNameCenter;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelSectionClearClassNumCenter;
|
|
|
|
[SerializeField]
|
|
private GameObject _labelNewMark;
|
|
|
|
[SerializeField]
|
|
private UITexture _textureBtnImage;
|
|
|
|
[SerializeField]
|
|
private UISprite _textureCompleteImage;
|
|
|
|
private Texture _textureNormalImage;
|
|
|
|
private Texture _texturePressImage;
|
|
|
|
[SerializeField]
|
|
private UIButton _btnSectionSummary;
|
|
|
|
public int SectionId { get; private set; }
|
|
|
|
public void SetData(StorySectionData sectionData, Action onClickSectionBtn, bool isLimitedOrEventStory)
|
|
{
|
|
SectionId = sectionData.Id;
|
|
UILabel uILabel;
|
|
if (!isLimitedOrEventStory && Data.SystemText.Get("Dialog_Text_Alignment") == "Left")
|
|
{
|
|
_labelSectionNameCenter.gameObject.SetActive(value: false);
|
|
_labelSectionClearClassNumCenter.gameObject.SetActive(value: false);
|
|
_labelSectionNo.gameObject.SetActive(value: true);
|
|
_labelSectionName.gameObject.SetActive(value: true);
|
|
_labelSectionClearClassNum.gameObject.SetActive(value: true);
|
|
_labelSectionNo.text = sectionData.NameNo;
|
|
_labelSectionName.text = sectionData.Name;
|
|
uILabel = _labelSectionClearClassNum;
|
|
}
|
|
else
|
|
{
|
|
_labelSectionNameCenter.gameObject.SetActive(value: true);
|
|
_labelSectionClearClassNumCenter.gameObject.SetActive(value: true);
|
|
_labelSectionNo.gameObject.SetActive(value: false);
|
|
_labelSectionName.gameObject.SetActive(value: false);
|
|
_labelSectionClearClassNum.gameObject.SetActive(value: false);
|
|
_labelSectionNameCenter.text = sectionData.NameNo + sectionData.Name;
|
|
uILabel = _labelSectionClearClassNumCenter;
|
|
}
|
|
Vector3 localPosition = uILabel.transform.parent.transform.localPosition;
|
|
if (sectionData.ReleasedCharaCount > 0 && !sectionData.IsFinish)
|
|
{
|
|
uILabel.gameObject.SetActive(value: true);
|
|
uILabel.text = Data.SystemText.Get("Story_0063", sectionData.FinishedCharaCount.ToString(), sectionData.ReleasedCharaCount.ToString());
|
|
uILabel.transform.parent.transform.localPosition = new Vector3(localPosition.x, 14f, localPosition.z);
|
|
}
|
|
else
|
|
{
|
|
uILabel.gameObject.SetActive(value: false);
|
|
uILabel.transform.parent.transform.localPosition = new Vector3(localPosition.x, 0f, localPosition.z);
|
|
}
|
|
_textureNormalImage = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath($"{sectionData.ImageName}_off", ResourcesManager.AssetLoadPathType.UiStory, isfetch: true)) as Texture;
|
|
_texturePressImage = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath($"{sectionData.ImageName}_on", ResourcesManager.AssetLoadPathType.UiStory, isfetch: true)) as Texture;
|
|
_textureBtnImage.mainTexture = _textureNormalImage;
|
|
if (sectionData.IsFinish)
|
|
{
|
|
_textureCompleteImage.gameObject.SetActive(value: true);
|
|
}
|
|
else
|
|
{
|
|
_textureCompleteImage.gameObject.SetActive(value: false);
|
|
}
|
|
UIEventListener uIEventListener = UIEventListener.Get(base.gameObject);
|
|
uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate
|
|
{
|
|
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
|
onClickSectionBtn.Call();
|
|
});
|
|
UIEventListener uIEventListener2 = UIEventListener.Get(base.gameObject);
|
|
uIEventListener2.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener2.onPress, (UIEventListener.BoolDelegate)delegate
|
|
{
|
|
StartCoroutine(OnPressImage());
|
|
});
|
|
if (sectionData.IsUnderMaintenance)
|
|
{
|
|
SetDisableBtn(isDisable: true);
|
|
GameMgr.GetIns().GetPrefabMgr().Load("Prefab/UI/Menu/CardPanelMaintenancePlate");
|
|
GameObject prefab = GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/Menu/CardPanelMaintenancePlate");
|
|
NGUITools.AddChild(base.gameObject, prefab).GetComponent<CardPanelMaintenancePlate>().SetDepth(_labelSectionName.depth + 1);
|
|
}
|
|
if (sectionData.Id != 0 && !isLimitedOrEventStory)
|
|
{
|
|
_btnSectionSummary.gameObject.SetActive(value: true);
|
|
_btnSectionSummary.onClick.Clear();
|
|
_btnSectionSummary.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnClickSectionSummaryBtn(sectionData.Id);
|
|
}));
|
|
}
|
|
else
|
|
{
|
|
_btnSectionSummary.gameObject.SetActive(value: false);
|
|
}
|
|
DispNewMark(inDisp: false);
|
|
if (isLimitedOrEventStory)
|
|
{
|
|
LimitedStoryAjustPosition();
|
|
}
|
|
}
|
|
|
|
private void LimitedStoryAjustPosition()
|
|
{
|
|
_textureCompleteImage.transform.localPosition = new Vector3(178f, _textureCompleteImage.transform.localPosition.y, _textureCompleteImage.transform.localPosition.z);
|
|
_labelSectionCenterRoot.transform.localPosition = Vector3.zero;
|
|
_labelSectionNameCenter.width = 280;
|
|
_labelSectionNameCenter.height = 60;
|
|
}
|
|
|
|
public void SetDisableBtn(bool isDisable)
|
|
{
|
|
UIManager.SetObjectToGrey(_textureBtnImage.gameObject, isDisable);
|
|
}
|
|
|
|
private IEnumerator OnPressImage()
|
|
{
|
|
_textureBtnImage.mainTexture = _texturePressImage;
|
|
while (Input.GetMouseButton(0))
|
|
{
|
|
yield return null;
|
|
}
|
|
_textureBtnImage.mainTexture = _textureNormalImage;
|
|
}
|
|
|
|
private void OnClickSectionSummaryBtn(int sectionId)
|
|
{
|
|
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON);
|
|
StorySectionSummaryDialog.Create(sectionId);
|
|
}
|
|
|
|
public void DispNewMark(bool inDisp)
|
|
{
|
|
_labelNewMark.SetActive(inDisp);
|
|
}
|
|
}
|