colstrom-ruby_armor 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +54 -0
- data/Gemfile +3 -0
- data/README.md +57 -0
- data/Rakefile +15 -0
- data/bin/ruby_armor +7 -0
- data/bin/ruby_armor.rbw +7 -0
- data/config/default_config.yml +5 -0
- data/config/gui/schema.yml +73 -0
- data/lib/ruby_armor.rb +42 -0
- data/lib/ruby_armor/base_user_data.rb +38 -0
- data/lib/ruby_armor/dungeon_view.rb +234 -0
- data/lib/ruby_armor/floating_text.rb +22 -0
- data/lib/ruby_armor/ruby_warrior_ext/abilities/rest.rb +13 -0
- data/lib/ruby_armor/ruby_warrior_ext/player_generator.rb +17 -0
- data/lib/ruby_armor/ruby_warrior_ext/position.rb +5 -0
- data/lib/ruby_armor/ruby_warrior_ext/ui.rb +44 -0
- data/lib/ruby_armor/ruby_warrior_ext/units/base.rb +12 -0
- data/lib/ruby_armor/sprite_sheet.rb +25 -0
- data/lib/ruby_armor/states/choose_profile.rb +61 -0
- data/lib/ruby_armor/states/create_profile.rb +79 -0
- data/lib/ruby_armor/states/play.rb +606 -0
- data/lib/ruby_armor/states/review_code.rb +75 -0
- data/lib/ruby_armor/version.rb +3 -0
- data/lib/ruby_armor/warrior_config.rb +35 -0
- data/lib/ruby_armor/window.rb +12 -0
- data/media/fonts/Licence.txt +7 -0
- data/media/fonts/ProggyCleanSZ.ttf +0 -0
- data/media/images/mobs.png +0 -0
- data/media/images/tiles.png +0 -0
- data/media/images/warriors.png +0 -0
- data/rake/gemspec.rake +48 -0
- data/rake/releasy.rake +43 -0
- data/ruby_armor.gemspec +28 -0
- metadata +172 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
module RubyArmor
|
2
|
+
class ReviewCode < Fidgit::DialogState
|
3
|
+
LEVELS = (1..9).to_a + [:EPIC]
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def path_for_level(profile, level)
|
7
|
+
File.join(profile.player_path, "ruby_armor/player_#{level.is_a?(Symbol) ? level : level.to_s.rjust(3, '0')}.rb")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Check if there are levels saved that can be recalled.
|
11
|
+
def saved_levels?(profile)
|
12
|
+
LEVELS.any? {|level| File.exists? path_for_level(profile, level) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(profile)
|
17
|
+
super(shadow_full: true)
|
18
|
+
|
19
|
+
on_input :escape, :hide
|
20
|
+
|
21
|
+
@profile = profile
|
22
|
+
|
23
|
+
vertical spacing: 10, align: :center, border_thickness: 4, background_color: Color::BLACK do
|
24
|
+
label "Reviewing code that completed levels in #{profile.tower.name} tower", font_height: 20
|
25
|
+
|
26
|
+
@tab_group = group do
|
27
|
+
@tab_buttons = horizontal padding: 0, spacing: 4 do
|
28
|
+
LEVELS.each do |level|
|
29
|
+
if File.exists?(path_for_level(level))
|
30
|
+
radio_button level.to_s, level, border_thickness: 0,
|
31
|
+
tip: "View code used to complete level #{level}"
|
32
|
+
else
|
33
|
+
button level.to_s, border_thickness: 0, enabled: false,
|
34
|
+
tip: "No code saved for level #{level}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
horizontal padding_left: 50, padding: 0 do
|
39
|
+
button "copy", tip: "Copy displayed code to clipboard", font_height: 12, border_thickness: 0, padding: 4 do
|
40
|
+
Clipboard.copy @code.stripped_text
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
subscribe :changed do |_, value|
|
46
|
+
buttons = @tab_buttons.each.grep Fidgit::RadioButton
|
47
|
+
current = buttons.find {|b| b.value == value }
|
48
|
+
buttons.each {|b| b.enabled = (b != current) }
|
49
|
+
current.color, current.background_color = current.background_color, current.color
|
50
|
+
|
51
|
+
@code.text = File.read path_for_level(value)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Contents of those tabs.
|
56
|
+
vertical padding: 0 do
|
57
|
+
scroll_window width: 700, height: 430 do
|
58
|
+
@code = text_area width: 680
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
button "Close", shortcut: :auto, shortcut_color: Play::SHORTCUT_COLOR, align_h: :center, border_thickness: 0 do
|
63
|
+
hide
|
64
|
+
end
|
65
|
+
|
66
|
+
# Pick the last level we have completed (and saved the code).
|
67
|
+
@tab_group.value = LEVELS.to_a.reverse.find {|level| File.exists? path_for_level(level) }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def path_for_level(level)
|
72
|
+
self.class.path_for_level @profile, level
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
require_relative "base_user_data"
|
4
|
+
|
5
|
+
module RubyArmor
|
6
|
+
class WarriorConfig < BaseUserData
|
7
|
+
DEFAULT_CONFIG = File.expand_path "../../../config/default_config.yml", __FILE__
|
8
|
+
OLD_CONFIG_FILE = "ruby_armour.yml"
|
9
|
+
CONFIG_FILE = "ruby_armor/config.yml"
|
10
|
+
|
11
|
+
def initialize(profile)
|
12
|
+
# Originally, config file was just in the folder. Move into its own folder, so we can put more in there.
|
13
|
+
old_config_file = File.join(profile.player_path, OLD_CONFIG_FILE)
|
14
|
+
config_file = File.join(profile.player_path, CONFIG_FILE)
|
15
|
+
if File.exists? old_config_file
|
16
|
+
FileUtils.mkdir_p File.dirname(config_file)
|
17
|
+
FileUtils.mv old_config_file, config_file
|
18
|
+
end
|
19
|
+
|
20
|
+
super config_file, DEFAULT_CONFIG
|
21
|
+
end
|
22
|
+
|
23
|
+
def turn_delay; data[:turn_delay]; end
|
24
|
+
def turn_delay=(delay)
|
25
|
+
data[:turn_delay] = delay
|
26
|
+
save
|
27
|
+
end
|
28
|
+
|
29
|
+
def warrior_class; data[:warrior_class]; end
|
30
|
+
def warrior_class=(warrior_class)
|
31
|
+
data[:warrior_class] = warrior_class
|
32
|
+
save
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module RubyArmor
|
2
|
+
class Window < Chingu::Window
|
3
|
+
def initialize
|
4
|
+
super 800, 600, false
|
5
|
+
|
6
|
+
Gosu::enable_undocumented_retrofication
|
7
|
+
|
8
|
+
self.caption = "RubyArmor v#{RubyArmor::VERSION} (for RubyWarrior)"
|
9
|
+
push_game_state ChooseProfile
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2004, 2005 Tristan Grimmer
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/rake/gemspec.rake
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
task :gemspec do
|
4
|
+
generate_gemspec
|
5
|
+
end
|
6
|
+
|
7
|
+
file "gale.gemspec" do
|
8
|
+
generate_gemspec
|
9
|
+
end
|
10
|
+
|
11
|
+
def generate_gemspec
|
12
|
+
puts "Generating gemspec"
|
13
|
+
|
14
|
+
require_relative "../lib/ruby_armor/version"
|
15
|
+
|
16
|
+
spec = Gem::Specification.new do |s|
|
17
|
+
s.name = "ruby_armor"
|
18
|
+
s.version = RubyArmor::VERSION
|
19
|
+
|
20
|
+
s.platform = Gem::Platform::RUBY
|
21
|
+
s.authors = ["Bil Bas (Spooner)"]
|
22
|
+
s.email = ["bil.bagpuss@gmail.com"]
|
23
|
+
s.homepage = "http://spooner.github.com/libraries/ruby_armor/"
|
24
|
+
s.summary = %q{GUI interface for RubyWarrior}
|
25
|
+
|
26
|
+
# TODO: Add the DLL when permission is granted.
|
27
|
+
s.files = DISTRO_FILES
|
28
|
+
s.licenses = ["MIT"]
|
29
|
+
s.rubyforge_project = s.name
|
30
|
+
|
31
|
+
s.executable = s.name
|
32
|
+
|
33
|
+
s.required_ruby_version = "~> 1.9.2" # Mainly because of fidgit.
|
34
|
+
|
35
|
+
s.test_files = Dir["test/**/*_spec.rb"]
|
36
|
+
|
37
|
+
s.add_runtime_dependency "rubywarrior", "~> 0.1.2"
|
38
|
+
s.add_runtime_dependency "gosu", "~> 0.7.41"
|
39
|
+
s.add_runtime_dependency "chingu", "~> 0.9rc7"
|
40
|
+
s.add_runtime_dependency "fidgit", "~> 0.2.4"
|
41
|
+
|
42
|
+
s.add_development_dependency "releasy", "~> 0.2.2"
|
43
|
+
end
|
44
|
+
|
45
|
+
File.open("#{spec.name}.gemspec", "w") do |file|
|
46
|
+
file.puts spec.to_ruby
|
47
|
+
end
|
48
|
+
end
|
data/rake/releasy.rake
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'releasy'
|
2
|
+
|
3
|
+
require_relative "../lib/ruby_armor/version"
|
4
|
+
|
5
|
+
Releasy::Project.new do
|
6
|
+
name "Ruby Armor"
|
7
|
+
version RubyArmor::VERSION
|
8
|
+
|
9
|
+
files DISTRO_FILES
|
10
|
+
|
11
|
+
exposed_files %w[README.md]
|
12
|
+
add_link "http://spooner.github.com/games/ruby_armor", "RubyArmor website"
|
13
|
+
exclude_encoding
|
14
|
+
|
15
|
+
add_build :osx_app do
|
16
|
+
wrapper "../releasy/wrappers/gosu-mac-wrapper-0.7.41.tar.gz"
|
17
|
+
url "com.github.spooner.games.ruby_armor"
|
18
|
+
#icon "media/icon.icns"
|
19
|
+
add_package :tar_gz
|
20
|
+
end
|
21
|
+
|
22
|
+
add_build :source do
|
23
|
+
add_package :zip
|
24
|
+
end
|
25
|
+
|
26
|
+
add_build :windows_folder do
|
27
|
+
#icon "media/icon.ico"
|
28
|
+
add_package :exe
|
29
|
+
executable_type :windows
|
30
|
+
end
|
31
|
+
|
32
|
+
add_build :windows_installer do
|
33
|
+
#icon "media/icon.ico"
|
34
|
+
start_menu_group "Spooner Games"
|
35
|
+
readme "README.html"
|
36
|
+
add_package :zip
|
37
|
+
executable_type :windows
|
38
|
+
end
|
39
|
+
|
40
|
+
add_deploy :local do
|
41
|
+
path "C:/users/spooner/dropbox/Public/games/ruby_armor"
|
42
|
+
end
|
43
|
+
end
|
data/ruby_armor.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'colstrom-ruby_armor'
|
5
|
+
s.version = '0.0.6'
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ['Bil Bas (Spooner)']
|
9
|
+
s.date = '2012-02-27'
|
10
|
+
s.email = ['bil.bagpuss@gmail.com']
|
11
|
+
s.executables = ['ruby_armor']
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.homepage = 'http://spooner.github.com/libraries/ruby_armor/'
|
16
|
+
s.licenses = ['MIT']
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
s.required_ruby_version = Gem::Requirement.new('>= 1.9.2')
|
19
|
+
s.rubyforge_project = 'ruby_armor'
|
20
|
+
s.rubygems_version = '1.8.16'
|
21
|
+
s.summary = "colstrom's fork of Spooner/ruby_armor"
|
22
|
+
|
23
|
+
s.add_runtime_dependency('rubywarrior', ['~> 0.1', '>= 0.1.2'])
|
24
|
+
s.add_runtime_dependency('gosu', ['~> 0.10', '>= 0.7.41'])
|
25
|
+
s.add_runtime_dependency('chingu', ['~> 0.9rc9'])
|
26
|
+
s.add_runtime_dependency('colstrom-fidgit', ['~> 0.2', '>= 0.2.7'])
|
27
|
+
s.add_development_dependency('releasy', ['~> 0.2', '>= 0.2.2'])
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: colstrom-ruby_armor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bil Bas (Spooner)
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2012-02-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubywarrior
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.1.2
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.1.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: gosu
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.10'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.7.41
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.10'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.7.41
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: chingu
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.9rc9
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.9rc9
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: colstrom-fidgit
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0.2'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.2.7
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0.2'
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.2.7
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: releasy
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0.2'
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.2
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.2'
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 0.2.2
|
107
|
+
description:
|
108
|
+
email:
|
109
|
+
- bil.bagpuss@gmail.com
|
110
|
+
executables:
|
111
|
+
- ruby_armor
|
112
|
+
extensions: []
|
113
|
+
extra_rdoc_files: []
|
114
|
+
files:
|
115
|
+
- ".gitignore"
|
116
|
+
- Gemfile
|
117
|
+
- README.md
|
118
|
+
- Rakefile
|
119
|
+
- bin/ruby_armor
|
120
|
+
- bin/ruby_armor.rbw
|
121
|
+
- config/default_config.yml
|
122
|
+
- config/gui/schema.yml
|
123
|
+
- lib/ruby_armor.rb
|
124
|
+
- lib/ruby_armor/base_user_data.rb
|
125
|
+
- lib/ruby_armor/dungeon_view.rb
|
126
|
+
- lib/ruby_armor/floating_text.rb
|
127
|
+
- lib/ruby_armor/ruby_warrior_ext/abilities/rest.rb
|
128
|
+
- lib/ruby_armor/ruby_warrior_ext/player_generator.rb
|
129
|
+
- lib/ruby_armor/ruby_warrior_ext/position.rb
|
130
|
+
- lib/ruby_armor/ruby_warrior_ext/ui.rb
|
131
|
+
- lib/ruby_armor/ruby_warrior_ext/units/base.rb
|
132
|
+
- lib/ruby_armor/sprite_sheet.rb
|
133
|
+
- lib/ruby_armor/states/choose_profile.rb
|
134
|
+
- lib/ruby_armor/states/create_profile.rb
|
135
|
+
- lib/ruby_armor/states/play.rb
|
136
|
+
- lib/ruby_armor/states/review_code.rb
|
137
|
+
- lib/ruby_armor/version.rb
|
138
|
+
- lib/ruby_armor/warrior_config.rb
|
139
|
+
- lib/ruby_armor/window.rb
|
140
|
+
- media/fonts/Licence.txt
|
141
|
+
- media/fonts/ProggyCleanSZ.ttf
|
142
|
+
- media/images/mobs.png
|
143
|
+
- media/images/tiles.png
|
144
|
+
- media/images/warriors.png
|
145
|
+
- rake/gemspec.rake
|
146
|
+
- rake/releasy.rake
|
147
|
+
- ruby_armor.gemspec
|
148
|
+
homepage: http://spooner.github.com/libraries/ruby_armor/
|
149
|
+
licenses:
|
150
|
+
- MIT
|
151
|
+
metadata: {}
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 1.9.2
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">"
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 1.3.1
|
166
|
+
requirements: []
|
167
|
+
rubyforge_project: ruby_armor
|
168
|
+
rubygems_version: 2.6.7
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
171
|
+
summary: colstrom's fork of Spooner/ruby_armor
|
172
|
+
test_files: []
|