赞 | 1 |
VIP | 0 |
好人卡 | 10 |
积分 | 38 |
经验 | 28385 |
最后登录 | 2022-4-9 |
在线时间 | 723 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3841
- 在线时间
- 723 小时
- 注册时间
- 2014-3-29
- 帖子
- 509
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 neverstop 于 2014-7-26 14:28 编辑
是这个意思,如图
全恢复剂是恢复全部体力的,以太是恢复200点mp的而鼠标放在上面,资料的显示开始是第一个,就是显示全恢复剂的(不管鼠标怎么移动的任何药品上)
但是,用鼠标点击药品后,仍显示的是第一个药品的资料,就是全恢复剂的资料,如果按右键取消的话才会显示该药品的资料
(在为人物自定义取名字的时候,出现的错误,感觉这两个状态类似)
上面的图片中没有鼠标,是因为。。。鼠标移到旁边按截图去了,但这没影响
求助~
鼠标脚本~#============================================================================== #新鼠标系统 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 残影 = false #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个= =!!~ #把【85】行去掉“#”就会掉many FPS 不过很华丽~~(注:先开启旋转,残光功能!) #-----------------------------------分割线-------------------------------------- #如果需要在游戏中调用修改鼠标各项设置:见204行处的方法调用,不需要改变的量用nil #表示! #============================================================================== module Mouse attr_accessor :count #变换动画计数 attr_accessor :npc #指向NPC attr_accessor :wait #指针变成角色正在移动 attr_accessor :enemy #指针指向敌人 attr_accessor :coach #coach icons switch #====================================================== #change icon! #====================================================== def self.npc if [url=home.php?mod=space&uid=113826]@NPC[/url] != true @count = 10 [url=home.php?mod=space&uid=113826]@NPC[/url] = true end end def self.wait if [url=home.php?mod=space&uid=36110]@Wait[/url] != true @count = 10 [url=home.php?mod=space&uid=36110]@Wait[/url] = true end end def self.enemy if @enemy != true @count = 10 @enemy = true end end def self.coach if [url=home.php?mod=space&uid=288325]@COACH[/url] != true @count = 10 [url=home.php?mod=space&uid=288325]@COACH[/url] = true end end #====================================================== #end #====================================================== def self.text return [["1.进入菜单","into_menu"],["2.世界地图","$game_temp.reserve_common_event(5)"],["3.精灵图鉴","$game_temp.reserve_common_event(1)"]] end def self.into_menu Sound.play_ok SceneManager.call(Scene_Menu) Window_MenuCommand::init_command_position 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 @mouse_touch = false @count = 0 @npc,@wait,@coach = false end def self.setbb(a,b,c,d,e,f,g,h,i) @blend_tepe = a if a != nil @opacity = b if b != nil @jy = c if c != nil @zoom_x = d if d != nil @zoom_y = e if e != nil [url=home.php?mod=space&uid=22469]@light[/url] = f if f != nil [url=home.php?mod=space&uid=31758]@Shadow[/url] = g if g != nil [url=home.php?mod=space&uid=124954]@Angle[/url] = h if h != nil [url=home.php?mod=space&uid=702975]@ANIMA[/url] = i if i != nil 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 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 ![url=home.php?mod=space&uid=31758]@Shadow[/url] == true sprite = Sprite.new sprite.z = 999 sprite.bitmap = @mouse_sprite.bitmap if !@mouse_sprite.disposed?#Bitmap.new("Graphics/Mouse/1.png") sprite.x = x sprite.y = 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]) } @rmenu.x,@rmenu.y = x,y @rmenu.opacity = 200 @rightmenu = true end def self.mouse_touch=(bar) @mouse_touch = bar end def self.mouse_touch return @mouse_touch end def self.check if Mouse.trigger?(Mouse::LEFT) if @rightmenu mx,my = Mouse.get_mouse_pos lx = @rmenu.x - @rmenu.ox rx = lx + @rmenu.bitmap.width ty = @rmenu.y - @rmenu.oy by = ty + @rmenu.bitmap.height if mx < lx or mx > rx or my < ty or my > by or @rmenu.bitmap.get_pixel(mx-lx,my-ty).alpha == 0 else a = [] text.size.times{|t|a << [t*32 , ([email]my-@rmenu.y[/email]).abs].min} eval(text[(a.max/32).to_i][1]) end @rightmenu = false @rmenu.dispose @rmenu = nil return end end end end Mouse.init2 Mouse.setbb(合成方式, 透明速度, 下降速度, X放大率, Y放大率,残光,残影,旋转,动态)
#==============================================================================
#新鼠标系统 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
残影 = false
#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个= =!!~
#把【85】行去掉“#”就会掉many FPS 不过很华丽~~(注:先开启旋转,残光功能!)
#-----------------------------------分割线--------------------------------------
#如果需要在游戏中调用修改鼠标各项设置:见204行处的方法调用,不需要改变的量用nil
#表示!
#==============================================================================
module Mouse
attr_accessor :count #变换动画计数
attr_accessor :npc #指向NPC
attr_accessor :wait #指针变成角色正在移动
attr_accessor :enemy #指针指向敌人
attr_accessor :coach #coach icons switch
#======================================================
#change icon!
#======================================================
def self.npc
if [url=home.php?mod=space&uid=113826]@NPC[/url] != true
@count = 10
[url=home.php?mod=space&uid=113826]@NPC[/url] = true
end
end
def self.wait
if [url=home.php?mod=space&uid=36110]@Wait[/url] != true
@count = 10
[url=home.php?mod=space&uid=36110]@Wait[/url] = true
end
end
def self.enemy
if @enemy != true
@count = 10
@enemy = true
end
end
def self.coach
if [url=home.php?mod=space&uid=288325]@COACH[/url] != true
@count = 10
[url=home.php?mod=space&uid=288325]@COACH[/url] = true
end
end
#======================================================
#end
#======================================================
def self.text
return [["1.进入菜单","into_menu"],["2.世界地图","$game_temp.reserve_common_event(5)"],["3.精灵图鉴","$game_temp.reserve_common_event(1)"]]
end
def self.into_menu
Sound.play_ok
SceneManager.call(Scene_Menu)
Window_MenuCommand::init_command_position
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
@mouse_touch = false
@count = 0
@npc,@wait,@coach = false
end
def self.setbb(a,b,c,d,e,f,g,h,i)
@blend_tepe = a if a != nil
@opacity = b if b != nil
@jy = c if c != nil
@zoom_x = d if d != nil
@zoom_y = e if e != nil
[url=home.php?mod=space&uid=22469]@light[/url] = f if f != nil
[url=home.php?mod=space&uid=31758]@Shadow[/url] = g if g != nil
[url=home.php?mod=space&uid=124954]@Angle[/url] = h if h != nil
[url=home.php?mod=space&uid=702975]@ANIMA[/url] = i if i != nil
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 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 ![url=home.php?mod=space&uid=31758]@Shadow[/url] == true
sprite = Sprite.new
sprite.z = 999
sprite.bitmap = @mouse_sprite.bitmap if !@mouse_sprite.disposed?#Bitmap.new("Graphics/Mouse/1.png")
sprite.x = x
sprite.y = 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])
}
@rmenu.x,@rmenu.y = x,y
@rmenu.opacity = 200
@rightmenu = true
end
def self.mouse_touch=(bar)
@mouse_touch = bar
end
def self.mouse_touch
return @mouse_touch
end
def self.check
if Mouse.trigger?(Mouse::LEFT)
if @rightmenu
mx,my = Mouse.get_mouse_pos
lx = @rmenu.x - @rmenu.ox
rx = lx + @rmenu.bitmap.width
ty = @rmenu.y - @rmenu.oy
by = ty + @rmenu.bitmap.height
if mx < lx or mx > rx or my < ty or my > by or
@rmenu.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
else
a = []
text.size.times{|t|a << [t*32 , ([email]my-@rmenu.y[/email]).abs].min}
eval(text[(a.max/32).to_i][1])
end
@rightmenu = false
@rmenu.dispose
@rmenu = nil
return
end
end
end
end
Mouse.init2
Mouse.setbb(合成方式,
透明速度,
下降速度,
X放大率,
Y放大率,残光,残影,旋转,动态)
#============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #============================================================================== #=================以下两个用来调整战斗时的手感问题,可以自己试试。 $敌人选框扩大 = 30 $角色选框扩大 = 20 #============================================================================== # API调用 #============================================================================== $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l') $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i') $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i') $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l') $Window_HWND = $GetActiveWindow.call $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i') #$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i') #$HookStart = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil) #$HookEnd = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil) #$GetMouseStatus = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i') #$Window_HWND = $FindWindow.call(nil, 'mousetry') module Mouse LEFT = 0x01 RIGHT = 0x02 def self.init(sprite = nil) # $HookStart.call($Window_HWND) $ShowCursor.call(0) @show_cursor = false @mouse_sprite = Sprite.new @mouse_sprite.z = 99999 @mouse_sprite.bitmap = Bitmap.new('Graphics/Mouse/1') #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0)) @left_press = false @right_press = false @left_trigger = false @right_trigger = false @left_repeat = false @right_repeat = false @click_lock = false @mouse_x, @mouse_y = self.get_mouse_pos update end def self.exit @mouse_sprite.bitmap.dispose @mouse_sprite.dispose @show_cursor = true # $HookEnd.call $ShowCursor.call(1) end def self.mouse_debug return @mouse_debug.bitmap end def self.update left_down = $GetKeyState.call(0x01) right_down = $GetKeyState.call(0x02) @click_lock = false mouse_x, mouse_y = self.get_mouse_pos if @mouse_x != mouse_x or @mouse_y != mouse_y moving(@mouse_x, @mouse_y) @mouse_x, @mouse_y = mouse_x,mouse_y end if @mouse_sprite != nil @mouse_sprite.x = mouse_x @mouse_sprite.y = mouse_y end if @anima == true if @npc == true if @count == 80 @count = 0 @npc = false else @count += 1 end if FileTest.exist?("Graphics/Mouse/npc_#{@count/10}.png") @mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/npc_#{@count/10}.png") end elsif @coach == true if @count == 60 @count = 0 @coach = false else @count += 1 end if FileTest.exist?("Graphics/Mouse/coach_#{@count/10}.png") @mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/coach_#{@count/10}.png") end elsif @enemy == true if @count == 60 @count = 0 @enemy= false else @count += 1 end if FileTest.exist?("Graphics/Mouse/#{@count/10 + 4}.png") @mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/#{@count/10 + 4}.png") end elsif @wait == true if @count == 60 @count = 0 @wait = false else @count += 1 end if FileTest.exist?("Graphics/Mouse/wait_#{@count/10}.png") @mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/wait_#{@count/10}.png") end else @count == 40 ? @count = 0 : @count += 1 if FileTest.exist?("Graphics/Mouse/#{@count/10}.png") @mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/#{@count/10}.png") end end end self.show_light(@mouse_sprite.x, mouse_y) self.check if left_down[7] == 1 @left_repeat = (not @left_repeat) @left_trigger = (not @left_press) @left_press = true else @left_press = false @left_trigger = false @left_repeat = false end if right_down[7] == 1 @right_repeat = (not @right_repeat) @right_trigger = (not @right_press) @right_press = true else @right_press = false @right_trigger = false @right_repeat = false end end def self.get_mouse_pos point_var = [0, 0].pack('ll') if $GetCursorPos.call(point_var) != 0 if $ScreenToClient.call($Window_HWND, point_var) != 0 x, y = point_var.unpack('ll') if (x < 0) or (x > 10000) then x = 0 end if (y < 0) or (y > 10000) then y = 0 end if x > Graphics.width then x = Graphics.width end if y > Graphics.height then y = Graphics.height end return x, y else return 0, 0 end else return 0, 0 end end def self.press?(mouse_code) if mouse_code == LEFT if @click_lock return false else return @left_press end elsif mouse_code == RIGHT return @right_press else return false end end def self.trigger?(mouse_code) if mouse_code == LEFT if @click_lock return false else return @left_trigger end elsif mouse_code == RIGHT return @right_trigger else return false end end def self.repeat?(mouse_code) if mouse_code == LEFT if @click_lock return false else return @left_repeat end elsif mouse_code == RIGHT return @right_repeat else return false end end def self.click_lock? return @click_lock end def self.click_lock @click_lock = true end def self.click_unlock @click_lock = false end end module Input if @self_update == nil @self_update = method('update') @self_press = method('press?') @self_trigger = method('trigger?') @self_repeat = method('repeat?') end def self.update @self_update.call Mouse.update end def self.press?(key_code) if @self_press.call(key_code) return true end if key_code == C return Mouse.press?(Mouse::LEFT) elsif key_code == B return Mouse.press?(Mouse::RIGHT)if !SceneManager.scene_is?(Scene_Map) else return @self_press.call(key_code) end end def self.trigger?(key_code) if @self_trigger.call(key_code) return true end if key_code == C return Mouse.trigger?(Mouse::LEFT) elsif key_code == B return Mouse.trigger?(Mouse::RIGHT) if !SceneManager.scene_is?(Scene_Map) else return @self_trigger.call(key_code) end end def self.repeat?(key_code) if @self_repeat.call(key_code) return true end if key_code == C return Mouse.repeat?(Mouse::LEFT) elsif key_code == B return Mouse.repeat?(Mouse::RIGHT)if !SceneManager.scene_is?(Scene_Map) else return @self_repeat.call(key_code) end end end class Window_Selectable if @self_alias == nil alias self_update update @self_alias = true end def update #self.cursor_rect.empty self_update if self.active and item_max > 0 index_var = @index tp_index = @index mouse_x, mouse_y = Mouse.get_mouse_pos mouse_not_in_rect = true for i in 0...item_max @index = i update_cursor top_x = self.cursor_rect.x + self.x + 16 top_y = self.cursor_rect.y + self.y + 16 bottom_x = top_x + self.cursor_rect.width bottom_y = top_y + self.cursor_rect.height top_x += self.x_mod top_y += self.y_mod bottom_x += self.x_mod bottom_y += self.y_mod if (mouse_x > top_x) and (mouse_y > top_y) and (mouse_x < bottom_x) and (mouse_y < bottom_y) mouse_not_in_rect = false if tp_index != @index tp_index = @index $data_system.sounds[0].play end break end end if Input.trigger?(Input::F9) p top_x,top_y,Mouse.get_mouse_pos end if mouse_not_in_rect @index = index_var update_cursor Mouse.click_lock else Mouse.click_unlock end end end end class Window_NameInput if @self_alias == nil alias self_update update @self_alias = true end def update #self.cursor_rect.empty self_update if self.active index_var = @index mouse_x, mouse_y = Mouse.get_mouse_pos mouse_not_in_rect = true for i in (0...HIRAGANA.size).to_a.push(180) @index = i update_cursor top_x = self.cursor_rect.x + self.x + 16 top_y = self.cursor_rect.y + self.y + 16 bottom_x = top_x + self.cursor_rect.width bottom_y = top_y + self.cursor_rect.height # if (mouse_x > top_x) and (mouse_y > top_y) and (mouse_x < bottom_x) and (mouse_y < bottom_y) mouse_not_in_rect = false break end end if mouse_not_in_rect @index = index_var update_cursor Mouse.click_lock else Mouse.click_unlock end end end end =begin class Window_InputNumber if @self_alias == nil alias self_update update @self_alias = true end def update #self.cursor_rect.empty self_update mouse_x, mouse_y = Mouse.get_mouse_pos if self.active and @digits_max > 0 index_var = @index mouse_not_in_rect = true for i in 0...@digits_max @index = i #update_cursor top_x = self.cursor_rect.x + self.x + 16 bottom_x = top_x + self.cursor_rect.width # if (mouse_x > top_x) and (mouse_x < bottom_x) mouse_not_in_rect = false break end end if mouse_not_in_rect @index = index_var #update_cursor Mouse.click_lock else Mouse.click_unlock end end if @last_mouse_y == nil @last_mouse_y = mouse_y end check_pos = (@last_mouse_y - mouse_y).abs if check_pos > 10 #$game_system.se_play($data_system.cursor_se) place = 10 ** (@digits_max - 1 - @index) n = @number / place % 10 @number -= n * place n = (n + 1) % 10 if mouse_y < @last_mouse_y n = (n + 9) % 10 if mouse_y > @last_mouse_y @number += n * place refresh @last_mouse_y = mouse_y end end end =end class Scene_File if @self_alias == nil alias self_update update @self_alias = true end def update mouse_x, mouse_y = Mouse.get_mouse_pos Mouse.click_lock idx = 0 for i in @savefile_windows top_x = i.x + 16 top_y = i.y + 16 bottom_x = top_x + i.width bottom_y = top_y + i.height if (mouse_x > top_x) and (mouse_y > top_y) and (mouse_x < bottom_x) and (mouse_y < bottom_y) i.selected = true if @file_index != idx @file_index = idx $data_system.sounds[0].play end Mouse.click_unlock else i.selected = false end idx += 1 end self_update end end class Game_Player if @self_alias == nil alias self_update update @self_alias = true end def update mouse_x, mouse_y = Mouse.get_mouse_pos if @last_move_x == nil @last_move_x = false end if Mouse.trigger?(Mouse::RIGHT) Mouse.right_menu(mouse_x, mouse_y) Graphics.update elsif Mouse.press?(Mouse::LEFT) if Mouse.mouse_touch == true Mouse.mouse_touch = false return end Mouse.plight Mouse.wait last_moving = moving? last_direction = @direction # return unless movable? # return if $game_map.interpreter.running? unless moving? or $game_map.interpreter.running? last_x = @x if @last_move_x @last_move_x = false elsif mouse_x > screen_x + 16 move_straight(6) elsif mouse_x < screen_x - 16 move_straight(4) end last_y = @y if last_x != @x @last_move_x = true elsif mouse_y > screen_y move_straight(2) elsif mouse_y < screen_y - 32 move_straight(8) end =begin if last_y != @y @last_move_x = false elsif not @last_move_x case last_direction when 2 turn_down when 4 turn_left when 6 turn_right when 8 turn_up end end =end end end self_update end end Mouse.init END { Mouse.exit } class Window_Base < Window attr_accessor :x_mod attr_accessor :y_mod alias ka_initialize initialize def initialize(x, y, width, height) ka_initialize(x, y, width, height) self.x_mod = 0 self.y_mod = 0 end end class Window_PartyCommand < Window_Command alias ka1_initialize initialize def initialize ka1_initialize self.y_mod = Graphics.height-128 end end class Window_ActorCommand < Window_Command alias ka2_initialize initialize def initialize ka2_initialize self.x_mod = -128 self.y_mod = Graphics.height-128 end end #============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #==============================================================================
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#=================以下两个用来调整战斗时的手感问题,可以自己试试。
$敌人选框扩大 = 30
$角色选框扩大 = 20
#==============================================================================
# API调用
#==============================================================================
$ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
$GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
$ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
$GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
$Window_HWND = $GetActiveWindow.call
$GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
#$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
#$HookStart = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
#$HookEnd = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
#$GetMouseStatus = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
#$Window_HWND = $FindWindow.call(nil, 'mousetry')
module Mouse
LEFT = 0x01
RIGHT = 0x02
def self.init(sprite = nil)
# $HookStart.call($Window_HWND)
$ShowCursor.call(0)
@show_cursor = false
@mouse_sprite = Sprite.new
@mouse_sprite.z = 99999
@mouse_sprite.bitmap = Bitmap.new('Graphics/Mouse/1')
#@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))
@left_press = false
@right_press = false
@left_trigger = false
@right_trigger = false
@left_repeat = false
@right_repeat = false
@click_lock = false
@mouse_x, @mouse_y = self.get_mouse_pos
update
end
def self.exit
@mouse_sprite.bitmap.dispose
@mouse_sprite.dispose
@show_cursor = true
# $HookEnd.call
$ShowCursor.call(1)
end
def self.mouse_debug
return @mouse_debug.bitmap
end
def self.update
left_down = $GetKeyState.call(0x01)
right_down = $GetKeyState.call(0x02)
@click_lock = false
mouse_x, mouse_y = self.get_mouse_pos
if @mouse_x != mouse_x or @mouse_y != mouse_y
moving(@mouse_x, @mouse_y)
@mouse_x, @mouse_y = mouse_x,mouse_y
end
if @mouse_sprite != nil
@mouse_sprite.x = mouse_x
@mouse_sprite.y = mouse_y
end
if @anima == true
if @npc == true
if @count == 80
@count = 0
@npc = false
else
@count += 1
end
if FileTest.exist?("Graphics/Mouse/npc_#{@count/10}.png")
@mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/npc_#{@count/10}.png")
end
elsif @coach == true
if @count == 60
@count = 0
@coach = false
else
@count += 1
end
if FileTest.exist?("Graphics/Mouse/coach_#{@count/10}.png")
@mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/coach_#{@count/10}.png")
end
elsif @enemy == true
if @count == 60
@count = 0
@enemy= false
else
@count += 1
end
if FileTest.exist?("Graphics/Mouse/#{@count/10 + 4}.png")
@mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/#{@count/10 + 4}.png")
end
elsif @wait == true
if @count == 60
@count = 0
@wait = false
else
@count += 1
end
if FileTest.exist?("Graphics/Mouse/wait_#{@count/10}.png")
@mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/wait_#{@count/10}.png")
end
else
@count == 40 ? @count = 0 : @count += 1
if FileTest.exist?("Graphics/Mouse/#{@count/10}.png")
@mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/#{@count/10}.png")
end
end
end
self.show_light(@mouse_sprite.x, mouse_y)
self.check
if left_down[7] == 1
@left_repeat = (not @left_repeat)
@left_trigger = (not @left_press)
@left_press = true
else
@left_press = false
@left_trigger = false
@left_repeat = false
end
if right_down[7] == 1
@right_repeat = (not @right_repeat)
@right_trigger = (not @right_press)
@right_press = true
else
@right_press = false
@right_trigger = false
@right_repeat = false
end
end
def self.get_mouse_pos
point_var = [0, 0].pack('ll')
if $GetCursorPos.call(point_var) != 0
if $ScreenToClient.call($Window_HWND, point_var) != 0
x, y = point_var.unpack('ll')
if (x < 0) or (x > 10000) then x = 0 end
if (y < 0) or (y > 10000) then y = 0 end
if x > Graphics.width then x = Graphics.width end
if y > Graphics.height then y = Graphics.height end
return x, y
else
return 0, 0
end
else
return 0, 0
end
end
def self.press?(mouse_code)
if mouse_code == LEFT
if @click_lock
return false
else
return @left_press
end
elsif mouse_code == RIGHT
return @right_press
else
return false
end
end
def self.trigger?(mouse_code)
if mouse_code == LEFT
if @click_lock
return false
else
return @left_trigger
end
elsif mouse_code == RIGHT
return @right_trigger
else
return false
end
end
def self.repeat?(mouse_code)
if mouse_code == LEFT
if @click_lock
return false
else
return @left_repeat
end
elsif mouse_code == RIGHT
return @right_repeat
else
return false
end
end
def self.click_lock?
return @click_lock
end
def self.click_lock
@click_lock = true
end
def self.click_unlock
@click_lock = false
end
end
module Input
if @self_update == nil
@self_update = method('update')
@self_press = method('press?')
@self_trigger = method('trigger?')
@self_repeat = method('repeat?')
end
def self.update
@self_update.call
Mouse.update
end
def self.press?(key_code)
if @self_press.call(key_code)
return true
end
if key_code == C
return Mouse.press?(Mouse::LEFT)
elsif key_code == B
return Mouse.press?(Mouse::RIGHT)if !SceneManager.scene_is?(Scene_Map)
else
return @self_press.call(key_code)
end
end
def self.trigger?(key_code)
if @self_trigger.call(key_code)
return true
end
if key_code == C
return Mouse.trigger?(Mouse::LEFT)
elsif key_code == B
return Mouse.trigger?(Mouse::RIGHT) if !SceneManager.scene_is?(Scene_Map)
else
return @self_trigger.call(key_code)
end
end
def self.repeat?(key_code)
if @self_repeat.call(key_code)
return true
end
if key_code == C
return Mouse.repeat?(Mouse::LEFT)
elsif key_code == B
return Mouse.repeat?(Mouse::RIGHT)if !SceneManager.scene_is?(Scene_Map)
else
return @self_repeat.call(key_code)
end
end
end
class Window_Selectable
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
#self.cursor_rect.empty
self_update
if self.active and item_max > 0
index_var = @index
tp_index = @index
mouse_x, mouse_y = Mouse.get_mouse_pos
mouse_not_in_rect = true
for i in 0...item_max
@index = i
update_cursor
top_x = self.cursor_rect.x + self.x + 16
top_y = self.cursor_rect.y + self.y + 16
bottom_x = top_x + self.cursor_rect.width
bottom_y = top_y + self.cursor_rect.height
top_x += self.x_mod
top_y += self.y_mod
bottom_x += self.x_mod
bottom_y += self.y_mod
if (mouse_x > top_x) and (mouse_y > top_y) and
(mouse_x < bottom_x) and (mouse_y < bottom_y)
mouse_not_in_rect = false
if tp_index != @index
tp_index = @index
$data_system.sounds[0].play
end
break
end
end
if Input.trigger?(Input::F9)
p top_x,top_y,Mouse.get_mouse_pos
end
if mouse_not_in_rect
@index = index_var
update_cursor
Mouse.click_lock
else
Mouse.click_unlock
end
end
end
end
class Window_NameInput
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
#self.cursor_rect.empty
self_update
if self.active
index_var = @index
mouse_x, mouse_y = Mouse.get_mouse_pos
mouse_not_in_rect = true
for i in (0...HIRAGANA.size).to_a.push(180)
@index = i
update_cursor
top_x = self.cursor_rect.x + self.x + 16
top_y = self.cursor_rect.y + self.y + 16
bottom_x = top_x + self.cursor_rect.width
bottom_y = top_y + self.cursor_rect.height
#
if (mouse_x > top_x) and (mouse_y > top_y) and
(mouse_x < bottom_x) and (mouse_y < bottom_y)
mouse_not_in_rect = false
break
end
end
if mouse_not_in_rect
@index = index_var
update_cursor
Mouse.click_lock
else
Mouse.click_unlock
end
end
end
end
=begin
class Window_InputNumber
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
#self.cursor_rect.empty
self_update
mouse_x, mouse_y = Mouse.get_mouse_pos
if self.active and @digits_max > 0
index_var = @index
mouse_not_in_rect = true
for i in 0...@digits_max
@index = i
#update_cursor
top_x = self.cursor_rect.x + self.x + 16
bottom_x = top_x + self.cursor_rect.width
#
if (mouse_x > top_x) and (mouse_x < bottom_x)
mouse_not_in_rect = false
break
end
end
if mouse_not_in_rect
@index = index_var
#update_cursor
Mouse.click_lock
else
Mouse.click_unlock
end
end
if @last_mouse_y == nil
@last_mouse_y = mouse_y
end
check_pos = (@last_mouse_y - mouse_y).abs
if check_pos > 10
#$game_system.se_play($data_system.cursor_se)
place = 10 ** (@digits_max - 1 - @index)
n = @number / place % 10
@number -= n * place
n = (n + 1) % 10 if mouse_y < @last_mouse_y
n = (n + 9) % 10 if mouse_y > @last_mouse_y
@number += n * place
refresh
@last_mouse_y = mouse_y
end
end
end
=end
class Scene_File
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
mouse_x, mouse_y = Mouse.get_mouse_pos
Mouse.click_lock
idx = 0
for i in @savefile_windows
top_x = i.x + 16
top_y = i.y + 16
bottom_x = top_x + i.width
bottom_y = top_y + i.height
if (mouse_x > top_x) and (mouse_y > top_y) and
(mouse_x < bottom_x) and (mouse_y < bottom_y)
i.selected = true
if @file_index != idx
@file_index = idx
$data_system.sounds[0].play
end
Mouse.click_unlock
else
i.selected = false
end
idx += 1
end
self_update
end
end
class Game_Player
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
mouse_x, mouse_y = Mouse.get_mouse_pos
if @last_move_x == nil
@last_move_x = false
end
if Mouse.trigger?(Mouse::RIGHT)
Mouse.right_menu(mouse_x, mouse_y)
Graphics.update
elsif Mouse.press?(Mouse::LEFT)
if Mouse.mouse_touch == true
Mouse.mouse_touch = false
return
end
Mouse.plight
Mouse.wait
last_moving = moving?
last_direction = @direction
# return unless movable?
# return if $game_map.interpreter.running?
unless moving? or $game_map.interpreter.running?
last_x = @x
if @last_move_x
@last_move_x = false
elsif mouse_x > screen_x + 16
move_straight(6)
elsif mouse_x < screen_x - 16
move_straight(4)
end
last_y = @y
if last_x != @x
@last_move_x = true
elsif mouse_y > screen_y
move_straight(2)
elsif mouse_y < screen_y - 32
move_straight(8)
end
=begin
if last_y != @y
@last_move_x = false
elsif not @last_move_x
case last_direction
when 2
turn_down
when 4
turn_left
when 6
turn_right
when 8
turn_up
end
end
=end
end
end
self_update
end
end
Mouse.init
END { Mouse.exit }
class Window_Base < Window
attr_accessor :x_mod
attr_accessor :y_mod
alias ka_initialize initialize
def initialize(x, y, width, height)
ka_initialize(x, y, width, height)
self.x_mod = 0
self.y_mod = 0
end
end
class Window_PartyCommand < Window_Command
alias ka1_initialize initialize
def initialize
ka1_initialize
self.y_mod = Graphics.height-128
end
end
class Window_ActorCommand < Window_Command
alias ka2_initialize initialize
def initialize
ka2_initialize
self.x_mod = -128
self.y_mod = Graphics.height-128
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#============================================================================== # ■ Sprite_Character #------------------------------------------------------------------------------ #check the mouse 's event and start. by End66rpg #============================================================================== class Sprite_Character < Sprite_Base def inside? mx,my = Mouse.get_mouse_pos lx = self.x - self.ox rx = lx + @cw ty = self.y - self.oy by = ty + @ch if mx < lx or mx > rx or my < ty or my > by or self.bitmap.get_pixel(mx-lx,my-ty).alpha == 0 return false end return true end alias update_old update def update update_old self.tone = Tone.new(0,0,0) self.zoom_y = 1 return if @character.is_a?(Game_Event) and @character.name.index('no point') return if !inside? Mouse.mouse_touch=true if Mouse.trigger?(Mouse::LEFT) Mouse.plight return false if $game_message.busy? || $game_message.visible return if @character == $game_player or @character.trigger == 4 @character.start end if @character != $game_player if @character.is_a?(Game_Event) if @character.name.index('item') Mouse.coach return elsif @character.name.index('heigh') Mouse.coach self.zoom_y = 1.5 return end end Mouse.npc end Mouse.enemy if @character != $game_map.events self.tone = Tone.new(122,122,122) end end class Game_Event < Game_Character #—————————————————————————————————————— # 用来返回名称 #—————————————————————————————————————— def name return @event.name end def name=(newname) @event.name = newname end end
#==============================================================================
# ■ Sprite_Character
#------------------------------------------------------------------------------
#check the mouse 's event and start. by End66rpg
#==============================================================================
class Sprite_Character < Sprite_Base
def inside?
mx,my = Mouse.get_mouse_pos
lx = self.x - self.ox
rx = lx + @cw
ty = self.y - self.oy
by = ty + @ch
if mx < lx or mx > rx or my < ty or my > by or
self.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
return false
end
return true
end
alias update_old update
def update
update_old
self.tone = Tone.new(0,0,0)
self.zoom_y = 1
return if @character.is_a?(Game_Event) and @character.name.index('no point')
return if !inside?
Mouse.mouse_touch=true
if Mouse.trigger?(Mouse::LEFT)
Mouse.plight
return false if $game_message.busy? || $game_message.visible
return if @character == $game_player or @character.trigger == 4
@character.start
end
if @character != $game_player
if @character.is_a?(Game_Event)
if @character.name.index('item')
Mouse.coach
return
elsif @character.name.index('heigh')
Mouse.coach
self.zoom_y = 1.5
return
end
end
Mouse.npc
end
Mouse.enemy if @character != $game_map.events
self.tone = Tone.new(122,122,122)
end
end
class Game_Event < Game_Character
#——————————————————————————————————————
# 用来返回名称
#——————————————————————————————————————
def name
return @event.name
end
def name=(newname)
@event.name = newname
end
end
|
|