Module: Lich::Common
- Defined in:
- lib/games.rb,
lib/common/hmr.rb,
lib/common/log.rb,
lib/common/vars.rb,
lib/common/spell.rb,
lib/common/buffer.rb,
lib/common/script.rb,
lib/common/account.rb,
lib/common/eaccess.rb,
lib/common/gameobj.rb,
lib/attributes/char.rb,
lib/common/db_store.rb,
lib/common/settings.rb,
lib/common/uservars.rb,
lib/common/watchfor.rb,
lib/common/front-end.rb,
lib/common/gui-login.rb,
lib/common/xmlparser.rb,
lib/common/map/map_dr.rb,
lib/common/map/map_gs.rb,
lib/common/game-loader.rb,
lib/common/limitedarray.rb,
lib/common/sharedbuffer.rb,
lib/common/upstreamhook.rb,
lib/common/downstreamhook.rb,
lib/common/class_exts/stringproc.rb,
lib/common/settings/charsettings.rb,
lib/common/settings/gamesettings.rb,
lib/common/settings/path_navigator.rb,
lib/common/settings/settings_proxy.rb,
lib/common/settings/database_adapter.rb,
lib/common/class_exts/synchronizedsocket.rb
Defined Under Namespace
Modules: Account, Buffer, CharSettings, DB_Store, EAccess, Frontend, GameLoader, GameSettings, HMR, Log, Settings, UserVars, Vars Classes: Char, DatabaseAdapter, DownstreamHook, ExecScript, GameObj, LimitedArray, Map, PathNavigator, Room, RoomObj, Script, Scripting, SettingsProxy, SharedBuffer, Spell, StringProc, SynchronizedSocket, UpstreamHook, Watchfor, WizardScript, XMLParser
Constant Summary collapse
- TRUSTED_SCRIPT_BINDING =
proc { _script }
Instance Method Summary collapse
-
#_script ⇒ Binding
Returns a binding for a new script.
-
#gui_login ⇒ void
Handles the GUI login process, including loading entry data, setting up the main window, and managing user interactions.
Instance Method Details
#_script ⇒ Binding
Returns a binding for a new script.
32 33 34 |
# File 'lib/common/script.rb', line 32 def _script Proc.new {}.binding end |
#gui_login ⇒ void
This method returns an undefined value.
Handles the GUI login process, including loading entry data, setting up the main window, and managing user interactions.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/common/gui-login.rb', line 12 def gui_login @autosort_state = Lich.track_autosort_state @tab_layout_state = Lich.track_layout_state @theme_state = Lich.track_dark_mode @launch_data = nil if File.exist?(File.join(DATA_DIR, "entry.dat")) @entry_data = File.open(File.join(DATA_DIR, "entry.dat"), 'r') { |file| begin if @autosort_state == true # Sort in list by instance name, account name, and then character name Marshal.load(file.read.unpack('m').first).sort do |a, b| [a[:game_name], a[:user_id], a[:char_name]] <=> [b[:game_name], b[:user_id], b[:char_name]] end else # Sort in list by account name, and then character name (old Lich 4) Marshal.load(file.read.unpack('m').first).sort do |a, b| [a[:user_id].downcase, a[:char_name]] <=> [b[:user_id].downcase, b[:char_name]] end end rescue Array.new end } else @entry_data = Array.new end @save_entry_data = false Gtk.queue { @window = nil install_tab_loaded = false @msgbox = proc { |msg| dialog = Gtk::MessageDialog.new(:parent => @window, :flags => Gtk::DialogFlags::DESTROY_WITH_PARENT, :type => Gtk::MessageType::ERROR, :buttons => Gtk::ButtonsType::CLOSE, :message => msg) # dialog.set_icon(default_icon) dialog.run dialog.destroy } # the following files are split out to ease interface design # they have to be included in the method's Gtk queue block to # be used, so they have to be called at this specific point. require_relative 'gui-saved-login' require_relative 'gui-manual-login' # # put it together and show the window # lightgrey = Gdk::RGBA::parse("#d3d3d3") @notebook = Gtk::Notebook.new @notebook.override_background_color(:normal, lightgrey) unless @theme_state == true @notebook.append_page(@quick_game_entry_tab, Gtk::Label.new('Saved Entry')) @notebook.append_page(@game_entry_tab, Gtk::Label.new('Manual Entry')) @notebook.signal_connect('switch-page') { |_who, _page, page_num| if (page_num == 2) and not install_tab_loaded .clicked end } # grey = Gdk::RGBA::parse("#d3d3d3") @window = Gtk::Window.new @window.set_icon(@default_icon) @window.title = "Lich v#{LICH_VERSION}" @window.border_width = 5 @window.add(@notebook) @window.signal_connect('delete_event') { @window.destroy; @done = true } @window.default_width = 590 @window.default_height = 550 @window.show_all @custom_launch_entry.visible = false @custom_launch_dir.visible = false @bonded_pair_char.visible = false @bonded_pair_inst.visible = false @slider_box.visible = false @notebook.set_page(1) if @entry_data.empty? } wait_until { @done } if @save_entry_data File.open(File.join(DATA_DIR, "entry.dat"), 'w') { |file| file.write([Marshal.dump(@entry_data)].pack('m')) } end @entry_data = nil unless !@launch_data.nil? Gtk.queue { Gtk.main_quit } Lich.log "info: exited without selection" exit end end |