查看: 2679|回复: 0

[有事请教] 新建窗口,打开第一次有文字,第二次才有图片 这是???

[复制链接]
梦石
0
星屑
145
在线时间
30 小时
注册时间
2010-7-28
回帖
8
发表于 2020-8-21 10:57:30 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
学着SIAKO.Mobi的教程 到创建一个基本窗口那一章。 最后的也是要第二次开才有角色图, 如何一打开就有角色图呢? 萌新求问

(function(){

//以别名填充菜单视窗方法
var screen_s = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
        screen_s.call(this);
        this._cw = new Window_C();
        this._cw.y = 340;
        this.addWindow( this._cw );

};

//建立新视窗
function Window_C() {
    this.initialize.apply(this, arguments);
}

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

Window_C.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_C.prototype.windowWidth = function() {
    return 200;
};
//视窗高度
Window_C.prototype.windowHeight = function() {
    return 200;
};
//更新动态
Window_C.prototype.refresh = function() {
    var x = this.textPadding();
    var width = this.contents.width - this.textPadding() * 2;
    this.contents.clear();
    //显示文字
    this.drawTextEx('测试窗口1', 0, 0);
    //显示角色脸图
    this.drawFace( 'longw', 0, 0, 30, 150, 150);


};

//视窗底层呼叫
Window_C.prototype.open = function() {
        this.refresh();
    Window_Base.prototype.open.call(this);

};

})();



搞不明白


迭代是人,递归是神
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部