Class: GamesAndRpgParadise::Sarlem::GraphDrawer

Inherits:
Base
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/sarlem/graph_drawer/graph_drawer.rb

Overview

GamesAndRpgParadise::Sarlem::GraphDrawer

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect

Constants included from Base::Extensions::Colours

Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Constants included from CommonExtensions

CommonExtensions::CONTROL_C_CODE, CommonExtensions::N

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::Extensions::Colours

ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow

Methods included from Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ GraphDrawer

#

initialize

#


29
30
31
32
33
34
35
36
37
38
# File 'lib/games_and_rpg_paradise/sarlem/graph_drawer/graph_drawer.rb', line 29

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

RpgParadise::Sarlem::GraphDrawer[]

#


147
148
149
# File 'lib/games_and_rpg_paradise/sarlem/graph_drawer/graph_drawer.rb', line 147

def self.[](i = '')
  new(i)
end

Instance Method Details

#resetObject

#

reset (reset tag)

#


43
44
45
46
47
48
49
50
51
52
53
# File 'lib/games_and_rpg_paradise/sarlem/graph_drawer/graph_drawer.rb', line 43

def reset
  super()
  # ======================================================================= #
  # === @g
  # ======================================================================= #
  @g = Gruff::Pie.new(720)
  #@g = Gruff::Line.new(600)
  @g.title = 'Bevölkerung im Westreich - Ende 107, nach Gwandreilamur'
  @g.title_font_size = 22
  @g.minimum_value = 0
end

#runObject

#

run (run tag)

#


138
139
140
141
142
# File 'lib/games_and_rpg_paradise/sarlem/graph_drawer/graph_drawer.rb', line 138

def run
  select_theme
  which_mode(:westreich)
  write_image
end

#select_theme(theme_select = 0) ⇒ Object

#

select_theme

Lists some possible themes (theme tag)

#


60
61
62
63
64
65
66
67
68
# File 'lib/games_and_rpg_paradise/sarlem/graph_drawer/graph_drawer.rb', line 60

def select_theme(theme_select = 0)
  case theme_select
  when 1 then @g.theme_37signals # ein bestimmtes theme setzen
  when 2 then @g.theme_rails_keynote # ein bestimmtes theme setzen
  when 3 then @g.theme_keynote # ein bestimmtes theme setzen
  when 4 then @g.theme_odeo
  else # default  
  end
end

#which_mode(this_mode = :default) ⇒ Object

#

which_mode

Select your mode here.

#


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/games_and_rpg_paradise/sarlem/graph_drawer/graph_drawer.rb', line 85

def which_mode(
    this_mode = :default
  )
  case this_mode
  # ======================================================================= #
  # === :westreich
  # ======================================================================= #
  when :towns, :westreich, # städte im westreich, population
       :default
    _ = RpgParadise.project_base_directory?+
        'sarlem/yaml/the_western_realm/westreich.yml'
    hash = YAML.load_file(_)
    hash.each_pair { |key, value|
      e " > The key was: #{key.capitalize}, its value was: #{value}"
      @g.data(key.capitalize, [value])
    }
  # ======================================================================= #
  # === :handel
  # ======================================================================= #
  when :handel, :gilden
    # ===================================================================== #
    #            Einfluss - Finanzkraft - Militär
    # ===================================================================== #
    # Shapiro      18           18           5
    # Heliodan     15           19           5
    # Agnathio     12           12           4
    # Breighenlu   11           14           3
    # Chi-Chiotai   7           14           4
    # Starbröck     6           11           2
    # Shiou         3            8           2
    # ===================================================================== #
    @g.data 'Shapiro',     [18]
    @g.data 'Heliodan ',   [19]
    @g.data 'Agnathio',    [12]
    @g.data 'Breighenlu',  [14]
    @g.data 'Chi-Chiotai', [14]
    @g.data 'Starbröck',   [11]
    #@g.data('Shiou', [3] )
    #@g.labels = { 
    #  0  => 'Shapiro',
    #  1  => 'Heliodan',
    #  2  => 'Agnathio',
    #  3  => 'Breighenlu',
    #  4  => 'Chi-Chiotai',
    #  5  => 'Starbröck',
    #  6  => 'Shiou'
    #}
  end
end

#write_image(where_to = '/Depot/Images/WESTREICH_BEVÖLKERUNG.png') ⇒ Object

#

write_image

#


73
74
75
76
77
78
# File 'lib/games_and_rpg_paradise/sarlem/graph_drawer/graph_drawer.rb', line 73

def write_image(
    where_to = '/Depot/Images/WESTREICH_BEVÖLKERUNG.png'
  )
  e 'Now writing into: '+sfile(where_to)
  @g.write(where_to)
end