Project1
标题: 这段XP脚本如何改写为MV的脚本? [打印本页]
作者: 刺夜之枪 时间: 2016-4-6 11:45
标题: 这段XP脚本如何改写为MV的脚本?
本帖最后由 刺夜之枪 于 2016-4-5 20:07 编辑
RUBY:
b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
我试着改写了一下,但是完全没有用:
MV:
b.blt(b2, 0, 0, b2.width, y2 + h, 0 , y, b2.width, y2 + h);
我经过一段时间的DEBUG后发现,好像问题就出现在上面这行里。。。
无论我怎么改都无解。。。
原来的语境:
Ruby:
def self.redraw
b = @@sprite.bitmap
b.clear
b2 = Bitmap.new(b.width,640)
y = b.height
for n in $game_system.notifications.reverse[0,@@limit]
x = 0
y2 = 0
b2.font = n.font
h = b2.text_size(n.msg).height
n.msg.split('').each do |char|
if (x + b2.text_size(char).width) > b2.width
x = 0
y2 += h
end
# b2.draw_text(x,y2,b2.width,h,char)
#sailcat_draw_text
if $game_temp.inefs
b2.sailcat_draw_text(x,y2,b2.width,h,char)
else
b2.draw_text(x,y2,b2.width,h,char)
end
x += b2.text_size(char).width + 2
end
y -= (y2 + h)
b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
b2.clear
y -= 4
end
b2.dispose
end
def self.redraw
b = @@sprite.bitmap
b.clear
b2 = Bitmap.new(b.width,640)
y = b.height
for n in $game_system.notifications.reverse[0,@@limit]
x = 0
y2 = 0
b2.font = n.font
h = b2.text_size(n.msg).height
n.msg.split('').each do |char|
if (x + b2.text_size(char).width) > b2.width
x = 0
y2 += h
end
# b2.draw_text(x,y2,b2.width,h,char)
#sailcat_draw_text
if $game_temp.inefs
b2.sailcat_draw_text(x,y2,b2.width,h,char)
else
b2.draw_text(x,y2,b2.width,h,char)
end
x += b2.text_size(char).width + 2
end
y -= (y2 + h)
b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
b2.clear
y -= 4
end
b2.dispose
end
Mv:
Notification.redraw = function () {
//console.log("redraw called");
var b = this._sprite.bitmap;
b.clear();
var b2 = new Bitmap(b.width,Graphics.boxHeight);
var y = b.height;
var self = this;
$gameSystem.notifications.slice().reverse().slice(0,this._limit).forEach(function(n) {
var x = 0;
var y2 = 0;
//alert(self._fontSize);
var h = self._fontSize;//b2.measureTextWidth(n);
n.split('').forEach(function(char) {
//console.log(char);
//alert(b2.measureTextWidth(char));
if (x + b2.measureTextWidth(char) > b2.width) {
x = 0;
y2 += h;
}
b2.drawText(x,y2,b2.width,h,char,'left');
x += b2.measureTextWidth(char) + 2;
});
y -= (y2+h);
//b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
//(source, sx, sy, sw, sh, dx, dy, dw, dh)
alert(b.width);
b.blt(b2, 0, 0, b2.width, y2 + h, 0 , y, b2.width, y2 + h);
b2.clear();
y -= 4;
});
//b2.dispose;
};
Notification.redraw = function () {
//console.log("redraw called");
var b = this._sprite.bitmap;
b.clear();
var b2 = new Bitmap(b.width,Graphics.boxHeight);
var y = b.height;
var self = this;
$gameSystem.notifications.slice().reverse().slice(0,this._limit).forEach(function(n) {
var x = 0;
var y2 = 0;
//alert(self._fontSize);
var h = self._fontSize;//b2.measureTextWidth(n);
n.split('').forEach(function(char) {
//console.log(char);
//alert(b2.measureTextWidth(char));
if (x + b2.measureTextWidth(char) > b2.width) {
x = 0;
y2 += h;
}
b2.drawText(x,y2,b2.width,h,char,'left');
x += b2.measureTextWidth(char) + 2;
});
y -= (y2+h);
//b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
//(source, sx, sy, sw, sh, dx, dy, dw, dh)
alert(b.width);
b.blt(b2, 0, 0, b2.width, y2 + h, 0 , y, b2.width, y2 + h);
b2.clear();
y -= 4;
});
//b2.dispose;
};
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |