Project1

标题: 我想在窗体上显示金钱。金钱,金钱变量是什么? [打印本页]

作者: fezero1981    时间: 2016-8-9 17:07
标题: 我想在窗体上显示金钱。金钱,金钱变量是什么?
function Window_Testing() {
    this.initialize.apply(this, arguments);
}
Window_Testing.prototype = Object.create(Window_Selectable.prototype);
Window_Testing.prototype.initialize = function(x, y, width, height) {
    Window_Selectable.prototype.initialize.call(this, x, y, width, height);
}

function Scene_Testing() {
    this.initialize.apply(this, arguments);
}
Scene_Testing.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Testing.prototype.initialize = function() {
    Scene_MenuBase.prototype.initialize.call(this);
};
Scene_Testing.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
    this._commandWindow = new Window_Testing(0, 0, 400, 200);
this.addWindow(this._commandWindow);
}
Scene_Testing.prototype.update = function() {
    if (Input.isTriggered('escape') || Input.isTriggered('cancel')) {
        this._commandWindow.hide();
        SceneManager.goto(Scene_Map);
    }
};

这个是窗口代码 我想让这个窗口一直显示,主要可以一直看见金钱。不会关掉就好。具体应该怎么设置。感谢。
作者: tseyik    时间: 2016-8-9 17:31
本帖最后由 tseyik 于 2016-8-9 17:47 编辑

$gameParty._gold
參考
JAVASCRIPT 代码复制
  1. /* マップ画面に常駐する所持金ウィンドウを扱うクラスです */
  2.  
  3. function Window_ResidentGold() {
  4.     this.initialize.apply(this, arguments);
  5. }
  6.  
  7. Window_ResidentGold.prototype = Object.create(Window_Gold.prototype);
  8. Window_ResidentGold.prototype.constructor = Window_ResidentGold;
  9.  
  10. Window_ResidentGold.prototype.initialize = function(x, y) {
  11.     Window_Gold.prototype.initialize.call(this, x, y);
  12.     this.refresh();
  13. };
  14.  
  15. /* 描画内容の更新 */
  16. Window_ResidentGold.prototype.refresh = function(){
  17.     this.last_gold = $gameParty.gold();
  18.     this.last_WinON = inVal.WinON;
  19.     var x = this.textPadding() + RGW_paddingWidth;
  20.     var y = (this.contentsHeight() - Window_Base.prototype.lineHeight() ) / 2;
  21.     var icon_y = (this.contentsHeight() - Window_Base._iconWidth) / 2;
  22.     var width = this.contentsWidth();
  23.     this.contents.clear();
  24.     if(RGW_type == 3){
  25.         this.drawBackground.call(this);
  26.     }
  27.     if(RGW_icon === 0){
  28.         this.drawCurrencyValue(this.value(), TextManager.currencyUnit, -x, y, width);
  29.     }else{
  30.         this.drawText(this.value(), -x, y, this.contentsWidth(), 'right');
  31.         this.drawIcon(RGW_icon, x, icon_y);
  32.     }
  33. };





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1