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

Project1

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

[有事请教] 关于这个yinhang系统的一点问题求解谢谢了

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1253
在线时间
175 小时
注册时间
2020-9-19
帖子
23
跳转到指定楼层
1
发表于 2023-12-7 17:04:17 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

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

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

x
求解啊 谢谢了
我尽力解释详细吧下面是图片






这是工程
https://rpg.blue/forum.php?mod=attachment&aid=NDAzMTM4fGE2OTUzZWJhZmVmODU1ZjU2ZDUxYWEyZmY4NTVlYjEwfDE3MzIyMDczNTc%3D&request=yes&_f=.rar
脚本在这里
RUBY 代码复制
  1. #   Created By SephirothSpawn (12.03.05)
  2. #   Last Updated: 12.03.05
  3. # Banking System
  4.  
  5. =begin
  6.  
  7. =^^=HI~~
  8.  
  9. 这个我只作个界面胡乱翻译啊……
  10. 大概的内容翻译完成,只是不太了解债券= =||||,所以……
  11.  
  12. 这个脚本主要功能是:存款,取款,购买债券,债券查看……
  13. 汉字的部分大家可以在脚本里替换~~~~基本的界面都汉化了,不影响使用滴~
  14.  
  15. 调用请用此脚本:$scene = Scene_Bank.new
  16.  
  17. by 秋弦月
  18.  
  19. =end
  20.  
  21.  
  22. # ** Scene_Title
  23. #==============================================================================
  24. class Scene_Title
  25.  
  26. # * Alias Command: New Game
  27. #--------------------------------------------------------------------------
  28. alias bank_command_new_game command_new_game
  29. #--------------------------------------------------------------------------
  30. # * Command: New Game
  31. #--------------------------------------------------------------------------
  32. def command_new_game
  33.    $game_bank = Game_BankSystem.new
  34.    bank_command_new_game
  35. end
  36. end
  37.  
  38. #==============================================================================
  39. # ** Window_RefreshCommand
  40. #==============================================================================
  41. class Window_RefreshCommand < Window_Selectable
  42. #--------------------------------------------------------------------------
  43. # * Object Initialization
  44. #     width    : window width
  45. #     commands : command text string array
  46. #--------------------------------------------------------------------------
  47. def initialize(width, commands)
  48.    # Compute window height from command quantity
  49.    super(0, 0, width, commands.size * 32 + 32)
  50.    @item_max = commands.size
  51.    @commands = commands
  52.    refresh
  53.    self.index = 0
  54. end
  55. #--------------------------------------------------------------------------
  56. # * Refresh
  57. #--------------------------------------------------------------------------
  58. def refresh(commands = @commands)
  59.    @commands = commands
  60.    @item_max = commands.size
  61.    if self.contents != nil
  62.      self.contents.dispose
  63.      self.contents = nil
  64.    end
  65.    self.contents = Bitmap.new(width - 32, @item_max * 32)
  66.    for i in 0...@item_max
  67.      draw_item(i, normal_color)
  68.    end
  69. end
  70. #--------------------------------------------------------------------------
  71. # * Draw Item
  72. #     index : item number
  73. #     color : text color
  74. #--------------------------------------------------------------------------
  75. def draw_item(index, color)
  76.    self.contents.font.color = color
  77.    self.contents.draw_text(0, 32 * index, self.contents.width - 8, 32, @commands[index], 1)
  78. end
  79. #--------------------------------------------------------------------------
  80. # * Disable Item
  81. #     index : item number
  82. #--------------------------------------------------------------------------
  83. def disable_item(index)
  84.    draw_item(index, disabled_color)
  85. end
  86. #--------------------------------------------------------------------------
  87. # * Undisable Item
  88. #     index : item number
  89. #--------------------------------------------------------------------------
  90. def disable_item(index)
  91.    draw_item(index, normal_color)
  92. end
  93. end
  94.  
  95. #==============================================================================
  96. # ** Game_BankSystem
  97. #==============================================================================
  98. class Game_BankSystem
  99. #--------------------------------------------------------------------------
  100. # * Public Instance Variables
  101. #--------------------------------------------------------------------------
  102. attr_accessor :account_balance
  103. attr_accessor :interest_rate
  104. attr_accessor :saving_bonds
  105. #--------------------------------------------------------------------------
  106. # * Object Initialization
  107. #--------------------------------------------------------------------------
  108. def initialize
  109.    @account_balance = 0
  110.    @interest_rate = 1
  111.    @saving_bonds = []
  112.    @last_interest_time = 0
  113. end
  114.  
  115. # * Update
  116.    def update
  117.    # Updates Deposited Amount
  118.    interest_time = (Graphics.frame_count / Graphics.frame_rate - @last_interest_time) / 3600.0
  119.    interest_amt = (@account_balance * @interest_rate / 100.0 * interest_time).to_i
  120.    if interest_amt > 0
  121.      @last_interest_time = Graphics.frame_count / Graphics.frame_rate
  122.      @account_balance += interest_amt
  123.      # Refreshes Data Windows
  124.      $scene.refresh_windows
  125.    end
  126. end
  127. #--------------------------------------------------------------------------
  128. # * Deposit
  129. #--------------------------------------------------------------------------
  130. def deposit(amount)
  131.    $game_party.lose_gold(amount)
  132.    @account_balance += amount
  133. end
  134. #--------------------------------------------------------------------------
  135. # * Withdraw
  136. #--------------------------------------------------------------------------
  137. def withdraw(amount)
  138.    @account_balance -= amount
  139.    $game_party.gain_gold(amount)
  140. end
  141. #--------------------------------------------------------------------------
  142. # * Add Savings Bond
  143. #--------------------------------------------------------------------------
  144. def add_bond(bond)
  145.    @saving_bonds.push(bond)
  146.    @saving_bonds.sort! {|a, b| a.name <=> b.name}
  147. end
  148. end
  149.  
  150. #==============================================================================
  151. # ** Savings_Bond
  152. #==============================================================================
  153. class Savings_Bond
  154. #--------------------------------------------------------------------------
  155. # * Public Instance Variables
  156. #--------------------------------------------------------------------------
  157. attr_accessor :name
  158. attr_accessor :cost
  159. attr_accessor :interest_rate
  160. attr_accessor :length
  161. attr_accessor :time_bought
  162. attr_accessor :time_finished
  163. attr_accessor :mature_value
  164. #--------------------------------------------------------------------------
  165. # * Object Initialization
  166. #     name           : Savings Bond Name
  167. #     cost             : Savings Bond Cost
  168. #     interest_rate : Savings Bond Interest Rate (In Percent)
  169. #     length          : Length of Hours until Mature
  170. #--------------------------------------------------------------------------
  171. def initialize(name, cost, interest_rate, length)
  172.    @name = name
  173.    @cost = cost
  174.    @interest_rate = interest_rate
  175.    @length = length
  176.    @mature_value = (@cost * (1+ @interest_rate / 100.0)).to_i
  177. end
  178. #--------------------------------------------------------------------------
  179. # * Set Times
  180. #--------------------------------------------------------------------------
  181. def set_times
  182.    @time_bought = Graphics.frame_count / Graphics.frame_rate
  183.    @time_finished = @time_bought + @length * 3600
  184. end
  185. #--------------------------------------------------------------------------
  186. # * Make Time to HH:MM:SS
  187. #--------------------------------------------------------------------------
  188. def return_time(time)
  189.    hours      = time / 60 / 60
  190.    minutes   = time / 60 % 60
  191.    seconds   = time % 60
  192.    return sprintf("%02d:%02d:%02d", hours, minutes, seconds)
  193. end
  194. end
  195.  
  196. #==============================================================================
  197. # ** Window_BankNumber
  198. #==============================================================================
  199. class Window_BankNumber < Window_Base
  200. #--------------------------------------------------------------------------
  201. # * Object Initialization
  202. #--------------------------------------------------------------------------
  203. def initialize
  204.    super(640, 272, 240, 192)
  205.      self.opacity = 175
  206.    self.contents = Bitmap.new(width - 32, height - 32)
  207. end
  208. #--------------------------------------------------------------------------
  209. # * Refresh
  210. #     money  : Gold being...
  211. #     type      : Deposit or Withdraw
  212. #--------------------------------------------------------------------------
  213. def refresh(money, type)
  214.    contents.clear
  215.    # Deposit or Withdraw
  216.    contents.font.color = system_color
  217.    contents.draw_text(0, 0, contents.width, 24, "存款信息", 1)
  218.    if type == "存入"
  219.      # Draws Game Party Gold
  220.      contents.draw_text(4, 48, contents.width, 24, "所持金钱:")
  221.      contents.font.color = normal_color
  222.      contents.draw_text(-4, 48, contents.width, 24, $game_party.gold.to_s, 2)
  223.    else
  224.      # Draws Account Balance
  225.      contents.draw_text(4, 48, contents.width, 24, "yinhang余额:")
  226.      contents.font.color = normal_color
  227.      contents.draw_text(-4, 48, contents.width, 24, $game_bank.account_balance.to_s, 2)
  228.    end
  229.    # Draws Money Being Deposited or Withdrawn
  230.    contents.font.color = system_color
  231.    contents.draw_text(4, 72, contents.width, 24, "预存金钱:")
  232.    contents.font.color = normal_color
  233.    contents.draw_text(-4, 72, contents.width, 24, "- #{money}", 2)
  234.    # Draws Line
  235.    line = ""
  236.    while contents.text_size(line).width < contents.width
  237.      line += "-"
  238.    end
  239.    contents.draw_text(0, 96, contents.width, 24, line, 2)
  240.    # Draws Game Party Gold Amont
  241.    contents.font.color = system_color
  242.    contents.draw_text(4, 112, contents.width, 32, "存后金钱:")
  243.    amount = $game_party.gold
  244.    amount += type == "存入" ? -money : money
  245.    contents.font.color = normal_color
  246.    contents.draw_text(-4, 112, contents.width, 32, amount.to_s, 2)
  247.    # Draws Deposit Amont
  248.    amount = $game_bank.account_balance
  249.    amount += type == "存入" ? money : -money
  250.    contents.font.color = system_color
  251.    contents.draw_text(4, 136, contents.width, 32, "存入余额:")
  252.    contents.font.color = normal_color
  253.    contents.draw_text(-4, 136, contents.width, 32, amount.to_s, 2)
  254. end
  255. end
  256.  
  257. #==============================================================================
  258. # ** Window_BankBio
  259. #==============================================================================
  260. class Window_BankBio < Window_Base
  261. #--------------------------------------------------------------------------
  262. # * Object Initialization
  263. #--------------------------------------------------------------------------
  264. def initialize
  265.    super(-240, 272, 240, 192)
  266.      self.opacity = 175
  267.    self.contents = Bitmap.new(width - 32, height - 32)
  268.    refresh
  269. end
  270. #--------------------------------------------------------------------------
  271. # * Refresh
  272. #--------------------------------------------------------------------------
  273. def refresh
  274.    contents.clear
  275.    # Deposit or Withdraw
  276.    contents.font.color = system_color
  277.    # Draws Actor Name in Postition 1
  278.    contents.font.color = normal_color
  279.    contents.draw_text(0, 0, contents.width, 24, "#{$game_party.actors[0].name}", 1)
  280.    # Draws Game Party Gold
  281.    contents.font.color = system_color
  282.    contents.draw_text(4, 32, contents.width, 24, "持有 #{$data_system.words.gold}:")
  283.    contents.font.color = normal_color
  284.    contents.draw_text(-4, 32, contents.width, 24, $game_party.gold.to_s, 2)
  285.    # Draws Account Balance
  286.    contents.font.color = system_color
  287.    contents.draw_text(4, 56, contents.width, 24, "yinhang余额:")
  288.    contents.font.color = normal_color
  289.    contents.draw_text(-4, 56, contents.width, 24, $game_bank.account_balance.to_s, 2)
  290.    # Draws Number of Savings Bond's
  291.    contents.font.color = system_color
  292.    contents.draw_text(4, 80, contents.width, 24, "理财产品持有:")
  293.    contents.font.color = normal_color
  294.    contents.draw_text(-4, 80, contents.width, 24, $game_bank.saving_bonds.size.to_s, 2)
  295.    # Draws Value of Savings Bond's
  296.    ;value = 0
  297.    $game_bank.saving_bonds.each { |x| value += x.mature_value}
  298.    contents.font.color = system_color
  299.    contents.draw_text(4, 104, contents.width, 24, "市值:")
  300.    contents.font.color = normal_color
  301.    contents.draw_text(-4, 104, contents.width, 24, value.to_s, 2)
  302.    # Draws Current Interest Rate
  303.    contents.font.color = system_color
  304.    contents.draw_text(4, 136, contents.width, 24, "利率:")
  305.    contents.font.color = normal_color
  306.    contents.draw_text(-4, 136, contents.width, 24, "#{$game_bank.interest_rate} %", 2)
  307. end
  308. end
  309.  
  310. #==============================================================================
  311. # ** Window_Bond
  312. #==============================================================================
  313. class Window_Bond < Window_Base
  314. #--------------------------------------------------------------------------
  315. # * Object Initialization
  316. #--------------------------------------------------------------------------
  317. def initialize
  318.    super(-240, 264, 240, 200)
  319.      self.opacity = 175
  320.    self.contents = Bitmap.new(width - 32, height - 32)
  321. end
  322. #--------------------------------------------------------------------------
  323. # * Refresh
  324. #     bond    : Savings Bond
  325. #--------------------------------------------------------------------------
  326. def refresh(bond, bought = false)
  327.    contents.clear
  328.    unless bond == nil
  329.      # Draws Bond Name
  330.      contents.font.color = system_color
  331.      contents.draw_text(0, 0, contents.width, 24, bond.name, 1)
  332.      # Draws Bond Cost
  333.      contents.font.color = system_color
  334.      contents.draw_text(4, 24, contents.width, 24, "产品价格:")
  335.      contents.font.color = normal_color
  336.      contents.draw_text(-4, 24, contents.width, 24, bond.cost.to_s, 2)
  337.      # Draws Bond Mature Value
  338.      contents.font.color = system_color
  339.      contents.draw_text(4, 48, contents.width, 24, "成熟价值:")
  340.      contents.font.color = normal_color
  341.      contents.draw_text(-4, 48, contents.width, 24, "#{bond.mature_value}", 2)
  342.      # Draws Bond Interest Rate
  343.      contents.font.color = system_color
  344.      contents.draw_text(4, 72, contents.width, 24, "利率:")
  345.      contents.font.color = normal_color
  346.      contents.draw_text(-4, 72, contents.width, 24, "#{bond.interest_rate} %", 2)
  347.      # Draws Length until Maturity
  348.      contents.font.color = system_color
  349.      contents.draw_text(4, 96, contents.width, 24, "到期时间:")
  350.      contents.font.color = normal_color
  351.      contents.draw_text(-4, 96, contents.width, 24, "#{bond.length} 小时", 2)
  352.      # Display only if Purchased CD
  353.      if bought
  354.        # Draws Time Bought
  355.        contents.font.color = system_color
  356.        contents.draw_text(4, 120, contents.width, 24, "购买时间:")
  357.        contents.font.color = normal_color
  358.        contents.draw_text(-4, 120, contents.width, 24, bond.return_time(bond.time_bought), 2)
  359.        # Draws Time Finished
  360.        contents.font.color = system_color
  361.        contents.draw_text(4, 144, contents.width, 24, "结束时间:")
  362.        contents.font.color = normal_color
  363.        contents.draw_text(-4, 144, contents.width, 24, bond.return_time(bond.time_finished), 2)
  364.      end
  365.    end
  366. end
  367. end
  368.  
  369. #==============================================================================
  370. # ** Scene_Bank
  371. #==============================================================================
  372. class Scene_Bank
  373. #--------------------------------------------------------------------------
  374. # * Object Initialization
  375. #     interest rate   :   Changes Current Interest Rate (Leave 0 for no Change)
  376. #     bonds           :   Avaliable CD's For Purchasing
  377. #--------------------------------------------------------------------------
  378. def initialize(interest_rate = $game_bank.interest_rate,
  379.      bonds = [ Savings_Bond.new("丰田汽车", 59757, 10, 8), Savings_Bond.new("本田汽车", 22837, 7, 8.4),
  380.      Savings_Bond.new("索尼电子", 16989, 18, 7.2), Savings_Bond.new("东京日产", 12212, 10, 8.2), Savings_Bond.new("任天堂电子", 10676, 16, 7.9),
  381.      Savings_Bond.new("优衣库服饰", 10470, 15, 5.3), Savings_Bond.new("都科摩电信", 6363, 8, 3), Savings_Bond.new("松下电器", 6337, 9, 5.7),
  382.      Savings_Bond.new("佳能电子", 5828, 15, 7.6), Savings_Bond.new("三菱金融", 5513, 8, 4.5), Savings_Bond.new("软银电信", 5295, 3, 1),
  383.      Savings_Bond.new("斯巴鲁汽车", 4668, 8, 8.2), Savings_Bond.new("三得利食品", 4162, 15, 1), Savings_Bond.new("瑞可利媒体", 4086, 3, 5.6),
  384.      Savings_Bond.new("普利司通轮胎", 3448, 10, 8.3), Savings_Bond.new("朝日食品", 3441, 14, 4.6), Savings_Bond.new("资生堂护理", 3206, 8, 6.9),
  385.      Savings_Bond.new("花王理疗", 3073, 1, 4.2), Savings_Bond.new("大金机械", 2974, 20, 7.9), Savings_Bond.new("乐天市场", 2660, 21, 1.7),
  386.      Savings_Bond.new("麒麟饮料", 2655, 5, 3.6), Savings_Bond.new("住友yinhang", 2509, 3, 3.6), Savings_Bond.new("禧玛诺机械", 2304, 23, 9),
  387.      Savings_Bond.new("海上金融", 2289, 3, 4.2), Savings_Bond.new("铃木汽车", 2190, 7, 7), Savings_Bond.new("雅马哈", 2004, 11, 8.8),
  388.      Savings_Bond.new("日立", 1964, 15, 5.9), Savings_Bond.new("尤尼佳", 1848, 3, 6.2), Savings_Bond.new("小松机械", 1708, 1, 8.6),
  389.      Savings_Bond.new("日清饮料", 1451, 9, 3), Savings_Bond.new("味之素", 1391, 15, 6.1), Savings_Bond.new("富士胶片", 1336, 4, 6.1),
  390.      Savings_Bond.new("无印良品", 1330, 9, 3.8), Savings_Bond.new("养乐多", 1295, 28, 4.5), Savings_Bond.new("富士通", 1278, 19, 3.7),
  391.      Savings_Bond.new("三菱地产", 1260, 5, 1.2), Savings_Bond.new("马自达汽车", 1171, 9, 8.2), Savings_Bond.new("久保田机械", 1163, 8, 7.3),
  392.      Savings_Bond.new("欧姆龙电子", 1153, 6, 6.2), Savings_Bond.new("泰尔茂药业", 1110, 13, 4.2), Savings_Bond.new("豪雅精密设备", 1068, 8, 7.5),
  393.      Savings_Bond.new("万代南宫梦", 1042, 13, 4.2), Savings_Bond.new("西科姆安防", 1033, 1, 6.9), Savings_Bond.new("龟甲万食品", 1001, 5, 6.9),
  394.      Savings_Bond.new("生命金融", 993, 8, 6), Savings_Bond.new("奥林巴斯医药", 968, 14, 8.4), Savings_Bond.new("亚瑟士运动", 868, 15, 7.9),
  395.      Savings_Bond.new("五十铃汽车", 849, 13, 6.5), Savings_Bond.new("牧田机械", 794, 16, 8.4), Savings_Bond.new("高丝护理", 721, 6, 4.9),
  396.      Savings_Bond.new("爱普生", 695, 7, 8), Savings_Bond.new("日航物流", 631, 6, 3.9), Savings_Bond.new("欧力士", 578, 3, 2.3),
  397.      Savings_Bond.new("科乐美", 539, 15, 2.3), Savings_Bond.new("三菱电机", 508, 10, 4.8), Savings_Bond.new("卡西欧", 472, 5, 7.5),
  398.      Savings_Bond.new("尼康", 422, 12, 8.2), Savings_Bond.new("雅玛多运输", 333, 9, 1), Savings_Bond.new("宝丽护理", 295, 2, 1.8), Savings_Bond.new("TOTO", 312, 1, 0)])
  399.    $game_bank.interest_rate = interest_rate unless interest_rate == 0
  400.    @bonds = bonds
  401. end
  402. #--------------------------------------------------------------------------
  403. # * Main Processing
  404. #--------------------------------------------------------------------------
  405. def main
  406.    # Current Phase
  407.    @phase = -1
  408.    # Refreshing Variables
  409.    @amount, @depositing = 0, true
  410.    @current_bond, @bond_bought = nil, false
  411.    # Make sprite set
  412.    @spriteset = Spriteset_Map.new
  413.    # Help Window
  414.    @help_window = Window_Help.new
  415.      @help_window.y, @help_window.opacity = -64, 175
  416.      @help_window.set_text("欢迎来到yinhang!你可以在这里存取金钱!=^^=", 1)
  417.    # Bank Bio
  418.    @bank_bio_window = Window_BankBio.new
  419.    # Avaliable Bond Information Display Window
  420.    @av_bond_display_window = Window_Bond.new
  421.    # Owned Bond Information Display Window
  422.    @own_bond_display_window = Window_Bond.new
  423.    # Main Command
  424.    @main_command = Window_RefreshCommand.new(180, [
  425.        "存款",
  426.        "取款", "购买理财产品", "我的理财产品", "退出"])
  427.      @main_command.x, @main_command.y, @main_command.opacity = 644, 272, 175
  428.      @main_command.active = false
  429.    # Bank Number Window
  430.    @bank_number_window = Window_BankNumber.new
  431.    # Avaliable Bonds Command
  432.    commands = []
  433.    @bonds.each {|x| commands.push(x.name)}; commands.push("返回")
  434.    @av_bond_command = Window_RefreshCommand.new(180, commands)
  435.      @av_bond_command.x, @av_bond_command.y = 644, 272
  436.      @av_bond_command.height, @av_bond_command.opacity = 192, 175
  437.      @av_bond_command.active = false
  438.    # CD's Have
  439.    @own_bond_command = Window_RefreshCommand.new(180, get_cd_list)
  440.      @own_bond_command.x, @own_bond_command.y = 644, 272
  441.      @own_bond_command.height, @own_bond_command.opacity = 192, 175
  442.      @own_bond_command.active = false
  443.    # Scene Objects
  444.    @objects = [@spriteset, @help_window, @bank_bio_window, @av_bond_display_window,
  445.        @own_bond_display_window, @main_command, @bank_number_window,
  446.        @av_bond_command, @own_bond_command]
  447.    # Execute transition
  448.    Graphics.transition
  449.    # Main loop
  450.    while $scene == self
  451.      # Update game screen
  452.      Graphics.update
  453.      # Update input information
  454.      Input.update
  455.      # Update Objects
  456.      @objects.each {|x| x.update}
  457.      # Updates Bank System
  458.      $game_bank.update
  459.      # Frame update
  460.      update
  461.    end
  462.    # Prepare for transition
  463.    Graphics.freeze
  464.    # Dispose of windows
  465.    @objects.each {|x| x.dispose}
  466. end
  467. #--------------------------------------------------------------------------
  468. # * Frame Update
  469. #--------------------------------------------------------------------------
  470. def update
  471.    # Splits Phases Up
  472.    case @phase
  473.    when -1 # Intro Phase
  474.      intro_update
  475.    when 0  # Main Phase
  476.      main_update
  477.    when 1  # Deposit or Withdraw Phase
  478.      account_update
  479.    when 2  # Buy CD Phase
  480.      buy_bond_update
  481.    when 3  # Get Mature CD Phse
  482.      get_bond_update
  483.    when 99 # Exit Phase
  484.      exit_update
  485.    end
  486. end
  487. #--------------------------------------------------------------------------
  488. # * Intro Update
  489. #--------------------------------------------------------------------------
  490. def intro_update
  491.    # Moves Window Down
  492.    @help_window.y += 4 if @help_window.y < 0
  493.    if @help_window.y == 0
  494.      # Input Processing
  495.      if Input.trigger?(Input::B)
  496.        $game_system.se_play($data_system.cancel_se)
  497.        # Returns to Scene
  498.        @phase = 99
  499.      elsif Input.trigger?(Input::C)
  500.        $game_system.se_play($data_system.decision_se)
  501.        # Switchs to Main Phase
  502.        @phase = 0
  503.      end
  504.    end
  505. end
  506. #--------------------------------------------------------------------------
  507. # * Main Update
  508. #--------------------------------------------------------------------------
  509. def main_update
  510.    # Turns On Main Command
  511.    @main_command.active = true
  512.    # Turns Off Other Command Windows
  513.    @av_bond_command.active = @own_bond_command.active = false
  514.    # Moves In Active Windows
  515.    @bank_bio_window.z = @main_command.z = 9999
  516.    @bank_bio_window.x += 32 if @bank_bio_window.x < 16
  517.    @main_command.x -= 25 if @main_command.x > 444
  518.    # Moves Out Inactive Windows
  519.    @av_bond_display_window.x -= 32 if @av_bond_display_window.x > - 240
  520.    [@av_bond_display_window, @own_bond_display_window, @bank_number_window,
  521.      @av_bond_command, @own_bond_command].each {|window| window.z = 9995}
  522.    [@av_bond_command, @own_bond_command].each {|command|
  523.      command.x += 25 if command.x < 644}
  524.    @own_bond_display_window.x -= 25 if @own_bond_display_window.x > - 240
  525.    @bank_number_window.x += 32 if @bank_number_window.x < 640
  526.    # Sets Help Window
  527.    case @main_command.index
  528.      when 0; @help_window.set_text("要 存款 从这里...", 1)
  529.      when 1; @help_window.set_text("要 提款 从这里...", 1)
  530.      when 2; @help_window.set_text("要 购买理财产品 从这里...", 1)
  531.      when 3; @help_window.set_text("要 已有理财产品 从这里...", 1)
  532.      when 4; @help_window.set_text("亲爱的顾客,您要离开yinhang吗?", 1)
  533.    end
  534.    # Input Processing
  535.    if Input.trigger?(Input::B) # Returns to Map
  536.      $game_system.se_play($data_system.cancel_se)
  537.      @phase = 99
  538.    elsif Input.trigger?(Input::C)
  539.      $game_system.se_play($data_system.decision_se)
  540.      case @main_command.index
  541.      when 0  # Deposit
  542.        @amount, @depositing = 0, true
  543.        refresh_windows
  544.        @help_window.set_text("存入 #{@amount} #{$data_system.words.gold}", 1)
  545.        @phase = 1
  546.      when 1  # Withdraw
  547.        @amount, @depositing = 0, false
  548.        refresh_windows
  549.        @help_window.set_text("取出 #{@amount} #{$data_system.words.gold}", 1)
  550.        @phase = 1
  551.      when 2  # Buy CD
  552.        @current_bond = @bonds[@av_bond_command.index]
  553.        @bond_bought = false
  554.        refresh_windows
  555.        @phase = 2
  556.      when 3  # Get CD
  557.        @current_bond = $game_bank.saving_bonds[@own_bond_command.index]
  558.        @bond_bought = true
  559.        refresh_windows
  560.        @phase = 3
  561.      when 4  # Exit Bank
  562.        @phase = 99
  563.      end
  564.    end
  565. end
  566. #--------------------------------------------------------------------------
  567. # * Accpunt Update
  568. #--------------------------------------------------------------------------
  569. def account_update
  570.    # Turns Off Command Windows
  571.    @main_command.active = @av_bond_command.active = @own_bond_command.active = false
  572.    # Moves In Active Windows
  573.    @bank_bio_window.z = @bank_number_window.z = 9999
  574.    @bank_bio_window.x += 32 if @bank_bio_window.x < 16
  575.    @bank_number_window.x -= 32 if @bank_number_window.x > 384
  576.    # Moves Out Inactive Windows
  577.    @av_bond_display_window.z = @own_bond_display_window.z =
  578.      @main_command.z = @av_bond_command.z = @own_bond_command.z = 9995
  579.    @av_bond_display_window.x -= 32 if @av_bond_display_window.x > - 240
  580.    [@own_bond_display_window].each {|window| window.x -= 25 if window.x > - 240}
  581.    [@main_command, @av_bond_command, @own_bond_command].each {|command|
  582.        command.x += 25 if command.x < 644}
  583.    # Input Processing
  584.    if Input.trigger?(Input::B)
  585.      $game_system.se_play($data_system.cancel_se)
  586.      @phase = 0
  587.    elsif Input.trigger?(Input::C)
  588.      $game_system.se_play($data_system.shop_se)
  589.      if @depositing
  590.        $game_bank.deposit(@amount)
  591.        refresh_windows
  592.        @phase = 0
  593.      else
  594.        $game_bank.withdraw(@amount)
  595.        refresh_windows
  596.        @phase = 0
  597.      end
  598.    elsif Input.repeat?(Input::LEFT) && Input.press?(Input::LEFT)
  599.      if @amount > 0
  600.        $game_system.se_play($data_system.cursor_se)
  601.        @amount -= 100
  602.        refresh_windows
  603.        @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  604.      else
  605.        $game_system.se_play($data_system.buzzer_se)
  606.      end
  607.    elsif Input.repeat?(Input::RIGHT) && Input.press?(Input::RIGHT)
  608.      if @depositing
  609.        if @amount < $game_party.gold
  610.          $game_system.se_play($data_system.cursor_se)
  611.          @amount += 100
  612.          refresh_windows
  613.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  614.        else
  615.          $game_system.se_play($data_system.buzzer_se)
  616.        end
  617.      else
  618.        if @amount < $game_bank.account_balance
  619.          $game_system.se_play($data_system.cursor_se)
  620.          @amount += 100
  621.          refresh_windows
  622.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  623.        else
  624.          $game_system.se_play($data_system.buzzer_se)
  625.        end
  626.      end
  627.    elsif Input.repeat?(Input::UP) && Input.press?(Input::UP)
  628.      if @amount == 0
  629.        $game_system.se_play($data_system.buzzer_se)
  630.      else
  631.        $game_system.se_play($data_system.cursor_se)
  632.        @amount > 1000 ? @amount -= 1000 : @amount = 0
  633.        refresh_windows
  634.        @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  635.      end
  636.    elsif Input.repeat?(Input::DOWN) && Input.press?(Input::DOWN)
  637.      if @depositing
  638.        if @amount < $game_party.gold
  639.          $game_system.se_play($data_system.cursor_se)
  640.          @amount < $game_party.gold - 1000 ? @amount += 1000 : @amount = $game_party.gold
  641.          refresh_windows
  642.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  643.        else
  644.          $game_system.se_play($data_system.buzzer_se)
  645.        end
  646.      else
  647.        if @amount < $game_bank.account_balance
  648.          $game_system.se_play($data_system.cursor_se)
  649.          @amount < $game_bank.account_balance - 100 ? @amount += 100 : @amount = $game_bank.account_balance
  650.          refresh_windows
  651.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  652.        else
  653.          $game_system.se_play($data_system.buzzer_se)
  654.        end
  655.      end
  656.    elsif Input.repeat?(Input::L) && Input.press?(Input::L)
  657.      if @amount == 0
  658.        $game_system.se_play($data_system.buzzer_se)
  659.      else
  660.        $game_system.se_play($data_system.cursor_se)
  661.        @amount > 1000 ? @amount -= 1000 : @amount = 0
  662.        refresh_windows
  663.        @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  664.      end
  665.    elsif Input.repeat?(Input::R) && Input.press?(Input::R)
  666.      if @depositing
  667.        if @amount < $game_party.gold
  668.          $game_system.se_play($data_system.cursor_se)
  669.          @amount < $game_party.gold - 1000 ? @amount += 1000 : @amount = $game_party.gold
  670.          refresh_windows
  671.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  672.        else
  673.          $game_system.se_play($data_system.buzzer_se)
  674.        end
  675.      else
  676.        if @amount < $game_bank.account_balance
  677.          $game_system.se_play($data_system.cursor_se)
  678.          @amount < $game_bank.account_balance - 1000 ? @amount += 1000 : @amount = $game_bank.account_balance
  679.          refresh_windows
  680.          @help_window.set_text("#{@depositing ? '存入' : '取出'} #{@amount} #{$data_system.words.gold}", 1)
  681.        else
  682.          $game_system.se_play($data_system.buzzer_se)
  683.        end
  684.      end
  685.    end
  686. end
  687. #--------------------------------------------------------------------------
  688. # * Buy Bond Update
  689. #--------------------------------------------------------------------------
  690. def buy_bond_update
  691.    # Turns On Avaliable Bond Window
  692.    @av_bond_command.active = true
  693.    # Turns Off Other Command Windows
  694.    @main_command.active = @own_bond_command.active = false
  695.    # Moves In Active Windows
  696.    @av_bond_display_window.z = @av_bond_command.z = 9999
  697.    @av_bond_display_window.x += 32 if @av_bond_display_window.x < 16
  698.    @av_bond_command.x -= 25 if @av_bond_command.x > 444
  699.    # Moves Out Inactive Windows
  700.    [@bank_bio_window, @bank_number_window, @own_bond_display_window,
  701.      @main_command, @own_bond_command].each {|window| window.z = 9995}
  702.    @bank_bio_window.x -= 32 if @bank_bio_window.x > - 240
  703.    @bank_number_window.x += 32 if @bank_number_window.x < 640
  704.    @own_bond_display_window.x -= 25 if @own_bond_display_window.x > - 240
  705.    [@main_command, @own_bond_command].each {|command| command.x += 25 if command.x < 644}
  706.    # Input Processing
  707.    if Input.trigger?(Input::B)
  708.      $game_system.se_play($data_system.cancel_se)
  709.      @phase = 0
  710.    elsif Input.trigger?(Input::C)
  711.      if @av_bond_command.index == @bonds.size
  712.        $game_system.se_play($data_system.cancel_se)
  713.        @phase = 0
  714.      else
  715.        current_bond = @bonds[@av_bond_command.index].dup
  716.        if current_bond.cost > $game_party.gold
  717.          $game_system.se_play($data_system.buzzer_se)
  718.        else
  719.          $game_system.se_play($data_system.decision_se)
  720.          $game_party.lose_gold(current_bond.cost)
  721.          current_bond.set_times
  722.          $game_bank.add_bond(current_bond)
  723.          refresh_windows
  724.          @phase = 0
  725.        end
  726.      end
  727.    # Updates Current Bond
  728.    elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  729.      @current_bond = @bonds[@av_bond_command.index]
  730.      refresh_windows
  731.    end
  732. end
  733. #--------------------------------------------------------------------------
  734. # * Get Bond Update
  735. #--------------------------------------------------------------------------
  736. def get_bond_update
  737.    # Turns On Avaliable Bond Window
  738.    @own_bond_command.active = true
  739.    # Turns Off Other Command Windows
  740.    @main_command.active = @av_bond_command.active = false
  741.    # Moves In Active Windows
  742.    [@own_bond_display_window, @own_bond_command].each {|window| window.z = 9999}
  743.    @own_bond_display_window.x += 32 if @own_bond_display_window.x < 16
  744.    @own_bond_command.x -= 25 if @own_bond_command.x > 444
  745.    # Moves Out Inactive Windows
  746.    [@bank_bio_window, @av_bond_display_window, @main_command, @bank_number_window,
  747.      @av_bond_command].each {|window| window.z = 9995}
  748.    [@bank_bio_window, @av_bond_display_window].each {|window|
  749.      window.x -= 32 if window.x > - 240}
  750.    [@main_command, @av_bond_command].each {|window|
  751.      window.x += 25 if window.x < 640}
  752.    @bank_number_window.x += 32 if @bank_number_window.x < 640
  753.    # Input Processing
  754.    if Input.trigger?(Input::B)
  755.      $game_system.se_play($data_system.cancel_se)
  756.      @phase = 0
  757.    elsif Input.trigger?(Input::C)
  758.      if @own_bond_command.index == $game_bank.saving_bonds.size
  759.        $game_system.se_play($data_system.cancel_se)
  760.        @phase = 0
  761.      else
  762.        current_bond = $game_bank.saving_bonds[@own_bond_command.index]
  763.        if current_bond.time_finished > Graphics.frame_count / Graphics.frame_rate
  764.          $game_system.se_play($data_system.buzzer_se)
  765.          @help_window.set_text("您的理财产品还没有到期!", 1)
  766.        else
  767.          $game_system.se_play($data_system.decision_se)
  768.          $game_party.gain_gold(current_bond.mature_value)
  769.          $game_bank.saving_bonds.delete_at[@own_bond_command.index]
  770.          refresh_windows
  771.          @phase = 0
  772.        end
  773.      end
  774.    elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
  775.      @current_bond = $game_bank.saving_bonds[@own_bond_command.index]
  776.      refresh_windows
  777.    end
  778. end
  779.  
  780. # * Exit Update
  781.  
  782. def exit_update
  783.    # Moves Out Windows
  784.    @help_window.y -= 4 if @help_window.y > - 64
  785.    [@bank_bio_window, @av_bond_display_window].each {|window| window.x -= 32 if window.x > - 240}
  786.    [@own_bond_display_window].each {|window| window.x -= 25 if window.x > - 240}
  787.    [@main_command, @bank_number_window, @av_bond_command,
  788.      @own_bond_command].each {|window| window.x += 25 if window.x < 640}
  789.    # Checks To Make Sure All Windows Are Out
  790.    if @help_window.y <= - 64 && @bank_bio_window.x <= - 240 && @av_bond_display_window.x <= - 240 &&
  791.        @own_bond_display_window.x <= - 240 && @main_command.x >= 644 &&
  792.        @bank_number_window.x >= 640 && @av_bond_command.x >= 640 && @own_bond_command.x >= 640
  793.      $scene = Scene_Map.new
  794.    end
  795. end
  796. #--------------------------------------------------------------------------
  797. # * Get CD List
  798. #--------------------------------------------------------------------------
  799. def get_cd_list
  800.    commands = []
  801.    $game_bank.saving_bonds.each {|x| commands.push(x.name)}
  802.    commands.push("返回")
  803.    return commands
  804. end
  805. #--------------------------------------------------------------------------
  806. # * Refresh Windows
  807. #--------------------------------------------------------------------------
  808. def refresh_windows
  809.    @bank_bio_window.refresh
  810.    @av_bond_display_window.refresh(@current_bond, @bond_bought)
  811.    @own_bond_display_window.refresh(@current_bond, @bond_bought)
  812.    @bank_number_window.refresh(@amount, @depositing ? "存入" : "取出")
  813.    @own_bond_command.refresh(get_cd_list)
  814. end
  815. end

Lv3.寻梦者

梦石
0
星屑
1253
在线时间
175 小时
注册时间
2020-9-19
帖子
23
3
 楼主| 发表于 2023-12-8 11:18:42 | 只看该作者
多谢多谢了
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
39016
在线时间
5717 小时
注册时间
2006-11-10
帖子
6619
2
发表于 2023-12-7 19:13:46 | 只看该作者
把错误的那行 中括号[] 改小括号 ()  注意要半角符号,也就是英文符号

评分

参与人数 1+1 收起 理由
195874 + 1 认可答案

查看全部评分

回复 支持 1 反对 0

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-22 00:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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