设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1712|回复: 3
打印 上一主题 下一主题

[已经过期] 如何实现点击技能图标出现类似仙灵店铺技能

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2274
在线时间
562 小时
注册时间
2012-5-3
帖子
86

开拓者

跳转到指定楼层
1
发表于 2016-3-27 23:54:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 邱小谦 于 2016-3-29 19:29 编辑

此脚本效果已经实现,但是我不知道怎样释放窗口。比如我打开了A窗口,紧接着打开B窗口,再从B窗口点击技能打开仙灵店铺。但是,A、B两个窗口没有被释放掉,必须等待一段时间才能消失,很影响效果。。

     
     这是脚本:
class Rw_Jn
        def initialize
                @index = 0
                @view = Viewport.new(20,0,451,465)
                @view.z = 9998
                @back2 = Sprite.new(@view)
                @back2.bitmap = RPG::Cache.picture("辅助技能框.png")
                @叉号 = Press.new("叉号",430,5,9998,@view)
                #描绘
                @actor = $game_party.actors[0]
                @data = []
                for i in [email protected]
                        skill = $data_skills[@actor.skills]
                        if skill != nil
                                @data.push(skill)
                        end
                end
                @sprite = Sprite.new(@view)
                @sprite.bitmap = Bitmap.new(451,465)
                for i in [email protected]
                        x = 14+i%7*60
                        y = 271+i/7*78
                        bitmap = RPG::Cache.icon(@data.icon_name)
                        @sprite.bitmap.blt(x, y + 4, bitmap, Rect.new(0, 0, 47, 47))
                        @view2 = Viewport.new(130,60,300,450)
                        @view2.z = 10000
                        @text = Sprite.new(@view2)
                        @text.bitmap = Bitmap.new(450,450)
                        @text.bitmap.font.size = 15
                        @text.bitmap.font.name = ["宋体"]
                        @text.bitmap.font.bold = true
                end
        end
        def update
                mouse_x, mouse_y = Mouse.get_mouse_pos
                @叉号.update
                if @叉号.pressed or Mouse.trigger?(Mouse::RIGHT)
                        $ext = true
                end
                if mouse_x>1 and mouse_x<32 and mouse_y>1 and mouse_y<32
                        if Mouse.trigger?(Mouse::LEFT)
                                common_event_id =  196
                                #设置事件
                                common_event = $data_common_events[common_event_id]
                                $game_system.map_interpreter.setup(common_event.list, 0)
                                $game_system.map_interpreter.update
                        end
                end
                if mouse_x>15 and mouse_x<443 and mouse_y>280 and mouse_y<416
                        #(坐标x,坐标y,横个数,纵个数,单格w,单格h,间隔w,间隔h)
                        n = 判断格子(20,270,7,2,41,42,22,22)
                        if @index != n
                                @index = n
                                if @index !=0 and @data[@index-1]
                                        @x = 70+(@index)%5*30+10
                                        @y = 30+(@index)/7*30+40
                                        @name = @data[@index-1].name
                                        @cost = @data[@index-1].sp_cost
                                        @description = @data[@index-1].description
                                        refresh
                                else
                                        if @back and @Edge and @back.visible = true
                                                @text.bitmap.clear
                                                @back.visible = @edge.visible = false
                                        end
                                end
                        end
                else
                        @index = 99
                        if @back and @edge and @back.visible = true
                                @text.bitmap.clear
                                @back.visible = @edge.visible = false
                        end
                end
        end
        def refresh
                if @back and @edge and
                        @back.visible = @edge.visible = false
                end
                @text.bitmap.clear
                @text.bitmap.font.size = 17
                @text.bitmap.font.color = Color.new(0,255,0)
                @text.bitmap.draw_text(@x-81,@y-60,80,32,@name)
                @text.bitmap.font.size = 15
                @text.bitmap.font.color = Color.new(255,255,255)
                description = @description.scan(/./)
                hang = 0
                @xx = @x
                for i in 0...description.size
                        cx = @text.bitmap.text_size(description).width
                        if @xx > @x+cx*12
                                hang +=1
                                @xx = @x
                        end
                        @text.bitmap.draw_text(@xx-81,@y-42 + hang*17,cx,32,description)
                        @xx +=cx
                end
                @back,@edge = System.draw_skin(@x+40,@y,9999,200,44+(hang+1)*17,Color.new(255,255,255), Color.new(17,17,17,125))   
                @back.visible = @edge.visible = true
                @text.bitmap.draw_text(@x-81,@y-42 + (hang+1)*17,100,32,"消耗:MP:#{@cost}")
        end
        def dispose
                @叉号.dispose
                @back2.dispose
                @view.dispose
                if @view2
                        @view2.dispose
                end
                if @text
                        @text.dispose
                end
                if @sprite
                        @sprite.dispose
                end
        end
end (ΦωΦ)

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

2
发表于 2016-3-28 12:14:58 | 只看该作者
应该还有个脚本吧
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2274
在线时间
562 小时
注册时间
2012-5-3
帖子
86

开拓者

3
 楼主| 发表于 2016-3-28 12:42:09 | 只看该作者
yang1zhi 发表于 2016-3-28 12:14
应该还有个脚本吧

确实还有脚本。但是这一个应该够用了。主要是思路,我没好的思路。。。

点评

这个脚本里的是DEF,另外应该还有用到这些DEF的地方  发表于 2016-3-28 13:15
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1358
在线时间
1295 小时
注册时间
2012-8-4
帖子
749
4
发表于 2016-3-28 13:26:09 | 只看该作者
  @left_window.active = false
   @right_window.active = true
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 15:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表