2024-12-13 05:40:51 +08:00
using DG.Tweening ;
2024-12-09 18:01:59 +08:00
using System.Collections ;
using System.Collections.Generic ;
using UnityEngine ;
using UnityEngine.UI ;
2024-12-13 05:40:51 +08:00
2024-12-25 21:49:36 +08:00
public class cardBox : Base
2024-12-09 18:01:59 +08:00
{
public static cardBox instance ;
2024-12-25 21:49:36 +08:00
[HideInInspector] public int mengyaoNumber = 0 ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-13 05:40:51 +08:00
[HideInInspector] public int inPlaceNumber = 0 ;
2024-12-09 18:01:59 +08:00
[Header("<22> <> ʼ <EFBFBD> <CABC> ťobj")] public GameObject btnObj ;
2024-12-11 21:34:19 +08:00
[Header("<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> <CFA2> ʾ <EFBFBD> <CABE> ťobj")] public GameObject IconTipObj ;
2024-12-13 05:40:51 +08:00
2025-01-06 16:13:39 +08:00
// [Header("<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> б <EFBFBD> ")] public List<MengyaoCardData> mengyaoCardDataList = new List<MengyaoCardData>();
2024-12-13 05:40:51 +08:00
[Header("<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɸ<EFBFBD> <C9B8> ڵ<EFBFBD> ")] public Transform parentPos ;
public float scaleUpDuration = 0.5f ; // <20> <> <EFBFBD> Ŷ<EFBFBD> <C5B6> <EFBFBD> ʱ<EFBFBD> <CAB1>
public float fadeInDuration = 0.5f ; // <20> <> <EFBFBD> 붯<EFBFBD> <EBB6AF> ʱ<EFBFBD> <CAB1>
// ID<49> <44> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ԥ<EFBFBD> <D4A4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ӳ<EFBFBD> <D3B3> <EFBFBD> ֵ<EFBFBD>
private Dictionary < string , GameObject > IDTomangyaoPrefab = new Dictionary < string , GameObject > ( ) ;
2024-12-24 15:38:28 +08:00
//public Dictionary<string,>
2024-12-13 22:29:17 +08:00
[HideInInspector] public List < GameObject > card = new List < GameObject > ( ) ;
2024-12-09 18:01:59 +08:00
private void Awake ( )
{
instance = this ;
2024-12-25 21:49:36 +08:00
2024-12-13 05:40:51 +08:00
}
void Start ( )
{
if ( btnObj = = null )
2024-12-09 18:01:59 +08:00
{
Debug . LogError ( "btnObj==null" ) ;
return ;
}
2024-12-13 05:40:51 +08:00
2024-12-09 18:01:59 +08:00
btnObj . SetActive ( false ) ;
2024-12-13 05:40:51 +08:00
Init ( ) ;
2024-12-25 21:49:36 +08:00
mengyaoNumber = Base . GlobalObj . GetComponent < gameGlobal > ( ) . CarryCardId . Count ;
2024-12-09 18:01:59 +08:00
}
2024-12-13 05:40:51 +08:00
public void ChangeInPlaceNumber ( int number )
2024-12-09 18:01:59 +08:00
{
inPlaceNumber + = number ;
2024-12-13 05:40:51 +08:00
if ( inPlaceNumber = = mengyaoNumber )
2024-12-09 18:01:59 +08:00
{
gameGlobal . GameStart ( ) ;
2024-12-12 23:04:13 +08:00
//Debug.Log("<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ");
2024-12-09 18:01:59 +08:00
btnObj . SetActive ( true ) ;
2024-12-13 05:40:51 +08:00
btnObj . GetComponent < Button > ( ) . onClick . AddListener ( ( ) = >
{
2024-12-11 21:34:19 +08:00
IconTipObj . gameObject . SetActive ( true ) ;
2024-12-09 23:24:46 +08:00
btnObj . SetActive ( false ) ;
2024-12-09 18:01:59 +08:00
} ) ;
}
}
2024-12-13 05:40:51 +08:00
2025-01-06 16:13:39 +08:00
2024-12-13 05:40:51 +08:00
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> CarryCardId<49> б <EFBFBD> <D0B1> <EFBFBD> <EFBFBD> ɶ<EFBFBD> Ӧ<EFBFBD> <D3A6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
void Init ( )
{
// <20> <> ȡ CarryCardId <20> б <EFBFBD>
List < string > carryCardIdList = Base . GlobalObj . GetComponent < gameGlobal > ( ) . CarryCardId ;
2024-12-14 00:14:40 +08:00
2024-12-13 05:40:51 +08:00
foreach ( string id in carryCardIdList )
{
2025-01-06 16:13:39 +08:00
mengyaoInfo info = MY_Infos . instane . GetMY ( id ) ;
if ( info ! = null )
2024-12-13 05:40:51 +08:00
{
2025-01-06 16:13:39 +08:00
2024-12-13 05:40:51 +08:00
// ʵ<> <CAB5> <EFBFBD> <EFBFBD> Ԥ<EFBFBD> <D4A4> <EFBFBD> 壬<EFBFBD> <E5A3AC> <EFBFBD> ø<EFBFBD> <C3B8> ڵ<EFBFBD> Ϊ parentPos
2025-01-06 16:13:39 +08:00
GameObject card = Instantiate ( info . cardprefab , parentPos ) ;
2024-12-13 22:29:17 +08:00
//card.GetComponent<enemy>().enemyId = id;
//this.card.Add(card);
2024-12-13 05:40:51 +08:00
// ȷ<> <C8B7> <EFBFBD> <EFBFBD> <EFBFBD> Ƶ<EFBFBD> <C6B5> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ0<CEAA> <30> <EFBFBD> <D7BC> <EFBFBD> <EFBFBD> <EFBFBD> зŴ<C5B4>
card . transform . localScale = Vector3 . zero ;
// ȷ<> <C8B7> <EFBFBD> <EFBFBD> <EFBFBD> Ƶ<EFBFBD> λ<EFBFBD> <CEBB> Ϊ<EFBFBD> <CEAA> <EFBFBD> ڵ<EFBFBD> <DAB5> ı <EFBFBD> <C4B1> <EFBFBD> λ<EFBFBD> <CEBB>
card . transform . localPosition = Vector3 . zero ;
// <20> <> <EFBFBD> ŷŴ<C5B4>
card . transform . DOScale ( Vector3 . one , scaleUpDuration ) . SetEase ( Ease . OutBack ) ;
}
}
}
2024-12-09 18:01:59 +08:00
}