KO API UO GetGlobalShared - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
ะฃะบัะฐัะฝััะบะฐ ยท ะ ัััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซไธญๆ ยท ๆฅๆฌ่ช ยท ํ๊ตญ์ด
UO.GetGlobalShared
C# ์๊ทธ๋์ฒ
string UO.GetGlobalShared(object? name);
๋์ ๋ฐ ๋ฐํ๊ฐ
SetGlobal๊ณผ GetGlobal์ ๋ชจ๋ ์คํฌ๋ฆฝํธ, ํ๋กํ๊ณผ Full Client/Client ํ๋ก์ธ์ค์์ ๊ณต์ ํฉ๋๋ค. ๊ฐ์ ๋ฌธ์์ด์ด๊ณ ์๋ ํค๋ "N/A"์ ๋๋ค. ํค๋ ๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ๋ฉฐ region ํ์์ region/name ์์ ๋๋ค. Manager/Game Manager/CSharp/globals.json์ ํ๋ก์ธ์ค ๊ฐ ์ ๊ธ์ผ๋ก ์๋ก ์ฝ๊ณ ์ฌ์์ ํ์๋ ๋ณด์กดํฉ๋๋ค. Shared ํ์๋ ๊ฐ์ ์ ์ฅ์์ ๋๋ค.
๋งค๊ฐ๋ณ์
nameโ ๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ๋ ๊ณต์ ํค ์ด๋ฆ.
๊ฐ ์ฝ๋ ๋ธ๋ก์ ์์ ํ ๋ ๋ฆฝ .csx์ ๋๋ค. ์์ serial, type๊ณผ ์ขํ๋ฅผ ๋ฐ๊พธ์ธ์. ์ธ์ ์์์ C# ๋ช ๋ช ๋ ์ธ์๋ ์๊ทธ๋์ฒ๋ฅผ ๋ฐ๋ฆ ๋๋ค.
์ฑํ ๋ช ๋ น
#getglobalshared team.delay
์์ ํ C# ์์
๊ฐ ์ฝ๋ ๋ธ๋ก์ ์์ ํ ๋ ๋ฆฝ .csx์ ๋๋ค. ์์ serial, type๊ณผ ์ขํ๋ฅผ ๋ฐ๊พธ์ธ์. ์ธ์ ์์์ C# ๋ช ๋ช ๋ ์ธ์๋ ์๊ทธ๋์ฒ๋ฅผ ๋ฐ๋ฆ ๋๋ค.
1
UO.Print(UO.GetGlobalShared("team.target"));
2
UO.SetGlobal("team.message", "ะัะธะฒัั");
string value = UO.GetGlobalShared("team.message");
UO.Print(value);
3
foreach (string key in new[] { "team.target", "team.delay" })
UO.Print(UO.GetGlobalShared(key));
4
new CommandSample().Execute(UO);
sealed class CommandSample
{
public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
{
api.Print(api.GetGlobalShared("team.target"));
}
}
๋ด๋ถ ํธ์ถ
CSharpGameApi.GetGlobalShared
-> CSharpScriptGlobals
-> InjectionScript.Runtime.State.Globals.GetGlobalShared
Globals -> SharedGlobalStore -> named mutex -> atomic JSON replacement