| 赞 | 0 |
| VIP | 0 |
| 好人卡 | 0 |
| 积分 | 1 |
| 经验 | 22997 |
| 最后登录 | 2013-9-8 |
| 在线时间 | 4 小时 |
Lv1.梦旅人 传奇
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 4 小时
- 注册时间
- 2007-4-10
- 帖子
- 427
|
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 288, 640, 192)
- @column_max = 2
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = $game_temp.food_data.dup
- @data.shift
- # 項目数が 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)
- item = @data[index]
- if item.cook_ok?
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- if item.show?
- 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(item.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, 212, 32, item.name, 0)
- else
- self.contents.draw_text(x + 28, y, 212, 32, "-----", 0)
- end
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- if self.item.show?
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- else
- @help_window.set_text("")
- end
- end
- end
- class Window_FoodInfo < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 128, 640, 160)
- self.contents = Bitmap.new(width - 32, height - 32)
- @item = nil
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @item == nil
- return
- end
- if @item.show? == false
- return
- end
- item_set = @item.recipe.keys
- need_number = []
- for i in item_set
- if i.is_a?(String)
- temp = @item.food_category(i)
- need_number.push(@item.cook_need_item_number(temp))
- else
- need_number.push(@item.cook_need_item_number(i))
- end
- end
- for i in 0...item_set.size
- x = 4 + i % 2 * (288 + 32)
- y = i / 2 * 32
- if item_set[i].is_a?(Numeric)
- now_num = $game_party.item_number(item_set[i])
- max_num = @item.recipe[item_set[i]]
- if now_num < max_num
- self.contents.font.color = disabled_color
- opacity = 128
- else
- self.contents.font.color = normal_color
- opacity = 255
- end
- item = $data_items[item_set[i]]
- name = item.name
- rect = Rect.new(x, y, self.width / 2 - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, name, 0)
- elsif item_set[i].is_a?(String)
- now_num = need_number[i]
- max_num = @item.recipe[item_set[i]]
- if now_num < max_num
- self.contents.font.color = disabled_color
- else
- self.contents.font.color = normal_color
- end
- name = item_set[i].to_s
- self.contents.draw_text(x + 28, y, 212, 32, name, 0)
- end
- self.contents.draw_text(x + 212, y, 24, 32, max_num.to_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 240, y, 16, 32, "/", 1)
- self.contents.draw_text(x + 256, y, 24, 32, now_num.to_s, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● アイテムの設定
- # item : 新しいアイテム
- #--------------------------------------------------------------------------
- def item=(item)
- if @item != item
- @item = item
- refresh
- end
- end
- end
- class Window_CookSelect < Window_Selectable
- include Cooking_System_Config
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 288, 640, 192)
- @column_max = 2
- self.contents = Bitmap.new(width - 32, height - 32)
- if COOK_TYPE_SELECT == 1
- @data = $game_party.actors
- else
- @data = [$game_party]
- end
- @item_max = @data.size
- @cookitem = nil
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● アクター取得
- #--------------------------------------------------------------------------
- def actor
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @cookitem == nil
- return
- end
- for i in [email protected]
- actor = @data[i]
- x = 4 + i % 2 * (288 + 32)
- y = i / 2 * 64
- self.contents.font.color = normal_color
- if COOK_TYPE_SELECT == 1
- self.contents.draw_text(x, y, 160, 32, actor.name, 0)
- else
- self.contents.draw_text(x, y, 160, 32, "料理実行", 0)
- end
- if USE_COOK_MASTERY
- cm = actor.cookmastery[@cookitem.id]
- cm = 0 if cm == nil
- hosi = "★" * cm
- hosi2= "☆" * (MAX_COOK_MASTERY - cm)
- self.contents.draw_text(x, y+32, 320, 32, hosi+hosi2, 0)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● アイテムの設定
- # item : 新しいアイテム
- #--------------------------------------------------------------------------
- def item=(item)
- if @cookitem != item
- @cookitem = item
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● カーソルの矩形更新
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- x = @index % @column_max * 320
- y = @index / @column_max * 64
- self.cursor_rect.set(x, y, 160, 32)
- end
- end
- end
- class Window_CookResult < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(80, 60, 480, 160)
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh(item, success)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 64, 32, "料理", 0)
- if success
- self.contents.font.color = system_color
- str = "成功!"
- else
- self.contents.font.color = text_color(2)
- str = "失敗…"
- end
- self.contents.draw_text(4+64, 0, 96, 32, str, 0)
- self.contents.font.color = normal_color
- rect = Rect.new(4, 32, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = 255
- hprate = $game_temp.temp_recover_hp_rate
- sprate = $game_temp.temp_recover_sp_rate
- hp = $game_temp.temp_recover_hp
- sp = $game_temp.temp_recover_sp
- self.contents.blt(4, 32 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(4 + 28, 32, 212, 32, item.name, 0)
- self.contents.draw_text(4 + 240, 32, 96, 32, "が完成!", 0)
- self.contents.draw_text(4, 64, 64, 32, $data_system.words.hp, 0)
- self.contents.draw_text(4 + 96, 64, 64, 32, hprate.to_s+"%", 2)
- self.contents.draw_text(4 + 160, 64, 32, 32, "+", 1)
- self.contents.draw_text(4 + 224, 64, 64, 32, hp.to_s, 2)
- self.contents.draw_text(4, 96, 64, 32, $data_system.words.sp, 0)
- self.contents.draw_text(4 + 96, 96, 64, 32, sprate.to_s+"%", 2)
- self.contents.draw_text(4 + 160, 96, 32, 32, "+", 1)
- self.contents.draw_text(4 + 224, 96, 64, 32, sp.to_s, 2)
- end
- end
- class Window_Use_CookItem < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(80, 220, 480, 192)
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh(useitem, use_add_food)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 160, 32, "使用した食材", 0)
- total_food = useitem + use_add_food
- for i in 0...total_food.size
- item = $data_items[total_food[i]]
- x = 4 + i % 2 * 240
- y = 32 + i / 2 * 32
- rect = Rect.new(x, y, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- if i < useitem.size
- self.contents.font.color = normal_color
- else
- self.contents.font.color = text_color(3)
- end
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- end
- end
- end
- class Window_Add_Mate < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 128, 640, 160)
- self.contents = Bitmap.new(width - 32, height - 32)
- end
-
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh(useitem)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 160, 32, "追加食材", 0)
- for i in 0...useitem.size
- item = $data_items[useitem[i]]
- x = 4 + i % 2 * 240
- y = 32 + i / 2 * 32
- rect = Rect.new(x, y, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- end
- end
- end
- class Scene_Cooking
- include Cooking_System_Config
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- $game_temp.set_food_data if $game_temp.food_data == nil
- # ウィンドウを作成
- @title_window = Window_Base.new(0, 0, 640, 64)
- @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
- @title_window.contents.draw_text(4, 0, 320, 32, "料理", 0)
- @main_window = Window_CookMenu.new
- @main_window.active = true
- @help_window = Window_Help.new
- @help_window.z = 110
- @help_window.y = 64
- @help_window.visible = true
- s1 = "料理実行"
- s2 = "やめる"
- command = [s1, s2]
- @select_window = Window_CookSelect.new #Window_Command.new(160, command)
- @select_window.z = 110
- @select_window.active = false
- @select_window.visible = false
- @add_mate_window = Window_Add_Mate.new
- @add_mate_window.z = 120
- @add_mate_window.visible = false
- # インフォウィンドウを作成
- @info_window = Window_FoodInfo.new
- # ヘルプウィンドウを関連付け
- @main_window.help_window = @help_window
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @title_window.dispose
- @help_window.dispose
- @main_window.dispose
- @select_window.dispose
- @info_window.dispose
- @add_mate_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # ウィンドウを更新
- @help_window.update
- @main_window.update
- @select_window.update
- @info_window.update
- @add_mate_window.update
- if @result_window != nil
- update_result
- return
- end
- # メインウィンドウがアクティブの場合: update_target を呼ぶ
- if @main_window.active
- update_main
- return
- end
- # 種類ウィンドウがアクティブの場合: update_kind を呼ぶ
- if @select_window.active
- update_select
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (選択ウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_select
- if USE_COOK_MATE_ADD and ADD_MATE_SHOW
- #追加食材ウィンドウを表示
- if @select_window.index != @select_w_last_index
- @add_mate_window.visible = true
- @select_w_last_index = @select_window.index
- add_food = actor_add_mate(@main_window.item, @select_window.actor)
- @add_mate_window.refresh(add_food)
- end
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- if $game_party.cook_battle_count > 0 or
- (COOK_TYPE_SELECT == 1 and @select_window.actor.dead?)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- use_item = @main_window.item.lose_item
-
- if USE_COOK_MATE_ADD
- add_food = actor_add_mate(@main_window.item, @select_window.actor)
- have_add_food = []
- for food_id in add_food
- if $game_party.item_number(food_id) > 0
- have_add_food.push(food_id)
- $game_party.lose_item(food_id, 1)
- end
- end
- result = @main_window.item.cook_effect(@select_window.actor, false, have_add_food)
- else
- result = @main_window.item.cook_effect(@select_window.actor)
- end
- if result
- $game_system.se_play(@main_window.item.cook_se)
- @result_window = Window_CookResult.new
- @result_window.refresh(@main_window.item, result)
- else
- @fail_food = FoodData.new(@main_window.item.fail_food_id)
- @fail_food.cook_effect(@select_window.actor, true)
- $game_system.se_play(@fail_food.cook_se)
- @result_window = Window_CookResult.new
- @result_window.refresh(@fail_food, result)
- end
- use_add_food = []
- if USE_COOK_MATE_ADD
- use_add_food = have_add_food
- end
- if use_item.size != 0 or use_add_food.size != 0
- @useitem_window = Window_Use_CookItem.new
- @useitem_window.refresh(use_item, use_add_food)
- @useitem_window.z = 130
- end
- @info_window.refresh
- @result_window.z = 130
- return
- end
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- @main_window.active = true
- @select_window.active = false
- @select_window.visible = false
- @add_mate_window.visible = false
- @select_w_last_index = nil
- return
- end
- if USE_COOK_MATE_ADD and ADD_MATE_SHOW
- # A ボタンが押された場合
- if Input.trigger?(Input::A)
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- if @add_mate_window.visible
- @add_mate_window.visible = false
- else
- @add_mate_window.visible = true
- end
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_main
- @info_window.item = @main_window.data[@main_window.index]
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- if @main_window.item == nil or
- @main_window.item.show? == false or
- @main_window.item.cook_ok? == false
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- @main_window.active = false
- @select_window.active = true
- @select_window.visible = true
- @select_window.item = @main_window.data[@main_window.index]
- @select_window.refresh
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (リザルトウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_result
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- @result_window.dispose
- @result_window = nil
- if @useitem_window != nil
- @useitem_window.dispose
- @useitem_window = nil
- end
- @main_window.active = true
- @main_window.refresh
- @select_window.active = false
- @select_window.visible = false
- @add_mate_window.visible = false
- @select_w_last_index = nil
- $game_party.cook_battle_count = COOK_BATTLE_COUNT
- if $game_temp.common_event_id > 0
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 追加食材を返す
- #--------------------------------------------------------------------------
- def actor_add_mate(food, actor=nil)
- #追加素材を取得
- if COOK_TYPE_SELECT == 1
- if USE_ACTOR_MATE_ADD
- useitem = food.add_mate[actor.id]
- else
- useitem = food.add_mate[0]
- end
- else
- useitem = food.add_mate[0]
- end
- return [] if useitem == nil
- return [] if useitem.size == 0
- #熟練度機能が使用されているなら熟練度を取得
- if USE_COOK_MASTERY
- cm = actor.cookmastery[food.id]
- cm = 0 if cm == nil
- else
- cm = 0
- end
- temp_item = []
- for i in 0..cm
- next if useitem[i] == nil
- temp_item.push(useitem[i])
- end
- return temp_item
- end
- end
复制代码
這個是我從外網找到的 我不知道怎么用
你們這些高手試下能用不 不能用就54我
使用方法[用翻譯工具從外網一字不漏粘貼到這 ]:
请自用法
Scene_Debug自下,Main上面粘贴。
后边,用活动指令的「脚本」
$scene = Scene_Cooking.new
转移到条款菜的景色。
对到现在没有设定项目多。
详细的说明在调味汁上写了,不过,如果因为清楚地说长在(汗)
样品的项目也准备了把那边做为参考可以。因为
…真的说明长注意。要是
momomo一定不读吧(笑)
返回 |
|