设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3090|回复: 6
打印 上一主题 下一主题

[已经过期] 怎么做有利息银行

[复制链接]

Lv1.梦旅人

梦石
0
星屑
84
在线时间
130 小时
注册时间
2014-9-1
帖子
98
跳转到指定楼层
1
发表于 2015-8-8 05:34:55 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如题,请各位大神帮帮忙。
小弟不胜感激!{:8_457:}

评分

参与人数 1+2 收起 理由
哇哇哇啊叭叭 + 2 天呐...怎么净有人提刁难RM的问题.

查看全部评分

halo大家好,欢迎支持我的部落格
http://dedarknightstudio.blogspot.com

Lv4.逐梦者

梦石
7
星屑
1113
在线时间
334 小时
注册时间
2008-1-28
帖子
1566
2
发表于 2015-8-8 12:01:49 | 只看该作者
普通的变量计算就好了……

对话数值输入变量[1],这是要借的钱数。
然后加在借钱总数(变量[2])里。

然后利息就用总数算。

还钱的时候也是输入变量[1],条件分析不要超过总数。
终于有可以放在这里的游戏了……
极短13 新生 《箱子新世界》
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (版主)

梦石
0
星屑
2300
在线时间
5538 小时
注册时间
2011-1-10
帖子
6619

青铜编剧史诗剧作家剧作品鉴家

