Skip to content

Commit

Permalink
1.0.4 詳細説明を開けるウィンドウの実装を共通ファイルに切り出す
Browse files Browse the repository at this point in the history
  • Loading branch information
elleonard committed Apr 16, 2024
1 parent ccb49f4 commit bb3374f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 38 deletions.
35 changes: 2 additions & 33 deletions src/codes/ItemDetail/DarkPlasma_ItemDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { settings } from "./_build/DarkPlasma_ItemDetail_parameters";
import { Window_DetailText } from '../../common/window/detailWindow';
import { Window_WithDetailWindowMixIn } from '../../common/window/withDetailWindow';

function Scene_Item_DetailMixIn(sceneItem: Scene_Item) {
const _create = sceneItem.create;
Expand Down Expand Up @@ -43,39 +44,7 @@ function Scene_Item_DetailMixIn(sceneItem: Scene_Item) {

Scene_Item_DetailMixIn(Scene_Item.prototype);

Window_CustomKeyHandlerMixIn(settings.openDetailKey, Window_ItemList.prototype, 'detail');

function Window_ItemList_DetailMixIn(windowClass: Window_ItemList) {
windowClass.setDetailWindow = function (detailWindow) {
this._detailWindow = detailWindow;
};

const _setHelpWindowItem = windowClass.setHelpWindowItem;
windowClass.setHelpWindowItem = function (item) {
_setHelpWindowItem.call(this, item);
this._detailWindow?.setItem(item as (MZ.Item|MZ.Weapon|MZ.Armor|null));
};

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_ItemList_DetailMixIn(Window_ItemList.prototype);
Window_WithDetailWindowMixIn(settings.openDetailKey, Window_ItemList.prototype);

class Window_ItemDetail extends Window_DetailText {
heightAdjustment(): number {
Expand Down
6 changes: 2 additions & 4 deletions src/codes/ItemDetail/ItemDetail.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference path="../../typings/rmmz.d.ts" />
/// <reference path="../../common/window/detailWindow.d.ts" />
/// <reference path="../CustomKeyHandler/CustomKeyHandler.d.ts" />
/// <reference path="../CustomKeyHandler/CustomKeyHandlerExport.d.ts" />

Expand All @@ -17,8 +18,5 @@ declare interface Window_ItemList {
setDetailWindow(detailWindow: Window_ItemDetail): void;
}

declare interface Window_ItemDetail extends Window_Scrollable {
_text: string;

setItem(item: MZ.Item|MZ.Weapon|MZ.Armor|null): void;
declare interface Window_ItemDetail extends Window_DetailText {
}
4 changes: 3 additions & 1 deletion src/codes/ItemDetail/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ DarkPlasma_ItemDetail:
license: MIT
histories:
- date: 2024/04/17
version: 1.0.3
version: 1.0.4
description: '詳細説明を開けるウィンドウの実装を共通ファイルに切り出す'
- version: 1.0.3
description: '詳細説明ウィンドウの実装を共通ファイルに切り出す'
- date: 2023/10/20
version: 1.0.2
Expand Down

0 comments on commit bb3374f

Please sign in to comment.