ES API UO GetGlobal - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
UO.GetGlobal
Firmas C#
string UO.GetGlobal(object? name);
dynamic UO.GetGlobal(object? globalRegion, object? varName);
Comportamiento y resultado
SetGlobal y GetGlobal comparten valores entre todos los scripts, perfiles y procesos Full Client/Client. Los valores son cadenas; una clave ausente devuelve "N/A". Se distingue mayúsculas; las formas region usan region/name. Manager/Game Manager/CSharp/globals.json persiste y se relee bajo bloqueo entre procesos. Las formas Shared usan el mismo almacén.
Parámetros
globalRegion— Espacio de nombres combinado con la clave.name— Nombre de clave compartida que distingue mayúsculas.varName— Nombre de clave compartida que distingue mayúsculas.
Cada bloque es un .csx completo. Sustituya serials, tipos y coordenadas de ejemplo. El orden y los argumentos C# con nombre siguen la firma.
Comandos del chat
#getglobal team.target
#get global team.message
Ejemplos C# completos
Cada bloque es un .csx completo. Sustituya serials, tipos y coordenadas de ejemplo. El orden y los argumentos C# con nombre siguen la firma.
1
string value = UO.GetGlobal("team.target");
UO.Print(value);
2
string value = UO.GetGlobal("team.delay");
if (int.TryParse(value, out int milliseconds))
UO.Print(milliseconds.ToString());
3
UO.Print(Convert.ToString(UO.GetGlobal("team", "delay")));
4
new CommandSample().Execute(UO);
sealed class CommandSample
{
public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
{
string value = api.GetGlobal("team.target");
api.Print(value);
}
}
Llamadas internas
CSharpGameApi.GetGlobal
-> CSharpScriptGlobals
-> InjectionScript.Runtime.InjectionApiUO.RegisterClientApiCompatibility
-> InjectionScript.Runtime.State.Globals.GetGlobal
Globals -> SharedGlobalStore -> named mutex -> atomic JSON replacement