… | |
… | |
144 | }); |
144 | }); |
145 | |
145 | |
146 | $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup"); |
146 | $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup"); |
147 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
147 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
148 | $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Host"); |
148 | $table->add (0, 2, new CFClient::UI::Label align => 1, text => "Host"); |
149 | $table->add (1, 2, my $host = new CFClient::UI::Entry text => $CFG->{host}); |
149 | $table->add (1, 2, my $host = new CFClient::UI::Entry text => $CFG->{host}, connect_changed => sub { |
150 | |
150 | my ($self, $value) = @_; |
|
|
151 | $CFG->{host} = $value; |
|
|
152 | }); |
|
|
153 | |
151 | $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Port"); |
154 | $table->add (0, 3, new CFClient::UI::Label align => 1, text => "Port"); |
152 | $table->add (1, 3, my $port = new CFClient::UI::Entry text => $CFG->{port}); |
155 | $table->add (1, 3, my $port = new CFClient::UI::Entry text => $CFG->{port}, connect_changed => sub { |
|
|
156 | my ($self, $value) = @_; |
|
|
157 | $CFG->{port} = $value; |
|
|
158 | }); |
153 | |
159 | |
154 | $table->add (0, 4, new CFClient::UI::Label align => 1, text => "Username"); |
160 | $table->add (0, 4, new CFClient::UI::Label align => 1, text => "Username"); |
155 | $table->add (1, 4, my $user = new CFClient::UI::Entry text => $CFG->{user}); |
161 | $table->add (1, 4, my $user = new CFClient::UI::Entry text => $CFG->{user}, connect_changed => sub { |
|
|
162 | my ($self, $value) = @_; |
|
|
163 | $CFG->{user} = $value; |
|
|
164 | }); |
156 | |
165 | |
157 | $table->add (0, 5, new CFClient::UI::Label align => 1, text => "Password"); |
166 | $table->add (0, 5, new CFClient::UI::Label align => 1, text => "Password"); |
158 | $table->add (1, 5, my $pass = new CFClient::UI::Entry text => $CFG->{password}, hidden => 1); |
167 | $table->add (1, 5, my $pass = new CFClient::UI::Entry text => $CFG->{password}, hidden => 1, connect_changed => sub { |
|
|
168 | my ($self, $value) = @_; |
|
|
169 | $CFG->{password} = $value; |
|
|
170 | }); |
159 | |
171 | |
|
|
172 | $table->add (0, 6, new CFClient::UI::Label align => 1, text => "Def. say cmd"); |
|
|
173 | $table->add (1, 6, my $saycmd = new CFClient::UI::Entry text => $CFG->{say_command}, connect_changed => sub { |
|
|
174 | my ($self, $value) = @_; |
|
|
175 | $CFG->{say_command} = $value; |
|
|
176 | }); |
|
|
177 | |
160 | $table->add (0, 6, new CFClient::UI::Label align => 1, text => "Map Size"); |
178 | $table->add (0, 7, new CFClient::UI::Label align => 1, text => "Map Size"); |
161 | $table->add (1, 6, new CFClient::UI::Slider |
179 | $table->add (1, 7, new CFClient::UI::Slider |
162 | req_w => 100, |
180 | req_w => 100, |
163 | range => [$CFG->{mapsize}, 10, 100 + 1, 1], |
181 | range => [$CFG->{mapsize}, 10, 100 + 1, 1], |
164 | connect_changed => sub { |
182 | connect_changed => sub { |
165 | my ($self, $value) = @_; |
183 | my ($self, $value) = @_; |
166 | |
184 | |
167 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
185 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
168 | }, |
186 | }, |
169 | ); |
187 | ); |
170 | |
188 | |
171 | $table->add (1, 7, new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub { |
189 | $table->add (1, 8, new CFClient::UI::Button expand => 1, align => 0, text => "Login", connect_activate => sub { |
172 | start_game; |
190 | start_game; |
173 | }); |
191 | }); |
174 | |
192 | |
175 | $vbox->add (my $hbox = new CFClient::UI::HBox); |
193 | $vbox->add (my $hbox = new CFClient::UI::HBox); |
176 | |
194 | |
… | |
… | |
195 | $input->set_text (''); |
213 | $input->set_text (''); |
196 | |
214 | |
197 | if ($text =~ /^\/(.*)/) { |
215 | if ($text =~ /^\/(.*)/) { |
198 | $::CONN->user_send ("command $1"); |
216 | $::CONN->user_send ("command $1"); |
199 | } else { |
217 | } else { |
|
|
218 | my $say_cmd = $::CFG->{say_command} || 'say'; |
200 | $::CONN->user_send ("command say $text"); |
219 | $::CONN->user_send ("command $say_cmd $text"); |
201 | } |
220 | } |
202 | 1 |
221 | 1 |
203 | }); |
222 | }); |
204 | |
223 | |
205 | $window |
224 | $window |
… | |
… | |
476 | fullscreen => 0, |
495 | fullscreen => 0, |
477 | sdl_mode => 0, |
496 | sdl_mode => 0, |
478 | mapsize => 100, |
497 | mapsize => 100, |
479 | host => "crossfire.schmorp.de", |
498 | host => "crossfire.schmorp.de", |
480 | port => 13327, |
499 | port => 13327, |
|
|
500 | say_command => 'say', |
481 | ); |
501 | ); |
482 | |
502 | |
483 | while (my ($k, $v) = each %DEF_CFG) { |
503 | while (my ($k, $v) = each %DEF_CFG) { |
484 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
504 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
485 | } |
505 | } |