Skip to content

Commit

Permalink
0.1 版本
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl-Frellett authored Aug 18, 2024
1 parent ca26945 commit 9359f08
Show file tree
Hide file tree
Showing 8 changed files with 431 additions and 0 deletions.
31 changes: 31 additions & 0 deletions 宇宙无敌超级神威霸王龙SL的实用API.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35103.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "宇宙无敌超级神威霸王龙SL的实用API", "宇宙无敌超级神威霸王龙SL的实用API\宇宙无敌超级神威霸王龙SL的实用API.csproj", "{00EA1890-5A51-4576-B38B-7284344185C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{00EA1890-5A51-4576-B38B-7284344185C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00EA1890-5A51-4576-B38B-7284344185C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00EA1890-5A51-4576-B38B-7284344185C2}.Debug|x64.ActiveCfg = Debug|x64
{00EA1890-5A51-4576-B38B-7284344185C2}.Debug|x64.Build.0 = Debug|x64
{00EA1890-5A51-4576-B38B-7284344185C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00EA1890-5A51-4576-B38B-7284344185C2}.Release|Any CPU.Build.0 = Release|Any CPU
{00EA1890-5A51-4576-B38B-7284344185C2}.Release|x64.ActiveCfg = Release|x64
{00EA1890-5A51-4576-B38B-7284344185C2}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8658499F-443D-4D7A-8E62-81D511E13E39}
EndGlobalSection
EndGlobal
55 changes: 55 additions & 0 deletions 宇宙无敌超级神威霸王龙SL的实用API/Hint/PosHint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Exiled.API.Features;
using MEC;
using RueI.Displays;
using RueI.Elements;
using System.Collections.Generic;

namespace 宇宙无敌超级神威霸王龙SL的实用API.hint
{
public static class PosRuelHint
{
public static class 显示中心
{
private static Dictionary<ReferenceHub, Display> 显示 = new Dictionary<ReferenceHub, Display>();

public static Display GetOrCreateDisplay(ReferenceHub hub)
{
if (!显示.ContainsKey(hub))
{
显示[hub] = new Display(hub);
}
return 显示[hub];
}
}

public static void PosHint(this Player 玩家, float 位置, string 文本, bool 是否启用日志 = true, int 时间 = 5)
{
if (玩家 != null && 玩家.ReferenceHub != null)
{
Display 显示 = 显示中心.GetOrCreateDisplay(玩家.ReferenceHub);

float 向下的位置 = -显示.Elements.Count * 30f;

SetElement 元素 = new SetElement(位置 + 向下的位置, 文本)
{
Position = 位置 + 向下的位置,
Enabled = 是否启用日志,
};

显示.Elements.Add(元素);

显示.Update();

Timing.CallDelayed(时间, () =>
{
显示.Elements.Remove(元素);
显示.Update();
});
if (是否启用日志 == true)
{
GameCore.Console.AddLog($"JBAPI.Hint调用", UnityEngine.Color.gray);
}
}
}
}
}
53 changes: 53 additions & 0 deletions 宇宙无敌超级神威霸王龙SL的实用API/Hint/RuelHint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Exiled.API.Features;
using MEC;
using RueI.Displays;
using RueI.Elements;
using System.Collections.Generic;

namespace 宇宙无敌超级神威霸王龙SL的实用API.hint
{
public static class _RuelHint
{
public static class 显示中心
{
private static Dictionary<ReferenceHub, Display> 显示 = new Dictionary<ReferenceHub, Display>();

public static Display GetOrCreateDisplay(ReferenceHub hub)
{
if (!显示.ContainsKey(hub))
{
显示[hub] = new Display(hub);
}
return 显示[hub];
}
}

public static void RuelHint(this Player 玩家, float 位置, string 文本, bool 是否启用日志 = true, int 时间 = 5)
{
if (玩家 != null && 玩家.ReferenceHub != null)
{
Display 显示 = 显示中心.GetOrCreateDisplay(玩家.ReferenceHub);

SetElement 元素 = new SetElement(位置, 文本)
{
Position = 位置,
Enabled = 是否启用日志,
};

显示.Elements.Add(元素);

显示.Update();

Timing.CallDelayed(时间, () =>
{
显示.Elements.Remove(元素);
显示.Update();
});
if (是否启用日志 == true)
{
GameCore.Console.AddLog($"JBAPI.Hint调用", UnityEngine.Color.gray);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Exiled.API.Features;

namespace 宇宙无敌超级神威霸王龙SL的实用API.Tag
{
public static class Onlycolor
{
public static void ORTag(this Player 玩家, string 文本, string 颜色)
{
玩家.RankName = 文本;
玩家.RankColor = 颜色;

GameCore.Console.AddLog($"JBAPI.Onlycolor调用 玩家 {玩家.Nickname} ({玩家.UserId})", UnityEngine.Color.gray);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Exiled.API.Features;
using UnityEngine;
using 宇宙无敌超级神威霸王龙SL的实用API.UnityScript;

namespace 宇宙无敌超级神威霸王龙SL的实用API
{
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 是否启用)
{
玩家.RankName = 文本;

if (!是否启用)
{
var 神威 = 玩家.GameObject.GetComponent<TagController>();
if (神威 != null)
{
Object.Destroy(神威);
}

玩家.RankColor = "red";

return;
}

var 霸王龙 = 玩家.GameObject.GetComponent<TagController>();

GameCore.Console.AddLog($"JBAPI.somecolor调用 玩家 {玩家.Nickname} ({玩家.UserId})",UnityEngine.Color.gray);

if (霸王龙 == null)
{
霸王龙 = 玩家.GameObject.AddComponent<TagController>();
霸王龙.Colors = 颜色;
霸王龙.Interval = 0.5f;//孩子,时间越快服务器越容易崩,如果你改了,服务器爆炸概不负责
}
}
}
}
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 宇宙无敌超级神威霸王龙SL的实用API.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];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EXILEDOFFICIAL" version="8.11.0" targetFramework="net481" />
<package id="Lib.Harmony" version="2.2.2" targetFramework="net481" />
<package id="RueI" version="2.1.0" targetFramework="net481" />
</packages>
Loading

0 comments on commit 9359f08

Please sign in to comment.