Put Team in the statscreen
This commit is contained in:
parent
68eab14326
commit
186c84ee62
@ -52,6 +52,9 @@ MonoBehaviour:
|
|||||||
RowColor: {r: 0.6117647, g: 0.6117647, b: 0.6117647, a: 0.13333334}
|
RowColor: {r: 0.6117647, g: 0.6117647, b: 0.6117647, a: 0.13333334}
|
||||||
BackroundPanel: {fileID: 2512848922102124251}
|
BackroundPanel: {fileID: 2512848922102124251}
|
||||||
RowPrefab: {fileID: 6592059455020087165, guid: 02259c41b4c68c246afbf2fd4b4c1624, type: 3}
|
RowPrefab: {fileID: 6592059455020087165, guid: 02259c41b4c68c246afbf2fd4b4c1624, type: 3}
|
||||||
|
ForceOpen: 0
|
||||||
|
SunColor: {r: 1, g: 0.8311939, b: 0.3160377, a: 1}
|
||||||
|
MoonColor: {r: 0.6666667, g: 0.85309076, b: 1, a: 1}
|
||||||
--- !u!1 &9081539380605237274
|
--- !u!1 &9081539380605237274
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -3,7 +3,7 @@ using UnityEngine;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NeonTea.Quakeball.Networking.Instances;
|
using NeonTea.Quakeball.Networking.Instances;
|
||||||
using NeonTea.Quakeball.Networking;
|
using NeonTea.Quakeball.Networking;
|
||||||
using NeonTea.Quakeball.TeaNet.Packets;
|
using NeonTea.Quakeball.Interface;
|
||||||
|
|
||||||
namespace NeonTea.Quakeball.Game {
|
namespace NeonTea.Quakeball.Game {
|
||||||
|
|
||||||
@ -33,6 +33,7 @@ namespace NeonTea.Quakeball.Game {
|
|||||||
}
|
}
|
||||||
Players[Team.Sun].Add(player.Id);
|
Players[Team.Sun].Add(player.Id);
|
||||||
player.Team = team;
|
player.Team = team;
|
||||||
|
Terminal.Singleton.Println($"Put {player.Nick} to Team {player.Team}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayerLeft(NetPlayer player) {
|
public void PlayerLeft(NetPlayer player) {
|
||||||
|
@ -4,16 +4,20 @@ using UnityEngine.UI;
|
|||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using NeonTea.Quakeball.Networking;
|
using NeonTea.Quakeball.Networking;
|
||||||
|
using NeonTea.Quakeball.Game;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace NeonTea.Quakeball.Interface {
|
namespace NeonTea.Quakeball.Interface {
|
||||||
public class StatScreen : MonoBehaviour {
|
public class StatScreen : MonoBehaviour {
|
||||||
|
|
||||||
public Color RowColor;
|
public Color RowColor = new Color();
|
||||||
public RectTransform BackroundPanel;
|
public RectTransform BackroundPanel;
|
||||||
public GameObject RowPrefab;
|
public GameObject RowPrefab;
|
||||||
public bool ForceOpen;
|
public bool ForceOpen;
|
||||||
|
|
||||||
|
public Color SunColor = new Color();
|
||||||
|
public Color MoonColor = new Color();
|
||||||
|
|
||||||
private bool Open;
|
private bool Open;
|
||||||
|
|
||||||
private InputAction OpenStatScreenAction;
|
private InputAction OpenStatScreenAction;
|
||||||
@ -55,10 +59,23 @@ namespace NeonTea.Quakeball.Interface {
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < rowAmount; i++) {
|
for (int i = 0; i < rowAmount; i++) {
|
||||||
NetPlayer player = Net.Singleton.Instance.PlayerList[i];
|
NetPlayer player = Net.Singleton.Instance.PlayerList[i];
|
||||||
Rows[i].GetChild(0).GetComponent<TMP_Text>().text = player.Nick;
|
Color playerColor = new Color(1, 1, 1, 1);
|
||||||
|
switch (player.Team) {
|
||||||
|
case Team.Sun:
|
||||||
|
playerColor = SunColor;
|
||||||
|
break;
|
||||||
|
case Team.Moon:
|
||||||
|
playerColor = MoonColor;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
TMP_Text NickText = Rows[i].GetChild(0).GetComponent<TMP_Text>();
|
||||||
|
NickText.color = playerColor;
|
||||||
|
NickText.text = player.Nick;
|
||||||
int ping = (int)(player.Ping * 1000);
|
int ping = (int)(player.Ping * 1000);
|
||||||
Rows[i].GetChild(1).GetComponent<TMP_Text>().text = $"{ping} ms";
|
Rows[i].GetChild(1).GetComponent<TMP_Text>().text = $"{ping} ms";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateRowAmount() {
|
public void UpdateRowAmount() {
|
||||||
|
@ -45,7 +45,7 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
|||||||
LocalPlayer.Nick = nick;
|
LocalPlayer.Nick = nick;
|
||||||
AddPlayer(LocalPlayer);
|
AddPlayer(LocalPlayer);
|
||||||
|
|
||||||
PlayerJoined(LocalPlayer);
|
GameMaster.PlayerJoined(LocalPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnStop() {
|
public override void OnStop() {
|
||||||
|
Loading…
Reference in New Issue
Block a user