- 累计送礼:
- 0 个
- 累计收礼:
- 0 个
TA的每日心情 | 开心 昨天 18:01 |
---|
签到天数: 114 天 连续签到: 4 天 [LV.6]常住居民II

管理员
  
- VIP
- 6
- 卡币
- 10632
- OK点
- 16
- 推广点
- 0
- 同能卷
- 0
- 积分
- 13401


|
源自: http://rpg.blue/thread-336098-1-1.html
看似很复杂,其实很简单。
脚本参考,当然要自行做一些整合
选择窗口 - # -------------------- # 重要!!!!!!!! # -------------------- attr_accessor :skill_case attr_accessor :shuzhi_hash复制代码
复制代码初始化 - # -------------------- # 重要!!!!!!!! # -------------------- # 判断选择状态用的哈希表 @skill_case = {} # 树枝的哈希表 @shuzhi_hash = {}复制代码
复制代码添加 - # ------------------ # 描绘图标与树枝 # ------------------ # 循环准备 xunhuan_time = 0 jineng_time = 0 # 简化 #@shuzhi_array.size - 1 #@shuzhi_array[jianqu1].split(/◎/)[0].to_i jianqu1 = @shuzhi_array.size - 1 jxmh = @shuzhi_array[jianqu1].split(/◎/)[0].to_i # 矩形 rect = Rect.new(0, 0, 24, 24) # 循环 for i in @shuzhi_array # 坐标 x = (xunhuan_time % jxmh) * 32 + 4 y = (xunhuan_time / jxmh) * 32 + 4 # 不等与"☆"描绘 if i != "☆" case i # 技能图标 when "★" # 图标透明度 unless @actor.skills.include?(@skill[jineng_time].id) opacity_icon = 160 else opacity_icon = 255 end self.contents.blt(x, y, @icon[jineng_time], rect, opacity_icon) # 以XY坐标为主键技能为值 @skill_case[x.to_s+"◎"+y.to_s] = @skill[jineng_time] jineng_time += 1 # 树枝 when "→" self.contents.blt(x, y, @shuzhi_picture[0], rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash[x.to_s+"◎"+y.to_s] = "→" when "←" self.contents.blt(x, y, @shuzhi_picture[1], rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash[x.to_s+"◎"+y.to_s] = "←" when "↑" self.contents.blt(x, y, @shuzhi_picture[2], rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↑" when "↓" self.contents.blt(x, y, @shuzhi_picture[3], rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↓" when "↖" self.contents.blt(x, y, @shuzhi_picture[4], rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↖" when "↗" self.contents.blt(x, y, @shuzhi_picture[5], rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↗" when "↘" self.contents.blt(x, y, @shuzhi_picture[6], rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↘" when "↙" self.contents.blt(x, y, @shuzhi_picture[7], rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↙" end end # 项目判断 xunhuan_time += 1 end复制代码
复制代码帮助刷新 - # 刷新帮助 def update_help # 为了刷新,就只好牺牲内存了 # 判断 #if self.index != @old_index # 隐藏帮助 @help_window.visible = false # 简化写法 jianqu1 = @shuzhi_array.size - 1 jxmh = @shuzhi_array[jianqu1].split(/◎/)[0].to_i # 帮助坐标 x = (self.index % jxmh) * 32 y = (self.index / jxmh) * 32 # 循环 for i in @skill_case.keys # 判断 if i == (x+4).to_s+"◎"+(y+4).to_s @help_window.set_text( x + 50, y, @skill_case[(x+4).to_s+"◎"+(y+4).to_s], @actor) end end # @old_index = self.index #end end复制代码
复制代码[code] # 刷新选择窗口 def update_select_window # B键的按下 if Input.trigger?(Input::B) $scene = Scene_Map.new end # C键的按下 if Input.trigger?(Input::C) # 获取坐标,以坐标为媒介(主键)获取相关信息 # 坐标 jianqu1 = SHEZHI::ACTOR_ARRAY[@actor.id].size - 1 jxmh = SHEZHI::ACTOR_ARRAY[@actor.id][jianqu1].split(/◎/)[0].to_i x = (@select_window.index % jxmh) * 32 + 4 y = (@select_window.index / jxmh) * 32 + 4 # 判断是否选中技能 if @select_window.skill_case[x.to_s+"◎"+y.to_s] != nil # 简化,方便之后使用skill值 skill = @select_window.skill_case[x.to_s+"◎"+y.to_s] # 判断技能是否已经领悟 unless @actor.skills.include?(skill) # ------------------ # 判断技能树关系 # (判断基础技能是否学习) # ------------------ # 连接线:→←↑↓↖↗↘↙ # ------------------ # 判断准备 base_skill_array = [] # 左边: x_copy = x - 32 y_copy = y if @select_window.shuzhi_hash[x_copy.to_s+"◎"+y_copy.to_s] != nil # 简化 shuzhi = @select_window.shuzhi_hash[x_copy.to_s+"◎"+y_copy.to_s] # 分歧 if shuzhi == "→" # 获得基础技能坐标 x_copy = x - 64 y_copy = y # 简化,通过基础技能坐标获取基础技能 base = @select_window.skill_case[x_copy.to_s+"◎"+y_copy.to_s] base_skill_array |
|