-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
231 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Exiled.API.Features; | ||
using static JBAPI.Log.Level; | ||
|
||
namespace JBAPI.Log | ||
{ | ||
public static class GameConsoleMessage | ||
{ | ||
public static void 控制台消息(this Player 玩家, string 消息, ConsoleLevel 级别) | ||
{ | ||
string 前缀 = _级别(级别); | ||
string 颜色 = _颜色(级别); | ||
|
||
玩家.SendConsoleMessage($"<color={颜色}>{前缀}</color>{消息}", 颜色); | ||
} | ||
|
||
private static string _级别(ConsoleLevel 级别) | ||
{ | ||
switch (级别) | ||
{ | ||
case ConsoleLevel.消息: | ||
return "[消息] "; | ||
case ConsoleLevel.警告: | ||
return "[警告] "; | ||
case ConsoleLevel.错误: | ||
return "[错误] "; | ||
case ConsoleLevel.自定义: | ||
return ""; | ||
default: | ||
return ""; | ||
} | ||
} | ||
|
||
private static string _颜色(ConsoleLevel 级别) | ||
{ | ||
switch (级别) | ||
{ | ||
case ConsoleLevel.消息: | ||
return "#a2a2a2"; | ||
case ConsoleLevel.警告: | ||
return "yellow"; | ||
case ConsoleLevel.错误: | ||
return "red"; | ||
default: | ||
return ""; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace JBAPI.Log | ||
{ | ||
public class Level | ||
{ | ||
public enum ConsoleLevel | ||
{ | ||
消息, | ||
警告, | ||
错误, | ||
自定义 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace JBPI.Log | ||
{ | ||
public static class ServerConsoleMessage | ||
{ | ||
// 默认情况下的日志 | ||
public static void 日志(string 消息) | ||
=> ServerConsole.AddLog(消息, System.ConsoleColor.Cyan); | ||
|
||
// 警告日志 | ||
public static void 警告(string 消息) | ||
=> ServerConsole.AddLog(消息, System.ConsoleColor.DarkYellow); | ||
|
||
// 调式日志 Debug | ||
public static void 调试(string 消息) | ||
=> ServerConsole.AddLog($"[调试] {消息}", System.ConsoleColor.Gray); | ||
|
||
// 发生错误时的日志 | ||
public static void 错误(string 消息) | ||
=> ServerConsole.AddLog($"[错误] {消息}", System.ConsoleColor.Red); | ||
|
||
// 其他日志 | ||
public static void 其他(string 消息) | ||
=> ServerConsole.AddLog(消息, System.ConsoleColor.Green); | ||
|
||
// 自定义消息 | ||
public static void 自定义(string 消息, System.ConsoleColor 颜色) | ||
=> ServerConsole.AddLog(消息, 颜色); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using Exiled.API.Features; | ||
using UnityEngine; | ||
using JBAPI.UnityScript; | ||
using JBPI.Log; | ||
using MEC; | ||
using JBAPI.Log; | ||
|
||
namespace JBAPI.Tag | ||
{ | ||
public static class somecolor | ||
{ | ||
private static readonly string[] 颜色 = new[] | ||
{ | ||
"pink", "red", "brown", "silver", | ||
"light_green", "crimson", "cyan", | ||
"aqua","deep_pink","tomato", | ||
"yellow","magenta","blue_green", | ||
"orange","lime","green", | ||
"emerald","carmine","nickel", | ||
"mint","army_green","pumpkin" | ||
}; | ||
|
||
public static void RTag(this Player 玩家, string 文本, bool 是否启用) | ||
{ | ||
Timing.CallContinuously(2f, () => | ||
{ | ||
玩家.RankName = 文本; | ||
if (!是否启用) | ||
{ | ||
var 神威 = 玩家.GameObject.GetComponent<TagController>(); | ||
if (神威 != null) | ||
{ | ||
Object.Destroy(神威); | ||
} | ||
玩家.RankColor = "red"; | ||
return; | ||
} | ||
|
||
var 霸王龙 = 玩家.GameObject.GetComponent<TagController>(); | ||
|
||
ServerConsoleMessage.日志($"JBAPI.somecolor调用 玩家 {玩家.Nickname} ({玩家.UserId})"); | ||
|
||
|
||
if (霸王龙 == null) | ||
{ | ||
霸王龙 = 玩家.GameObject.AddComponent<TagController>(); | ||
霸王龙.Colors = 颜色; | ||
霸王龙.Interval = 0.5f;//孩子,时间越快服务器越容易崩,如果你改了,服务器爆炸概不负责 | ||
} | ||
|
||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System.Collections; | ||
using UnityEngine; | ||
using Exiled.API.Features; | ||
using System; | ||
|
||
namespace JBAPI.UnityScript | ||
{ | ||
public class TagController : MonoBehaviour | ||
{ | ||
private Player player; | ||
private int positionIndex = 0; | ||
private string[] colors = Array.Empty<string>(); | ||
private float timer = 0f; | ||
|
||
public string[] Colors | ||
{ | ||
get => colors; | ||
set | ||
{ | ||
colors = value ?? Array.Empty<string>(); | ||
positionIndex = 0; | ||
} | ||
} | ||
|
||
public float Interval { get; set; } | ||
|
||
void Awake() | ||
{ | ||
player = Player.Get(gameObject); | ||
|
||
if (player == null) | ||
{ | ||
Destroy(this); | ||
return; | ||
} | ||
|
||
StartCoroutine(InitializeColorChange()); | ||
} | ||
|
||
IEnumerator InitializeColorChange() | ||
{ | ||
yield return new WaitForSeconds(0.5f); | ||
|
||
SetNextColor(); | ||
} | ||
|
||
void Update() | ||
{ | ||
timer += Time.deltaTime; | ||
|
||
if (timer >= Interval) | ||
{ | ||
SetNextColor(); | ||
timer %= Interval; | ||
} | ||
} | ||
|
||
void SetNextColor() | ||
{ | ||
var nextColor = RollNext(); | ||
if (!string.IsNullOrEmpty(nextColor)) | ||
player.RankColor = nextColor; | ||
} | ||
|
||
public string RollNext() | ||
{ | ||
if (colors.Length == 0) | ||
return string.Empty; | ||
|
||
positionIndex++; | ||
if (positionIndex >= colors.Length) positionIndex = 0; | ||
|
||
return colors[positionIndex]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters