“字符串”技能树
源自:http://rpg.blue/thread-336098-1-1.html看似很复杂,其实很简单。
脚本参考,当然要自行做一些整合
选择窗口# --------------------# 重要!!!!!!!!# --------------------attr_accessor :skill_caseattr_accessor :shuzhi_hash复制代码初始化# -------------------- # 重要!!!!!!!! # -------------------- # 判断选择状态用的哈希表 @skill_case = {} # 树枝的哈希表 @shuzhi_hash = {}复制代码添加# ------------------ # 描绘图标与树枝 # ------------------ # 循环准备 xunhuan_time = 0 jineng_time = 0 # 简化 #@shuzhi_array.size - 1 #@shuzhi_array.split(/◎/).to_i jianqu1 = @shuzhi_array.size - 1 jxmh = @shuzhi_array.split(/◎/).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.id) opacity_icon = 160 else opacity_icon = 255 end self.contents.blt(x, y, @icon, rect, opacity_icon) # 以XY坐标为主键技能为值 @skill_case = @skill jineng_time += 1 # 树枝 when "→" self.contents.blt(x, y, @shuzhi_picture, rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash = "→" when "←" self.contents.blt(x, y, @shuzhi_picture, rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash = "←" when "↑" self.contents.blt(x, y, @shuzhi_picture, rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash = "↑" when "↓" self.contents.blt(x, y, @shuzhi_picture, rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash = "↓" when "↖" self.contents.blt(x, y, @shuzhi_picture, rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash = "↖" when "↗" self.contents.blt(x, y, @shuzhi_picture, rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash = "↗" when "↘" self.contents.blt(x, y, @shuzhi_picture, rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash = "↘" when "↙" self.contents.blt(x, y, @shuzhi_picture, rect) # 以XY坐标为主键方向字符为值 @shuzhi_hash = "↙" 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.split(/◎/).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复制代码# 刷新选择窗口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].split(/◎/).to_i x = (@select_window.index % jxmh) * 32 + 4 y = (@select_window.index / jxmh) * 32 + 4 # 判断是否选中技能 if @select_window.skill_case != nil # 简化,方便之后使用skill值 skill = @select_window.skill_case # 判断技能是否已经领悟 unless @actor.skills.include?(skill) # ------------------ # 判断技能树关系 # (判断基础技能是否学习) # ------------------ # 连接线:→←↑↓↖↗↘↙ # ------------------ # 判断准备 base_skill_array = [] # 左边: x_copy = x - 32 y_copy = y if @select_window.shuzhi_hash != nil # 简化 shuzhi = @select_window.shuzhi_hash # 分歧 if shuzhi == "→" # 获得基础技能坐标 x_copy = x - 64 y_copy = y # 简化,通过基础技能坐标获取基础技能 base = @select_window.skill_case base_skill_array
页:
[1]