Project1

标题: 如何把菜单整个改掉 [打印本页]

作者: 鑫の尘埃    时间: 2015-8-9 14:01
标题: 如何把菜单整个改掉

本鑫想实现这样的效果,就是一按B键就直接出现如下的菜单




左边是主人物的状态
右边是主人物的技能

光标在右边

可以上下移动

按确定键是就会生成一个技能介绍的窗口

要怎么写?

作者: 浮云半仙    时间: 2015-8-10 11:58

你是要这样的么?
作者: 浮云半仙    时间: 2015-8-10 12:44


这样么?

脚本:


#记得把原先va自带的Scene_Menu删掉,这个脚本才能正确运行
#encoding:utf-8

class Window_MenuSkillList < Window_Selectable
  attr_reader :skills
  def initialize
    super(400,0,144,416)
    make_skill_list
    open
    select(0)
    activate
  end
  def make_skill_list
    @skills = $game_party.members[0].skills
    idx = 0
    @skills.each do |each_skill|
      draw_item(idx,each_skill.name)
      #msgbox(each_skill.name)
      idx += 1
    end
  end
  def draw_item(index,text)
    draw_text(item_rect_for_text(index), text)
  end
  def item_max
    return @skills? @skills.size : 1
  end
end

class Window_MenuSkillHelp < Window_Help
  def initialize
    super(3)
    close
  end
end

class Scene_Menu < Scene_Base
  def start
    super
    create_status_window
    create_skill_list
  end
  def create_status_window
    @status_window = Window_Status.new($game_party.members[0])
    @status_window.x = 0
    @status_window.y = 0
    @status_window.height = Graphics.height
    @status_window.width = 360
  end
  def create_skill_list
    @skill_list = Window_MenuSkillList.new
    @skill_list.height = @status_window.height
    @skill_list.width = Graphics.width - @status_window.width
    @skill_list.x = @status_window.width
    @skill_list.y = 0
    #@skill_list.set_handler(:cancel,method(:skill_list_cancel))
                 #这个不好用啦,直接重载update(好bao力 O(∩_∩))
    @skill_list.set_handler(:ok,    method(:skill_list_ok))
  end
  def skill_list_ok
    @help ||= Window_MenuSkillHelp.new
    @help.set_text(@skill_list.skills[@skill_list.index].description)
    @help.open
  end
  def update
    super
    if Input.trigger?(:B)
      if @help != nil && @help.open?
        @help.close
        @skill_list.activate
      else
        SceneManager.return
      end
    end
  end
end

作者: 浮云半仙    时间: 2015-8-10 12:52
浮云半仙 发表于 2015-8-10 12:44
这样么?

脚本:

orz....那个箭头我也不知道怎么去掉,
{:2_253:}我刚发现,左边状态窗口里面有些东西显示不全{:2_275:}我再改下
作者: 浮云半仙    时间: 2015-8-10 13:27


{:2_264:} 就是弄个合适的位置竟然弄了那么久

脚本:
#encoding:utf-8

class Window_MenuSkillList < Window_Selectable
  attr_reader :skills
  def initialize
    super(400,0,144,416)
    make_skill_list
    open
    select(0)
    activate
  end
  def make_skill_list
    @skills = $game_party.members[0].skills
    idx = 0
    @skills.each do |each_skill|
      draw_item(idx,each_skill.name)
      #msgbox(each_skill.name)
      idx += 1
    end
  end
  def draw_item(index,text)
    draw_text(item_rect_for_text(index), text)
  end
  def item_max
    return @skills? @skills.size : 1
  end
end

class Window_Status_SpecialChg < Window_Status
  def initialize(actor)
    super(actor)
  end
  def draw_block1(y)
    draw_actor_name(@actor, 4, y)
    draw_actor_class(@actor, 80, y)
    draw_actor_nickname(@actor, 128, y)
  end
  def draw_block2(y)
    draw_actor_face(@actor, 8, y)
    draw_basic_info(126, y)
    draw_exp_info(218, y)
  end
  def draw_block3(y)
    draw_parameters(32, y)
    draw_equipments(144, y)
  end
  def draw_actor_param(actor, x, y, param_id)
    change_color(system_color)
    draw_text(x, y, 120, line_height, Vocab::param(param_id))
    change_color(normal_color)
    draw_text(x + 40, y, 36, line_height, actor.param(param_id), 2)
  end
  def draw_exp_info(x, y)
    s1 = @actor.max_level? ? "-" : @actor.exp
    s2 = @actor.max_level? ? "-" : @actor.next_level_exp - @actor.exp
    s_next = sprintf(Vocab::ExpNext, Vocab::level)
    change_color(system_color)
    draw_text(x-40, y + line_height * 0, 100, line_height, Vocab::ExpTotal)
    draw_text(x-40, y + line_height * 1, 100, line_height, s_next)
    change_color(normal_color)
    draw_text(x+60, y + line_height * 0, 60, line_height, s1, 2)
    draw_text(x+60, y + line_height * 1, 60, line_height, s2, 2)
  end
end

class Window_MenuSkillHelp < Window_Help
  def initialize
    super(3)
    close
  end
end

class Scene_Menu < Scene_Base
  def start
    super
    create_status_window
    create_skill_list
  end
  def create_status_window
    @status_window = Window_Status_SpecialChg.new($game_party.members[0])
    @status_window.x = 0
    @status_window.y = 0
    @status_window.height = Graphics.height
    @status_window.width = 360
  end
  def create_skill_list
    @skill_list = Window_MenuSkillList.new
    @skill_list.height = @status_window.height
    @skill_list.width = Graphics.width - @status_window.width
    @skill_list.x = @status_window.width
    @skill_list.y = 0
    #@skill_list.set_handler(:cancel,method(:skill_list_cancel))
                 #这个不好用啦,直接重载update(好bao力 O(∩_∩))
    @skill_list.set_handler(:ok,    method(:skill_list_ok))
  end
  def skill_list_ok
    @help ||= Window_MenuSkillHelp.new
    @help.set_text(@skill_list.skills[@skill_list.index].description)
    @help.open
  end
  def update
    super
    if Input.trigger?(:B)
      if @help != nil && @help.open?
        @help.close
        @skill_list.activate
      else
        SceneManager.return
      end
    end
  end
end
作者: tseyik    时间: 2015-8-10 13:44
本帖最后由 tseyik 于 2015-8-10 13:46 编辑

最簡単就是禁止調用菜単
自己用事件寫一個
按B就直接調用該事件

或者用選單編輯器做一個
https://rpg.blue/thread-378309-1-1.html




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1