kumpan2000   08-31-2016, 05:41 AM
#1
มีคำถามครับบ คำสั่งต้องการให้เกิดจากตัวเลือกที่สร้างจาก addCommand ต้องใส่ที่ไหนครับ ลองแกะไฟล์ rpg_scene, rpg_window เขียนตามแล้วไม่ได้อะครับ

Code:
//=====
// Choose Motherland Scenes
//=====

/*:
* @plugindesc Display Motherland Scenes. Use for project Ornearth only.
* @author Pannxe (irpg.in.th/user-1284.html)
*/

function Scene_pxeChooseHomeland() {
    this.initialize.apply(this, arguments);
}

Scene_pxeChooseHomeland.prototype = Object.create(Scene_MenuBase.prototype);
Scene_pxeChooseHomeland.prototype.constructor = Scene_pxeChooseHomeland;

Scene_pxeChooseHomeland.prototype.initialize = function() {
    Scene_MenuBase.prototype.initialize.call(this);
};
Scene_pxeChooseHomeland.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createHeadWindow();
    this.createMotherlandWindow();
};
Scene_pxeChooseHomeland.prototype.createHeadWindow = function() {
    this._HeadWindow = new Window_Head(0,0);
    this.addWindow(this._HeadWindow);
}
Scene_pxeChooseHomeland.prototype.createMotherlandWindow = function() {
    this._MotherlandWindow = new Window_MotherlandList(0,0);
    this._MotherlandWindow.y = Graphics.boxHeight - this._MotherlandWindow.height;
    this.addWindow(this._MotherlandWindow);
}
Scene_pxeChooseHomeland.prototype.start = function() {
    Scene_MenuBase.prototype.start.call(this);
};
Scene_pxeChooseHomeland.prototype.update = function() {
    Scene_MenuBase.prototype.update.call(this);
    if (Input.isTriggered('cancel')) {
        SoundManager.playCancel();
        SceneManager.goto(Scene_Map);
    }
};

//------------------

Scene_pxeChooseHomeland.prototype.createCommandWindow = function() {
    this._motherlandListWindow = new Window_MotherlandList(0, 0);
    this._motherlandListWindow.setHandler('syrin',      this.commandSyrin.bind(this));
    this._motherlandListWindow.setHandler('dinyard',    this.commandDinyard.bind(this));
    this._motherlandListWindow.setHandler('cancel',     this.popScene.bind(this));
    this.addWindow(this._motherlandListWindow);

};

Scene_pxeChooseHomeland.prototype.commandSyrin = function() {
    DataManager.setupNewGame();
    this._commandWindow.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);

};

Scene_pxeChooseHomeland.prototype.commandDinyard = function() {
    /*
        .
        .
        .
    */
};

//=================================================
// Windows
//=================================================

//Head

function Window_Head() {
    this.initialize.apply(this, arguments);
}

Window_Head.prototype = Object.create(Window_Base.prototype);
Window_Head.prototype.constructor = Window_Head;

Window_Head.prototype.initialize = function(x, y) {
    var width = this.windowWidth();
    var height = this.windowHeight();
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    this.refresh();
};

Window_Head.prototype.windowWidth = function() {
    return Graphics.width;
};

Window_Head.prototype.windowHeight = function() {
    return this.fittingHeight(1);
};

Window_Head.prototype.refresh = function() {
    var x = this.textPadding();
    var width = this.contents.width - this.textPadding() * 2;
    this.contents.clear();
    this.drawTextEx("Please choose your motherland.", 0, 0);
};

Window_Head.prototype.open = function() {
    this.refresh();
    Window_Base.prototype.open.call(this);
};

//------------------
//
//Homeland list

function Window_MotherlandList() {
    this.initialize.apply(this, arguments);
}

Window_MotherlandList.prototype = Object.create(Window_Command.prototype);
Window_MotherlandList.prototype.constructor = Window_MotherlandList;

Window_MotherlandList.prototype.initialize = function(x, y) {
    Window_Command.prototype.initialize.call(this, x, y);
    this.selectLast();
};

Window_MotherlandList._lastCommandSymbol = null;

Window_MotherlandList.initCommandPosition = function() {
    this._lastCommandSymbol = null;
};
Window_MotherlandList.prototype.windowWidth = function() {
    return 240;
};
Window_MotherlandList.prototype.numVisibleRows = function() {
    return this.maxItems();
};
Window_MotherlandList.prototype.makeCommandList = function() {
    this.addMainList();
};
Window_MotherlandList.prototype.addMainList = function() {
        this.addCommand("Syrin", 'syrin');
        this.addCommand('Dinyard', 'dinyard');
        this.addCommand('Logout', 'cancel');
};
Window_MotherlandList.prototype.areMainCommandsEnabled = function() {
    return $gameParty.exists();
};
Window_MotherlandList.prototype.processOk = function() {
    Window_MotherlandList._lastCommandSymbol = this.currentSymbol();
    Window_Command.prototype.processOk.call(this);
};
Window_MotherlandList.prototype.selectLast = function() {
    this.selectSymbol(Window_MotherlandList._lastCommandSymbol);
};

/puke/puke/puke/puke
This post was last modified: 08-31-2016, 05:42 AM by kumpan2000.

งั่ม
  
Users browsing this thread: 1 Guest(s)
Powered By MyBB, © 2002-2024 MyBB Group.
Made with by Curves UI.