| |
#============================================================================== # * Window_Help #------------------------------------------------------------------------------ # ?It is the window which indicates the item description the skill and the status etc. of the actor. #============================================================================== class Window_Help < Window_Base #-------------------------------------------------------------------------- # - Object initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize end #-------------------------------------------------------------------------- # - Text setting # text : The character string which is indicated in the window # align : Alignment (0. The left arranging, 1. Central arranging, 2. The right it arranges) #-------------------------------------------------------------------------- def set_text(text, align = 0) # When at least one side of the text and the alignment it is different from the last time if text != @text or align != @align # Redrawing the text self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, self.width - 40, 32, text, align) @text = text @align = align @actor = nil end self.visible = true end #-------------------------------------------------------------------------- # - Actor setting # actor : The actor who indicates status #-------------------------------------------------------------------------- def set_actor(actor) if actor != @actor self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) draw_actor_hp(actor, 284, 0) draw_actor_sp(actor, 460, 0) @actor = actor @text = nil self.visible = true end end #-------------------------------------------------------------------------- # - Enemy setting # enemy : The enemy which indicates name and the state #-------------------------------------------------------------------------- def set_enemy(enemy) text = enemy.name state_text = make_battler_state_text(enemy, 112, false) if state_text != "" text += " " + state_text end set_text(text, 1) end #-------------------------------------------------------------------------- def set_enemy(actor) self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) carol3_draw_hp_bar(actor, 284, 0) carol3_draw_sp_bar(actor, 460, 0) @text = nil self.visible = true end def carol3_draw_hp_bar(actor, x, y, width = 128) self.contents.font.color = system_color self.contents.fill_rect(x-1, y+17, width+2,6, Color.new(0, 0, 0, 255)) w = width * actor.hp / actor.maxhp self.contents.fill_rect(x, y+18, w,1, Color.new(255, 96, 96, 255)) self.contents.fill_rect(x, y+19, w,1, Color.new(255, 0, 0, 255)) self.contents.fill_rect(x, y+20, w,1, Color.new(128, 0, 0, 255)) self.contents.fill_rect(x, y+21, w,1, Color.new(0, 0, 0, 255)) self.contents.draw_text(x,y,128,32,$data_system.words.hp,1) self.contents.font.color = normal_color end def carol3_draw_sp_bar(actor, x, y, width = 128) self.contents.font.color = system_color self.contents.fill_rect(x-1, y+17, width+2,6, Color.new(0, 0, 0, 255)) w = width * actor.sp / actor.maxsp self.contents.fill_rect(x, y+18, w,1, Color.new(128, 255, 255, 255)) self.contents.fill_rect(x, y+19, w,1, Color.new(0, 255, 255, 255)) self.contents.fill_rect(x, y+20, w,1, Color.new(0, 192, 192, 255)) self.contents.fill_rect(x, y+21, w,1, Color.new(0, 128, 128, 255)) self.contents.draw_text(x,y,128,32,$data_system.words.sp,1) self.contents.font.color = normal_color end end | |
| |
1.นำไปทับกับ Window_Help อันเก่า |
[สคริปต์] หลอดเลือด+เวทย์ศัตรูไม่มีค่าพลัง