This commit is contained in:
2026-07-20 02:52:51 +08:00
parent aba7dc924a
commit 46c43e43bf
8 changed files with 43 additions and 10 deletions
@@ -93,7 +93,26 @@ public class SubUIManager
}
}
/// <summary>
/// 这里使用C#的异步所以操作建议在onshown中进行要不然外面的函数要加异步
/// </summary>
/// <param name="type"></param>
/// <param name="args"></param>
/// <param name="onShown"></param>
public async void ShowAsync(UIPanel type, System.Action args)
{
if (addressMap.ContainsKey(type))
{
args?.Invoke();
UIBase uIBase = await LoadAndShowAsync(type, addressMap[type], null);
}
else
{
Debug.LogError("当前页面不存在");
}
}
private async Task<SubUIBase> LoadAndShowAsync(UIPanel type, string address, object args = null)
{
if (panels.TryGetValue(type, out var existing) && existing != null)
+1 -1
View File
@@ -363,7 +363,7 @@ namespace Assets.MyGame.Scripts.Net
#endif
//这里之后补弹窗
UIManager.Instance.ShowBoardError("错误代码:" + code + "错误信息:" + message);
UIManager.Instance.ShowBoardError(message);
}
}
}
@@ -214,9 +214,9 @@ namespace Assets.MyGame.Scripts.Net
#if UNITY_EDITOR
Debug.LogWarning($"[WebSocket] {type} 未连接,无法发送消息" + msg);
UIManager.Instance.ShowBoardError($"[WebSocket] {type} 未连接,无法发送消息");
#endif
UIManager.Instance.ShowBoardError($"[WebSocket] {type} 未连接,无法发送消息");
}
}
@@ -583,7 +583,7 @@ namespace Assets.MyGame.Scripts.Net
string roomName = GameManager.Instance.gameData.currRoomData?.roomName ?? "";
string roomLevel = GameManager.Instance.gameData.currRoomData?.roomLevel.ToString() ?? "";
string msgText = $"恭喜用户{userName} 在 {roomName} {roomLevel}场 捕获了{fishId}*{gold}倍";
UIManager.Instance.ShowBoardGongGao(msgText);
//UIManager.Instance.ShowBoardGongGao(msgText);
}
break;
@@ -2576,6 +2576,7 @@ MonoBehaviour:
toggle_Black: {fileID: 4300691433647707251}
tMPInput_Password: {fileID: 5686063089244421633}
TiShi: {fileID: 6026358677931071003}
btn_VIP: {fileID: 6523045360275411240}
--- !u!1 &6814235304022214699
GameObject:
m_ObjectHideFlags: 0
@@ -83,10 +83,18 @@ public class UIChineseChessCreateRoom : SubUIBase
}
public GameObject TiShi;
public Button btn_VIP;
public void ShowTiShi()
{
TiShi.SetActive(true);
btn_VIP.onClick.AddListener(() =>{
uIManager.Get<UIHome_BY_ShopPanel>(UIPanel.HomeMainPanel)?.uIManager.ShowAsync(UIPanel.ShopPanel, () =>
{
uIManager.Close(UIPanel.MainGamePanelZGXQ);
});
});
}
}
@@ -85,7 +85,7 @@ public class UIHome_BY_SelectRoomLevelPanel : SubUIBase
{
HideTiShi();
UIManager.Instance.Get<UIHomeMain>(UIPanel.HomeMainPanel)
.subUIManager.ShowAsync(UIPanel.ShopPanel, ShopTab.Diamond);
.subUIManager.ShowAsync(UIPanel.ShopPanel, ShopTab.VipExp);
});
}
@@ -83,7 +83,7 @@ public class UIHome_BY_ShopPanel : SubUIBase
{
APIRequestList.BuyGold(new BuyGoldParam { number = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
UIManager.Instance.ShowBoardError("购买成功");
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
@@ -130,7 +130,8 @@ public class UIHome_BY_ShopPanel : SubUIBase
{
APIRequestList.BuyGold(new BuyGoldParam { number = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
UIManager.Instance.ShowBoardError("购买成功");
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
@@ -179,7 +180,8 @@ public class UIHome_BY_ShopPanel : SubUIBase
{
APIRequestList.BuyDiamond(new BuyDiamondParam { number = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
UIManager.Instance.ShowBoardError("购买成功");
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
@@ -227,7 +229,8 @@ public class UIHome_BY_ShopPanel : SubUIBase
{
APIRequestList.BuyProp(new BuyPropParam { propNumber = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
UIManager.Instance.ShowBoardError("购买成功");
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
@@ -269,7 +272,8 @@ public class UIHome_BY_ShopPanel : SubUIBase
{
APIRequestList.BuyProp(new BuyPropParam { propNumber = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
UIManager.Instance.ShowBoardError("购买成功");
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);
@@ -320,7 +324,8 @@ public class UIHome_BY_ShopPanel : SubUIBase
{
APIRequestList.BuyProp(new BuyPropParam { propNumber = item.number, count = 1 }, (response) =>
{
UIManager.Instance.ShowBoardError(response);
UIManager.Instance.ShowBoardError("购买成功");
APIRequestList.GetUser(GameManager.Instance.user.id, (a) =>
{
GameManager.Instance.UpdataUserData(a);