Jongyeol(비교)

r15 vs r16
......
295295플레이 할 떄 사용하고 있는 입력 오프셋을 전체, 맵별로 기록한다.
296296기록된 오프셋은 버튼을 눌러 바로 현재 오프셋으로 설정할 수 있다.
297297=== JALib ===
298==== 개요 ====
299Jongyeol Adofai Library에 약자로 얼불춤 모딩에 여러가지 편리한 기능을 제공하는 라이브러리형 모드다.
300[[https://jalib.jongyeol.kr/modApplicator/JALib/betalatest|다운로드]][* 베타버전으로 정식버전은 아직 존재하지 않는다.]
301JALib을 이용하여 모드를 만드려면 UMM모드 만들듯이 만들면 안되고 JALib을 사용한 모드들에 틀에 맞게 만들어야된다. [[https://github.com/Jongye0l/JALib/blob/main/Document/DevelopGuide.md|JALib 모드 개발 가이드]]
302{{{#!syntax csharp
303using JALib.Core;
304
305namespace MyMod;
306
307public class Main : JAMod {
308 protected override void OnSetup() {
309 Log("MyMod is Setuped.");
310 }
311
312 protected override void OnEnable() {
313 Log("MyMod is Enabled.");
314 }
315
316 protected override void OnDisable() {
317 Log("MyMod is Disabled.");
318 }
319}
320}}}
321==== 기능 ====
322라이브러리가 아직 배타버전이기 때문에 없어지거나 사용법이 바뀔 수 있다.
323===== 모드 기본 기능 =====
324 * 자동 업데이트
325 * 업데이트 알림
326 * 모드 자동 적용
327 * 온라인 모드 정보 받아오기
328 * 모드 자동 다운로드
329 * 필요한 모드 자동 다운로드
330===== 자동 예외 Catch =====
331자동 예외 Catch는 Action, Task가 지원한다.
332
333 * Action 사용법
334 {{{#!syntax csharp
335JAction action = new JAction(Main.Instance, () => {
336 throw new Exception("Action Catch");
337});
338action.Invoke();
339}}}
340 * Task 사용법
341 {{{#!syntax csharp
342JATask.Run(Main.Instance, () => {
343 throw new Exception("Task Catch");
344});
345}}}
346===== 다양한 랜덤 =====
347{{{#!syntax csharp
348JARandom random = new JARandom();
349random.NextInt();
350random.NextLong();
351}}}
352===== 쉬운 TCP 통신 =====
353{{{#!syntax csharp
354JATcpClient client = new JATcpClient("localhost", 12345, new JAction(Main.Instance, () => {
355 client.ReadUTF();
356});
357}}}
358SRV 사용하여 TCP연결
359{{{#!syntax csharp
360JATcpClient client = new JATcpClient("localhost", 12345, "MyService", false, new JAction(Main.Instance, () => {
361 client.ReadUTF();
362});
363}}}
364===== 간단한 HTTP 통신 =====
365{{{#!syntax csharp
366HttpClient client = new HttpClient();
367string result = await client.GetString("http://localhost:3000");
368}}}
369===== 간단한 리플렉션 =====
370{{{#!syntax csharp
371typeof(Main).Invoke("OnEnable", this);
372this.Invoke("Log", "Hello World!");
373}}}
374===== 스트림 다양한 형식 읽기 =====
375{{{#!syntax csharp
376Stream stream;
377stream.ReadInt();
378stream.ReadLong();
379stream.ReadUTF();
380}}}
381===== 메모리 형식에 파일 압축/압축해제 =====
382{{{#!syntax csharp
383byte[] data;
384RawFile[] result = Zipper.Unzip(data);
385}}}
386===== 메인 스레드 =====
387{{{#!syntax csharp
388if(!MainThread.IsMainThread()) {
389 MainThread.Run(Main.Instance, () => {
390 Main.Instance.Log("Hello World!");
391 });
392 await MainThread.WaitForMainThread();
393}
394}}}
395===== 언어별 글데이터 =====
396언어별 글 데이터는 모드 폴더/localization/언어.json 에 넣은 데이터들을 불러옵니다.
397{{{#!syntax csharp
398string value = Main.Instance.Localization["Hi"];
399}}}
400===== 기능별 관리 =====
401다음과 같이 기능을 생성할 수 있다.
402{{{#!syntax csharp
403public MyFeature : Feature {
404 public MyFeature() : base(Main.Instance, nameof(MyFeature)) {
405 }
406
407 protected override void OnEnable() {
408 Main.Instance.Log("MyFeature is Enabled");
409 }
410
411 protected override void OnDisable() {
412 Main.Instance.Log("MyFeature is Disabled");
413 }
414}
415}}}
416기능 추가는 OnSetup 매서드에서 진행되며 다음과 같이 할 수 있다.
417{{{#!syntax csharp
418protected override void OnSetup() {
419 AddFeature(new MyFeature());
420}
421}}}
422기능을 생성할 때 기능별 설정, 패치를 설정할 수 있다.
423===== 패치 =====
424JALib에선 기존 Harmony 기능보다 다양하게 패치를 진행할 수 있다.
425일반 패치 매서드는 다음과 같이 만들 수 있다.
426{{{#!syntax csharp
427[JAPatch(typeof(Main), "OnEnable", PatchType.Prefix, false, TryingCatch = true)]
428private static void OnEnablePrefix(Main __instance) {
429 __instance.Log("Enable Prefix");
430}
431}}}
432PatchType에는 다음과 같은 종류가 있다.
433 * Prefix
434 * Postfix
435 * Transpiler
436 * Finalizer
437 * Replace
438TryingCatch를 통해 이 패치 매서드에서 예외발생을 방지할 지 설정할 수 있다.
439
440Reverse 패치 매서드는 다음과 같이 만들 수 있다.
441{{{#!syntax csharp
442[JAReversePatch(typeof(Main), "OnEnable", ReversePatchType.Original)]
443private static void OnEnableReverse(Main __instance) => throw new NotImplementedException();
444}}}
445ReversePatchType은 Flag로 여러개를 한번에 선택할 수 있으며 다음과 같은 종류가 있다.
446 * Original = 0
447 * PrefixCombine = 1
448 * PostfixCombine = 2
449 * TranspilerCombine = 4
450 * FinalizerCombine = 8
451 * ReplaceCombine = 16
452 * OverrideCombine = 32
453 * AllCombine = PrefixCombine | PostfixCombine | TranspilerCombine | FinalizerCombine | ReplaceCombine | OverrideCombine
454 * DontUpdate = 0x40000000
455
456Override 패치 매서드는 기본적으로 상속된 매서드에서 사용할 수 있다. Override 패치 매서드는 다음과 같이 만들 수 있다.
457{{{#!syntax csharp
458[JAOverridePatch]
459public void OnEnable() {
460 Log("MyMod is Enabled but Patched!");
461}
462}}}
463===== 설정 =====
464다음과 같은 형식으로 설정을 만들 수 있다.
465{{{#!syntax csharp
466public MyModSetting : JASetting {
467 public string SettingField;
468
469 public MyModSetting(JAMod mod, JObject jsonObject) : base(mod, jsonObject) {
470 }
471}
472}}}
473기본적으로 field를 이용해 저장한다.
474
475다음과 같은 형식으로 field에 넣지않고 저장할수도 있다.
476{{{#!syntax csharp
477JASetting setting;
478setting["MySetting"] = "This is my Setting";
479}}}
298480==== JALib ModApplicator ====
299481=== JipperResourcePack ===
300482==== Jipper-Overlayer ====
......