Advertisement
Jaizu85

Untitled

Oct 16th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. class Scene_NameInput
  2. def adjust_char_texts
  3. end
  4. RectWidths = 0
  5. Bases_X = [2000, 3000, 4000, 5000, 5000]
  6. def init_input_chars
  7. x = (320 - 18 * @max_length)/2
  8. y = 16 - Text::Util::FOY
  9. bmp = RPG::Cache.interface("NameInput_Underscore")
  10. @input_texts = Array.new(@max_length)
  11. @input_underscore = Array.new(@max_length)
  12. @max_length.times do |i|
  13. @input_underscore[i] = Sprite.new(@viewport).set_bitmap(bmp).set_position(x, 32)
  14. @input_texts[i] = Text.new(0, @viewport, x, y, 18, 16, nil.to_s, 1).load_color(0)
  15. x += 18
  16. end
  17. end
  18. def initialize(default_name, max_length, character = nil)
  19. @default_name = default_name
  20. @name = default_name.split(//)[0,max_length]
  21. @max_length = max_length
  22. @viewport = Viewport.create(:main, 20000)
  23. @background = Sprite.new(@viewport)
  24. .set_bitmap("NameInput_Fond", :interface)
  25. adjust_char_texts
  26. init_key_text
  27. init_input_chars
  28. @cursor = Sprite.new(@viewport)
  29. @maj_c = Sprite::WithColor.new(@viewport)
  30. .set_position(230, 200)
  31. .set_bitmap("", :interface)
  32. .set_color([0, 1.0, 0.39, 1.0])
  33. @character = Sprite.new(@viewport)
  34. #>Pokémon
  35. if(character.class == PFM::Pokemon)
  36. @character.bitmap = character.icon
  37. @character.set_position(18, 8).mirror = true
  38. @character.src_rect.width = @character.src_rect.height
  39. elsif(character)
  40. @character.bitmap = RPG::Cache.character(character)
  41. width = @character.bitmap.width/4
  42. height = @character.bitmap.height/4
  43. @character.src_rect.set(0, 0, width, height)
  44. @character.set_position(10 + (48 - width)/2, (48 - height) / 2)
  45. end
  46. @index_x = 0
  47. @index_y = 0
  48. @opacity = 10
  49. end
  50.  
  51. def update
  52. op = @cursor.opacity
  53. @cursor.opacity += @opacity
  54. @opacity -= 2*@opacity if op == @cursor.opacity
  55. unless(@cursor.visible)
  56. return update_keyboard
  57. end
  58. @cursor.visible = false
  59. @lastctrl = true
  60. end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement