赞 | 5 |
VIP | 71 |
好人卡 | 22 |
积分 | 6 |
经验 | 32145 |
最后登录 | 2013-8-9 |
在线时间 | 184 小时 |
Lv2.观梦者 天仙
- 梦石
- 0
- 星屑
- 620
- 在线时间
- 184 小时
- 注册时间
- 2008-4-15
- 帖子
- 5023
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
如題
效果截圖:
腳本:
- class Window_Base < Window
- #===========================================================
- # 获取中文数字
- # 除了10、100、1000、10000会返回其中文之外
- # 只会取其参数的個位數
- #===========================================================
- def number_snstar(num)
- ch_number_snstar = ["零", "一", "二", "三", "四",
- "五", "六", "七", "八", "九",
- "十", "百", "千", "万"]
- if num == 100
- return ch_number_snstar[11]
- elsif num == 1000
- return ch_number_snstar[12]
- elsif num == 10000
- return ch_number_snstar[13]
- elsif num == 10
- return ch_number_snstar[10]
- else
- return ch_number_snstar[num%10]
- end
- end
-
- # 显示中文数字
- def change_to_ch(num)
- return num unless num.is_a?(Integer)
- if num < 0
- rnum = "负 "
- else
- rnum = ""
- end
- num = num.abs
- if num <= 10
- return rnum+number_snstar(num)
- else
- # 个
- ones = number_snstar(num%10)
- # 十
- tens = number_snstar(num/10%10)# if num%100!=0
- # 百
- huns = number_snstar(num/100%10)# if num%1000!=0
- # 千
- thos = number_snstar(num/1000%10)
- # 万
- tths = number_snstar(num/10000%10)
- # 十万
- hths = number_snstar(num/100000%10)
- # 百万
- mils = number_snstar(num/1000000%10)
- # 千万
- tmis = number_snstar(num/10000000%10)
-
- # 数字小於100
- if num < 100
- if num%10==0
- rnum += tens+number_snstar(10)
- else
- if num<20
- rnum += number_snstar(10)+ones
- else
- rnum += tens+number_snstar(10)+ones
- end
- end
- end
-
- # 数字100~999
- if num<1000 and num>=100
- if num%100==0
- rnum += huns+number_snstar(100)
- else
- if tens != number_snstar(0)
- rnum += huns+number_snstar(100)+tens+number_snstar(10)+ones
- else
- rnum += huns+number_snstar(100)+number_snstar(0)+ones
- end
- end
- end
-
- # 数字1000~9999
- if num<10000 and num>=1000
- if num%1000==0
- rnum += thos+number_snstar(1000)
- else
- if huns != number_snstar(0)
- if tens != number_snstar(0)
- rnum += thos+number_snstar(1000)+huns+number_snstar(100)+tens+number_snstar(10)+ones
- else
- rnum += thos+number_snstar(1000)+huns+number_snstar(100)+tens+ones
- end
- else
- rnum += thos+number_snstar(1000)+tens+ones
- end
- end
- end
-
- # 数字10000~99999
- if num>=10000
- if num%10000==0
- rnum += tths+number_snstar(10000)
- else
- if tths != number_snstar(0)
- if thos != number_snstar(0)
- if huns != number_snstar(0)
- if tens != number_snstar(0)
- rnum += tths+number_snstar(10000)+thos+number_snstar(1000)+
- huns+number_snstar(100)+tens+number_snstar(10)+ones
- else
- rnum += tths+number_snstar(10000)+thos+number_snstar(1000)+
- huns+number_snstar(100)+tens+ones
- end
- else
- rnum += tths+number_snstar(10000)+thos+number_snstar(1000)+huns+ones
- end
- else
- rnum += tths+number_snstar(10000)+thos+ones
- end
- else
- rnum += number_snstar(10000)+number_snstar(0)+ones
- end
- end
-
- # 数字100000~999999
- if num>=100000 and num<1000000
- rnum = hths+number_snstar(10)+rnum
- end
-
- # 数字1000000~9999999
- if num>=1000000 and num<10000000
- if hths != number_snstar(0)
- rnum = mils + number_snstar(100) + hths+number_snstar(10)+rnum
- else
- rnum = mils + number_snstar(100) + number_snstar(0)+rnum
- end
- end
-
- # 数字10000000~99999999
- if num>=10000000 and num<100000000
- if mils != number_snstar(0)
- if hths != number_snstar(0)
- rnum = tmis + number_snstar(1000) + mils + number_snstar(100) +
- hths+number_snstar(10)+rnum
- else
- rnum = tmis + number_snstar(1000) + mils + number_snstar(100) +
- number_snstar(0)+rnum
- end
- else
- rnum = tmis + number_snstar(1000) + number_snstar(0)+rnum
- end
- end
- end
- return rnum
- end
- end
-
- # 显示纯数字
- def change_to_ch_pn(num)
- return num unless num.is_a?(Integer)
- if num < 0
- rnum = "负 "
- else
- rnum = ""
- end
- num = num.abs
- if num <= 10
- return rnum+number_snstar(num)
- else
- # 个
- ones = number_snstar(num%10)
- # 十
- tens = number_snstar(num/10%10)# if num%100!=0
- # 百
- huns = number_snstar(num/100%10)# if num%1000!=0
- # 千
- thos = number_snstar(num/1000%10)
- # 万
- tths = number_snstar(num/10000%10)
- # 十万
- hths = number_snstar(num/100000%10)
- # 百万
- mils = number_snstar(num/1000000%10)
- # 千万
- tmis = number_snstar(num/10000000%10)
-
- if num < 100
- if num%10==0
- rnum += tens+number_snstar(10)
- else
- if num<20
- rnum += number_snstar(10)+ones
- else
- rnum += tens+ones
- end
- end
- end
-
- if num<1000 and num>=100
- if num%100==0
- rnum += huns+number_snstar(100)
- else
- rnum += huns+tens+ones
- end
- end
-
- if num<10000 and num>=1000
- if num%1000==0
- rnum += thos+number_snstar(1000)
- else
- rnum += thos+huns+tens+ones
- end
- end
-
- if num<100000 and num>=10000
- if num%10000==0
- rnum += tths+number_snstar(10000)
- else
- rnum += tths+thos+huns+ones
- end
- end
-
- if num<1000000 and num>=100000
- if num%100000==0
- rnum += hths+number_snstar(10)+number_snstar(10000)
- else
- rnum += hths+tths+thos+huns+tens+ones
- end
- end
-
- if num<10000000 and num>=1000000
- if num%1000000==0
- rnum += mils+number_snstar(100)+number_snstar(10000)
- else
- rnum += mils+hths+tths+thos+huns+tens+ones
- end
- end
- if num<100000000 and num>=10000000
- if num%10000000==0
- rnum += tmis+number_snstar(1000)+number_snstar(10000)
- else
- rnum += tmis+mils+hths+tths+thos+huns+tens+ones
- end
- end
- return rnum
- end
- end
- end
- #============================================================================
- # 函数重新定义
- # 显示微中文数字
- #============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● レベルの描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_actor_level(actor, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
- self.contents.font.color = normal_color
- clevel = change_to_ch(actor.level)
- self.contents.draw_text(x + 32, y, 24, WLH, clevel, 2)
- end
- #--------------------------------------------------------------------------
- # ● HP の描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_actor_hp(actor, x, y, width = 120)
- draw_actor_hp_gauge(actor, x, y, width)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
- self.contents.font.color = hp_color(actor)
- xr = x + width
- chp = change_to_ch_pn(actor.hp)
- chpm= change_to_ch_pn(actor.maxhp)
- if width < 120
- self.contents.draw_text(xr - 40, y, 40, WLH, chp, 2)
- else
- self.contents.draw_text(xr - 90, y, 40, WLH, chp, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
- self.contents.draw_text(xr - 40, y, 40, WLH, chpm, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● MP の描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_actor_mp(actor, x, y, width = 120)
- draw_actor_mp_gauge(actor, x, y, width)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 30, WLH, Vocab::mp_a)
- self.contents.font.color = mp_color(actor)
- xr = x + width
- cmp = change_to_ch_pn(actor.mp)
- cmpm= change_to_ch_pn(actor.maxmp)
- if width < 120
- self.contents.draw_text(xr - 40, y, 40, WLH, cmp, 2)
- else
- self.contents.draw_text(xr - 90, y, 40, WLH, cmp, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
- self.contents.draw_text(xr - 40, y, 40, WLH, cmpm, 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● 能力値の描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # type : 能力値の種類 (0~3)
- #--------------------------------------------------------------------------
- def draw_actor_parameter(actor, x, y, type)
- case type
- when 0
- parameter_name = Vocab::atk
- parameter_value = actor.atk
- when 1
- parameter_name = Vocab::def
- parameter_value = actor.def
- when 2
- parameter_name = Vocab::spi
- parameter_value = actor.spi
- when 3
- parameter_name = Vocab::agi
- parameter_value = actor.agi
- end
- self.contents.font.color = system_color
-
- cparam = change_to_ch_pn(parameter_value)
- width = self.contents.text_size(cparam).width
-
- self.contents.draw_text(x, y, 120, WLH, parameter_name)
- self.contents.font.color = normal_color
- self.contents.draw_text(x+120, y, width, WLH, cparam, 0)
- end
- #--------------------------------------------------------------------------
- # ● 通貨単位つきの数値描画
- # value : 数値 (所持金など)
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_currency_value(value, x, y, width)
- cx = contents.text_size(Vocab::gold).width
- self.contents.font.color = normal_color
- vgold = change_to_ch(value)
- self.contents.draw_text(x, y, width-cx-2, WLH, vgold, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, width, WLH, Vocab::gold, 2)
- end
-
- end
- class Window_Status < Window_Base
- #--------------------------------------------------------------------------
- # ● 経験値情報の描画
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_exp_info(x, y)
- s1 = change_to_ch_pn(@actor.exp_s)
- s2 = change_to_ch_pn(@actor.next_rest_exp_s)
- s_next = sprintf(Vocab::ExpNext, Vocab::level)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
- self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2)
- self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2)
- end
- end
- class Window_EquipStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 能力値の描画
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # type : 能力値の種類 (0~3)
- #--------------------------------------------------------------------------
- def draw_parameter(x, y, type)
- case type
- when 0
- name = Vocab::atk
- value = @actor.atk
- new_value = @new_atk
- when 1
- name = Vocab::def
- value = @actor.def
- new_value = @new_def
- when 2
- name = Vocab::spi
- value = @actor.spi
- new_value = @new_spi
- when 3
- name = Vocab::agi
- value = @actor.agi
- new_value = @new_agi
- end
- cv = change_to_ch_pn(value)
- self.contents.font.color = system_color
- self.contents.draw_text(x + 4, y, 80, WLH, name)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 90, y, 30, WLH, cv, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(x + 122, y, 20, WLH, "→", 1)
- if new_value != nil
- ncv = change_to_ch_pn(new_value)
- self.contents.font.color = new_parameter_color(cv, ncv)
- self.contents.draw_text(x + 142, y, 30, WLH, ncv, 2)
- end
- end
- end
复制代码
{/cy}中國風的遊戲用阿拉伯數字實在太奇怪了
用我們偉大的中國文字顯示才對
其實是為了我即將出的遊戲寫的
順便貼出來
|
|