line-em-up 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 355d80eddd51bba34630ada558a16331979bb1ce
4
- data.tar.gz: e8005d22fdf8599ddc3c36525c1bad61a9995387
3
+ metadata.gz: 36230f97fa8a9410ec6aaa037ccf96927225a228
4
+ data.tar.gz: 848b5b2c38e62b4adf4abbcc5b94d6c14f444c74
5
5
  SHA512:
6
- metadata.gz: 68ddd19bc70a4665892dae349b58bdf101c2698440662214ac8fc57144725861ce97cdc7d420e7d27b71099a3a8d08284392d48a36f29819ac9a6dccff57c9e1
7
- data.tar.gz: 4514d5bfff105922305f2460571f7d64152020c5af47077a9a09136efceb4c90be79f6507781eae6c6efc355584ddc491031164d1d40a4ba35b1f16c7053bad2
6
+ metadata.gz: 3a32a7c25a62c46a5c58729012ed8c8bd80ce440e1c2322e56363da3eb7c4e9df17a27ee8a5970b8541f2e022927ba8fdb97b91556e8dca45f1071a544d1c321
7
+ data.tar.gz: e1a811212aa923a2a878cc91b4e2870d09e7665983fcae74cfbd83ed5c70df7398820ff058bee8d16de3ada9fb79abc66ec4ebbe2c514dfd9908e9bf9082b6b6
data/bin/line-em-up.sh CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  SCRIPT_DIRECTORY = File.expand_path('../../', __FILE__)
3
+ CONFIG_FILE = File.expand_path('../../', __FILE__) + '/config.txt'
3
4
  require "#{SCRIPT_DIRECTORY}/menu_launcher.rb"
4
- Main.new.show
5
+ Main.new(CONFIG_FILE).show
@@ -79,6 +79,7 @@ class GameWindow < Gosu::Window
79
79
  @config_path = self.class::CONFIG_FILE
80
80
  @window = self
81
81
  @open_gl_executer = ExecuteOpenGl.new
82
+ # GET difficulty from config file.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
82
83
  @difficulty = options[:difficulty]
83
84
  @block_all_controls = !options[:block_controls_until_button_up].nil? && options[:block_controls_until_button_up] == true ? true : false
84
85
  @debug = options[:debug]
@@ -35,6 +35,7 @@ module ConfigSetting
35
35
  end
36
36
 
37
37
  def self.get_setting file_location, setting_name, default_value = nil
38
+ raise "NO FILE LOCATION PATH" if file_location.nil?
38
39
  create_file_if_non_existent(file_location)
