refracta / dcss-webtiles-extension-module

A framework designed to extend the features of Dungeon Crawl Stone Soup WebTiles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dcss-webtiles-extension-module (Korean)

This document will soon be available in English.

dcss-webtiles-extension-module (DWEM)은 던전 크롤 스톤 수프 웹 타일의 기능을 확장하기 위해 설계된 프레임워크입니다.

RequireJS을 후킹하여 웹 타일 자바스크립트 코드가 로딩되기 전에 사용자 코드 조각을 주입할 수 있습니다.

Installation (User)

Tampermonkey, Greasemonkey 등의 스크립트 관리자 설치 후, loader/dwem-base-loader.js를 설치합니다.

Greasy Fork

Installation (Webtiles Server)

<script type="text/javascript">
    var socket_server = "{{ socket_server }}";
    localStorage.DWEM_MODULES = ['https://example.org/module1.js', 'https://example.org/module2.js'];
</script>
<script src="https://cdn.jsdelivr.net/gh/refracta/dcss-webtiles-extension-module/loader/dwem-base-loader.js"></script>

webserver/templates/client.html를 위와 같은 형식으로 수정합니다. localStorage.DWEM_MODULES에 기본적으로 불러오고 싶은 모듈의 주소들을 정의할 수 있습니다.

How to develop Module?

모듈 클래스 정의

export default class BasicModule {
    static name = 'BasicModule'
    static version = '1.0'
    static dependencies = []
    static description = ''

    onLoad() {

    }
}
  • name, version은 DWEM 로더가 처리하기 위해서 필요한 필수적인 속성입니다.
  • dependencies 속성은 다른 모듈의 의존 관계를 명시합니다. 이 속성의 정의된 경우, DWEM 로더는 의존 관계에 있는 다른 모듈을 먼저 로딩한 후, 해당 모듈을 로딩합니다. ( 예시: dependencies = ['Module1', 'Module2:1.0'];)
  • description 속성을 통해, 모듈 매니저에서 나타낼 모듈의 간단한 설명을 기술할 수 있습니다.
  • DWEM 로더는, RequireJS의 로딩을 중단시킨 후, 로더 자신과 다른 모듈들의 클래스를 로딩한 후, 각 모듈의 onLoad() 함수를 실행시킵니다. 이 부분에서 각 모듈에 필요한 초기화 로직을 정의할 수 있습니다.

소스 재매핑과 기본 예제 (문서 작업 중)

  • modules/io-hook/index.js, modules/test-module1/index.js 예제를 참조할 수 있습니다.

Module list

  • ModuleManager:1.0 : Ctrl + F12로 모듈 목록 확인 (개발 중)
  • IOHook:1.0: 입출력 관련 후킹을 돕는 모듈

기타

DWEM은 현재 개발 및 테스트 단계입니다.

DWEM is currently in the development and testing phase.

About

A framework designed to extend the features of Dungeon Crawl Stone Soup WebTiles


Languages

Language:JavaScript 100.0%