3
发表于 2015-8-8 14:09:10 | 只看该作者
简单的方法:存钱时用公共事件和变量开始计时,每20帧变量+1,取钱时用这个变量×利息×金钱总额,然后就相当于连本带息取出钱了。记得每次使用的时候将计时变量清零。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
33 小时
注册时间
2015-7-4
帖子
27
4
发表于 2015-8-12 12:18:55 | 只看该作者
这银行脚本效果蛮不错的
或者也可以用事件,很简单的
  1. #   Created By SephirothSpawn (12.03.05)
  2. #   Last Updated: 12.03.05
  3. # Banking System

  4. =begin

  5. =^^=HI~~

  6. 这个我只作个界面胡乱翻译啊……
  7. 大概的内容翻译完成,只是不太了解债券= =||||,所以……

  8. 这个脚本主要功能是:存款,取款,购买债券,债券查看……
  9. 汉字的部分大家可以在脚本里替换~~~~基本的界面都汉化了,不影响使用滴~

  10. 调用请用此脚本:$scene = Scene_Bank.new

  11. by 秋弦月

  12. =end


  13. # ** Scene_Title
  14. #==============================================================================
  15. class Scene_Title

  16. # * Alias Command: New Game
  17. #--------------------------------------------------------------------------
  18. alias bank_command_new_game command_new_game
  19. #--------------------------------------------------------------------------
  20. # * Command: New Game
  21. #--------------------------------------------------------------------------
  22. def command_new_game
  23.    $game_bank = Game_BankSystem.new
  24.    bank_command_new_game
  25. end
  26. end

  27. #==============================================================================
  28. # ** Window_RefreshCommand
  29. #==============================================================================
  30. class Window_RefreshCommand < Window_Selectable
  31. #--------------------------------------------------------------------------
  32. # * Object Initialization
  33. #     width    : window width
  34. #     commands : command text string array
  35. #--------------------------------------------------------------------------
  36. def initialize(width, commands)
  37.    # Compute window height from command quantity
  38.    super(0, 0, width, commands.size * 32 + 32)
  39.    @item_max = commands.size
  40.    @commands = commands
  41.    refresh
  42.    self.index = 0
  43. end
  44. #--------------------------------------------------------------------------
  45. # * Refresh
  46. #--------------------------------------------------------------------------
  47. def refresh(commands = @commands)
  48.    @commands = commands
  49.    @item_max = commands.size
  50.    if self.contents != nil
  51.      self.contents.dispose
  52.      self.contents = nil
  53.    end
  54.    self.contents = Bitmap.new(width - 32, @item_max * 32)
  55.    for i in 0...@item_max
  56.      draw_item(i, normal_color)
  57.    end
  58. end
  59. #--------------------------------------------------------------------------
  60. # * Draw Item
  61. #     index : item number
  62. #     color : text color
  63. #--------------------------------------------------------------------------
  64. def draw_item(index, color)
  65.    self.contents.font.color = color
  66.    self.contents.draw_text(0, 32 * index, self.contents.width - 8, 32, @commands[index], 1)
  67. end
  68. #--------------------------------------------------------------------------
  69. # * Disable Item
  70. #     index : item number
  71. #--------------------------------------------------------------------------
  72. def disable_item(index)
  73.    draw_item(index, disabled_color)
  74. end
  75. #--------------------------------------------------------------------------
  76. # * Undisable Item
  77. #     index : item number
  78. #--------------------------------------------------------------------------
  79. def disable_item(index)
  80.    draw_item(index, normal_color)
  81. end
  82. end

  83. #==============================================================================
  84. # ** Game_BankSystem
  85. #==============================================================================
  86. class Game_BankSystem
  87. #--------------------------------------------------------------------------
  88. # * Public Instance Variables
  89. #--------------------------------------------------------------------------
  90. attr_accessor :account_balance
  91. attr_accessor :interest_rate
  92. attr_accessor :saving_bonds
  93. #--------------------------------------------------------------------------
  94. # * Object Initialization
  95. #--------------------------------------------------------------------------
  96. def initialize
  97.    @account_balance = 0
  98.    @interest_rate = 1
  99.    @saving_bonds = []
  100.    @last_interest_time = 0
  101. end

  102. # * Update
  103.    def update
  104.    # Updates Deposited Amount
  105.    interest_time = (Graphics.frame_count / Graphics.frame_rate - @last_interest_time) / 3600.0
  106.    interest_amt = (@account_balance * @interest_rate / 100.0 * interest_time).to_i
  107.    if interest_amt > 0
  108.      @last_interest_time = Graphics.frame_count / Graphics.frame_rate
  109.      @account_balance += interest_amt
  110.      # Refreshes Data Windows
  111.      $scene.refresh_windows
  112.    end
  113. end
  114. #--------------------------------------------------------------------------
  115. # * Deposit
  116. #--------------------------------------------------------------------------
  117. def deposit(amount)
  118.    $game_party.lose_gold(amount)
  119.    @account_balance += amount
  120. end
  121. #--------------------------------------------------------------------------
  122. # * Withdraw
  123. #--------------------------------------------------------------------------
  124. def withdraw(amount)
  125.    @account_balance -= amount
  126.    $game_party.gain_gold(amount)
  127. end
  128. #--------------------------------------------------------------------------
  129. # * Add Savings Bond
  130. #--------------------------------------------------------------------------
  131. def add_bond(bond)
  132.    @saving_bonds.push(bond)
  133.    @saving_bonds.sort! {|a, b| a.name <=> b.name}
  134. end
  135. end

  136. #==============================================================================
  137. # ** Savings_Bond
  138. #==============================================================================
  139. class Savings_Bond
  140. #--------------------------------------------------------------------------
  141. # * Public Instance Variables
  142. #--------------------------------------------------------------------------
  143. attr_accessor :name
  144. attr_accessor :cost
  145. attr_accessor :interest_rate
  146. attr_accessor :length
  147. attr_accessor :time_bought
  148. attr_accessor :time_finished
  149. attr_accessor :mature_value
  150. #--------------------------------------------------------------------------
  151. # * Object Initialization
  152. #     name           : Savings Bond Name
  153. #     cost             : Savings Bond Cost
  154. #     interest_rate : Savings Bond Interest Rate (In Percent)
  155. #     length          : Length of Hours until Mature
  156. #--------------------------------------------------------------------------
  157. def initialize(name, cost, interest_rate, length)
  158.    @name = name
  159.    @cost = cost
  160.    @interest_rate = interest_rate
  161.    @length = length
  162.    @mature_value = (@cost * (1+ @interest_rate / 100.0)).to_i
  163. end
  164. #--------------------------------------------------------------------------
  165. # * Set Times
  166. #--------------------------------------------------------------------------
  167. def set_times
  168.    @time_bought = Graphics.frame_count / Graphics.frame_rate
  169.    @time_finished = @time_bought + @length * 3600
  170. end
  171. #--------------------------------------------------------------------------
  172. # * Make Time to HH:MM:SS
  173. #--------------------------------------------------------------------------
  174. def return_time(time)
  175.    hours      = time / 60 / 60
  176.    minutes   = time / 60 % 60
  177.    seconds   = time % 60
  178.    return sprintf("%02d:%02d:%02d", hours, minutes, seconds)
  179. end
  180. end

  181. #==============================================================================
  182. # ** Window_BankNumber
  183. #==============================================================================
  184. class Window_BankNumber < Window_Base
  185. #--------------------------------------------------------------------------
  186. # * Object Initialization
  187. #--------------------------------------------------------------------------
  188. def initialize
  189.    super(640, 272, 240, 192)
  190.      self.opacity = 175
  191.    self.contents = Bitmap.new(width - 32, height - 32)
  192. end
  193. #--------------------------------------------------------------------------
  194. # * Refresh
  195. #     money  : Gold being...
  196. #     type      : Deposit or Withdraw
  197. #--------------------------------------------------------------------------
  198. def refresh(money, type)
  199.    contents.clear
  200.    # Deposit or Withdraw
  201.    contents.font.color = system_color
  202.    contents.draw_text(0, 0, contents.width, 24, "存款信息", 1)
  203.    if type == "存入"
  204.      # Draws Game Party Gold
  205.      contents.draw_text(4, 48, contents.width, 24, "所持金钱:")
  206.      contents.font.color = normal_color
  207.      contents.draw_text(-4, 48, contents.width, 24, $game_party.gold.to_s, 2)
  208.    else
  209.      # Draws Account Balance
  210.      contents.draw_text(4, 48, contents.width, 24, "银行余额:")
  211.      contents.font.color = normal_color
  212.      contents.draw_text(-4, 48, contents.width, 24, $game_bank.account_balance.to_s, 2)
  213.    end
  214.    # Draws Money Being Deposited or Withdrawn
  215.    contents.font.color = system_color
  216.    contents.draw_text(4, 72, contents.width, 24, "预存金钱:")
  217.    contents.font.color = normal_color
  218.    contents.draw_text(-4, 72, contents.width, 24, "- #{money}", 2)
  219.    # Draws Line
  220.    line = ""
  221.    while contents.text_size(line).width < contents.width
  222.      line += "-"
  223.    end
  224.    contents.draw_text(0, 96, contents.width, 24, line, 2)
  225.    # Draws Game Party Gold Amont
  226.    contents.font.color = system_color
  227.    contents.draw_text(4, 112, contents.width, 32, "存后金钱:")
  228.    amount = $game_party.gold
  229.    amount += type == "存入" ? -money : money
  230.    contents.font.color = normal_color
  231.    contents.draw_text(-4, 112, contents.width, 32, amount.to_s, 2)
  232.    # Draws Deposit Amont
  233.    amount = $game_bank.account_balance
  234.    amount += type == "存入" ? money : -money
  235.    contents.font.color = system_color
  236.    contents.draw_text(4, 136, contents.width, 32, "存入余额:")
  237.    contents.font.color = normal_color
  238.    contents.draw_text(-4, 136, contents.width, 32, amount.to_s, 2)
  239. end
  240. end

  241. #==============================================================================
  242. # ** Window_BankBio
  243. #==============================================================================
  244. class Window_BankBio < Window_Base
  245. #--------------------------------------------------------------------------
  246. # * Object Initialization
  247. #--------------------------------------------------------------------------
  248. def initialize
  249.    super(-240, 272, 240, 192)
  250.      self.opacity = 175
  251.    self.contents = Bitmap.new(width - 32, height - 32)
  252.    refresh
  253. end
  254. #--------------------------------------------------------------------------
  255. # * Refresh
  256. #--------------------------------------------------------------------------
  257. def refresh
  258.    contents.clear
  259.    # Deposit or Withdraw
  260.    contents.font.color = system_color
  261.    # Draws Actor Name in Postition 1
  262.    contents.font.color = normal_color
  263.    contents.draw_text(0, 0, contents.width, 24, "#{$game_party.actors[0].name}", 1)
  264.    # Draws Game Party Gold
  265.    contents.font.color = system_color
  266.    contents.draw_text(4, 32, contents.width, 24, "持有 #{$data_system.words.gold}:")
  267.    contents.font.color = normal_color
  268.    contents.draw_text(-4, 32, contents.width, 24, $game_party.gold.to_s, 2)
  269.    # Draws Account Balance
  270.    contents.font.color = system_color
  271.    contents.draw_text(4, 56, contents.width, 24, "银行余额:")
  272.    contents.font.color = normal_color
  273.    contents.draw_text(-4, 56, contents.width, 24, $game_bank.account_balance.to_s, 2)
  274.    # Draws Number of Savings Bond's
  275.    contents.font.color = system_color
  276.    contents.draw_text(4, 80, contents.width, 24, "债券持有:")
  277.    contents.font.color = normal_color
  278.    contents.draw_text(-4, 80, contents.width, 24, $game_bank.saving_bonds.size.to_s, 2)
  279.    # Draws Value of Savings Bond's
  280.    ;value = 0
  281.    $game_bank.saving_bonds.each { |x| value += x.mature_value}
  282.    contents.font.color = system_color
  283.    contents.draw_text(4, 104, contents.width, 24, "债券价值:")
  284.    contents.font.color = normal_color
  285.    contents.draw_text(-4, 104, contents.width, 24, value.to_s, 2)
  286.    # Draws Current Interest Rate
  287.    contents.font.color = system_color
  288.    contents.draw_text(4, 136, contents.width, 24, "利率:")
  289.    contents.font.color = normal_color
  290.    contents.draw_text(-4, 136, contents.width, 24, "#{$game_bank.interest_rate} %", 2)
  291. end
  292. end

  293. #==============================================================================
  294. # ** Window_Bond
  295. #==============================================================================
  296. class Window_Bond < Window_Base
  297. #--------------------------------------------------------------------------
  298. # * Object Initialization
  299. #--------------------------------------------------------------------------
  300. def initialize
  301.    super(-240, 264, 240, 200)
  302.      self.opacity = 175
  303.    self.contents = Bitmap.new(width - 32, height - 32)
  304. end
  305. #--------------------------------------------------------------------------
  306. # * Refresh
  307. #     bond    : Savings Bond
  308. #--------------------------------------------------------------------------
  309. def refresh(bond, bought = false)
  310.    contents.clear
  311.    unless bond == nil
  312.      # Draws Bond Name
  313.      contents.font.color = system_color
  314.      contents.draw_text(0, 0, contents.width, 24, bond.name, 1)
  315.      # Draws Bond Cost
  316.      contents.font.color = system_color
  317.      contents.draw_text(4, 24, contents.width, 24, "债券价格:")
  318.      contents.font.color = normal_color
  319.      contents.draw_text(-4, 24, contents.width, 24, bond.cost.to_s, 2)
  320.      # Draws Bond Mature Value
  321.      contents.font.color = system_color
  322.      contents.draw_text(4, 48, contents.width, 24, "成熟价值:")
  323.      contents.font.color = normal_color
  324.      contents.draw_text(-4, 48, contents.width, 24, "#{bond.mature_value}", 2)
  325.      # Draws Bond Interest Rate
  326.      contents.font.color = system_color
  327.      contents.draw_text(4, 72, contents.width, 24, "利率:")
  328.      contents.font.color = normal_color
  329.      contents.draw_text(-4, 72, contents.width, 24, "#{bond.interest_rate} %", 2)
  330.      # Draws Length until Maturity
  331.      contents.font.color = system_color
  332.      contents.draw_text(4, 96, contents.width, 24, "到期时间:")
  333.      contents.font.color = normal_color
  334.      contents.draw_text(-4, 96, contents.width, 24, "#{bond.length} 小时", 2)
  335.      # Display only if Purchased CD
  336.      if bought
  337.        # Draws Time Bought
  338.        contents.font.color = system_color
  339.        contents.draw_text(4, 120, contents.width, 24, "购买时间:")
  340.        contents.font.color = normal_color
  341.        contents.draw_text(-4, 120, contents.width, 24, bond.return_time(bond.time_bought), 2)
  342.        # Draws Time Finished
  343.        contents.font.color = system_color
  344.        contents.draw_text(4, 144, contents.width, 24, "结束时间:")
  345.        contents.font.color = normal_color
  346.        contents.draw_text(-4, 144, contents.width, 24, bond.return_time(bond.time_finished), 2)
  347.      end
  348.    end
  349. end
  350. end

  351. #==============================================================================
  352. # ** Scene_Bank
  353. #==============================================================================
  354. class Scene_Bank
  355. #--------------------------------------------------------------------------
  356. # * Object Initialization
  357. #     interest rate   :   Changes Current Interest Rate (Leave 0 for no Change)
  358. #     bonds           :   Avaliable CD's For Purchasing
  359. #--------------------------------------------------------------------------
  360. def initialize(interest_rate = $game_bank.interest_rate,
  361.      bonds = [ Savings_Bond.new("CD-7", 100, 7.5, 7), Savings_Bond.new("CD-14", 500, 15, 14)])
  362.    $game_bank.interest_rate = interest_rate unless interest_rate == 0
  363.    @bonds = bonds
  364. end
  365. #--------------------------------------------------------------------------
  366. # * Main Processing
  367. #--------------------------------------------------------------------------
  368. def main
  369.    # Current Phase
  370.    @phase = -1
  371.    # Refreshing Variables
  372.    @amount, @depositing = 0, true
  373.    @current_bond, @bond_bought = nil, false
  374.    # Make sprite set
  375.    @spriteset = Spriteset_Map.new
  376.    # Help Window
  377.    @help_window = Window_Help.new
  378.      @help_window.y, @help_window.opacity = -64, 175
  379.      @help_window.set_text("欢迎来到银行!你可以在这里存取金钱!=^^=", 1)
  380.    # Bank Bio
  381.    @bank_bio_window = Window_BankBio.new
  382.    # Avaliable Bond Information Display Window
  383.    @av_bond_display_window = Window_Bond.new
  384.    # Owned Bond Information Display Window
  385.    @own_bond_display_window = Window_Bond.new
  386.    # Main Command
  387.    @main_command = Window_RefreshCommand.new(180, [
  388.        "存款",
  389.        "取款", "购买债券", "债券查看", "退出"])
  390.      @main_command.x, @main_command.y, @main_command.opacity = 644, 272, 175
  391.      @main_command.active = false
  392.    # Bank Number Window
  393.    @bank_number_window = Window_BankNumber.new
  394.    # Avaliable Bonds Command
  395.    commands = []
  396.    @bonds.each {|x| commands.push(x.name)}; commands.push("返回")
  397.    @av_bond_command = Window_RefreshCommand.new(180, commands)
  398.      @av_bond_command.x, @av_bond_command.y = 644, 272
  399.      @av_bond_command.height, @av_bond_command.opacity = 192, 175
  400.      @av_bond_command.active = false
  401.    # CD's Have
  402.    @own_bond_command = Window_RefreshCommand.new(180, get_cd_list)
  403.      @own_bond_command.x, @own_bond_command.y = 644, 272
  404.      @own_bond_command.height, @own_bond_command.opacity = 192, 175
  405.      @own_bond_command.active = false
  406.    # Scene Objects
  407.    @objects = [@spriteset, @help_window, @bank_bio_window, @av_bond_display_window,
  408.        @own_bond_display_window, @main_command, @bank_number_window,
  409.        @av_bond_command, @own_bond_command]
  410.    # Execute transition
  411.    Graphics.transition
  412.    # Main loop
  413.    while $scene == self
  414.      # Update game screen
  415.      Graphics.update
  416.      # Update input information
  417.      Input.update
  418.      # Update Objects
  419.      @objects.each {|x| x.update}
  420.      # Updates Bank System
  421.      $game_bank.update
  422.      # Frame update
  423.      update
  424.    end
  425.    # Prepare for transition
  426.    Graphics.freeze
  427.    # Dispose of windows
  428.    @objects.each {|x| x.dispose}
  429. end
  430. #--------------------------------------------------------------------------
  431. # * Frame Update
  432. #--------------------------------------------------------------------------
  433. def update
  434.    # Splits Phases Up
  435.    case @phase
  436.    when -1 # Intro Phase
  437.      intro_update
  438.    when 0  # Main Phase
  439.      main_update
  440.    when 1  # Deposit or Withdraw Phase
  441.      account_update
  442.    when 2  # Buy CD Phase
  443.      buy_bond_update
  444.    when 3  # Get Mature CD Phse
  445.      get_bond_update
  446.    when 99 # Exit Phase
  447.      exit_update
  448.    end
  449. end
  450. #--------------------------------------------------------------------------
  451. # * Intro Update
  452. #--------------------------------------------------------------------------
  453. def intro_update
  454.    # Moves Window Down
  455.    @help_window.y += 4 if @help_window.y < 0
  456.    if @help_window.y == 0
  457.      # Input Processing
  458.      if Input.trigger?(Input::B)
  459.        $game_system.se_play($data_system.cancel_se)
  460.        # Returns to Scene
  461.        @phase = 99
  462.      elsif Input.trigger?(Input::C)
  463.        $game_system.se_play($data_system.decision_se)
  464.        # Switchs to Main Phase
  465.        @phase = 0
  466.      end
  467.    end
  468. end
  469. #--------------------------------------------------------------------------
  470. # * Main Update
  471. #--------------------------------------------------------------------------
  472. def main_update
  473.    # Turns On Main Command
  474.    @main_command.active = true
  475.    # Turns Off Other Command Windows
  476.    @av_bond_command.active = @own_bond_command.active = false
  477.    # Moves In Active Windows
  478.    @bank_bio_window.z = @main_command.z = 9999
  479.    @bank_bio_window.x += 32 if @bank_bio_window.x < 16
  480.    @main_command.x -= 25 if @main_command.x > 444
  481.    # Moves Out Inactive Windows
  482.    @av_bond_display_window.x -= 32 if @av_bond_display_window.x > - 240
  483.    [@av_bond_display_window, @own_bond_display_window, @bank_number_window,
  484.      @av_bond_command, @own_bond_command].each {|window| window.z = 9995}
  485.    [@av_bond_command, @own_bond_command].each {|command|
  486.      command.x += 25 if command.x < 644}
  487.    @own_bond_display_window.x -= 25 if @own_bond_display_window.x > - 240
  488.    @bank_number_window.x += 32 if @bank_number_window.x < 640
  489.    # Sets Help Window
  490.    case @main_command.index
  491.      when 0; @help_window.set_text("要 存款 从这里...", 1)
  492.      when 1; @help_window.set_text("要 提款 从这里...", 1)
  493.      when 2; @help_window.set_text("要 购买债券 从这里...", 1)
  494.      when 3; @help_window.set_text("要 查看债券 从这里...", 1)
  495.      when 4; @help_window.set_text("亲爱的顾客,您要离开银行吗?", 1)
  496.    end
  497.    # Input Processing
  498.    if Input.trigger?(Input::B) # Returns to Map
  499.      $game_system.se_play($data_system.cancel_se)
  500.      @phase = 99
  501.    elsif Input.trigger?(Input::C)
  502.      $game_system.se_play($data_system.decision_se)
  503.      case @main_command.index
  504.      when 0  # Deposit
  505.        @amount, @depositing = 0, true
  506.        refresh_windows
  507.        @help_window.set_text("存入 #{@amount} #{$data_system.words.gold}", 1)
  508.        @phase = 1
  509.      when 1  # Withdraw
  510.        @amount, @depositing = 0, false
  511.        refresh_windows
  512.        @help_window.set_text("取出 #{@amount} #{$data_system.words.gold}", 1)
  513.        @phase = 1
  514.      when 2  # Buy CD
  515.        @current_bond = @bonds[@av_bond_command.index]
  516.        @bond_bought = false
  517.        refresh_windows
  518.        @phase = 2
  519.      when 3  # Get CD
  520.        @current_bond = $game_bank.saving_bonds[@own_bond_command.index]
  521.        @bond_bought = true
  522.        refresh_windows
  523.        @phase = 3
  524.      when 4  # Exit Bank
  525.        @phase = 99
  526.      end
  527.    end
  528. end
  529. #--------------------------------------------------------------------------
  530. # * Accpunt Update
  531. #--------------------------------------------------------------------------
  532. def account_update
  533.    # Turns Off Command Windows
  534.    @main_command.active = @av_bond_command.active = @own_bond_command.active = false
  535.    # Moves In Active Windows
  536.    @bank_bio_window.z = @bank_number_window.z = 9999
  537.    @bank_bio_window.x += 32 if @bank_bio_window.x < 16
  538.    @bank_number_window.x -= 32 if @bank_number_window.x > 384
  539.    # Moves Out Inactive Windows
  540.    @av_bond_display_window.z = @own_bond_display_window.z =
  541.      @main_command.z = @av_bond_command.z = @own_bond_command.z = 9995
  542.    @av_bond_display_window.x -= 32 if @av_bond_display_window.x > - 240
  543.    [@own_bond_display_window].each {|window| window.x -= 25 if window.x > - 240}
  544.    [@main_command, @av_bond_command, @own_bond_command].each {|command|
  545.        command.x += 25 if command.x < 644}
  546.    # Input Processing
  547.    if Input.trigger?(Input::B)
  548.      $game_system.se_play($data_system.cancel_se)
  549.      @phase = 0
  550.    elsif Input.trigger?(Input::C)
  551.      $game_system.se_play($data_system.shop_se)
  552.      if @depositing
  553.        $game_bank.deposit(@amount)
  554.        refresh_windows
  555.        @phase = 0
  556.      else
  557.        $game_bank.withdraw(@amount)
  558.        refresh_windows
  559.        @phase = 0
  560.      end
  561.    elsif Input.repeat?(Input::LEFT) && Input.press?(Input::LEFT)
  562.      if @amount > 0
  563.        $game_system.se_play($data_system.cursor_se)
  564.        @amount -= 1
  565.        refresh_windows
  566.        @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  567.      else
  568.        $game_system.se_play($data_system.buzzer_se)
  569.      end
  570.    elsif Input.repeat?(Input::RIGHT) && Input.press?(Input::RIGHT)
  571.      if @depositing
  572.        if @amount < $game_party.gold
  573.          $game_system.se_play($data_system.cursor_se)
  574.          @amount += 1
  575.          refresh_windows
  576.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  577.        else
  578.          $game_system.se_play($data_system.buzzer_se)
  579.        end
  580.      else
  581.        if @amount < $game_bank.account_balance
  582.          $game_system.se_play($data_system.cursor_se)
  583.          @amount += 1
  584.          refresh_windows
  585.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  586.        else
  587.          $game_system.se_play($data_system.buzzer_se)
  588.        end
  589.      end
  590.    elsif Input.repeat?(Input::UP) && Input.press?(Input::UP)
  591.      if @amount == 0
  592.        $game_system.se_play($data_system.buzzer_se)
  593.      else
  594.        $game_system.se_play($data_system.cursor_se)
  595.        @amount > 10 ? @amount -= 10 : @amount = 0
  596.        refresh_windows
  597.        @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  598.      end
  599.    elsif Input.repeat?(Input::DOWN) && Input.press?(Input::DOWN)
  600.      if @depositing
  601.        if @amount < $game_party.gold
  602.          $game_system.se_play($data_system.cursor_se)
  603.          @amount < $game_party.gold - 10 ? @amount += 10 : @amount = $game_party.gold
  604.          refresh_windows
  605.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  606.        else
  607.          $game_system.se_play($data_system.buzzer_se)
  608.        end
  609.      else
  610.        if @amount < $game_bank.account_balance
  611.          $game_system.se_play($data_system.cursor_se)
  612.          @amount < $game_bank.account_balance - 10 ? @amount += 10 : @amount = $game_bank.account_balance
  613.          refresh_windows
  614.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  615.        else
  616.          $game_system.se_play($data_system.buzzer_se)
  617.        end
  618.      end
  619.    elsif Input.repeat?(Input::L) && Input.press?(Input::L)
  620.      if @amount == 0
  621.        $game_system.se_play($data_system.buzzer_se)
  622.      else
  623.        $game_system.se_play($data_system.cursor_se)
  624.        @amount > 100 ? @amount -= 100 : @amount = 0
  625.        refresh_windows
  626.        @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  627.      end
  628.    elsif Input.repeat?(Input::R) && Input.press?(Input::R)
  629.      if @depositing
  630.        if @amount < $game_party.gold
  631.          $game_system.se_play($data_system.cursor_se)
  632.          @amount < $game_party.gold - 100 ? @amount += 100 : @amount = $game_party.gold
  633.          refresh_windows
  634.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  635.        else
  636.          $game_system.se_play($data_system.buzzer_se)
  637.        end
  638.      else
  639.        if @amount < $game_bank.account_balance
  640.          $game_system.se_play($data_system.cursor_se)
  641.          @amount < $game_bank.account_balance - 100 ? @amount += 100 : @amount = $game_bank.account_balance
  642.          refresh_windows
  643.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  644.        else
  645.          $game_system.se_play($data_system.buzzer_se)
  646.        end
  647.      end
  648.    end
  649. end
  650. #--------------------------------------------------------------------------
  651. # * Buy Bond Update
  652. #--------------------------------------------------------------------------
  653. def buy_bond_update
  654.    # Turns On Avaliable Bond Window
  655.    @av_bond_command.active = true
  656.    # Turns Off Other Command Windows
  657.    @main_command.active = @own_bond_command.active = false
  658.    # Moves In Active Windows
  659.    @av_bond_display_window.z = @av_bond_command.z = 9999
  660.    @av_bond_display_window.x += 32 if @av_bond_display_window.x < 16
  661.    @av_bond_command.x -= 25 if @av_bond_command.x > 444
  662.    # Moves Out Inactive Windows
  663.    [@bank_bio_window, @bank_number_window, @own_bond_display_window,
  664.      @main_command, @own_bond_command].each {|window| window.z = 9995}
  665.    @bank_bio_window.x -= 32 if @bank_bio_window.x > - 240
  666.    @bank_number_window.x += 32 if @bank_number_window.x < 640
  667.    @own_bond_display_window.x -= 25 if @own_bond_display_window.x > - 240
  668.    [@main_command, @own_bond_command].each {|command| command.x += 25 if command.x < 644}
  669.    # Input Processing
  670.    if Input.trigger?(Input::B)
  671.      $game_system.se_play($data_system.cancel_se)
  672.      @phase = 0
  673.    elsif Input.trigger?(Input::C)
  674.      if @av_bond_command.index == @bonds.size
  675.        $game_system.se_play($data_system.cancel_se)
  676.        @phase = 0
  677.      else
  678.        current_bond = @bonds[@av_bond_command.index].dup
  679.        if current_bond.cost > $game_party.gold
  680.          $game_system.se_play($data_system.buzzer_se)
  681.        else
  682.          $game_system.se_play($data_system.decision_se)
  683.          $game_party.lose_gold(current_bond.cost)
  684.          current_bond.set_times
  685.          $game_bank.add_bond(current_bond)
  686.          refresh_windows
  687.          @phase = 0
  688.        end
  689.      end
  690.    # Updates Current Bond
  691.    elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  692.      @current_bond = @bonds[@av_bond_command.index]
  693.      refresh_windows
  694.    end
  695. end
  696. #--------------------------------------------------------------------------
  697. # * Get Bond Update
  698. #--------------------------------------------------------------------------
  699. def get_bond_update
  700.    # Turns On Avaliable Bond Window
  701.    @own_bond_command.active = true
  702.    # Turns Off Other Command Windows
  703.    @main_command.active = @av_bond_command.active = false
  704.    # Moves In Active Windows
  705.    [@own_bond_display_window, @own_bond_command].each {|window| window.z = 9999}
  706.    @own_bond_display_window.x += 32 if @own_bond_display_window.x < 16
  707.    @own_bond_command.x -= 25 if @own_bond_command.x > 444
  708.    # Moves Out Inactive Windows
  709.    [@bank_bio_window, @av_bond_display_window, @main_command, @bank_number_window,
  710.      @av_bond_command].each {|window| window.z = 9995}
  711.    [@bank_bio_window, @av_bond_display_window].each {|window|
  712.      window.x -= 32 if window.x > - 240}
  713.    [@main_command, @av_bond_command].each {|window|
  714.      window.x += 25 if window.x < 640}
  715.    @bank_number_window.x += 32 if @bank_number_window.x < 640
  716.    # Input Processing
  717.    if Input.trigger?(Input::B)
  718.      $game_system.se_play($data_system.cancel_se)
  719.      @phase = 0
  720.    elsif Input.trigger?(Input::C)
  721.      if @own_bond_command.index == $game_bank.saving_bonds.size
  722.        $game_system.se_play($data_system.cancel_se)
  723.        @phase = 0
  724.      else
  725.        current_bond = $game_bank.saving_bonds[@own_bond_command.index]
  726.        if current_bond.time_finished > Graphics.frame_count / Graphics.frame_rate
  727.          $game_system.se_play($data_system.buzzer_se)
  728.          @help_window.set_text("储蓄债券还未成熟!", 1)
  729.        else
  730.          $game_system.se_play($data_system.decision_se)
  731.          $game_party.gain_gold(current_bond.mature_value)
  732.          $game_bank.saving_bonds.delete_at[@own_bond_command.index]
  733.          refresh_windows
  734.          @phase = 0
  735.        end
  736.      end
  737.    elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  738.      @current_bond = $game_bank.saving_bonds[@own_bond_command.index]
  739.      refresh_windows
  740.    end
  741. end

  742. # * Exit Update

  743. def exit_update
  744.    # Moves Out Windows
  745.    @help_window.y -= 4 if @help_window.y > - 64
  746.    [@bank_bio_window, @av_bond_display_window].each {|window| window.x -= 32 if window.x > - 240}
  747.    [@own_bond_display_window].each {|window| window.x -= 25 if window.x > - 240}
  748.    [@main_command, @bank_number_window, @av_bond_command,
  749.      @own_bond_command].each {|window| window.x += 25 if window.x < 640}
  750.    # Checks To Make Sure All Windows Are Out
  751.    if @help_window.y <= - 64 && @bank_bio_window.x <= - 240 && @av_bond_display_window.x <= - 240 &&
  752.        @own_bond_display_window.x <= - 240 && @main_command.x >= 644 &&
  753.        @bank_number_window.x >= 640 && @av_bond_command.x >= 640 && @own_bond_command.x >= 640
  754.      $scene = Scene_Map.new
  755.    end
  756. end
  757. #--------------------------------------------------------------------------
  758. # * Get CD List
  759. #--------------------------------------------------------------------------
  760. def get_cd_list
  761.    commands = []
  762.    $game_bank.saving_bonds.each {|x| commands.push(x.name)}
  763.    commands.push("返回")
  764.    return commands
  765. end
  766. #--------------------------------------------------------------------------
  767. # * Refresh Windows
  768. #--------------------------------------------------------------------------
  769. def refresh_windows
  770.    @bank_bio_window.refresh
  771.    @av_bond_display_window.refresh(@current_bond, @bond_bought)
  772.    @own_bond_display_window.refresh(@current_bond, @bond_bought)
  773.    @bank_number_window.refresh(@amount, @depositing ? "存入" : "取出")
  774.    @own_bond_command.refresh(get_cd_list)
  775. end
  776. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