39
40
  test = File.readlines(file_location).select { |line| line =~ /^#{setting_name}: ([^;]*);$/ }
40
41
  if test && test.first
@@ -53,6 +54,7 @@ module ConfigSetting
53
54
  end
54
55
 
55
56
  def self.set_mapped_setting file_location, setting_names, setting_value
57
+ raise "NO FILE LOCATION PATH" if file_location.nil?
56
58
  puts "set_mapped_setting".upcase
57
59
  puts setting_names
58
60
  puts setting_value
@@ -149,6 +151,7 @@ module ConfigSetting
149
151
  end
150
152
 
151
153
  def self.get_mapped_setting file_location, setting_names = [], default_value = nil
154
+ raise "NO FILE LOCATION PATH" if file_location.nil?
152
155
  create_file_if_non_existent(file_location)
153
156
  setting_name = setting_names.shift
154
157
  text = (File.readlines(file_location).select { |line| line =~ /^#{setting_name}: ([^;]*);$/ }).first
@@ -168,7 +171,11 @@ module ConfigSetting
168
171
  indexer = indexer.to_s if indexer
169
172
  end
170
173
  puts "FOUND DATA: #{data}"
171
- return data
174
+ if data
175
+ return data
176
+ else
177
+ return default_value
178
+ end
172
179
  else
173
180
  return default_value
174
181
  end
@@ -127,7 +127,32 @@ class ShipLoadoutSetting < Setting
127
127
  key = "matrix_#{x}_#{y}"
128
128
  click_area = LUIT::ClickArea.new(@window, key, current_x, current_y, @cell_width, @cell_height)
129
129
  # click_area = LUIT::Button.new(@window, click_key, current_x, current_y, '', @cell_width, @cell_height)
130
- klass_name = ConfigSetting.get_mapped_setting(@config_file_path, ['Inventory', x.to_s, y.to_s])
130
+ # Kludge here to populate inventory on first load, without committing the config file.
131
+ # puts "X AND Y START : #{x} - #{y}"
132
+ # if y == 0
133
+ # klass_name = ConfigSetting.get_mapped_setting(@config_file_path, ['Inventory', x.to_s, y.to_s], 'DumbMissileLauncher')
134
+ # if klass_name == 'DumbMissileLauncher'
135
+ # puts "SETTING X AND Y: #{x} - #{y} - with DumbMissileLauncher"
136
+ # ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', x.to_s, y.to_s], 'DumbMissileLauncher')
137
+ # end
138
+ # elsif y == 1
139
+ # klass_name = ConfigSetting.get_mapped_setting(@config_file_path, ['Inventory', x.to_s, y.to_s], 'LaserLauncher')
140
+ # puts "Y HERE was 1: AND GOT ORIGINAL KLASS HERE #{klass_name}"
141
+ # if klass_name == 'LaserLauncher'
142
+ # puts "SETTING X AND Y: #{x} - #{y} - with LaserLauncher"
143
+ # ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', x.to_s, y.to_s], 'LaserLauncher')
144
+ # end
145
+ # elsif y == 2
146
+ # klass_name = ConfigSetting.get_mapped_setting(@config_file_path, ['Inventory', x.to_s, y.to_s], 'BulletLauncher')
147
+ # if klass_name == 'BulletLauncher'
148
+ # puts "SETTING X AND Y: #{x} - #{y} - with BulletLauncher"
149
+ # ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', x.to_s, y.to_s], 'BulletLauncher')
150
+ # end
151
+ # else
152
+ klass_name = ConfigSetting.get_mapped_setting(@config_file_path, ['Inventory', x.to_s, y.to_s])
153
+ # end
154
+ puts "X and Y WAS : #{x} - #{y}"
155
+ puts "CLASS WAS: #{klass_name}"
131
156
  item = nil
132
157
  if klass_name
133
158
  klass = eval(klass_name)
@@ -37,6 +37,7 @@ class LoadoutWindow < Gosu::Window
37
37
  attr_accessor :width, :height, :block_all_controls, :game_window
38
38
  # attr_accessor :mouse_x, :mouse_y
39
39
  def initialize width = nil, height = nil, fullscreen = false, options = {}
40
+ @block_all_controls = !options[:block_controls_until_button_up].nil? && options[:block_controls_until_button_up] == true ? true : false
40
41
  puts "INCOMING WIDHT AND HEIGHT: #{width} and #{height}"
41
42
  @config_file_path = self.class::CONFIG_FILE
42
43
  @cursor_object = nil
@@ -194,6 +195,10 @@ class LoadoutWindow < Gosu::Window
194
195
  end
195
196
  end
196
197
 
198
+ def button_up id
199
+ @block_all_controls = false
200
+ end
201
+
197
202
  def increase_center_font_ui_y amount
198
203
  @center_ui_y += amount
199
204
  end
@@ -215,6 +220,7 @@ class LoadoutWindow < Gosu::Window
215
220
  {
216
221
  # back: lambda { |window, id| window.close; Main.new.show }
217
222
  back: lambda { |window, id|
223
+ puts "RIGHT HERE IS THE ISSUE!!!!!!!!!!!!!!!!"
218
224
  # puts "SElocal_windowLF? #{local_window.class.name}"
219
225
  # can't get it to bring the game window back
220
226
  # self.close
@@ -225,9 +231,9 @@ class LoadoutWindow < Gosu::Window
225
231
  # puts "!!!!!!GAME wINDOW: #{window.game_window}"
226
232
  if window.game_window
227
233
  # window.game_window.show
228
- GameWindow.new.show
234
+ GameWindow.new(nil, nil, nil, {block_controls_until_button_up: true}).show
229
235
  else
230
- Main.new.show
236
+ Main.new(@config_file_path, {block_controls_until_button_up: true}).show
231
237
  end
232
238
  }
233
239
  }
@@ -5,13 +5,18 @@ class Main < Gosu::Window
5
5
  require "#{CURRENT_DIRECTORY}/../game_window.rb"
6
6
  require "#{CURRENT_DIRECTORY}/../loadout_window.rb"
7
7
 
8
-
9
- def initialize config_path = nil
10
- config_path = CONFIG_FILE if config_path.nil?
8
+ # block_controls_until_button_up: true
9
+ attr_accessor :block_all_controls, :config_path
10
+ def initialize config_path = nil, options = {}
11
+ @block_all_controls = !options[:block_controls_until_button_up].nil? && options[:block_controls_until_button_up] == true ? true : false
12
+ puts "MAIN HERE: block? #{@block_all_controls}"
13
+ @config_file_path = config_path
14
+ @config_file_path = CONFIG_FILE if config_path.nil?
15
+ puts "MAIN CONFIG INITL: #{@config_file_path} - #{config_path} - #{CONFIG_FILE}"
11
16
 
12
17
 
13
18
  # @width, @height = ResolutionSetting::SELECTION[0].split('x').collect{|s| s.to_i}
14
- value = ConfigSetting.get_setting(config_path, 'resolution', ResolutionSetting::SELECTION[0])
19
+ value = ConfigSetting.get_setting(@config_file_path, 'resolution', ResolutionSetting::SELECTION[0])
15
20
  raise "DID NOT GET A RESOLUTION FROM CONFIG" if value.nil?
16
21
  width, height = value.split('x')
17
22
  @width, @height = [width.to_i, height.to_i]
@@ -58,10 +63,10 @@ class Main < Gosu::Window
58
63
 
59
64
  window_height = Gosu.screen_height
60
65
  @window = self
61
- @resolution_menu = ResolutionSetting.new(@window, window_height, @width, @height, get_center_font_ui_y, config_path)
66
+ @resolution_menu = ResolutionSetting.new(@window, window_height, @width, @height, get_center_font_ui_y, @config_file_path)
62
67
 
63
68
  @difficulty = nil
64
- @difficulty_menu = DifficultySetting.new(@window, window_height, @width, @height, get_center_font_ui_y, config_path)
69
+ @difficulty_menu = DifficultySetting.new(@window, window_height, @width, @height, get_center_font_ui_y, @config_file_path)
65
70
  @menu = Menu.new(self, @width / 2, get_center_font_ui_y, ZOrder::UI, @scale)
66
71
  # Just move everything else above the menu
67
72
  # increase_center_font_ui_y(@menu.current_height)
@@ -75,7 +80,11 @@ class Main < Gosu::Window
75
80
  LUIT::Button.new(@menu.local_window, button_key, @menu.x, @menu.y + @menu.current_height, "Start", 0, 1),
76
81
  0,
77
82
  0,
78
- lambda {|window, id| self.close; GameWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true, difficulty: @difficulty}) },
83
+ lambda {|window, id|
84
+ if !@block_all_controls
85
+ self.close; GameWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true, difficulty: @difficulty})
86
+ end
87
+ },
79
88
  # lambda {|window, id| self.close },
80
89
  nil,
81
90
  {is_button: true, key: button_key}
@@ -91,7 +100,11 @@ class Main < Gosu::Window
91
100
  LUIT::Button.new(@menu.local_window, button_key, @menu.x, @menu.y + @menu.current_height, "Loadout", 0, 1),
92
101
  0,
93
102
  0,
94
- lambda {|window, id| self.close; LoadoutWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true}) },
103
+ lambda {|window, id|
104
+ if !@block_all_controls
105
+ self.close; LoadoutWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true})
106
+ end
107
+ },
95
108
  nil,
96
109
  {is_button: true, key: button_key}
97
110
  )
@@ -99,21 +112,54 @@ class Main < Gosu::Window
99
112
  # debug_start_image = Gosu::Image.new("#{MEDIA_DIRECTORY}/debug_start.png")
100
113
  # @menu.add_item(debug_start_image, (@width / 2) - (debug_start_image.width / 2), get_center_font_ui_y, 1, lambda {self.close; GameWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true, debug: true, difficulty: @difficulty}) }, debug_start_image)
101
114
 
102
- button_key = :debug_start
115
+ # button_key = :debug_start
116
+ # @menu.add_item(
117
+ # LUIT::Button.new(@menu.local_window, button_key, @menu.x, @menu.y + @menu.current_height, "Debug Start", 0, 1),
118
+ # 0,
119
+ # 0,
120
+ # lambda {|window, id|
121
+ # if !@block_all_controls
122
+ # self.close; GameWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true, debug: true, difficulty: @difficulty})
123
+ # end
124
+ # },
125
+ # nil,
126
+ # {is_button: true, key: button_key}
127
+ # )
128
+ button_key = :debug_start # too lazy to rename
103
129
  @menu.add_item(
104
- LUIT::Button.new(@menu.local_window, button_key, @menu.x, @menu.y + @menu.current_height, "Debug Start", 0, 1),
130
+ LUIT::Button.new(@menu.local_window, button_key, @menu.x, @menu.y + @menu.current_height, "Populate Inventory", 0, 1),
105
131
  0,
106
132
  0,
107
- lambda {|window, id| self.close; GameWindow.start(@game_window_width, @game_window_height, dynamic_get_resolution_fs, {block_controls_until_button_up: true, debug: true, difficulty: @difficulty}) },
133
+ lambda {|window, id|
134
+ if !@block_all_controls
135
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '0'.to_s, '0'.to_s], 'DumbMissileLauncher')
136
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '1'.to_s, '0'.to_s], 'DumbMissileLauncher')
137
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '2'.to_s, '0'.to_s], 'DumbMissileLauncher')
138
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '0'.to_s, '1'.to_s], 'LaserLauncher')
139
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '1'.to_s, '1'.to_s], 'LaserLauncher')
140
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '2'.to_s, '1'.to_s], 'LaserLauncher')
141
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '0'.to_s, '2'.to_s], 'BulletLauncher')
142
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '1'.to_s, '2'.to_s], 'BulletLauncher')
143
+ ConfigSetting.set_mapped_setting(@config_file_path, ['Inventory', '2'.to_s, '2'.to_s], 'BulletLauncher')
144
+ end
145
+ },
108
146
  nil,
109
147
  {is_button: true, key: button_key}
110
148
  )
149
+
111
150
  button_key = :exit
112
151
  @menu.add_item(
113
152
  LUIT::Button.new(@menu.local_window, button_key, @menu.x, @menu.y + @menu.current_height, "Exit", 0, 1),
114
153
  0,
115
154
  0,
116
- lambda {|window, id| self.close },
155
+ lambda {|window, id|
156
+ puts "WINDOW: #{window.class}"
157
+ puts "SELF blcok?: #{self.block_all_controls}"
158
+ puts "EXIT BUTTON: @block_all_controls: #{@block_all_controls}"
159
+ if !@block_all_controls
160
+ self.close
161
+ end
162
+ },
117
163
  nil,
118
164
  {is_button: true, key: button_key}
119
165
  )
@@ -161,6 +207,10 @@ class Main < Gosu::Window
161
207
  end
162
208
  end
163
209
 
210
+ def button_up id
211
+ @block_all_controls = false
212
+ end
213
+
164
214
  def increase_center_font_ui_y amount
165
215
  @center_ui_y += amount
166
216
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: line-em-up
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Dana