查看: 1875|回复: 5

[已经解决] 请问这个脚本 怎么退出 点进去就不能退出了。。

[复制链接]
梦石
0
星屑
2457
在线时间
912 小时
注册时间
2014-10-14
回帖
1155

开拓者

发表于 2016-12-6 02:23:17 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 j296196585 于 2016-12-6 02:24 编辑

[pre lang="ruby"]class Window_HelpSkillLv < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 240, 13*32)
    self.opacity = 200
    self.z = 9000
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  def dispose
    super
    if @icon != nil
      @icon.dispose
      @icon = nil
    end
  end
  #--------------------------------------------------------------------------
  # ● 设置文本
  #     text  : 窗口显示的字符串
  #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  #--------------------------------------------------------------------------
  def set_text(x, y, skill)
    # 如果文本和对齐方式的至少一方与上次的不同
    if x != @x or y != @y or skill != @skill
      # 再描绘文本
      self.contents.clear
      self.x = x
      self.y = y
      if @icon != nil
        @icon.dispose
        @icon = nil
      end
      #——————————color
      for b in 1..150
      @color_2 = Color.new(255, 128, 255, 80 - b)
      @color_3 = Color.new(255, 128, 255, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 0, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4 - 32, 0, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(192, 192, 192, 80 - b)
      @color_3 = Color.new(192, 192, 192, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 32, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4 - 32, 32, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(255, 255, 128, 80 - b)
      @color_3 = Color.new(255, 255, 128, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 64, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4 - 32, 64, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(128, 255, 128, 80 - b)
      @color_3 = Color.new(128, 255, 128, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 96, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4 - 32, 96, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(128, 255, 255, 80 - b)
      @color_3 = Color.new(128, 255, 255, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 128, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4-32, 128, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(255, 128, 255, 80 - b)
      @color_3 = Color.new(255, 128, 255, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 128+32, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4-32, 128+32, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(255, 255, 128, 80 - b)
      @color_3 = Color.new(255, 255, 128, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 128+32*2, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4-32, 128+32*2, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(192, 192, 192, 80 - b)
      @color_3 = Color.new(192, 192, 192, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 128+32*3, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4-32, 128+32*3, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(255, 128, 255, 80 - b)
      @color_3 = Color.new(255, 128, 255, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 128+32*4, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4-32, 128+32*4, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(128, 255, 255, 80 - b)
      @color_3 = Color.new(128, 255, 255, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 128+32*5, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4-32, 128+32*5, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(255, 128, 255, 80 - b)
      @color_3 = Color.new(255, 128, 255, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 128+32*6, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4-32, 128+32*6, 2, 30), @color_3) if b < 20
      @color_2 = Color.new(255, 255, 128, 80 - b)
      @color_3 = Color.new(255, 255, 128, 60 + b)
      self.contents.fill_rect(
      Rect.new(2 * b + 4, 128+32*7, 2, 30), @color_2)
      self.contents.fill_rect(
      Rect.new(2 * b + 4-32, 128+32*7, 2, 30), @color_3) if b < 20
      end
      #——————————size
      self.contents.font.size = 15
      #——————————icon
      @icon = RPG::Cache.icon(skill.icon_name)
      self.contents.blt(
      0, 4, @icon, Rect.new(0, 0, @icon.width, @icon.height))
      #——————————id
      yes_id = true
      if yes_id
      self.contents.font.color = text_color(3)
      self.contents.draw_text(40, 0, width - 8, 32, "["+skill.id.to_s+"]")
      #——————————name
      x_plus = contents.text_size("["+skill.id.to_s+"]").width
      else
      x_plus = 0
      end
      self.contents.font.color = normal_color
      self.contents.draw_text(40+x_plus, 0, width - 8, 32, skill.name)
      #——————————description
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 32, width - 8, 32, skill.description)
      #——————————scope
      self.contents.font.color = system_color
      self.contents.draw_text(0, 32*2, width - 8, 32, "效果范围:")
      self.contents.font.color = normal_color
      case skill.scope
      when 0
        self.contents.draw_text(0, 32*2, width - 8, 32, "无", 1)
      when 1
        self.contents.draw_text(0, 32*2, width - 8, 32, "敌单体", 1)
      when 2
        self.contents.draw_text(0, 32*2, width - 8, 32, "敌全体", 1)
      when 3
        self.contents.draw_text(0, 32*2, width - 8, 32, "己方单体", 1)
      when 4
        self.contents.draw_text(0, 32*2, width - 8, 32, "己方全体", 1)
      when 5
        self.contents.draw_text(20, 32*2, width - 8, 32, "己方单体(HP 0)", 1)
      when 6
        self.contents.draw_text(20, 32*2, width - 8, 32, "己方全体(HP 0)", 1)
      when 7
        self.contents.draw_text(0, 32*2, width - 8, 32, "使用者", 1)
      end
      #——————————occasion
      self.contents.font.color = system_color
      self.contents.draw_text(0, 32*3, width - 8, 32, "可能使用的场合:")
      self.contents.font.color = normal_color
      case skill.scope
      when 0
        self.contents.draw_text(40, 32*3, width - 8, 32, "平时", 1)
      when 1
        self.contents.draw_text(40, 32*3, width - 8, 32, "战斗中", 1)
      when 2
        self.contents.draw_text(40, 32*3, width - 8, 32, "菜单中", 1)
      when 3
        self.contents.draw_text(40, 32*3, width - 8, 32, "不能使用", 1)
      end
      #——————————sp_cost
      self.contents.font.color = system_color
      self.contents.draw_text(
      0, 32*4, width - 8, 32, "消耗"+$data_system.words.sp+":")
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 32*4, width - 8, 32, skill.sp_cost.to_s, 1)
      #——————————power
      self.contents.font.color = system_color
      self.contents.draw_text(0, 32*5, width - 8, 32, "基础威力:")
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 32*5, width - 8, 32, skill.power.to_s, 1)
      #——————————hit
      self.contents.font.color = system_color
      self.contents.draw_text(0, 32*6, width - 8, 32, "命中率:")
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 32*6, width - 8, 32, skill.hit.to_s, 1)
      #——————————element_set
      self.contents.font.color = system_color
      x = 0
      self.contents.draw_text(0, 32*7, width - 8, 32, "属性:")
      for i in skill.element_set
        element_name = $data_system.elements
        self.contents.font.color = normal_color
        self.contents.draw_text(0, 32*7, width - 8, 32, element_name, 1)
        x += 32
      end
      if element_name == nil
        self.contents.font.color = normal_color
        self.contents.draw_text(0, 32*7, width - 8, 32, "无", 1)
      end
      #——————————plus_state_set
      self.contents.font.color = system_color
      x = 0
      self.contents.draw_text(0, 32*8, width - 8, 32, "附加状态:")
      for i in skill.plus_state_set
        state_name = $data_states.name
        self.contents.font.color = normal_color
        self.contents.draw_text(0, 32*8, width - 8, 32, state_name, 1)
        x += 32
      end
      if state_name == nil
        self.contents.font.color = normal_color
        self.contents.draw_text(0, 32*8, width - 8, 32, "无", 1)
      end
      #——————————minus_state_set
      self.contents.font.color = system_color
      x = 0
      self.contents.draw_text(0, 32*9, width - 8, 32, "解除状态:")
      for i in skill.minus_state_set
        state_name_2 = $data_states.name
        self.contents.font.color = normal_color
        self.contents.draw_text(x, 32*9, width - 8, 32, state_name_2, 1)
        x += 32
      end
      if state_name_2 == nil
        self.contents.font.color = normal_color
        self.contents.draw_text(0, 32*9, width - 8, 32, "无", 1)
      end
      #——————————F
      f = ""
      if skill.atk_f > 0
        f<<"攻击力"<<skill.atk_f.to_s<<"/"
      end
      if skill.eva_f > 0
        f<<"回避"<<skill.eva_f.to_s<<"/"
      end
      if skill.str_f > 0
        f<<"力量"<<skill.str_f.to_s<<"/"
      end
      if skill.dex_f > 0
        f<<"灵巧"<<skill.dex_f.to_s<<"/"
      end
      if skill.agi_f > 0
        f<<"速度"<<skill.agi_f.to_s<<"/"
      end
      if skill.int_f > 0
        f<<"魔力"<<skill.int_f.to_s<<"/"
      end
      if skill.pdef_f > 0
        f<<"物防"<<skill.pdef_f.to_s<<"/"
      end
      if skill.mdef_f > 0
        f<<"魔防"<<skill.mdef_f.to_s<<"."
      end
      self.contents.font.color = system_color
      self.contents.draw_text(
      0, 32*10, width - 8, 32, "受角色能力影响系数:")
      self.contents.font.color = normal_color
      self.contents.draw_text(0, 32*11, width - 8, 32, f)
      @x = x
      @y = y
      @skill = skill
      @actor = nil
    end
    self.visible = true
  end
end
# 设置模块
module Skill_Lv
  ITEM = {}
end
# 直接把默认技能窗口复制来的
class Window_Skill_Lv < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor : 角色
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, 320, 352)
    self.opacity = 160
    @actor = actor
    @column_max = 1
    refresh
    self.index = 0
    # 战斗中的情况下将窗口移至中央并将其半透明化
    #if $game_temp.in_battle
    #  self.y = 64
    #  self.height = 256
    #  self.back_opacity = 160
    #end
  end
  #--------------------------------------------------------------------------
  # ● 获取特技
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills]
      if skill != nil
        @data.push(skill)
      end
    end
    # 如果项目数不是 0 就生成位图、重新描绘全部项目
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘项目
  #     index : 项目编号
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    #if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    #else
    #  self.contents.font.color = disabled_color
    #end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    #rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    #self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    #opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))#, opacity
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    #self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # ● 刷新帮助文本
  #--------------------------------------------------------------------------
  def update_help
    if self.index != @old_index
    @help_window.set_text(150, 50, self.skill == nil ? "" : self.skill)
    @old_index = self.index
    end
  end
end
class Scene_LvSkill
  def initialize(id)
    @actor = $game_actors[id]
  end
  def main
    map = Spriteset_Map.new
    @skill_window = Window_Skill_Lv.new(@actor)
    @skill_help = Window_HelpSkillLv.new
    @skill_window.help_window = @skill_help
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    map.dispose
    @skill_window.dispose
    @skill_help.dispose
  end
  def update
    @skill_window.update
  end
end[/pre]
360截图20161206022944903.jpg

点评

原脚本 也没有 退出功能 能不能 看看  发表于 2016-12-6 13:19
好像是和其他脚本一起用的  发表于 2016-12-6 10:09
按图片上说 点进去就不能退出了5555  发表于 2016-12-6 02:25
------落尽红樱君不见,轻绘梨花泪沾衣。~~~
梦石
0
星屑
606
在线时间
797 小时
注册时间
2014-7-1
回帖
501

开拓者

发表于 2016-12-7 19:28:32 | 显示全部楼层
本帖最后由 jiushiainilip19 于 2016-12-7 19:35 编辑

348-374行 def update 后面好像没有设定退出, 比如说这样的
  1.    
  2. if Input.trigger?(Input::B)
  3.       # 演奏取消 SE
  4.       $game_system.se_play($data_system.cancel_se)
  5.       # 切换的地图画面
  6.       $scene = Scene_Map.new
  7.       return
  8.     end
复制代码

额。。。好像这脚本不全吧!

点评

不清楚,,,因为这个脚本看起来蛮漂亮的使用起来很萌哒哒  发表于 2016-12-7 22:07

评分

参与人数 2星屑 +215 收起 理由
RyanBern + 200 认可答案
j296196585 + 15 嘿嘿 你可以用用 很好看的

查看全部评分

学习使我疲劳,打工使我疲惫,恋爱使我伤身,吸烟伤我肺腑,饮酒损我形象,旅游使我破费,月底不见铜板,只有在论坛里面看看各种大佬才能使我进去
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部