84
在线时间
130 小时
注册时间
2014-9-1
帖子
98
5
 楼主| 发表于 2015-8-12 16:00:00 | 只看该作者
本帖最后由 creeper0924 于 2015-8-12 16:11 编辑
亡灵史莱姆 发表于 2015-8-12 12:18
这银行脚本效果蛮不错的
或者也可以用事件,很简单的


不行啊,它显示脚本太深。。。(σ゚∀゚)σ

上图:
halo大家好,欢迎支持我的部落格
http://dedarknightstudio.blogspot.com
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
33 小时
注册时间
2015-7-4
帖子
27
6
发表于 2015-8-15 12:10:36 | 只看该作者
那么让我换个脚本
  1. #==============================================================================
  2. # ● 银行系统 v1.2  by 后知后觉
  3. #==============================================================================
  4. =begin
  5.   说明书:
  6.       用 $scene = Scene_Bank.new 进入银行信息界面
  7.       然后在下面设置好对应的变量编号
  8.       用 $game_system.bank 可以获取到存入的本钱
  9.       用到这句的人应该不多。      
  10.       建立了多个数据库变量,可以用这些东西更加方便灵活的控制这个系统
  11.       这个是用行走步数来进行的判断
  12.       利用1个开关和1个变量来共同对刷钱行为进行控制
  13.       计算公式很简单:
  14.           增长值=本钱*利息-本钱 (结果小于0,就是负增长→亏钱)
  15.           现有积蓄+增长值=最后的积蓄(显示在窗口上的那个)
  16.       如果想对公式进行修改,主要在下面的Scene_Map里
  17.       和脚本最后的有注释的地方
  18.       如果想加入第2+n的货币、显示银行服务员画像等个性设置
  19.       那就只有你自己动动手了=v= 喵~!很简单哦~~~!
  20.   冲突可能:
  21.            基本上没有
  22. =end

  23. BANK_SWITCHES = 12  #银行系统的开关编号 打开时有效
  24.             #本开关只针对地图上的数据处理
  25.             #在某些地图开启、在某些地图关闭可以达到某种限制刷钱的效果

  26. GAIN_STEPS = 10     #接受走多少步涨一次积蓄的变量编号

  27. JIXU_VARIABLE = 11  #接受储存积蓄的变量编号
  28. LIXI_VARIABLE = 12  #接受利息的变量编号
  29.          #利息是浮点数的话、请用脚本语句进行赋值
  30.          #并且不推荐用+-*/法来对浮点数利息进行运算,
  31.          #最好用 = 直接赋值,
  32.          #就像这样 $game_variables[编号] = 数值

  33. BASE_MONEY = 13     #存钱的最低限制的变量编号
  34. BASE_MONEY_2 = 14   #取钱的最低数额的变量编号
  35.                 #以上2个不想用的话就把该变量的值赋为0


  36. BATTLE_VAR_1 = 15   #战斗胜利值的变量编号
  37. BATTLE_VAR_2 = 16   #限制值的变量编号
  38.     #当1小于2的时候 每次增加积蓄时1会加1 如果1等于2
  39.     #则不会增长积蓄 每次战斗胜利1会减1
  40.     #游戏里适当的时候把1清零一下是必要的~~或直接在脚本里添加
  41.     #如果不想要这功能 就把2设置为很大很大


  42. XIANJIN_FONT = "  现金  "        #其他的字符串可以用搜索功能
  43. JIXU_FONT = "  积蓄  "           #直接搜索到然后进行修改
  44. LIXI_FONT = "  利息  "           #主要说的是播放冻结SE是偶的
  45. CUNQIAN_FONT = "存入现金"        #提示窗口。
  46. QVQIAN_FONT = "取回积蓄"
  47. TUICHU_FONT = "离开银行"



  48. class Scene_Map
  49.   def initialize
  50.     #这个@bs是用来防止刷钱的
  51.     @bs = $game_party.steps
  52.   end
  53.   alias houzhihoujue_update update
  54.   def update
  55.     houzhihoujue_update
  56.     if $game_switches[BANK_SWITCHES] == true
  57.       bushu = $game_party.steps
  58.       # 存入银行的本钱
  59.       gold = $game_system.bank
  60.       # 代入利息变量
  61.       lixi = $game_variables[LIXI_VARIABLE]
  62.       # 增加的金额
  63.       gain = gold * lixi - gold
  64.       if @bs < bushu
  65.         if bushu % $game_variables[GAIN_STEPS] == 0
  66.           if $game_variables[BATTLE_VAR_1] < $game_variables[BATTLE_VAR_2]
  67.             # 最后的结果
  68.             $game_variables[JIXU_VARIABLE] += gain
  69.             $game_variables[BATTLE_VAR_1] += 1
  70.             # 下面这行可别动哦~
  71.             @bs = bushu
  72.           end
  73.         end
  74.       end
  75.     end
  76.   end
  77. end

  78. class Scene_Battle
  79.   alias hzhj_start_phase5 start_phase5
  80.   def start_phase5
  81.     hzhj_start_phase5
  82.     $game_variables[BATTLE_VAR_1] -= 1
  83.   end
  84. end


  85. class Game_System
  86.   attr_accessor :bank
  87.   alias hzhj_ini initialize
  88.   def initialize
  89.     hzhj_ini
  90.     @bank = 0
  91.   end
  92. end

  93. class Window_Bank_Message < Window_Base
  94.   def initialize(message = 0)
  95.     super(0, 0, 320, 96)
  96.     self.contents = Bitmap.new(width - 32, height - 32)
  97.     self.x = 160
  98.     self.y = 240 - self.height / 2 + 16
  99.     self.opacity = 255
  100.     self.back_opacity = 255
  101.     self.z = 9995
  102.     @msg = message
  103.     self.visible = true
  104.     refresh(@msg)
  105.   end
  106.   def refresh(msg)
  107.     self.contents.clear
  108.     case msg
  109.     when 0  # 低于存钱限制
  110.       text_1 = "根据现在的市场行情"
  111.       self.contents.font.color = system_color
  112.       self.contents.draw_text(0,0,320-32,32,text_1)
  113.       text_2 = "最低储存数额为"
  114.       self.contents.draw_text(0,32,192+24,32,text_2,2)
  115.       self.contents.font.color = Color.new(255,0,0,255)
  116.       text_3 = $game_variables[BASE_MONEY].to_s
  117.       self.contents.draw_text(192+24,32,96-24,32,text_3)
  118.     when 1  # 低于最低取钱
  119.       text_1 = "根据现在的市场行情"
  120.       self.contents.font.color = system_color
  121.       self.contents.draw_text(0,0,320-32,32,text_1)
  122.       text_2 = "最低取回数额为"
  123.       self.contents.draw_text(0,32,192+24,32,text_2,2)
  124.       self.contents.font.color = Color.new(255,0,0,255)
  125.       text_3 = $game_variables[BASE_MONEY_2].to_s
  126.       self.contents.draw_text(192+24,32,96-24,32,text_3)
  127.     when 2  # 存钱超过身上的钱
  128.       text_1 = "您身上可没那么多哦~~!"
  129.       self.contents.font.color = system_color
  130.       self.contents.draw_text(0,16,320-32,32,text_1,1)
  131.     when 3  # 取钱超过银行里的钱
  132.       text_1 = "有人抢劫啊~~!救命呐~~!"
  133.       self.contents.font.color = system_color
  134.       self.contents.draw_text(0,16,320-32,32,text_1,1)
  135.     end
  136.   end
  137. end


  138. class Window_ShuRu < Window_Selectable
  139.   def initialize
  140.     super(0, 0, 224, 96)
  141.     self.contents = Bitmap.new(width - 32, height - 32)
  142.     self.x = 320 - self.width / 2
  143.     self.y = 240 - self.height / 2 + 16
  144.     @item_max = 8
  145.     @column_max = 8
  146.     refresh
  147.     self.visible = false
  148.     self.active = false
  149.     self.index = 7
  150.     self.opacity = 255
  151.     self.back_opacity = 255
  152.     self.z = 9990
  153.   end
  154.   
  155.   def refresh(s1=0,s2=0,s3=0,s4=0,s5=0,s6=0,s7=0,s8=0)
  156.     @s1 = s1
  157.     @s2 = s2
  158.     @s3 = s3
  159.     @s4 = s4
  160.     @s5 = s5
  161.     @s6 = s6
  162.     @s7 = s7
  163.     @s8= s8
  164.     self.contents.clear
  165.     self.contents.font.color = normal_color
  166.     self.contents.draw_text(4, 0, 96, 32, "输入数值",1)
  167.     self.contents.font.color = system_color
  168.     self.contents.draw_text(0,   32, 24, 32, @s1.to_s, 1)
  169.     self.contents.draw_text(24,  32, 24, 32, @s2.to_s, 1)
  170.     self.contents.draw_text(48,  32, 24, 32, @s3.to_s, 1)
  171.     self.contents.draw_text(72,  32, 24, 32, @s4.to_s, 1)
  172.     self.contents.draw_text(96,  32, 24, 32, @s5.to_s, 1)
  173.     self.contents.draw_text(120, 32, 24, 32, @s6.to_s, 1)
  174.     self.contents.draw_text(144, 32, 24, 32, @s7.to_s, 1)
  175.     self.contents.draw_text(168, 32, 24, 32, @s8.to_s, 1)
  176.   end
  177.   
  178.   def update_cursor_rect
  179.     if @index < 0
  180.       self.cursor_rect.empty
  181.     else
  182.       self.cursor_rect.set(@index*24, 32, 24, 32)
  183.     end
  184.   end
  185. end


  186. class Window_Bank < Window_Selectable
  187.   def initialize
  188.     super(0, 0, 256, 224)
  189.     self.contents = Bitmap.new(width - 32, height - 32)
  190.     self.x = 320 - self.width / 2
  191.     self.y = 240 - self.height / 2
  192.     @item_max = 3
  193.     refresh
  194.     self.index = 0
  195.     self.opacity = 255
  196.     self.back_opacity = 160
  197.     self.z = 5555
  198.   end
  199.   
  200.   def refresh
  201.     self.contents.clear
  202.     self.contents.font.color = normal_color
  203.     self.contents.draw_text(4, 0,  96, 32, XIANJIN_FONT, 1)
  204.     self.contents.draw_text(4, 32, 96, 32, JIXU_FONT, 1)
  205.     self.contents.draw_text(4, 64, 96, 32, LIXI_FONT, 1)
  206.     self.contents.font.color = system_color
  207.     self.contents.draw_text(0,  96, 224, 32, CUNQIAN_FONT, 1)
  208.     self.contents.draw_text(0, 128, 224, 32, QVQIAN_FONT, 1)
  209.     self.contents.draw_text(0, 160, 224, 32, TUICHU_FONT, 1)
  210.     self.contents.draw_text(120, 0,  104, 32, $game_party.gold.to_s, 1)
  211.     self.contents.draw_text(120, 32, 104, 32, $game_variables[JIXU_VARIABLE].to_i.to_s, 1)
  212.     self.contents.draw_text(120, 64, 104, 32, $game_variables[LIXI_VARIABLE].to_s, 1)
  213.   end

  214.   def update_cursor_rect
  215.     if @index < 0
  216.       self.cursor_rect.empty
  217.     else
  218.       self.cursor_rect.set(0, @index*32+96, 224, 32)
  219.     end
  220.   end
  221. end


  222. class Scene_Bank
  223.   def initialize(index = 0, bank_window_index = 0)
  224.     @bank_index = index
  225.     @bank_window_index = bank_window_index
  226.     @s1 = 0
  227.     @s2 = 0
  228.     @s3 = 0
  229.     @s4 = 0
  230.     @s5 = 0
  231.     @s6 = 0
  232.     @s7 = 0
  233.     @s8 = 0
  234.     @s9 = 0
  235.   end
  236.   
  237.   def main
  238.     @shuru_window = Window_ShuRu.new
  239.     @bank_window = Window_Bank.new
  240.     @bank_window.index = @bank_window_index
  241.     @msg_window = Window_Bank_Message.new
  242.     @msg_window.visible = false
  243.     @spriteset = Spriteset_Map.new
  244.     Graphics.transition
  245.     loop do
  246.       Graphics.update
  247.       Input.update
  248.       update
  249.       break if $scene != self
  250.     end
  251.     Graphics.freeze
  252.     @shuru_window.dispose
  253.     @bank_window.dispose
  254.     @msg_window.dispose
  255.     @spriteset.dispose
  256.   end
  257.   
  258.   def update
  259.     @bank_window.update
  260.     @shuru_window.update
  261.     @msg_window.update
  262.     if @msg_window.visible
  263.       if Input.trigger?(Input::C)
  264.         @msg_window.visible = false
  265.         @shuru_window.active = true
  266.         return
  267.       end
  268.     end
  269.     if @shuru_window.active
  270.       update_shuru
  271.     end
  272.     if @bank_window.active
  273.       if Input.trigger?(Input::B)
  274.         $game_system.se_play($data_system.cancel_se)
  275.         $scene = Scene_Map.new
  276.         return
  277.       end
  278.       if Input.trigger?(Input::C)
  279.         case @bank_window.index
  280.         when 0
  281.           $game_system.se_play($data_system.decision_se)
  282.           @bank_window.active = false
  283.           @shuru_window.active = true
  284.           @shuru_window.visible = true
  285.           return
  286.         when 1
  287.           $game_system.se_play($data_system.decision_se)
  288.           @bank_window.active = false
  289.           @shuru_window.active = true
  290.           @shuru_window.visible = true
  291.           return
  292.         when 2
  293.           $game_system.se_play($data_system.decision_se)
  294.           $scene = Scene_Map.new
  295.           return
  296.         end
  297.       end
  298.     end
  299.   end

  300.   def update_shuru
  301.     if Input.trigger?(Input::B)
  302.       case @bank_window.index
  303.       when 0
  304.         $game_system.se_play($data_system.cancel_se)
  305.         @bank_index += 1
  306.         @bank_index %= 2
  307.         @bank_window_index = 0
  308.         $scene = Scene_Bank.new(@bank_index, @bank_window_index)
  309.       when 1
  310.         $game_system.se_play($data_system.cancel_se)
  311.         @bank_index += 1
  312.         @bank_index %= 2
  313.         @bank_window_index = 1
  314.         $scene = Scene_Bank.new(@bank_index, @bank_window_index)
  315.       end
  316.       return
  317.     end
  318.     if Input.trigger?(Input::UP)
  319.       $game_system.se_play($data_system.cursor_se)
  320.       case @shuru_window.index
  321.       when 0
  322.         @s1 += 1
  323.         @s1 = 0 if @s1 > 9
  324.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  325.       when 1
  326.         @s2 += 1
  327.         @s2 = 0 if @s2 > 9
  328.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  329.       when 2
  330.         @s3 += 1
  331.         @s3 = 0 if @s3 > 9
  332.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  333.       when 3
  334.         @s4 += 1
  335.         @s4 = 0 if @s4 > 9
  336.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  337.       when 4
  338.         @s5 += 1
  339.         @s5 = 0 if @s5 > 9
  340.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  341.       when 5
  342.         @s6 += 1
  343.         @s6 = 0 if @s6 > 9
  344.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  345.       when 6
  346.         @s7 += 1
  347.         @s7 = 0 if @s7 > 9
  348.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  349.       when 7
  350.         @s8 += 1
  351.         @s8 = 0 if @s8 > 9
  352.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  353.       end
  354.     end
  355.     if Input.trigger?(Input::DOWN)
  356.       $game_system.se_play($data_system.cursor_se)
  357.       case @shuru_window.index
  358.       when 0
  359.         @s1 -= 1
  360.         @s1 = 9 if @s1 < 0
  361.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  362.       when 1
  363.         @s2 -= 1
  364.         @s2 = 9 if @s2 < 0
  365.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  366.       when 2
  367.         @s3 -= 1
  368.         @s3 = 9 if @s3 < 0
  369.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  370.       when 3
  371.         @s4 -= 1
  372.         @s4 = 9 if @s4 < 0
  373.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  374.       when 4
  375.         @s5 -= 1
  376.         @s5 = 9 if @s5 < 0
  377.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  378.       when 5
  379.         @s6 -= 1
  380.         @s6 = 9 if @s6 < 0
  381.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  382.       when 6
  383.         @s7 -= 1
  384.         @s7 = 9 if @s7 < 0
  385.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  386.       when 7
  387.         @s8 -= 1
  388.         @s8 = 9 if @s8 < 0
  389.         @shuru_window.refresh(@s1,@s2,@s3,@s4,@s5,@s6,@s7,@s8)
  390.       end
  391.     end
  392.     if Input.trigger?(Input::C)
  393.       # @s9就是输入数值的最后结果
  394.       @s9=@s1*10000000+@s2*1000000+@s3*100000+@s4*10000+@s5*1000+@s6*100+@s7*10+@s8
  395.       case @bank_window.index
  396.       when 0  # 存入
  397.         # 数额大于身上的钱时
  398.         if @s9 > $game_party.gold
  399.           $game_system.se_play($data_system.buzzer_se)
  400.           @shuru_window.active = false
  401.           @msg_window.refresh(2)
  402.           @msg_window.visible = true
  403.           return
  404.         # 数额低于存钱限制时
  405.         elsif @s9 < $game_variables[BASE_MONEY]
  406.           $game_system.se_play($data_system.buzzer_se)
  407.           @shuru_window.active = false
  408.           @msg_window.refresh(0)
  409.           @msg_window.visible = true
  410.           return
  411.         else
  412.           $game_system.se_play($data_system.equip_se)
  413.           # 扣去身上相应的钱
  414.           $game_party.lose_gold(@s9)
  415.           # 增加积蓄
  416.           $game_variables[JIXU_VARIABLE] += @s9
  417.           # 替换本钱
  418.           $game_system.bank = $game_variables[JIXU_VARIABLE]
  419.           @bank_index += 1
  420.           @bank_index %= 2
  421.           @bank_window_index = 0
  422.           $scene = Scene_Bank.new(@bank_index, @bank_window_index)
  423.         end
  424.       when 1  # 取钱
  425.         # 当输入数值大于积蓄时
  426.         if @s9 > $game_variables[JIXU_VARIABLE]
  427.           $game_system.se_play($data_system.buzzer_se)
  428.           @shuru_window.active = false
  429.           @msg_window.refresh(3)
  430.           @msg_window.visible = true
  431.           return
  432.         # 低于取钱限制时
  433.         elsif @s9 < $game_variables[BASE_MONEY_2]
  434.           $game_system.se_play($data_system.buzzer_se)
  435.           @shuru_window.active = false
  436.           @msg_window.refresh(1)
  437.           @msg_window.visible = true
  438.           return
  439.         else
  440.           $game_system.se_play($data_system.equip_se)
  441.           # 增加金钱
  442.           $game_party.gain_gold(@s9)
  443.           # 积蓄减少
  444.           $game_variables[JIXU_VARIABLE] -= @s9
  445.           # 如果积蓄为0.+ 的浮点数就把他代入为0整数
  446.           if $game_variables[JIXU_VARIABLE] < 1
  447.             $game_variables[JIXU_VARIABLE] = 0
  448.           end
  449.           # 本钱代入积蓄
  450.           $game_system.bank = $game_variables[JIXU_VARIABLE].to_i
  451.           @bank_index += 1
  452.           @bank_index %= 2
  453.           @bank_window_index = 1
  454.           $scene = Scene_Bank.new(@bank_index, @bank_window_index)
  455.         end
  456.       end
  457.       return
  458.     end
  459.   end
  460. end

  461.   
  462.   
复制代码
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
946
在线时间
61 小时
注册时间
2019-12-10
帖子
97
7
发表于 2019-12-26 23:05:28 | 只看该作者
H·H·Y 发表于 2015-8-8 14:09
简单的方法:存钱时用公共事件和变量开始计时,每20帧变量+1,取钱时用这个变量×利息×金钱总额,然后就相 ...

可不可以弄成操作的形式,我只会模仿,说的不会做
想玩我做的游戏加我qq947128749
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-19 18:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表