-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { ConfigDefinitionBuilder } from '../../../../modules/config/configDefinitionBuilder.js'; | ||
import { PluginHistorySchema } from '../../../../modules/config/configSchema.js'; | ||
import { createSelectParam } from '../../../../modules/config/createParameter.js'; | ||
import { dedent } from '@qnighy/dedent'; | ||
|
||
const histories: PluginHistorySchema[] = [ | ||
{ | ||
date: "2024/04/17", | ||
version: "1.0.0", | ||
description: "公開", | ||
} | ||
]; | ||
|
||
const parameters = [ | ||
createSelectParam('openDetailKey', { | ||
text: '詳細説明ボタン', | ||
description: '詳細説明を開くためのボタンを設定します。', | ||
options: [ | ||
{ | ||
name: 'pageup', | ||
}, | ||
{ | ||
name: 'pagedown', | ||
}, | ||
{ | ||
name: 'shift', | ||
}, | ||
{ | ||
name: 'control', | ||
}, | ||
{ | ||
name: 'tab', | ||
}, | ||
], | ||
default: 'shift', | ||
}), | ||
]; | ||
|
||
export const config = new ConfigDefinitionBuilder( | ||
"EquipDetail", | ||
2024, | ||
"装備シーンで装備品の詳細説明を表示する" | ||
) | ||
.withHistories(histories) | ||
.withLicense("MIT") | ||
.withParameters(parameters) | ||
.withBaseDependency({ | ||
name: 'DarkPlasma_CustomKeyHandler', | ||
version: '1.3.0', | ||
}) | ||
.withOrderAfterDependency({ | ||
name: 'DarkPlasma_CustomKeyHandler', | ||
}) | ||
.withHelp(dedent`装備シーンの装備にカーソルを合わせて特定のボタンを押すと | ||
装備詳細説明ウィンドウを開きます。 | ||
装備のメモ欄に下記のような記述で詳細説明を記述できます。 | ||
<detail:詳細説明文。 | ||
~~~~。>`) | ||
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/// <reference path="./EquipDetail.d.ts" /> | ||
|
||
import { settings } from '../config/_build/DarkPlasma_EquipDetail_parameters'; | ||
import { Window_DetailText } from '../../../common/window/detailWindow'; | ||
|
||
function Scene_Equip_DetailMixIn(sceneEquip: Scene_Equip) { | ||
const _create = sceneEquip.create; | ||
sceneEquip.create = function () { | ||
_create.call(this); | ||
this.createDetailWindow(); | ||
}; | ||
|
||
const _createSlotWindow = sceneEquip.createSlotWindow; | ||
sceneEquip.createSlotWindow = function () { | ||
_createSlotWindow.call(this); | ||
this._slotWindow.setHandler('detail', () => this.toggleDetailWindow(this._slotWindow)); | ||
}; | ||
|
||
const _createItemWindow = sceneEquip.createItemWindow; | ||
sceneEquip.createItemWindow = function () { | ||
_createItemWindow.call(this); | ||
this._itemWindow.setHandler('detail', () => this.toggleDetailWindow(this._itemWindow)); | ||
}; | ||
|
||
sceneEquip.createDetailWindow = function () { | ||
this._detailWindowLayer = new WindowLayer(); | ||
this._detailWindowLayer.x = (Graphics.width - Graphics.boxWidth) / 2; | ||
this._detailWindowLayer.y = (Graphics.height - Graphics.boxHeight) / 2; | ||
this.addChild(this._detailWindowLayer); | ||
this._detailWindow = new Window_DetailText(this.detailWindowRect()); | ||
this._detailWindowLayer.addChild(this._detailWindow); | ||
this._itemWindow.setDetailWindow(this._detailWindow); | ||
this._slotWindow.setDetailWindow(this._detailWindow); | ||
}; | ||
|
||
sceneEquip.detailWindowRect = function () { | ||
return this.slotWindowRect(); | ||
}; | ||
|
||
sceneEquip.toggleDetailWindow = function (activeWindow) { | ||
activeWindow.activate(); | ||
this._detailWindow.scrollTo(0, 0); | ||
if (!this._detailWindow.visible) { | ||
this._detailWindow.show(); | ||
} else { | ||
this._detailWindow.hide(); | ||
} | ||
}; | ||
} | ||
|
||
Scene_Equip_DetailMixIn(Scene_Equip.prototype); | ||
|
||
Window_CustomKeyHandlerMixIn(settings.openDetailKey, Window_EquipSlot.prototype, 'detail'); | ||
Window_CustomKeyHandlerMixIn(settings.openDetailKey, Window_EquipItem.prototype, 'detail'); | ||
|
||
function Window_Equip_DetailMixIn(windowClass: Window_EquipSlot|Window_EquipItem) { | ||
windowClass.setDetailWindow = function (detailWindow) { | ||
this._detailWindow = detailWindow; | ||
}; | ||
|
||
const _setHelpWindowItem = windowClass.setHelpWindowItem; | ||
windowClass.setHelpWindowItem = function (item) { | ||
_setHelpWindowItem.call(this, item); | ||
this._detailWindow?.setItem(item as DataManager.NoteHolder); | ||
}; | ||
|
||
const _isCursorMovable = windowClass.isCursorMovable; | ||
windowClass.isCursorMovable = function () { | ||
return _isCursorMovable.call(this) && (!this._detailWindow || !this._detailWindow.visible); | ||
}; | ||
|
||
const _isOkEnabled = windowClass.isOkEnabled; | ||
windowClass.isOkEnabled = function () { | ||
return _isOkEnabled.call(this) && (!this._detailWindow || !this._detailWindow.visible); | ||
}; | ||
|
||
const _processCancel = windowClass.processCancel; | ||
windowClass.processCancel = function () { | ||
this._detailWindow?.hide(); | ||
_processCancel.call(this); | ||
}; | ||
} | ||
|
||
Window_Equip_DetailMixIn(Window_EquipSlot.prototype); | ||
Window_Equip_DetailMixIn(Window_EquipItem.prototype); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="../../../typings/rmmz.d.ts" /> | ||
/// <reference path="../../CustomKeyHandler/CustomKeyHandler.d.ts" /> | ||
/// <reference path="../../CustomKeyHandler/CustomKeyHandlerExport.d.ts" /> | ||
/// <reference path="../../../common/window/detailWindow.d.ts" /> | ||
|
||
declare interface Scene_Equip { | ||
_detailWindowLayer: WindowLayer; | ||
_detailWindow: Window_DetailText; | ||
|
||
createDetailWindow(): void; | ||
detailWindowRect(): Rectangle; | ||
toggleDetailWindow(activeWindow: Window_EquipSlot|Window_EquipItem): void; | ||
} | ||
|
||
declare interface Window_EquipSlot { | ||
_detailWindow?: Window_DetailText; | ||
|
||
setDetailWindow(detailWindow: Window_DetailText): void; | ||
} | ||
|
||
declare interface Window_EquipItem { | ||
_detailWindow?: Window_DetailText; | ||
|
||
setDetailWindow(detailWindow: Window_DetailText): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// <reference path="../../typings/rmmz.d.ts" /> | ||
|
||
declare class Window_DetailText extends Window_Scrollable { | ||
_text: string; | ||
|
||
initialize(rect: Rectangle): void; | ||
setItem(item: DataManager.NoteHolder|null): void; | ||
setText(text: string): void; | ||
drawDetail(detail: string): void; | ||
baseLineY(): number; | ||
heightAdjustment(): number; | ||
refresh(): void; | ||
processCursorMove(): void; | ||
isCursorMovable(): boolean; | ||
cursorDown(): void; | ||
cursorUp(): void; | ||
} |