讓某一個命令按鈕不能按
所謂的命令按鈕就是command window裡面的按鈕,就是它!
看那個「繼續」是不能按的,這個功能在腳本裡面該怎麼實現呢?
我們要先知道command是怎樣生出來的
用的是addCommand()這個函式,以上三個選項就是下列三行:
this.addCommand(TextManager.newGame, 'newGame');this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());this.addCommand(TextManager.options, 'options');
this.isContinueEnabled() 這個函式則是用來檢查玩家是否擁有遊戲save檔案,若是的話回傳true,若否的話回傳false。
也就是說,我們也能自行修改這個位置的內容,比如說像這樣:
this.addCommand(TextManager.newGame, 'newGame' , fasle);
新遊戲就不能按了,如果需要多重判斷的情況,也可以另外寫函式再把布林值回傳進來,就跟那個「繼續」一樣。
是不是很簡單呢?
我之前去問人沒人願意回答我...
害我一直無法了解是太簡單了還是太困難了,過了幾個月後我自己發現了...也不是發現了,就剛好真的很需要這個功能,然後也不知道怎地就會了
另外如果想要更動單一命令視窗的 文字顏色、文字大小等等,要在這裡修改:
Window_Command.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);var align = this.itemTextAlign();this.resetTextColor();this.changePaintOpacity(this.isCommandEnabled(index));//文字修改放在這裡this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align);
};
//*Window_Command需自行修改成當前command window的名稱
//修改欄高
Window_Selectable.prototype.itemHeight = function() {
return this.lineHeight();
};
*Window_Selectable 需自行修改成當前command window的名稱
//修改生成順序
Window_Selectable.prototype.itemRect = function(index) {
var rect = new Rectangle();var maxCols = this.maxCols();rect.width = this.itemWidth();rect.height = this.itemHeight();rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX;rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY;return rect;
};
rect.x 跟 rect.y
控制命令按鈕的生成順序位置,也可以改成從下面生到上面...(但鍵盤上下移動會出錯,滑鼠沒問題)
//取消內定的滑鼠光標
Window_Selectable.prototype.updateCursor = function() {
if (this._cursorAll) {
var allRowsHeight = this.maxRows() * this.itemHeight();this.setCursorRect(0, 0, this.contents.width, allRowsHeight);this.setTopRow(0);
} else if (this.isCursorVisible()) {
var rect = this.itemRect(this.index());//把下面這行註解掉,就沒有光標了//this.setCursorRect(rect.x, rect.y, rect.width, rect.height);
} else {
this.setCursorRect(0, 0, 0, 0);
}
};
想要做自己的滑鼠游標,理論上也是在這裡做,不過我還沒想到怎麼做啦XD
在這裡生成一個Sprite...嗎?