_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Battle_Royale/JournalPanel.cs

124 lines
3.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using TMPro;
using UnityEngine;
public class JournalPanel : MonoBehaviour
{
public string gameNo;//游戏期号
public float bet;//下注的蜗牛蛋
public int roomNo;// 下注房间号
public string roomNoKill;// 击杀房间号
public int outcome;//本局结果默认0还未结束1胜利2失败
public float beansCoin;// 本局最终获得欢乐豆
public string createTime;// 创建时间
public TextMeshProUGUI gameNoText;//游戏期号
public TextMeshProUGUI betText;//下注的蜗牛蛋
public TextMeshProUGUI roomNoText;// 下注房间号
public TextMeshProUGUI roomNameKillText;// 击杀房间号
public TextMeshProUGUI outcomeText;//本局结果默认0还未结束1胜利2失败
public TextMeshProUGUI beansCoinText;// 本局最终获得欢乐豆
public TextMeshProUGUI createTimeText;// 创建时间
// Start is called before the first frame update
void Start()
{
SetOutcomeText();
JudgeRoomName();
SetKillRoomText();
}
// 设置描边颜色的通用方法
private void SetTextOutline(TextMeshProUGUI text, UnityEngine.Color outlineColor)
{
// 确保材质是唯一的,避免影响其他文本
text.fontMaterial = new Material(text.fontMaterial);
// 设置描边颜色和宽度
text.fontMaterial.SetColor("_OutlineColor", outlineColor);
}
public void SetOutcomeText()//设置成功或者失败文本
{
if (outcome == 1)
{
outcomeText.text = "逃脱成功";
}
else if (outcome == 2)
{
outcomeText.text = "逃脱失败";
// 设置描边为红色(失败的颜色)
SetTextOutline(outcomeText, new UnityEngine.Color(1f, 0.5f, 0.5f));
}
}
public void JudgeRoomName()
{
if (roomNo == 1)
{
roomNoText.text = "【紫怪屋】";
}
else if (roomNo == 2)
{
roomNoText.text = "【青嬉舍】";
}
else if (roomNo == 3)
{
roomNoText.text = "【粉乐居】";
}
else if (roomNo == 4)
{
roomNoText.text = "【黄逗室】";
}
else if (roomNo == 5)
{
roomNoText.text = "【蓝笑窟】";
}
else if (roomNo == 6)
{
roomNoText.text = "【绿趣巢】";
}
}
public void JudgeKillRoomName(int roomNo)
{
if (roomNo == 1)
{
roomNameKillText.text += "【紫怪屋】";
}
else if (roomNo == 2)
{
roomNameKillText.text += "【青嬉舍】";
}
else if (roomNo == 3)
{
roomNameKillText.text += "【粉乐居】";
}
else if (roomNo == 4)
{
roomNameKillText.text += "【黄逗室】";
}
else if (roomNo == 5)
{
roomNameKillText.text += "【蓝笑窟】";
}
else if (roomNo == 6)
{
roomNameKillText.text += "【绿趣巢】";
}
}
public void SetKillRoomText()
{
string[] parts = roomNoKill.Split(",");
foreach (string part in parts)
{
JudgeKillRoomName(int.Parse(part));
}
}
}