#==============================================================================
#新鼠标系统 V 1.1 by END66RPG && end55rpg && 灵魂の补给 2012.5
#----------------------------使用必看------------------------------------------
#脚本修改较多,要换素材最好不要改脚本,直接看素材Graphics/Mouse/...文件夹。
#鼠标形状状态的说明:
#1.行走时会变成 wait.png
#2.指向事件会变成 npc.png
#3.指向非事件的character会变成 红色光标
#4.指向名字含有item字样的事件会变成 coach.png、
#5.【注意!】不用鼠标触发の事件请名字带有“no point”
#除上所述,鼠标变成 紫色光标
#备注:要修改鼠标图像,最好别改脚本了,
# 在Graphics\Mouse中:
# 1.png为鼠标图标
# 2.png-4.png是动态普通形状
# 5-10是指向非事件的鼠标图
# 其余自己看着改吧!
# 复制本工程需要3个脚本 /Graphics/(+ Icons + Mouse)图像。
#下面可修改([]中为通常的样子):
合成方式 = 0
#@blend_tepe【1 】:0~2
透明速度 = 10
#@opacity 【10 】:0~255
下降速度 = 1
#@jy 【1 】:0~50
X放大率 = 0.1
#@zoom_x 【0.1 or -0.03】:-1~1
Y放大率 = 0.1
#@zoom_y 【0.1 or -0.03】:-1~1
残影 = true
#shadow 【true / false】
残光 = false
#show_light 【true / false】
旋转 = false
#angle 【true、false】
动态 = true#true
#anima 【true、false】
#由于残光会建立94个图像,内存低就把show_light 给false掉吧~~
#加入鼠标转向专利一个~~我是仿windows显示时间屏保的鼠标制作的~~
#是关于Math的算法,不是只有8方向,而是360个= =!!~
#把69行去掉“#”就会掉many FPS 不过很华丽~~(注:先开启旋转,残光功能!)
#==============================================================================
module Mouse
def self.text
return [["1.进入菜单","$scene = Scene_Menu.new"],["2.游戏版权","$game_temp.common_event_id = 1"]]
end
def self.init2
#Directions
@dir = 0
@old_x, @old_y = 0, 0
#Animations
@light_id = 1
@mouse_sprite1 = Sprite.new;
@mouse_sprite1.z = 9999;
@mouse_sprite1.bitmap = Bitmap.new("Graphics/Icons/#{@light_id}");
@light_id = 1
@canyin = []
@rmenu = nil#右键菜单
@rightmenu = false
end
def self.setbb(a,b,c,d,e,f,g,h,i)
@blend_tepe = a
@opacity = b
@jy = c
@zoom_x = d
@zoom_y = e
@light = f
@shadow = g
@angle = h
@anima = i
end
def self.show_light(mx, my)
@canyin.each{|s|s.opacity <= 0 ? (s.visible = false ; @canyin.delete(s)) : s.opacity -= 25}
if @light
@light_id < 94 ? @light_id += 1 : @light_id = 1
i = @light_id
eval("@mouse_sprite#{i} = Sprite.new")
eval("@mouse_sprite#{i}.x = #{mx}")
eval("@mouse_sprite#{i}").y = my
eval("@mouse_sprite#{i}").blend_type = @blend_tepe
eval("@mouse_sprite#{i}").z = 9999;
#eval("@mouse_sprite#{i}").angle = @mouse_sprite.angle
eval("@mouse_sprite#{i}").bitmap = Bitmap.new("Graphics/Icons/#{@light_id}")
for i in 1..94
begin
eval("@mouse_sprite#{i}").opacity -= @opacity #10
eval("@mouse_sprite#{i}").y += @jy#1
eval("@mouse_sprite#{i}").zoom_x += @zoom_x#0.105
eval("@mouse_sprite#{i}").zoom_y += @zoom_y#0.105
eval("@mouse_sprite#{i}").dispose if eval("@mouse_sprite#{i}").opacity <= 0
rescue
end
end
if @plight == true
self.update_light
end
end
return if !@angle
a = 0
#被废掉的朝向
hu = [(@old_x - mx), (@old_y - my)]
return if hu[0] == 0 or hu[1] == 0
math = 135 - self.atoa(Math.atan(hu[1]/hu[0]))
if hu[0] > 0
@mouse_sprite.angle = math - 90
else
@mouse_sprite.angle = math + 90
end
#p math
@old_x, @old_y = mx, my
end
def self.plight
return unless @light
@l = Sprite.new
@l.z = 999999
@pcount = 30
@l.blend_type = 1
@l.bitmap = Bitmap.new("Graphics/Icons/#{@pcount}");
@l.ox = @l.bitmap.width / 2
@l.oy = @l.bitmap.height / 2
@l.x, @l.y = @mouse_sprite.x, @mouse_sprite.y
@plight = true
end
def self.update_light
@pcount += 1
@l.bitmap = Bitmap.new("Graphics/Icons/#{@pcount}")
@l.zoom_x += 0.1
@l.zoom_y += 0.1
@l.opacity -= 10
if @pcount >= 70
@l.dispose
@pcount = 0
@plight = false
end
end
def self.atoa(hu)#弧度转角度
return (hu * 180) / Math::PI
#
end
#==============================================================================
#New Part!
#==============================================================================
def self.moving(x,y)
return if !@shadow == true
sprite = Sprite.new
sprite.z = 999
sprite.bitmap = @mouse_sprite.bitmap#Bitmap.new("Graphics/Mouse/1.png")
sprite.x,sprite.y = x,y
sprite.opacity = 200
sprite.angle = @mouse_sprite.angle
@canyin.push sprite
end
def self.canyin
return @canyin.size
end
def self.right_menu(x,y)
n = text.size
@rmenu.dispose if @rmenu != nil
@rmenu = Sprite.new
@rmenu.z = 1000
@rmenu.bitmap = Bitmap.new(150,32*n)
@rmenu.bitmap.fill_rect(0, 0, 150, 32*n, Color.new(255,255,255))
@rmenu.bitmap.font.color = Color.new(68,34,255)
n.times{|i|
@rmenu.bitmap.fill_rect(0, i*32, 150, 1, Color.new(0,0,0))
@rmenu.bitmap.draw_text(0, i*32, 150, 32,text[i][0]) [/i]
[i] }[/i]
[i] @rmenu.x,@rmenu.y = x,y[/i]
[i] @rmenu.opacity = 200[/i]
[i] @rightmenu = true[/i]
[i] end[/i]
[i] def self.check[/i]
[i] if Mouse.trigger?(Mouse::LEFT)[/i]
[i] if @rightmenu[/i]
[i] mx,my = Mouse.get_mouse_pos[/i]
[i] lx = @rmenu.x - @rmenu.ox[/i]
[i] rx = lx + @rmenu.bitmap.width[/i]
[i] ty = @rmenu.y - @rmenu.oy[/i]
[i] by = ty + @rmenu.bitmap.height[/i]
[i] if mx < lx or mx > rx or my < ty or my > by or[/i]
[i] @rmenu.bitmap.get_pixel(mx-lx,my-ty).alpha == 0[/i]
[i] else[/i]
[i] a = [][/i]
[i] text.size.times{|t|a << [t*32 , ([/i][i][url=mailto:my-@rmenu.y]my-@rmenu.y[/url][/i][i]).abs].min}[/i]
[i] eval(text[(a.max/32).to_i][1])[/i]
[i] end[/i]
[i] @rightmenu = false[/i]
[i] @rmenu.dispose[/i]
[i] @rmenu = nil[/i]
[i] return[/i]
[i] end[/i]
[i] end[/i]
[i] end [/i]
[i]end[/i]
[i]Mouse.init2[/i]
[i]Mouse.setbb(合成方式,[/i]
[i]透明速度,[/i]
[i]下降速度,[/i]
[i]X放大率,[/i]
[i]Y放大率,残光,残影,旋转,动态)