Scritp Retirado =)
Última edição por Kakashy Hatake em Sex Fev 10, 2012 12:16 pm, editado 2 vez(es)
#==============================================================================
# Window Login
#==============================================================================
class Window_Register < Window_Base
def initialize
super((Graphics.width-260)/2, (Graphics.height-(WLH*9+32))/2, 260, WLH*9+32)
self.visible = self.active = false
@title.draw_text(@title.rect, "Account Creation", 1)
@login_box = TextBox.new(self, contents.width-84, WLH*2, 100, 12)
@pass_box = TextBox.new(self, contents.width-84, WLH*3, 100, 12, true)
@pass2_box = TextBox.new(self, contents.width-84, WLH*4, 100, 12, true)
@email_box = TextBox.new(self, contents.width-84, WLH*5, 100)
@question_box = TextBox.new(self, contents.width-84, WLH*6, 100, 15)
@answer_box = TextBox.new(self, contents.width-84, WLH*7, 100, 15)
@register_button = Button.new(self, 100, WLH*9, Vocab::Register) { do_register }
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, WLH, contents.width, WLH, Vocab::Username)
self.contents.draw_text(0, WLH*2, contents.width, WLH, Vocab::Password)
self.contents.draw_text(0, WLH*3, contents.width, WLH, Vocab::ConfirmPassword)
self.contents.draw_text(0, WLH*4, contents.width, WLH, Vocab::Email)
self.contents.draw_text(0, WLH*5, contents.width, WLH, Vocab::SecretQuestion)
self.contents.draw_text(0, WLH*6, contents.width, WLH, Vocab::SecretAnswer)
end
def update
super
if Input.trigger?(Keys::Tab)
if @login_box.active
@login_box.active = false
@pass_box.active = true
elsif @pass_box.active
@pass_box.active = false
@pass2_box.active = true
elsif @pass2_box.active
@pass2_box.active = false
@email_box.active = true
elsif @email_box.active
@email_box.active = false
@question_box.active = true
elsif @question_box.active
@question_box.active = false
@answer_box.active = true
elsif @answer_box.active
@answer_box.active = false
@login_box.active = true
end
elsif Input.trigger?(Keys::Esc)
on_close
end
end
def do_register
if #$game_temp.server_status <= 0
$alert_window.open(Vocab::ServerOffline)
elsif @login_box.text == ""
$alert_window.open(Vocab::InvalidUsername)
elsif @login_box.text.length < Config::Min_Characters
$alert_window.open(sprintf(Vocab::Insufficient, Vocab::Username))
elsif @pass_box.text == ""
$alert_window.open(Vocab::InvalidPassword)
elsif @pass_box.text.length < Config::Min_Characters
$alert_window.open(sprintf(Vocab::Insufficient, Vocab::Password))
elsif @pass_box.text != @pass2_box.text
$alert_window.open(Vocab::PasswordsNotMatch)
elsif @email_box.text == ""
$alert_window.open(Vocab::InvalidEmail)
elsif @question_box.text == ""
$alert_window.open(Vocab::InvalidQuestion)
elsif @answer_box.text == ""
$alert_window.open(Vocab::InvalidAnswer)
else
for i in Config::Forbidden_Strings
next unless @login_box.text.include?(i) or @login_box.text.include?(i) or
@login_box.text.include?(i) or @login_box.text.include?(i) or
@login_box.text.include?(i)
$alert_window.open(Vocab::ForbiddenCharacter)
return
end
Network.send_register(@login_box.text, @pass_box.text, @email_box.text,
@question_box.text, @answer_box.text)
end
end
def on_open
super
@login_box.text = ""
@pass_box.text = ""
@pass2_box.text = ""
@email_box.text = ""
@question_box.text = ""
@answer_box.text = ""
end
def on_close
super
$scene.login_window.on_open if $scene.is_a?(Scene_Login)
end
end