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.
158 lines
4.7 KiB
C#
158 lines
4.7 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using Wizard;
|
|
|
|
public class MyPageCardDetail : MonoBehaviour
|
|
{
|
|
private const float POSITION_Y = -88f;
|
|
|
|
private const float CARD_ROTATION = 100f;
|
|
|
|
private const float CARD_ROTATION_MIN_X = -65f;
|
|
|
|
private const float CARD_ROTATION_MAX_X = 35f;
|
|
|
|
private const float CARD_ROTATION_MIN_Y = -50f;
|
|
|
|
private const float CARD_ROTATION_MAX_Y = 50f;
|
|
|
|
[SerializeField]
|
|
private GameObject prefabCardDetailWindow;
|
|
|
|
[SerializeField]
|
|
private GameObject m_CardObj;
|
|
|
|
[SerializeField]
|
|
private UIEventListener m_TouchEventListener;
|
|
|
|
[SerializeField]
|
|
private UIEventListener _touchColliderBG;
|
|
|
|
private bool m_IsDrag;
|
|
|
|
private Vector3 m_CardViewPortPoint = Vector3.zero;
|
|
|
|
public MyPageMenu MyPageMenuClass;
|
|
|
|
private int _cardId;
|
|
|
|
public SimpleCardDetail CardDetailWindow { get; private set; }
|
|
|
|
public bool IsCardObjRotateTween { get; private set; }
|
|
|
|
private void Start()
|
|
{
|
|
CardDetailWindow = NGUITools.AddChild(base.gameObject, prefabCardDetailWindow).GetComponent<SimpleCardDetail>();
|
|
CardDetailWindow.SetLocalOffset(Vector3.up * -88f);
|
|
CardDetailWindow.ActiveCraftPanel(isActive: false);
|
|
CardDetailWindow.ActiveCloseCollider(isActive: false);
|
|
SetTouchEvent();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (IsCardObjRotateTween && m_CardObj.transform.localEulerAngles.magnitude < 3f)
|
|
{
|
|
ResetAngleCardObj();
|
|
IsCardObjRotateTween = false;
|
|
}
|
|
}
|
|
|
|
public void UpdateCardData(int cardId)
|
|
{
|
|
_cardId = cardId;
|
|
if (CardDetailWindow != null && CardDetailWindow.IsVisible)
|
|
{
|
|
CardDetailWindow.ChangeDetail(_cardId, CardMaster.CardMasterId.Default);
|
|
}
|
|
}
|
|
|
|
public void ResetAngleCardObj()
|
|
{
|
|
iTween.Stop(m_CardObj);
|
|
m_CardObj.transform.localEulerAngles = Vector3.zero;
|
|
}
|
|
|
|
private void SetTouchEvent()
|
|
{
|
|
UIEventListener touchColliderBG = _touchColliderBG;
|
|
touchColliderBG.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(touchColliderBG.onClick, new UIEventListener.VoidDelegate(OnClickBG));
|
|
UIEventListener touchEventListener = m_TouchEventListener;
|
|
touchEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(touchEventListener.onClick, new UIEventListener.VoidDelegate(OnClick));
|
|
UIEventListener touchEventListener2 = m_TouchEventListener;
|
|
touchEventListener2.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(touchEventListener2.onDrag, new UIEventListener.VectorDelegate(OnDrag));
|
|
UIEventListener touchEventListener3 = m_TouchEventListener;
|
|
touchEventListener3.onDragStart = (UIEventListener.VoidDelegate)Delegate.Combine(touchEventListener3.onDragStart, new UIEventListener.VoidDelegate(OnDragStart));
|
|
UIEventListener touchEventListener4 = m_TouchEventListener;
|
|
touchEventListener4.onDragEnd = (UIEventListener.VoidDelegate)Delegate.Combine(touchEventListener4.onDragEnd, new UIEventListener.VoidDelegate(OnDragEnd));
|
|
}
|
|
|
|
private void OnClickBG(GameObject gameObj)
|
|
{
|
|
if (CardDetailWindow.IsVisible)
|
|
{
|
|
CardDetailWindow.HideDetail();
|
|
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_INFO_CANCEL);
|
|
MyPageMenuClass.ShowBanner();
|
|
}
|
|
}
|
|
|
|
private void OnClick(GameObject gameObj)
|
|
{
|
|
if (CardDetailWindow.IsVisible)
|
|
{
|
|
CardDetailWindow.HideDetail();
|
|
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_INFO_CANCEL);
|
|
MyPageMenuClass.ShowBanner();
|
|
}
|
|
else
|
|
{
|
|
CardDetailWindow.ChangeDetail(_cardId, CardMaster.CardMasterId.Default);
|
|
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_INFO_SMALL);
|
|
MyPageMenuClass.HideBanner();
|
|
}
|
|
}
|
|
|
|
private void OnDrag(GameObject g, Vector2 delta)
|
|
{
|
|
if (m_IsDrag)
|
|
{
|
|
Vector3 vector = m_CardViewPortPoint - UICamera.currentCamera.ScreenToViewportPoint(UICamera.lastEventPosition);
|
|
Vector3 vector2 = new Vector3(0f - vector.y, vector.x, 0f) * 100f;
|
|
vector2 = new Vector3(Mathf.Clamp(vector2.x, -65f, 35f), Mathf.Clamp(vector2.y, -50f, 50f), 0f);
|
|
m_CardObj.transform.localEulerAngles = vector2;
|
|
}
|
|
}
|
|
|
|
private void OnDragStart(GameObject gameObj)
|
|
{
|
|
iTween component = m_CardObj.GetComponent<iTween>();
|
|
if (null != component)
|
|
{
|
|
component.enabled = false;
|
|
}
|
|
m_CardViewPortPoint = UICamera.currentCamera.WorldToViewportPoint(m_CardObj.transform.position);
|
|
m_IsDrag = true;
|
|
}
|
|
|
|
private void OnDragEnd(GameObject gameObj)
|
|
{
|
|
iTween component = m_CardObj.GetComponent<iTween>();
|
|
if (null != component)
|
|
{
|
|
component.enabled = true;
|
|
}
|
|
IsCardObjRotateTween = true;
|
|
iTween.RotateTo(m_CardObj, iTween.Hash("rotation", Vector3.zero, "islocal", true, "time", 0.5f));
|
|
m_IsDrag = false;
|
|
}
|
|
|
|
private void OnApplicationPause(bool paused)
|
|
{
|
|
if (!paused)
|
|
{
|
|
ResetAngleCardObj();
|
|
}
|
|
}
|
|
}
|