This commit is contained in:
liuliang 2024-12-18 12:03:36 +08:00
commit 3b5c92a7f3
4 changed files with 113 additions and 3360 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
public class Manager : MonoBehaviour
{
public static Manager instance;
public Canvas _Canvas;
public List<GameObject> panelsPrefab = new List<GameObject>();
// 使用Dictionary来管理已实例化的面板键为预制体的索引值为实例化的面板
private Dictionary<int, GameObject> panels = new Dictionary<int, GameObject>();
void Awake()
{
instance = this;
}
public GameObject ShowPanel(int index)
{
if (index < 0 || index >= panelsPrefab.Count)
{
Debug.LogError("ShowPanel: Index 超出范围");
return null;
}
if (panels.ContainsKey(index))
{
ShowPanel(panels[index]);
return panels[index];
}
else
{
ShowPanel(panels[index]);
return GameObject.Instantiate(panelsPrefab[index], _Canvas.transform);
}
return null;
}
public virtual void ShowPanel(GameObject _panel)
{
_panel.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
_panel.transform.DOScale(1f, 0.5f);
}
public virtual void hidePanel(GameObject _panel)
{
_panel.SetActive(false);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 540b624a12d7f6b41aa484eb3aaf4aea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,18 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Asset_Details : MonoBehaviour
{
public Text PanelName;
public Text GetMoneyText;
public Text GiveMoneyText;
public Text HaveMoneyText;
// Start is called before the first frame update
void Start()
{
//ShowPanel(3);
}
// Update is called once per frame
void Update()
{
/// <summary>
/// 账单
/// </summary>
/// <param name="type">1宝石,2金币,3水,4锻造令</param>
public async void ShowPanel(int type)
{
billingStatisticsData info=await Scene_main_jiekou.instance.GetbillingStatisticsData(type);
switch (type)
{
case 1:
initPanel("宝石统计", info.Income,info.Expend,info.Balance);
break;
case 2:
initPanel("金币统计", info.Income, info.Expend, info.Balance);
break;
case 3:
initPanel("水滴统计", info.Income, info.Expend, info.Balance);
break;
case 4:
initPanel("锻造令统计", info.Income, info.Expend, info.Balance);
break;
}
}
/// <summary>
/// 初始化panel
/// </summary>
/// <param name="name"></param>
/// <param name="get">获取</param>
/// <param name="give">支出</param>
/// <param name="have">余额</param>
void initPanel(string name,string get,string give,string have)
{
PanelName.text= name;
GetMoneyText.text = "¥"+get;
GiveMoneyText.text = "¥" + give;
HaveMoneyText.text = "¥" + have;
}
}