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

Project1

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

[已经过期] 如何用F键开启或关闭Title_Command命令窗口

[复制链接]

Lv4.逐梦者

梦石
0
星屑
6291
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
跳转到指定楼层
1
发表于 2022-12-14 10:28:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_Title_Command
  3. #------------------------------------------------------------------------------
  4. #  标题的主菜单。
  5. #==============================================================================
  6. class Window_Title_Command < Window_Base
  7.   attr_reader   :index
  8.   attr_reader   :slide_over   #滚动结束
  9.   #start load option exit
  10.   #--------------------------------------------------------------------------
  11.   # ● 初始化对像
  12.   #     actor : 角色
  13.   #--------------------------------------------------------------------------
  14.   def initialize(index=0)
  15.     @index = index
  16.     #选项背景
  17.     @button_base = Sprite.new
  18.     @button_base.bitmap = RPG::Cache.title("title-base-light")
  19.     @button_base.x = 1200-680+409
  20.     @button_base.y = 56
  21.  
  22.  
  23.     @cur_back = []
  24.     @text_list = []
  25.     @able = []
  26.     #光标
  27.     @item_max = 7
  28.     for i in 0...@item_max
  29.       @able[i] = true
  30.       @cur_back[i] = Sprite.new
  31.       @cur_back[i].bitmap = RPG::Cache.title("title-normal")#+i.to_s)
  32.       @cur_back[i].x = 1200-680+435
  33.       @cur_back[i].y = 81+45*i
  34.       @text_list[i] = Sprite.new
  35.       @text_list[i].bitmap = RPG::Cache.title("index-"+i.to_s)
  36.       @text_list[i].x = 1200-680+435 + 47
  37.       @text_list[i].y = 81+45*i + 9
  38.     end
  39.     @slide_over = false
  40.     super(0, 0, 0, 0)
  41.     self.opacity = 0
  42.     self.active = true
  43.   end
  44.   def origin_x
  45.     return 1200-680+435
  46.   end
  47.   def origin_y
  48.     return 81
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ● 一些方法的重载
  52.   #--------------------------------------------------------------------------  
  53.   def dispose
  54.     @button_base.dispose
  55.     for i in 0...@item_max
  56.       @cur_back[i].dispose
  57.       @text_list[i].dispose
  58.     end
  59.     super
  60.   end
  61.  
  62.   def z=(z)
  63.     super(z)
  64.     @button_base.z=z
  65.     for i in 0...@item_max
  66.       @cur_back[i].z=z
  67.       @text_list[i].z=z
  68.     end
  69.   end
  70.   def visible=(visible)
  71.     super(visible)
  72.     @button_base.visible = visible
  73.     for i in 0...@item_max
  74.       @cur_back[i].visible = visible
  75.       @text_list[i].visible = visible
  76.     end
  77.   end
  78.   def index=(index)
  79.     @index=index
  80.   end
  81.   def disable_item(i)
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 光标不被选中状态
  85.   #--------------------------------------------------------------------------
  86.   def back_normal(index)
  87.     if index != -1
  88.        @cur_back[index].bitmap = RPG::Cache.title("title-normal")#+i.to_s)
  89.        @text_list[index].bitmap = RPG::Cache.title("index-"+index.to_s)
  90.     end
  91.   end
  92.   def disable_item(index)
  93.     @cur_back[index].bitmap = RPG::Cache.title("title-pressed")#+i.to_s)
  94.     @able[index] = false
  95.     @text_list[index].bitmap = RPG::Cache.title("index-"+index.to_s+"-black")
  96.     #@cur_back[index].color = Color.new(0,0,0,128)
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 更新光标矩形
  100.   #--------------------------------------------------------------------------
  101.   def update_cursor_rect
  102.     # 光标位置不满 0 的情况下
  103.     if @index < 0
  104.       for i in 0...@item_max
  105.         back_normal(i)
  106.       end
  107.       return
  108.     end
  109.     @cur_back[@index].bitmap = RPG::Cache.title("title-highlight")#+i.to_s)
  110.     @text_list[@index].bitmap = RPG::Cache.title("index-"+index.to_s+"-hl")
  111. =begin   
  112.     speed = 40#闪烁速度
  113.     if Graphics.frame_count % speed
  114.       < speed/2
  115.       @cur_back[@index].color = Color.new(255,255,255,100+(Graphics.frame_count%speed)*2)
  116.     else
  117.       @cur_back[@index].color = Color.new(255,255,255,100+(speed-Graphics.frame_count%speed)*2)
  118.     end
  119. =end
  120.  
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 刷新画面
  124.   #--------------------------------------------------------------------------
  125.   def update
  126.     #@cur_back[i].x = 644#640-188
  127.      @slide_over = true
  128.  
  129.  
  130.     if self.active
  131.       # 方向键左被按下的情况下
  132.       if Input.repeat?(Input::DOWN)
  133.         $game_system.se_play($data_system.cursor_se)
  134.         back_normal(@index)
  135.         @index = (@index+1)%@item_max
  136.         until @able[@index]
  137.           @index = (@index+1)%@item_max
  138.         end
  139.       end
  140.       # 方向键右被按下的情况下
  141.       if Input.repeat?(Input::UP)
  142.         $game_system.se_play($data_system.cursor_se)
  143.         back_normal(@index)
  144.         @index = (@index+@item_max-1)%@item_max
  145.         until @able[@index]
  146.           @index = (@index+@item_max-1)%@item_max
  147.         end
  148.       end
  149.     end
  150.     # 刷新光标矩形
  151.     update_cursor_rect if @slide_over
  152.   end
  153.  
  154. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-28 14:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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