Cruel On Sky :: เพื่อนกันตลอดไป
สวัสดีครับ ยินดีต้อนรับเข้าสู้ Cruel on sky นะครับ

ท่ายังไม่มี ไอดี เชิญกดสมัครสมาชิครด้านล่างครับ

ขอบคุณที่เข้าบอร์ดเราครับ (ปกติไม่มีคนเข้า)

Join the forum, it's quick and easy

Cruel On Sky :: เพื่อนกันตลอดไป
สวัสดีครับ ยินดีต้อนรับเข้าสู้ Cruel on sky นะครับ

ท่ายังไม่มี ไอดี เชิญกดสมัครสมาชิครด้านล่างครับ

ขอบคุณที่เข้าบอร์ดเราครับ (ปกติไม่มีคนเข้า)
Cruel On Sky :: เพื่อนกันตลอดไป
Would you like to react to this message? Create an account in a few clicks or log in to continue.

[สคริปต์] ระบบวันเวลา ตามเครื่องคอม

Go down

[สคริปต์] ระบบวันเวลา ตามเครื่องคอม Empty [สคริปต์] ระบบวันเวลา ตามเครื่องคอม

ตั้งหัวข้อ by CruelMaster Tue Mar 16, 2010 7:07 pm

สคริปต์ วันเวลา ตามเครื่องคอม (ตามปัจจุบัน)

หากใครเคยเล่นเกมpokemonบนเครื่องDSก็จะรู้ว่าเกมนั้น ใช้วันเวลาจริง เช่น ถ้าเราเล่นตอน 3 ทุ่ม เวลาในเกม ก็จะ 3 ทุ่มเช่นกัน ซึ่งสคริปต์นี้จะมีผลแบบนี้นั่นเอง

----------------------------------------------------------------------------

  1. #============================
  2. # Your Current Time Window
  3. # version 1.1
  4. # by shadowball
  5. # 11.25.2007 - 11.28.2007
  6. #============================
  7. # This is what I edited in the Window_PlayTime script...
  8. # I replaced the original lines (where def refresh is defined) with these...
  9. # It prints the current date/time this way:
  10. # Sunday
  11. # 11.25.2007 23:59
  12. class Window_YourCurrentTime < Window_Base
  13. #------------------------------------------------------------
  14. # * Object Initialization
  15. #------------------------------------------------------------
  16. def initialize
  17. super(0, 0, 160, 96)#88)
  18. self.contents = Bitmap.new(width - 32, height - 32)
  19. #self.windowskin = RPG::Cache.windowskin('001-WallofCloudsSHB01')
  20. refresh
  21. end
  22. #------------------------------------------------------------
  23. # * Refresh
  24. #------------------------------------------------------------
  25. def refresh
  26. self.contents.clear
  27. # Draw Time Text
  28. t = Time.now
  29. # The full weekday name is normally displayed in English.
  30. # If you speak English, you may delete this hash.
  31. days = {'Monday' => 'วันจันทร์',
  32. 'Tuesday' => 'วันอังคาร',
  33. 'Wednesday' => 'วันพุธ',
  34. 'Thursday' => 'วันพฤหัสบดี',
  35. 'Friday' => 'วันศุกร์',
  36. 'Saturday' => 'วันเสาร์',
  37. 'Sunday' => 'วันอาทิตย์'}

  38. months = {'January' => 'มกราคม',
  39. 'February' => 'กุมภาพันธ์',
  40. 'March' => 'มีนาคม',
  41. 'April' => 'เมษายน',
  42. 'May' => 'พฤษภาคม',
  43. 'June' => 'มิถุนายน',
  44. 'July' => 'กรกฎาคม',
  45. 'August' => 'สิงหาคม',
  46. 'September' => 'กันยายน',
  47. 'October' => 'ตุลาคม',
  48. 'November' => 'พฤศจิกายน',
  49. 'December' => 'ธันวาคม'}

  50. text1 = days[t.strftime('%A')]
  51. text2 = months[t.strftime('%B')]
  52. # End of full weekday / month name in your language
  53. text3 = t.strftime('%d / %m / %Y %H:%M')
  54. self.contents.font.bold = true
  55. # System Color
  56. self.contents.font.color = system_color
  57. # Print Day Of The Week
  58. self.contents.draw_text(0, 0, 60, 32, text1, 0)
  59. # Normal Color
  60. self.contents.font.color = normal_color
  61. # Print Time
  62. self.contents.draw_text(0, 32, 145, 32, text3, 0)
  63. #self.contents.draw_text(0, 32, 145, 32, text2, 0)
  64. end
  65. #--------------------------------------------------------------
  66. # * Frame Update
  67. #--------------------------------------------------------------
  68. def update
  69. super
  70. if Graphics.frame_count / Graphics.frame_rate != @total_sec
  71. refresh
  72. end
  73. end
  74. end
  75. #=======================================
  76. # ** Window_YourCurrentTimeHUD
  77. # v1.0
  78. # by shadowball
  79. # 27.12.2007
  80. #=======================================
  81. class Scene_Map
  82. alias_method :shbyct_main, :main
  83. def main
  84. # Make play time window
  85. @yctime_window = Window_YourCurrentTime.new
  86. @yctime_window.x = 480
  87. @yctime_window.y = 0
  88. @yctime_window.z = 120
  89. shbyct_main
  90. Graphics.freeze
  91. @yctime_window.dispose
  92. end
  93. alias_method :shbyct_update, :update
  94. def update
  95. @shb_hour = Time.now.strftime('%H').to_i
  96. if @shb_hour < 5 || @shb_hour > 18 # 7 p.m. - 5 a.m.
  97. $game_screen.start_tone_change(Tone.new(-120, -120, -120, 0), 1)
  98. elsif @shb_hour > 4 && @shb_hour < 7 # 5 - 7 a.m.
  99. $game_screen.start_tone_change(Tone.new(-40, -40, 0, 0), 1)
  100. elsif @shb_hour > 6 && @shb_hour < 16 # 7 a.m. - 4 p.m.
  101. $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 1)
  102. elsif @shb_hour > 15 && @shb_hour < 19 # 4 - 7 p.m.
  103. $game_screen.start_tone_change(Tone.new(30, 10, 0, 0), 1)
  104. end
  105. shbyct_update
  106. @yctime_window.update
  107. if Input.trigger?(Input::L) && $scene.is_a?(Scene_Map)
  108. @yctime_window.visible = false
  109. elsif Input.trigger?(Input::R) && $scene.is_a?(Scene_Map)
  110. @yctime_window.visible = true
  111. end
  112. end
  113. end
  114. class Scene_Menu
  115. alias_method :shbyct_main, :main
  116. def main
  117. # Make play time window
  118. @yctime_window = Window_YourCurrentTime.new
  119. @yctime_window.x = 0
  120. @yctime_window.y = 224
  121. @yctime_window.z = 120
  122. shbyct_main
  123. Graphics.freeze
  124. @yctime_window.dispose
  125. end
  126. alias_method :shbyct_update, :update
  127. def update
  128. shbyct_update
  129. @yctime_window.update
  130. end
  131. end
CruelMaster
CruelMaster
Admin
Admin

จำนวนข้อความ : 144
เฟรน โกล์ : 397444
ชื่อเสียง : 2
Join date : 16/03/2010
: 26
ที่อยู่ : 159/7 ถนน ประชาอุทิศ ตำบล ท่าตะเภา อำเภอเมือง จังหวัดชุมพร

เหรียญ
เหรียญมาร เหรียญมาร: 1

https://cruelonsky.thai-forum.net

ขึ้นไปข้างบน Go down

ขึ้นไปข้างบน

- Similar topics

 
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