currently working prefab dlgpetRec
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BrewMonster.Scripts.Pet;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BrewMonster.UI
|
||||
{
|
||||
public class DlgPetRec : AUIDialog
|
||||
{
|
||||
public const int PETSLOT_MAX = 20;
|
||||
[Header("Component")]
|
||||
[SerializeField] private TextMeshProUGUI m_pTxt_Gold;
|
||||
[SerializeField] private TextMeshProUGUI m_pTxt_Name;
|
||||
[SerializeField] private Image m_pImg_Item;
|
||||
|
||||
[Header("Button")]
|
||||
[SerializeField] private Button m_btnComfirm;
|
||||
[SerializeField] private Button m_btnCancle;
|
||||
[SerializeField] private Button m_btnClose;
|
||||
|
||||
[Header("Icon Default")]
|
||||
[SerializeField] private Sprite m_defaultIcon;
|
||||
|
||||
private int m_nSlot= -1;
|
||||
private CECPetData m_pCurrentPet = null;
|
||||
|
||||
private CECPetData[] m_petSlots = new CECPetData[PETSLOT_MAX];
|
||||
|
||||
private float m_doubleClickTime = 1f;
|
||||
private Dictionary<int, float> m_lastClickTime = new Dictionary<int, float>();
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
// RegisterClick(m_pImg_Item.transform, OnClickPetSlot);
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
ClearPet();
|
||||
LoadPetSlotFromCorral();
|
||||
RegisterPetListDoubleClick();
|
||||
}
|
||||
|
||||
public override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
UnregisterPetListDoubleClick();
|
||||
}
|
||||
|
||||
private void RegisterPetListDoubleClick()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void UnregisterPetListDoubleClick()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Show(bool value)
|
||||
{
|
||||
base.Show(value);
|
||||
if (value)
|
||||
{
|
||||
OnShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnShowDialog(){
|
||||
ClearPet();
|
||||
LoadPetSlotFromCorral();
|
||||
}
|
||||
|
||||
private void ClearPet()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private void RegisterClick(Transform transform1, object onClickEggSlot)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
private void OnCommandConfirm(){
|
||||
// TODO
|
||||
}
|
||||
|
||||
private void SetPet(int nSlot){
|
||||
var host = CECGameRun.Instance.GetHostPlayer();
|
||||
if(host == null)
|
||||
return;
|
||||
var petCorral = host.GetPetCorral();
|
||||
if(petCorral == null)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void LoadPetSlotFromCorral()
|
||||
{
|
||||
Array.Clear(m_petSlots, 0, m_petSlots.Length);
|
||||
|
||||
var host = CECGameRun.Instance?.GetHostPlayer();
|
||||
if(host == null)
|
||||
return;
|
||||
|
||||
var petCorral = host.GetPetCorral();
|
||||
if(petCorral == null)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < PETSLOT_MAX; i++)
|
||||
{
|
||||
m_petSlots[i] = petCorral.GetPetData(i);
|
||||
}
|
||||
}
|
||||
|
||||
public CECPetData GetPetSlot(int slotIndex)
|
||||
{
|
||||
if (slotIndex < 0 || slotIndex >= PETSLOT_MAX)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return m_petSlots[slotIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b015f204bd2048bcbd863ed5f164d98
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37f331119e0524018a0a7266aa257777
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user