整理抽卡结果代码
parent
107ccab5ae
commit
8c7a6d66d8
BIN
ProjectNLD/Assets/Art/UI/Fonts/SourceHanSansCN-Medium SDF.asset (Stored with Git LFS)
BIN
ProjectNLD/Assets/Art/UI/Fonts/SourceHanSansCN-Medium SDF.asset (Stored with Git LFS)
Binary file not shown.
|
|
@ -1610,7 +1610,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 7581025338141196448}
|
||||
m_Layer: 5
|
||||
m_Name: UIRaffle
|
||||
m_Name: UI_Raffle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 30b9dad7869a7d94885d8b6a6c649516
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -39,8 +39,9 @@ public partial class UIManager
|
|||
_WindowMeta(UINameConst.UIRedPointTest, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UITeamChoose, UIWindowLayer.Normal, UIOpenType.FullScreen);
|
||||
_WindowMeta(UINameConst.UITeamInfo, UIWindowLayer.Normal, UIOpenType.FullScreen);
|
||||
_WindowMeta(UINameConst.UIRaffleResult,UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UIRaffle, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UI_RaffleTotalResult,UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UI_Raffle, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UI_RaffleOneResult, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UIStoryMain, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UINewLogin, UIWindowLayer.Normal);
|
||||
_WindowMeta(UINameConst.UIGiftCode, UIWindowLayer.Normal);
|
||||
|
|
@ -135,11 +136,15 @@ public static class UINameConst
|
|||
/// <summary>
|
||||
/// 抽卡界面
|
||||
/// </summary>
|
||||
public static readonly string UIRaffle = "MainScene/Raffle/UIRaffle"; // 测试
|
||||
public static readonly string UI_Raffle = "MainScene/Raffle/UI_Raffle"; // 测试
|
||||
/// <summary>
|
||||
/// 单次抽取结果
|
||||
/// </summary>
|
||||
public static readonly string UI_RaffleOneResult = "MainScene/Raffle/UI_RaffleOneResult"; // 测试
|
||||
/// <summary>
|
||||
/// 抽卡结果界面
|
||||
/// </summary>
|
||||
public static readonly string UIRaffleResult = "MainScene/Raffle/UIRaffleResult"; // 测试
|
||||
public static readonly string UI_RaffleTotalResult = "MainScene/Raffle/UI_RaffleTotalResult"; // 测试
|
||||
|
||||
public static readonly string UIVersionUpdate = "VersionUpdate/UI_VersionUpdate";
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace Gameplay.Net
|
|||
if (m_Counts.TryGetValue(GachaID, out RaffleCount count))
|
||||
return count;
|
||||
|
||||
DebugUtil.LogError("没有ID为{0}的池子", GachaID);
|
||||
DebugUtil.LogWarning($"没有ID为{GachaID}的卡池的抽取数据");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,125 +0,0 @@
|
|||
using cfg.CharacterCfg;
|
||||
using Framework;
|
||||
using Gameplay;
|
||||
using Gameplay.Net;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIRaffleResultController : UIWindow
|
||||
{
|
||||
private ItemCounts mNowItems;
|
||||
private Image Image_poster;
|
||||
private TMP_Text Name;
|
||||
private Button RaffleOne;
|
||||
private Button RaffleTen;
|
||||
private Button mHome_Btn;
|
||||
private Button mBack_Btn;
|
||||
public override void OnInit()
|
||||
{
|
||||
|
||||
RaffleOne = GetComponent<Button>("RaffleOneBtn");
|
||||
RaffleTen = GetComponent<Button>("RaffleTenBtn");
|
||||
Image_poster = GetComponent<Image>("Single/Image_Poster00");
|
||||
Name =FindObj("Single/Image_GroupLogo/Image_NameInfo/Text_CharacterName").GetComponent<TMP_Text>();
|
||||
mBack_Btn = GetComponent<Button>("Button_Back");
|
||||
mHome_Btn = GetComponent<Button>("Button_Home");
|
||||
|
||||
BindButton(RaffleOne, OnRaffleOne);
|
||||
BindButton(RaffleTen, OnRaffleTen);
|
||||
BindButton(mBack_Btn, OnBackOnClick);
|
||||
}
|
||||
private void OnBackOnClick()
|
||||
{
|
||||
CloseWindow();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void OnRaffleTen()
|
||||
{
|
||||
}
|
||||
|
||||
private void OnRaffleOne()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
mNowItems=data as ItemCounts;
|
||||
RefreshAll(mNowItems);
|
||||
|
||||
// RefreshBtns();
|
||||
|
||||
}
|
||||
|
||||
public void RefreshAll(ItemCounts data)
|
||||
{
|
||||
RefreshAwards(data);
|
||||
RefreshRemain();
|
||||
}
|
||||
private void RefreshRemain()
|
||||
{
|
||||
GetComponent<TMP_Text>("Remain/remain").text = "抽卡道具:" + Actor.Instance.Item.GetItemCount(2);
|
||||
}
|
||||
|
||||
|
||||
public void RefreshAwards(ItemCounts awards)
|
||||
{
|
||||
if (awards.Ids.Count == 1)
|
||||
{
|
||||
RefreshSingleAwards(awards);
|
||||
}
|
||||
else if(awards.Ids.Count>1)
|
||||
{
|
||||
RefreshMultiAwards(awards);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUtil.LogError("奖励数据不对");
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshMultiAwards(ItemCounts awards)
|
||||
{
|
||||
FindObj("Single").SetActive(false);
|
||||
FindObj("Multilple").SetActive(true);
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
GameObject obj = FindObj(string.Format("Multilple/1/{0}",i));
|
||||
if (i <= awards.Ids.Count)
|
||||
{
|
||||
obj.SetActive(true);
|
||||
RefreshSingleCharacter(obj,awards.Ids[i - 1], awards.Counts[i-1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void RefreshSingleCharacter(GameObject obj,uint id ,uint count)
|
||||
{
|
||||
DebugUtil.LogError("抽取的角色Id为:" + id);
|
||||
int uid = TableManager.Instance.Tables.Item.GetOrDefault((int)id).Param1;
|
||||
CommonUtils.RefreshCharacter2DPic(CommonUtils.GetComponent<Image>(obj, "Image_Poster"), uid, CommonUtils.ECharacterPicPathType.SelectCharacter);
|
||||
|
||||
}
|
||||
|
||||
private void RefreshSingleAwards(ItemCounts awards)
|
||||
{
|
||||
FindObj("Single").SetActive(true);
|
||||
FindObj("Multilple").SetActive(false);
|
||||
|
||||
int cId = TableManager.Instance.Tables.Item.GetOrDefault((int)awards.Ids[0]).Param1;
|
||||
DataCharacterAttri cfg = TableManager.Instance.Tables.CharacterAttri.GetOrDefault(cId);
|
||||
CommonUtils.RefreshCharacter2DPic(Image_poster, cfg.RoleID, CommonUtils.ECharacterPicPathType.Cultivate);
|
||||
Name.text = CommonUtils.GetLocalizeText(cfg.Name);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,19 +8,19 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Button = UnityEngine.UI.Button;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// 抽卡测试界面
|
||||
/// </summary>
|
||||
public class UIRaffleController : UIWindow
|
||||
public class UI_RaffleController : UIWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// 打开抽卡界面
|
||||
/// </summary>
|
||||
public static async UniTask<UIWindow> Open()
|
||||
{
|
||||
return await UIManager.Instance.OpenWindow(UINameConst.UIRaffle);
|
||||
return await UIManager.Instance.OpenWindow(UINameConst.UI_Raffle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -201,10 +201,7 @@ public class UIRaffleController : UIWindow
|
|||
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
foreach (RafflePoolForDisplay rafflePoolForDisplay in listRaffle)
|
||||
{
|
||||
rafflePoolForDisplay.Refresh();
|
||||
}
|
||||
RefreshData();
|
||||
|
||||
recycleView.ShowList(listRaffle.Count);
|
||||
}
|
||||
|
|
@ -235,6 +232,9 @@ public class UIRaffleController : UIWindow
|
|||
case GachaDrawType.NormalOne:
|
||||
res = gachaDrawType;
|
||||
return (uint)res;
|
||||
case GachaDrawType.LimitTen:
|
||||
case GachaDrawType.NormalTen:
|
||||
break;
|
||||
default:
|
||||
DebugUtil.LogError("未处理类型");
|
||||
break;
|
||||
|
|
@ -252,6 +252,9 @@ public class UIRaffleController : UIWindow
|
|||
case GachaDrawType.NormalTen:
|
||||
res = gachaDrawType;
|
||||
return (uint)res;
|
||||
case GachaDrawType.LimitOne:
|
||||
case GachaDrawType.NormalOne:
|
||||
break;
|
||||
default:
|
||||
DebugUtil.LogError("未处理类型");
|
||||
break;
|
||||
|
|
@ -269,7 +272,27 @@ public class UIRaffleController : UIWindow
|
|||
return (uint)res;
|
||||
}
|
||||
|
||||
#region 刷新回调
|
||||
/// <summary>
|
||||
/// 抽卡结果
|
||||
/// </summary>
|
||||
/// <param name="itemCounts"></param>
|
||||
private async void OnRecvUIReturnRaffleResult(ItemCounts itemCounts)
|
||||
{
|
||||
RefreshData();
|
||||
RefreshPool();
|
||||
|
||||
if (itemCounts.Ids.Count == 0)
|
||||
{
|
||||
DebugUtil.LogError("没有东西");
|
||||
return;
|
||||
}
|
||||
else if (itemCounts.Ids.Count == 1)
|
||||
await UI_RaffleOneResultController.Open((int)itemCounts.Ids[0]);
|
||||
else
|
||||
await UI_RaffleTotalResultController.Open(itemCounts);
|
||||
}
|
||||
|
||||
#region 刷新方法
|
||||
/// <summary>
|
||||
/// 无限列表刷新单个项
|
||||
/// </summary>
|
||||
|
|
@ -312,6 +335,17 @@ public class UIRaffleController : UIWindow
|
|||
textRemain2.text = $"十连抽道具: {itemName}X{Actor.Instance.Item.GetItemCount(dataItem.ID)}";
|
||||
textTenCost.text = $"{itemName}X{curTab.RaffleData.Cfg.Cost[1].Count}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新数据
|
||||
/// </summary>
|
||||
private void RefreshData()
|
||||
{
|
||||
foreach (RafflePoolForDisplay rafflePoolForDisplay in listRaffle)
|
||||
{
|
||||
rafflePoolForDisplay.Refresh();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 按钮点击回调方法
|
||||
|
|
@ -387,22 +421,5 @@ public class UIRaffleController : UIWindow
|
|||
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UI_Patio, normalShopDataForGacha);*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 抽卡结果
|
||||
/// </summary>
|
||||
/// <param name="itemCounts"></param>
|
||||
private async void OnRecvUIReturnRaffleResult(ItemCounts itemCounts)
|
||||
{
|
||||
if (itemCounts.Ids.Count == 0)
|
||||
{
|
||||
DebugUtil.LogError("没有东西");
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshPool();
|
||||
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UIRaffleResult, itemCounts);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1efbedebe84044e47ba56976ca65eeb1
|
||||
guid: ec096f48f0d19ed43b5bdf53a93181e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
using cfg.ActorCfg;
|
||||
using cfg.CharacterCfg;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Framework;
|
||||
using Gameplay;
|
||||
using Gameplay.Net;
|
||||
using PhxhSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// 单次抽卡结果测试界面
|
||||
/// </summary>
|
||||
public class UI_RaffleOneResultController : UIWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// 打开单次抽卡结果界面
|
||||
/// </summary>
|
||||
public static async UniTask<UIWindow> Open(int characterId)
|
||||
{
|
||||
return await UIManager.Instance.OpenWindow(UINameConst.UI_RaffleOneResult, characterId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主页
|
||||
/// </summary>
|
||||
private Button btnHome;
|
||||
/// <summary>
|
||||
/// 返回
|
||||
/// </summary>
|
||||
private Button btnBack;
|
||||
/// <summary>
|
||||
/// 角色立绘
|
||||
/// </summary>
|
||||
private Image imagePoster;
|
||||
/// <summary>
|
||||
/// 角色名
|
||||
/// </summary>
|
||||
private TMP_Text textName;
|
||||
|
||||
public override void OnInit()
|
||||
{
|
||||
btnBack = GetComponent<Button>("ImageBG/UI_Topbtn/Button_Back");
|
||||
btnHome = GetComponent<Button>("ImageBG/UI_Topbtn/Button_Home");
|
||||
imagePoster = GetComponent<Image>("ImageBG/Image_Poster");
|
||||
textName = GetComponent<TMP_Text>("ImageBG/Image_GroupLogo/Image_NameInfo/Text_CharacterName");
|
||||
|
||||
BindButton(btnBack, OnBackOnClick);
|
||||
BindButton(btnHome, OnHomeBtnOnClick);
|
||||
}
|
||||
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
int cId = TableManager.Instance.Tables.Item.GetOrDefault((int)data).Param1;
|
||||
DataCharacterAttri cfg = TableManager.Instance.Tables.CharacterAttri.GetOrDefault(cId);
|
||||
CommonUtils.RefreshCharacter2DPic(imagePoster, cfg.RoleID, CommonUtils.ECharacterPicPathType.Cultivate);
|
||||
textName.text = CommonUtils.GetLocalizeText(cfg.Name);
|
||||
}
|
||||
|
||||
#region 按钮点击回调方法
|
||||
/// <summary>
|
||||
/// 返回主页
|
||||
/// </summary>
|
||||
private void OnHomeBtnOnClick()
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回
|
||||
/// </summary>
|
||||
private void OnBackOnClick()
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b3817c1608ef66c4b9b50ab18bdd6d9f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
using cfg.CharacterCfg;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Framework;
|
||||
using Gameplay;
|
||||
using PhxhSDK;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UI_RaffleTotalResultController : UIWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// 打开抽卡结果界面
|
||||
/// </summary>
|
||||
public static async UniTask<UIWindow> Open(ItemCounts itemCounts)
|
||||
{
|
||||
return await UIManager.Instance.OpenWindow(UINameConst.UI_RaffleTotalResult, itemCounts);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 卡牌
|
||||
/// </summary>
|
||||
private class CardItem : UIGameObjectWrapper
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色立绘
|
||||
/// </summary>
|
||||
private Image imagePoster;
|
||||
/// <summary>
|
||||
/// 角色名
|
||||
/// </summary>
|
||||
private TMP_Text textName;
|
||||
|
||||
public CardItem(GameObject root) : base(root)
|
||||
{
|
||||
imagePoster = GetComponent<Image>("Image_Poster");
|
||||
textName = GetComponent<TMP_Text>("Image_Poster/Image_ColorCover/Image_CharacterName/Text_CharacterName");
|
||||
}
|
||||
|
||||
public void SetInfo(int id)
|
||||
{
|
||||
int cId = TableManager.Instance.Tables.Item.GetOrDefault(id).Param1;
|
||||
DataCharacterAttri cfg = TableManager.Instance.Tables.CharacterAttri.GetOrDefault(cId);
|
||||
CommonUtils.RefreshCharacter2DPic(imagePoster, cfg.RoleID, CommonUtils.ECharacterPicPathType.Cultivate);
|
||||
textName.text = CommonUtils.GetLocalizeText(cfg.Name);
|
||||
|
||||
IsScaleShow = true;
|
||||
}
|
||||
}
|
||||
|
||||
private Button buttonHome;
|
||||
private Button buttonBack;
|
||||
|
||||
private readonly List<CardItem> listCard = new();
|
||||
|
||||
public override void OnInit()
|
||||
{
|
||||
buttonBack = GetComponent<Button>("ImageBG/UI_Topbtn/Button_Back");
|
||||
buttonHome = GetComponent<Button>("ImageBG/UI_Topbtn/Button_Home");
|
||||
|
||||
Transform tsCardRoot = FindObj("ImageBG/CardRoot").transform;
|
||||
for (int i = 0; i < tsCardRoot.childCount; ++i)
|
||||
{
|
||||
listCard.Add(new CardItem(tsCardRoot.GetChild(i).gameObject));
|
||||
}
|
||||
|
||||
BindButton(buttonBack, OnBack);
|
||||
BindButton(buttonHome, OnHome);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
ItemCounts itemCounts = data as ItemCounts;
|
||||
for (int i = 0; i < listCard.Count; ++i)
|
||||
{
|
||||
if (itemCounts.Ids.Count <= i)
|
||||
continue;
|
||||
|
||||
listCard[i].SetInfo((int)itemCounts.Ids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#region 按钮回调方法
|
||||
private void OnBack()
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
private void OnHome()
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ public class UI_MainPanelController: UIWindow
|
|||
|
||||
private async void OnDrawCardClick()
|
||||
{
|
||||
await UIManager.Instance.OpenWindow(UINameConst.UIRaffle);
|
||||
await UI_RaffleController.Open();
|
||||
}
|
||||
|
||||
private async void OnPVPClick()
|
||||
|
|
|
|||
|
|
@ -64,13 +64,9 @@ namespace cfg
|
|||
/// </summary>
|
||||
CombatLeastTime = 12,
|
||||
/// <summary>
|
||||
/// (指挥官技能升级)强化等级大于等于
|
||||
/// </summary>
|
||||
PlayerSkillUpgradeLevel = 13,
|
||||
/// <summary>
|
||||
/// 最大类型
|
||||
/// </summary>
|
||||
Max = 14,
|
||||
Max = 13,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue