module OMEGAS7
WINDOW_X = 5
WINDOW_Y = 5
FONT_SIZE = 16
SECONDS_VAR_ID = 7
MINUTES_VAR_ID = 6
HOURS_VAR_ID = 5
end
class Omegas_Clock < Window_Base
include OMEGAS7
def initialize
super(WINDOW_X,WINDOW_Y,180,50)
self.contents.font.size = FONT_SIZE
refresh
end
def refresh
self.contents.clear
@seconds = $game_variables[SECONDS_VAR_ID]
@minutes = $game_variables[MINUTES_VAR_ID]
@hours = $game_variables[HOURS_VAR_ID]
self.contents.draw_text(0,-10,150,35,@hours.to_s + " : " + @minutes.to_s + " Uhr " + "[" + @seconds.to_s + "] Tag" )
end
def update
if @seconds != $game_variables[SECONDS_VAR_ID]
refresh
end
if @minutes != $game_variables[MINUTES_VAR_ID]
refresh
end
if @hours != $game_variables[HOURS_VAR_ID]
refresh
end
end
end
class Scene_Map
alias omegas_start start
def start
omegas_start
@omegas_clock_window = Omegas_Clock.new
end
alias omegas_update update
def update
omegas_update
@omegas_clock_window.update
end
def omegas_window_dispose
@omegas_clock_window.dispose
end
alias omegas_terminate terminate
def terminate
omegas_terminate
omegas_window_dispose
end
end
module OMEGAS7
WINDOW_X = 5 # X-Koordinate des Fensters.
WINDOW_Y = 5 # Y-Koordinate des Fensters.
WIDTH = 180 # Breite des Fensters. Bei DAY_SHOW = true ~ 180 , Bei DAY_SHOW = false ~120
FONT_SIZE = 16 # Schriftgröße
SECONDS_VAR_ID = 1 # Variablen-ID für die Sekunden.
MINUTES_VAR_ID = 2 # Variablen-ID für die Minuten.
HOURS_VAR_ID = 3 # Variablen-ID für die Stunden.
DAY_VAR_ID = 4 # Variablen-ID für die Tage(Nummer des Tages).
VISIBLE_SWITCH_ID = 1 #Switch-ID, der die Sichtbarkeit des Fensters beeinflust. ~ ON = Sichtbar, OFF = Nicht Sichtbar.
DAY_SHOW = true # Soll die Tagesnummer angezeigt werden? true = ja / false = nein
TIME = "Uhr" # Anzeigetext für Uhr(Hinter der Uhrzeit).
end
class Omegas_Clock < Window_Base
include OMEGAS7
def initialize
super(WINDOW_X,WINDOW_Y, WIDTH,50)
self.contents.font.size = FONT_SIZE
refresh
end
def refresh
self.contents.clear
@seconds = $game_variables[SECONDS_VAR_ID]
@minutes = $game_variables[MINUTES_VAR_ID]
@hours = $game_variables[HOURS_VAR_ID]
if DAY_SHOW == true
@day = $game_variables[DAY_VAR_ID]
end
if DAY_SHOW == true
self.contents.draw_text(0,-10,150,35,@hours.to_s + " : " + @minutes.to_s + " : " + @seconds.to_s + " Uhr " + "[" + @day.to_s + "] Tag",1 )
else
self.contents.draw_text(0,-10,90,35,@hours.to_s + " : " + @minutes.to_s + " : " + @seconds.to_s + " " + TIME,1 )
end
end
def update
if $game_switches[VISIBLE_SWITCH_ID] == true
self.visible = true
else
self.visible = false
end
if @seconds != $game_variables[SECONDS_VAR_ID]
refresh
end
if @minutes != $game_variables[MINUTES_VAR_ID]
refresh
end
if @hours != $game_variables[HOURS_VAR_ID]
refresh
end
end
end
class Scene_Map
alias omegas_start start
def start
omegas_start
@omegas_clock_window = Omegas_Clock.new
end
alias omegas_update update
def update
omegas_update
@omegas_clock_window.update
end
def omegas_window_dispose
@omegas_clock_window.dispose
end
alias omegas_terminate terminate
def terminate
omegas_terminate
omegas_window_dispose
end
end
module OMEGAS7
WINDOW_X = 5 # X-Koordinate des Fensters.
WINDOW_Y = 5 # Y-Koordinate des Fensters.
WIDTH = 180 # Breite des Fensters. Bei DAY_SHOW = true ~ 180 , Bei DAY_SHOW = false ~120
FONT_SIZE = 16 # Schriftgröße
SECONDS_VAR_ID = 1 # Variablen-ID für die Sekunden.
MINUTES_VAR_ID = 2 # Variablen-ID für die Minuten.
HOURS_VAR_ID = 3 # Variablen-ID für die Stunden.
DAY_VAR_ID = 4 # Variablen-ID für die Tage(Nummer des Tages).
VISIBLE_SWITCH_ID = 1 #Switch-ID, der die Sichtbarkeit des Fensters beeinflust. ~ ON = Sichtbar, OFF = Nicht Sichtbar.
DAY_SHOW = true # Soll die Tagesnummer angezeigt werden? true = ja / false = nein
TIME = "Uhr" # Anzeigetext für Uhr(Hinter der Uhrzeit).
end
class Omegas_Clock < Window_Base
include OMEGAS7
def initialize
super(WINDOW_X,WINDOW_Y, WIDTH,50)
self.contents.font.size = FONT_SIZE
self.visible = false
refresh
end
def refresh
self.contents.clear
@seconds = $game_variables[SECONDS_VAR_ID]
@minutes = $game_variables[MINUTES_VAR_ID]
@hours = $game_variables[HOURS_VAR_ID]
if DAY_SHOW == true
@day = $game_variables[DAY_VAR_ID]
end
if DAY_SHOW == true
self.contents.draw_text(0,-10,150,35,@hours.to_s + " : " + @minutes.to_s + " : " + @seconds.to_s + " Uhr " + "[" + @day.to_s + "] Tag",1 )
else
self.contents.draw_text(0,-10,90,35,@hours.to_s + " : " + @minutes.to_s + " : " + @seconds.to_s + " " + TIME,1 )
end
end
def update
if $game_switches[VISIBLE_SWITCH_ID] == true
self.visible = true
else
self.visible = false
end
if @seconds != $game_variables[SECONDS_VAR_ID]
refresh
end
if @minutes != $game_variables[MINUTES_VAR_ID]
refresh
end
if @hours != $game_variables[HOURS_VAR_ID]
refresh
end
end
end
class Scene_Map
alias omegas_start start
def start
omegas_start
@omegas_clock_window = Omegas_Clock.new
end
alias omegas_update update
def update
omegas_update
@omegas_clock_window.update
end
def omegas_window_dispose
@omegas_clock_window.dispose
end
alias omegas_terminate terminate
def terminate
omegas_terminate
omegas_window_dispose
end
end
# Variable Clock Window Draw
# By Mithran
# Requested by Klex1992
# Draws a clock with 'hours' and 'minutes' based off two variables
# : symbol blinks on and off
# Set the options in the module
# The "X" button (keyboard A) toggles clock window position on screen in game
# The user is responsible for updating the variables used for the clock.
# Event Commands
# Event > Advanced > Script (type exactly how shown, without the leading #)
# hide_clock
# Hides the clock window.
# show_clock
# Shows the clock window.
module DrawClock
MINS_VAR_ID = 1
# Variable ID of minutes
HOURS_VAR_ID = 2
# Variable ID of hours
POSITION = 3
# Initial position
# 1 = upper left
# 2 = lower left
# 3 = upper right
# 4 = lower right
# if set to 0, the clock is not shown until the "X" button is pressed
# (keyboard A)
INITIAL_HIDE = true
# Clock hide value on startup. When set to true, the clock his hidden.
# If set to false, the clock is shown from the first map screen.
SHOW_WINDOW = true
# If set to false, no window will be drawn around the clock. If set to false
# the normal blue window will be shown.
end
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
alias start_clock start
def start
start_clock
@clock_window = Window_Clock.new($game_system.clock_draw_posx, $game_system.clock_draw_posy)
@clock_window.openness = 0 if $game_system.clock_draw_pos == 0
end
def clock_draw_posx
return DrawClock::POSITION
end
def clock_draw_posy
return DrawClock::POSITION
end
alias update_clock update
def update
if Input.trigger?(Input::Z)
@clock_window.shift_pos if @clock_window.visible
end
@clock_window.update
update_clock
end
alias terminate_clock terminate
def terminate
@clock_window.dispose
terminate_clock
end
end
class Window_Clock < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 12 * 5 + 32, WLH + 32 - 12)
self.windowskin = Cache.system("") unless DrawClock::SHOW_WINDOW
update
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_time
end
def update
super
self.visible = !$game_system.hide_clock
if self.openness == 0 && $game_system.clock_draw_pos > 0
self.x = $game_system.clock_draw_posx
self.y = $game_system.clock_draw_posy
self.open
end
update_clock if self.openness > 0
end
def shift_pos
last_pos = $game_system.clock_draw_pos
$game_system.clock_draw_pos += 1
if $game_system.clock_draw_pos > 4
$game_system.clock_draw_pos = 0
end
self.close if last_pos != $game_system.clock_draw_pos
update
end
def update_clock
last_mins = @mins
last_hrs = @hrs
@mins = $game_variables[DrawClock::MINS_VAR_ID]
@hrs = $game_variables[DrawClock::HOURS_VAR_ID]
@blink_counter ||= 0
@blink_counter += 1
@blink_counter %= 100
last_dots_on = @dots_on
if @blink_counter <= 50
@dots_on = true
else
@dots_on = false
end
if (last_dots_on != @dots_on) || (last_mins != @mins) || (last_hrs != @hrs)
refresh
end
end
def draw_time
mins = @mins
hrs = @hrs
sep = @dots_on ? ":" : " "
if mins < 10
mins = "0" + mins.to_s
else
mins = mins.to_s
end
if hrs < 10
hrs = "0" + hrs.to_s
else
hrs = hrs.to_s
end
self.contents.draw_text(0, 0 - 7, 24, WLH, hrs)
self.contents.draw_text(0 + 24, 0 - 7, 12, WLH, sep)
self.contents.draw_text(0 + 36, 0 - 7, 24, WLH, mins)
end
end
class Game_System
attr_accessor :clock_draw_pos
attr_accessor :hide_clock
def hide_clock
@hide_clock = DrawClock::INITIAL_HIDE if @hide_clock == nil
return @hide_clock
end
def clock_draw_pos
@clock_draw_pos ||= DrawClock::POSITION
return @clock_draw_pos
end
def clock_draw_posx
posx = 32
posy = 416 - 32 - 16 - 16
case clock_draw_pos
when 1
posy = 32
when 2
posx = 32
posy = 416 - 32 - 16 - 16
when 3
posx = 544 - 32 - (12 * 5) - 32
posy = 32
when 4
posx = 544 - 32 - (12 * 5) - 32
end
return posx
end
def clock_draw_posy
posx = 32
posy = 416 - 32 - 16 - 16
case clock_draw_pos
when 1
posy = 32
when 2
posx = 32
posy = 416 - 32 - 16 - 16
when 3
posx = 544 - 32 - (12 * 5) - 32
posy = 10
when 4
posx = 544 - 32 - (12 * 5) - 32
end
return posy
end
end
class Game_Interpreter
def hide_clock
$game_system.hide_clock = true
end
def show_clock
$game_system.hide_clock = false
end
end