Files
ft/Client/Assets/Scripts/Event1v1Battle/Panel/TVPanel/Event1v1BattleSlapCan.cs
2026-06-29 21:18:33 +08:00

78 lines
3.0 KiB
C#

using System;
using System.Threading.Tasks;
using CodeStage.AntiCheat.Utils;
using TMPro;
using UIExtend.Component;
using UnityEngine;
namespace game
{
public class Event1v1BattleSlapCan:MonoBehaviour
{
private GameObject[] cans;
private GameObject[] pepperTrackFxs;
private GameObject[] pepperTrackFxs2;
private GameObject[] pepperTrackFxs3;
private TMP_Text text_num;
private TMP_Text text_num_buff;
private void Awake()
{
text_num=gameObject.FindChildGameObject("text_num")?.GetComponent<TMP_Text>();
text_num_buff=gameObject.FindChildGameObject("text_num_buff")?.GetComponent<TMP_Text>();
cans = gameObject.FindChildGameObject("surface").FindGameObjects(new[]
{ "icon_green", "icon_blue", "icon_purple", "icon_yellow", "icon_red" });
foreach (var can in cans)
{
can.SetActive(false);
}
pepperTrackFxs = gameObject.FindChildGameObject("fx_peppertrack").FindGameObjects(new[]
{
"fx_event1v1battle_slap_peppertrack01",
"fx_event1v1battle_slap_peppertrack02",
"fx_event1v1battle_slap_peppertrack03",
"fx_event1v1battle_slap_peppertrack04",
"fx_event1v1battle_slap_peppertrack05"
});
pepperTrackFxs2 = gameObject.FindChildGameObject("fx_peppertrack1").FindGameObjects(new[]
{
"fx_event1v1battle_slap_peppertrack01",
"fx_event1v1battle_slap_peppertrack02",
"fx_event1v1battle_slap_peppertrack03",
"fx_event1v1battle_slap_peppertrack04",
"fx_event1v1battle_slap_peppertrack05"
});
pepperTrackFxs3 = gameObject.FindChildGameObject("fx_peppertrack2").FindGameObjects(new[]
{
"fx_event1v1battle_slap_peppertrack01",
"fx_event1v1battle_slap_peppertrack02",
"fx_event1v1battle_slap_peppertrack03",
"fx_event1v1battle_slap_peppertrack04",
"fx_event1v1battle_slap_peppertrack05"
});
foreach (var fx in pepperTrackFxs)
{
fx.gameObject.SetActive(false);
}
foreach (var fx in pepperTrackFxs2)
{
fx.gameObject.SetActive(false);
}
foreach (var fx in pepperTrackFxs3)
{
fx.gameObject.SetActive(false);
}
}
public void ShowCan(int index, int multiplier, float buff)
{
gameObject.SetActive(true);
cans[index].SetActive(true);
pepperTrackFxs[index].SetActive(true);
pepperTrackFxs2[index].SetActive(true);
pepperTrackFxs3[index].SetActive(true);
text_num.text ="x"+ multiplier.ToString();
text_num_buff.text ="+"+ ((int)(multiplier*(1+buff))).ToString();
}
}
}