赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 2 |
经验 | 4841 |
最后登录 | 2018-3-30 |
在线时间 | 677 小时 |
Lv1.梦旅人 饕餮
- 梦石
- 0
- 星屑
- 222
- 在线时间
- 677 小时
- 注册时间
- 2011-5-9
- 帖子
- 486
|
- #==============================================================================
- # ■ 物品丢弃 + 物品种类数限制 —— by 水镜风生
- #------------------------------------------------------------------------------
- LOSE_ITEM_SE_NAME = "Evasion" # 丢弃物品时播放的SE
- LOW_SPEED = 2 # 物品超重时的移动速度
- USUAL_SPEED = 4 # 平时的移动速度
- ITEM_MAX_N = 17 # 储存物品最大种类数的事件变量的编号
- class Window_LoseNumber < Window_Base
- #--------------------------------------------------------------------------
- # ★ 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 260, 104)
- @item = nil
- @max = 1
- @number = 1
- end
- #--------------------------------------------------------------------------
- # ★ 设置物品、最大数量
- #--------------------------------------------------------------------------
- def set(item, max)
- @item = item
- @max = max
- @number = 1
- refresh
- end
- #--------------------------------------------------------------------------
- # ★ 设置数量输入
- #--------------------------------------------------------------------------
- def number
- return @number
- end
- #--------------------------------------------------------------------------
- # ★ 刷新
- #--------------------------------------------------------------------------
- def refresh
- y = 24
- self.contents.clear
- draw_item_name(@item, 0, y)
- self.contents.font.color = normal_color
- self.contents.draw_text(164, y, 20, WLH, "×")
- self.contents.draw_text(190, y, 20, WLH, @number, 2)
- self.cursor_rect.set(186, y, 28, WLH)
- end
- #--------------------------------------------------------------------------
- # ★ 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- if self.active
- last_number = @number
- if Input.repeat?(Input::RIGHT) and @number < @max
- @number += 1
- end
- if Input.repeat?(Input::LEFT) and @number > 1
- @number -= 1
- end
- if Input.repeat?(Input::UP) and @number < @max
- @number = [@number + 10, @max].min
- end
- if Input.repeat?(Input::DOWN) and @number > 1
- @number = [@number - 10, 1].max
- end
- if @number != last_number
- Sound.play_cursor
- refresh
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_Item_Max
- #-----------------------------------------------------------------------------
- # 显示背包容量和当前物品数的窗口
- #============================================================================
- class Window_Item_Max < Window_Base
- #--------------------------------------------------------------------------
- # ★ 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(290, 360, 254, 56)
- refresh
- end
-
- #--------------------------------------------------------------------------
- # ★ 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_icon(144, 0, 0)
- self.contents.draw_text(36, 0, 100, 24, "背包容量:")
- item = $game_party.items
- string = item.size.to_s
- item_max = $game_variables[ITEM_MAX_N]
- item_max = 0 if item_max == nil
- self.contents.font.color = knockout_color if item.size > item_max
- self.contents.draw_text(135, 0, 30, 24, string, 2)
- self.contents.font.color = normal_color
- string = "/ " + item_max.to_s
- self.contents.draw_text(173, 0, 100, 24, string )
- end
-
- end
- #==============================================================================
- # ■ Window_Waring
- #-----------------------------------------------------------------------------
- # 显示超重警告的窗口
- #============================================================================
- class Window_Waring < Window_Base
- def initialize
- super(544 - 180, 416 - 56, 180, 56)
- refresh
- end
-
- def refresh
- self.contents.clear
- self.contents.draw_text(0, -4, 150, 32, "你已经超重了。")
- end
- end
- #==============================================================================
- # Game_Player 添加更改移动速度的方法
- #============================================================================
- class Game_Player
- def change_move_speed(n)
- @move_speed = n
- end
- end
- #==============================================================================
- # Scene_Map 添加在地图上显示警告窗口的处理
- #============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- $game_map.refresh
- @spriteset = Spriteset_Map.new
- @message_window = Window_Message.new
- @waring_window = Window_Waring.new
- @waring_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- if $scene.is_a?(Scene_Battle) # 正在切换战斗画面的情况下
- @spriteset.dispose_characters # 为了生成背景隐藏角色
- end
- snapshot_for_background
- @spriteset.dispose
- @message_window.dispose
- @waring_window.dispose
- if $scene.is_a?(Scene_Battle) # 正在切换战斗画面的情况下
- perform_battle_transition # 执行战斗前变换
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- $game_map.interpreter.update # 更新解释器
- $game_map.update # 更新滴入
- $game_player.update # 更新玩家
- $game_system.update # 更新计时器
- @spriteset.update # 更新活动块元件
- @message_window.update # 更新消息窗口
- unless $game_message.visible # 正在显示消息以外的情况
- update_transfer_player
- update_encounter
- update_call_menu
- update_call_debug
- update_scene_change
- update_over_item
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新物品超限判定
- #--------------------------------------------------------------------------
- def update_over_item
- item_max = $game_variables[ITEM_MAX_N]
- item_max = 0 if item_max == nil
- if $game_party.items.size > item_max
- @waring_window.visible = true
- a=$game_party.items.size - item_max
- if a>=18
- $game_player.change_move_speed(-1)
- # $scene = Scene_Item.new
- elsif a>=15
- $game_player.change_move_speed(0)
- elsif a>=12
- $game_player.change_move_speed(1)
- elsif a>=8
- $game_player.change_move_speed(2)
- elsif a>=5
- $game_player.change_move_speed(3)
- end
- else
- @waring_window.visible = false
- $game_player.change_move_speed(USUAL_SPEED)
- end
- end
- end
复制代码 使用方法很简单,带入变量来设置负重上限,给分吧! |
评分
-
查看全部评分
|