Revision | a5aff6bde5451479a0f6188c0f6e5b2f6f4e9680 (tree) |
---|---|
Zeit | 2012-10-29 15:53:29 |
Autor | h2so5 <h2so5@git....> |
Commiter | h2so5 |
ver0.4.0
UILabelの改行バグを修正
コピペ機能を削除
ステージを持っていないチャンネルへのワープゾーンを表示しないように変更
@@ -1,4 +1,4 @@ | ||
1 | -Miku Miku Online 0.3.10 | |
1 | +Miku Miku Online 0.4.0 | |
2 | 2 | |
3 | 3 | // ******************************** 警告 *********************************** // |
4 | 4 | // *** |
@@ -105,5 +105,5 @@ Client.exeを終了した状態で、server/Server.exe を実行すると単独 | ||
105 | 105 | |
106 | 106 | -- |
107 | 107 | mailto:mmo@h2so5.net |
108 | -http://mmo.h2so5.net/ | |
108 | +http://m2op.net/ | |
109 | 109 | http://sourceforge.jp/projects/mmo/ |
\ No newline at end of file |
@@ -46,32 +46,7 @@ Stage::Stage(const ChannelPtr& channel,const ConfigManagerPtr &config_manager) : | ||
46 | 46 | warpobj_handles_.push_back(handle); |
47 | 47 | } |
48 | 48 | |
49 | - /* | |
50 | - auto warp_points_array = map_handle_.property().get_child("stage.warp_points", ptree()); | |
51 | - for (auto it = warp_points_array.begin(); it != warp_points_array.end(); ++it) { | |
52 | - float x = it->second.get<float>("x", 0); | |
53 | - float y = it->second.get<float>("y", 0); | |
54 | - float z = it->second.get<float>("z", 0); | |
55 | - warp_points_.push_back(VGet(x, y, z)); | |
56 | - } | |
57 | - if (warp_points_.empty()) { | |
58 | - warp_points_.push_back(VGet(0,0,0)); | |
59 | - } | |
60 | - auto warpobj_name = map_handle_.property().get<std::string>("stage.warpobj_name", unicode::ToString(_T("warpobj:デフォルトワープオブジェクト"))); | |
61 | - warpobj_handle_ = ResourceManager::LoadModelFromName(unicode::ToTString(warpobj_name)); | |
62 | - | |
63 | - float warpobj_scale = warpobj_handle_.property().get<float>("scale",12.5f); | |
64 | - if(warpobj_scale != 1.0f)MV1SetScale(warpobj_handle_.handle(), VGet(warpobj_scale, warpobj_scale, warpobj_scale)); | |
65 | - auto warpobj_push_it = warp_points_.begin(); | |
66 | - for( warpobj_push_it; warpobj_push_it != warp_points_.end(); ++warpobj_push_it) | |
67 | - { | |
68 | - auto tmp = ResourceManager::LoadModelFromName(unicode::ToTString(warpobj_name)); | |
69 | - MV1SetScale(tmp.handle(), VGet(warpobj_scale, warpobj_scale, warpobj_scale)); | |
70 | - MV1SetPosition(tmp.handle(),*warpobj_push_it); | |
71 | - warpobj_array_.push_back(tmp); | |
72 | - } | |
73 | - */ | |
74 | - auto skymap_name = map_handle_.property().get<std::string>("stage.skydome", unicode::ToString(_T("skydome:入道雲のある風景"))); | |
49 | + auto skymap_name = unicode::ToString(_T("skydome:スカイドーム")); | |
75 | 50 | skymap_handle_ = ResourceManager::LoadModelFromName(unicode::ToTString(skymap_name)); |
76 | 51 | |
77 | 52 | float skymap_scale = skymap_handle_.property().get<float>("scale", 80.0); |
@@ -96,18 +71,16 @@ void Stage::Draw() | ||
96 | 71 | } |
97 | 72 | } |
98 | 73 | |
74 | + auto skymep_rotate = MV1GetRotationXYZ(skymap_handle_.handle()); | |
75 | + skymep_rotate.y += 0.0001; | |
76 | + MV1SetRotationXYZ(skymap_handle_.handle(), skymep_rotate); | |
77 | + | |
99 | 78 | MV1DrawModel(skymap_handle_.handle()); |
100 | 79 | |
101 | 80 | BOOST_FOREACH(const auto& warp_point_handle, warpobj_handles_) { |
102 | 81 | MV1DrawModel(warp_point_handle.handle()); |
103 | 82 | } |
104 | 83 | |
105 | - /* | |
106 | - BOOST_FOREACH(auto warp_handle,warpobj_array_) | |
107 | - { | |
108 | - MV1DrawModel(warp_handle.handle()); | |
109 | - } | |
110 | - */ | |
111 | 84 | } |
112 | 85 | |
113 | 86 | void Stage::DrawAfter() |
@@ -119,7 +119,7 @@ void CommandManager::FetchCommand(const network::Command& command) | ||
119 | 119 | channels_[id] = ptr; |
120 | 120 | } |
121 | 121 | |
122 | - // 存在しないチャンネルへのワープポイントを削除 | |
122 | + // 存在しない・ステージデータがないチャンネルへのワープポイントを削除 | |
123 | 123 | BOOST_FOREACH(const auto& channel, channels_) { |
124 | 124 | auto& warp_points = channel.second->warp_points; |
125 | 125 | auto end_it = std::remove_if(warp_points.begin(), |
@@ -127,6 +127,12 @@ void CommandManager::FetchCommand(const network::Command& command) | ||
127 | 127 | [this](Channel::WarpPoint& point) -> bool { |
128 | 128 | auto it = channels_.find(point.channel); |
129 | 129 | if (it != channels_.end()) { |
130 | + | |
131 | + if (ResourceManager::NameToFullPath( | |
132 | + unicode::ToTString(it->second->stage)).empty()) { | |
133 | + return true; | |
134 | + } | |
135 | + | |
130 | 136 | point.name = it->second->name; |
131 | 137 | return false; |
132 | 138 | } else { |
@@ -15,7 +15,6 @@ | ||
15 | 15 | "start_points": |
16 | 16 | [ |
17 | 17 | {"x":0.0, "y":0.0, "z":0.0} |
18 | - ], | |
19 | - "skydome": "skydome:入道雲のある風景" | |
18 | + ] | |
20 | 19 | } |
21 | 20 | } |
\ No newline at end of file |
@@ -45,6 +45,8 @@ void ChannelChange::Update() | ||
45 | 45 | player_manager_->ResetStage(); |
46 | 46 | manager_accessor_->set_world_manager(WorldManagerPtr()); |
47 | 47 | |
48 | + ResourceManager::ClearModelHandle(); | |
49 | + | |
48 | 50 | command_manager_->Write(network::ServerUpdateAccountProperty(CHANNEL, network::Utils::Serialize(channel_))); |
49 | 51 | |
50 | 52 | auto channel_ptr = command_manager_->channels().at(channel_); |
@@ -176,13 +176,14 @@ void MainLoop::Draw() | ||
176 | 176 | |
177 | 177 | UILabel label_; |
178 | 178 | label_.set_width(160); |
179 | + auto text = _T("【") + unicode::ToTString(warp_point.name) + _T("】"); | |
179 | 180 | if (distance < 50) { |
180 | - label_.set_text(unicode::ToTString(warp_point.name) + _T("\nMキーで転送します")); | |
181 | + text += _T("\nMキーで転送します"); | |
181 | 182 | label_.set_bgcolor(UIBase::Color(255,0,0,150)); |
182 | 183 | } else { |
183 | - label_.set_text(unicode::ToTString(warp_point.name)); | |
184 | 184 | label_.set_bgcolor(UIBase::Color(0,0,0,150)); |
185 | 185 | } |
186 | + label_.set_text(text); | |
186 | 187 | label_.set_textcolor(UIBase::Color(255,255,255,255)); |
187 | 188 | |
188 | 189 | label_.set_left(x - 60); |
@@ -8,7 +8,7 @@ | ||
8 | 8 | |
9 | 9 | const size_t Input::TEXT_BUFFER_SIZE = 1024; |
10 | 10 | const size_t Input::HISTORY_MAX_SIZE = 50; |
11 | -const int Input::KEY_REPEAT_FRAME = 8; | |
11 | +const int Input::KEY_REPEAT_FRAME = 6; | |
12 | 12 | |
13 | 13 | const int Input::INPUT_MARGIN_X = 8; |
14 | 14 | const int Input::INPUT_MARGIN_Y = 6; |
@@ -19,12 +19,9 @@ const int Input::IME_MARGIN_Y = 16; | ||
19 | 19 | const int Input::IME_MAX_PAGE_SIZE = 6; |
20 | 20 | const int Input::IME_MIN_WIDTH = 120; |
21 | 21 | |
22 | -Input::Input(ConfigManagerPtr config_manager) : | |
22 | +Input::Input() : | |
23 | 23 | multiline_(true), |
24 | - reverse_color_(false), | |
25 | - drag_flag_(false), | |
26 | - rightmenu_show_(false), | |
27 | - config_manager_(config_manager) | |
24 | + reverse_color_(false) | |
28 | 25 | { |
29 | 26 | input_bg_image_handle_ = ResourceManager::LoadCachedDivGraph<4>( |
30 | 27 | _T("system/images/gui/gui_inputbox_input_bg.png"), 2, 2, 12, 12); |
@@ -48,104 +45,6 @@ Input::Input(ConfigManagerPtr config_manager) : | ||
48 | 45 | y_ = 100; |
49 | 46 | width_ = 160; |
50 | 47 | height_ = font_height_ + 4; |
51 | - | |
52 | -} | |
53 | - | |
54 | -void Input::Init() | |
55 | -{ | |
56 | - right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{ | |
57 | - UILabel label; | |
58 | - label.set_input_adaptor(this); | |
59 | - label.set_text(unicode::ToTString(unicode::sjis2utf8("切り取り"))); | |
60 | - label.set_width(120); | |
61 | - label.set_top(12); | |
62 | - label.set_left(0); | |
63 | - label.set_textcolor(UISuper::Color(0,0,0,255)); | |
64 | - label.set_bgcolor(UISuper::Color(255,255,255,180)); | |
65 | - label.set_on_click_function_([](UIBase* ptr)->void{ | |
66 | - auto input_ = ptr->input_adpator(); | |
67 | - auto sel_txt = input_->selecting_text(); | |
68 | - SetClipboardText(sel_txt.c_str()); | |
69 | - auto text = input_->text(); | |
70 | - auto pos = text.find(sel_txt); | |
71 | - tstring res; | |
72 | - if( pos != std::string::npos ) | |
73 | - { | |
74 | - res = text.substr(0,pos); | |
75 | - res += text.substr(pos + sel_txt.size(),text.size() - pos + sel_txt.size()); | |
76 | - } | |
77 | - input_->set_text(res); | |
78 | - }); | |
79 | - label.set_on_hover_function_([](UIBase* ptr)->void{ | |
80 | - auto label_ptr = (UILabel *)ptr; | |
81 | - label_ptr->set_bgcolor(UISuper::Color(0,0,0,180)); | |
82 | - label_ptr->set_textcolor(UISuper::Color(255,255,255)); | |
83 | - }); | |
84 | - label.set_on_out_function_([](UIBase* ptr)->void{ | |
85 | - auto label_ptr = (UILabel *)ptr; | |
86 | - label_ptr->set_bgcolor(UISuper::Color(255,255,255,180)); | |
87 | - label_ptr->set_textcolor(UISuper::Color(0,0,0)); | |
88 | - }); | |
89 | - return label; | |
90 | - }()))); | |
91 | - right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{ | |
92 | - UILabel label; | |
93 | - label.set_input_adaptor(this); | |
94 | - label.set_text(unicode::ToTString(unicode::sjis2utf8("コピー"))); | |
95 | - label.set_width(120); | |
96 | - label.set_top(12); | |
97 | - label.set_left(0); | |
98 | - label.set_textcolor(UISuper::Color(0,0,0,255)); | |
99 | - label.set_bgcolor(UISuper::Color(255,255,255,180)); | |
100 | - label.set_on_click_function_([&](UIBase* ptr)->void{ | |
101 | - auto input_ = ptr->input_adpator(); | |
102 | - SetClipboardText(input_->selecting_text().c_str()); | |
103 | - }); | |
104 | - label.set_on_hover_function_([](UIBase* ptr)->void{ | |
105 | - auto label_ptr = (UILabel *)ptr; | |
106 | - label_ptr->set_bgcolor(UISuper::Color(0,0,0,180)); | |
107 | - label_ptr->set_textcolor(UISuper::Color(255,255,255)); | |
108 | - }); | |
109 | - label.set_on_out_function_([](UIBase* ptr)->void{ | |
110 | - auto label_ptr = (UILabel *)ptr; | |
111 | - label_ptr->set_bgcolor(UISuper::Color(255,255,255,180)); | |
112 | - label_ptr->set_textcolor(UISuper::Color(0,0,0)); | |
113 | - }); | |
114 | - return label; | |
115 | - }()))); | |
116 | - right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{ | |
117 | - UILabel label; | |
118 | - label.set_input_adaptor(this); | |
119 | - label.set_text(unicode::ToTString(unicode::sjis2utf8("貼り付け"))); | |
120 | - label.set_width(120); | |
121 | - label.set_top(12); | |
122 | - label.set_left(0); | |
123 | - label.set_textcolor(UISuper::Color(0,0,0,255)); | |
124 | - label.set_bgcolor(UISuper::Color(255,255,255,180)); | |
125 | - label.set_on_click_function_([&](UIBase* ptr)->void{ | |
126 | - auto input_ = ptr->input_adpator(); | |
127 | - auto size = GetClipboardText(NULL); | |
128 | - if(size > 0){ | |
129 | - TCHAR *buf = new TCHAR[size]; | |
130 | - GetClipboardText(buf); | |
131 | - input_->paste_text(buf); | |
132 | - delete []buf; | |
133 | - } | |
134 | - }); | |
135 | - label.set_on_hover_function_([](UIBase* ptr)->void{ | |
136 | - auto label_ptr = (UILabel *)ptr; | |
137 | - label_ptr->set_bgcolor(UISuper::Color(0,0,0,180)); | |
138 | - label_ptr->set_textcolor(UISuper::Color(255,255,255)); | |
139 | - }); | |
140 | - label.set_on_out_function_([](UIBase* ptr)->void{ | |
141 | - auto label_ptr = (UILabel *)ptr; | |
142 | - label_ptr->set_bgcolor(UISuper::Color(255,255,255,180)); | |
143 | - label_ptr->set_textcolor(UISuper::Color(0,0,0)); | |
144 | - }); | |
145 | - return label; | |
146 | - }()))); | |
147 | - right_click_list_.set_height((font_height_ + 2)* 3); | |
148 | - right_click_list_.set_width(120); | |
149 | 48 | } |
150 | 49 | |
151 | 50 | void Input::Draw() |
@@ -260,98 +159,12 @@ void Input::Draw() | ||
260 | 159 | } |
261 | 160 | } |
262 | 161 | |
263 | - int select_start = 0,select_end = 0; | |
264 | - GetKeyInputSelectArea(&select_start,&select_end,input_handle_); | |
265 | - if( select_start > select_end )std::swap(select_start,select_end); | |
266 | - | |
267 | - if( select_start > -1 && select_end != select_start ) { | |
268 | - if ( multiline_ ) { | |
269 | - BOOST_FOREACH(auto it,lines_){ | |
270 | - int width = 0; | |
271 | - TCHAR c[2] = {0}; | |
272 | - if( select_start >= it.size() && select_start != -1 ) { | |
273 | - DrawStringToHandle(internal_x, internal_y + current_line * font_height_, | |
274 | - it.c_str(), text_color, font_handle_); | |
275 | - if(select_start == it.size()){ | |
276 | - select_start -= it.size(); | |
277 | - }else{ | |
278 | - select_start -= it.size() + 1; | |
279 | - } | |
280 | - select_end -= it.size() + 1; | |
281 | - ++current_line; | |
282 | - }else if(select_start != -1){ | |
283 | - for(int i = 0;i < select_start;++i){ | |
284 | - c[0] = it[i]; | |
285 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
286 | - c, text_color, font_handle_); | |
287 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
288 | - } | |
289 | - for(int i = select_start;i < ((select_end > static_cast<int>(it.size())) ? it.size() : select_end); ++i){ | |
290 | - c[0] = it[i]; | |
291 | - SetDrawBlendMode(DX_BLENDMODE_ALPHA, 180); | |
292 | - DrawBox(internal_x + width,internal_y + current_line * font_height_, | |
293 | - internal_x + width + GetDrawStringWidthToHandle(c,1,font_handle_),internal_y + ( current_line + 1 ) * font_height_,text_color,1); | |
294 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
295 | - c, !reverse_color_ ? GetColor(255, 255, 255) : GetColor(0, 0, 0), font_handle_); | |
296 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
297 | - SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); | |
298 | - } | |
299 | - for(int i = ((select_end > static_cast<int>(it.size())) ? it.size() : select_end);i < it.size(); ++i){ | |
300 | - c[0] = it[i]; | |
301 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
302 | - c, text_color, font_handle_); | |
303 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
304 | - } | |
305 | - if(select_end > it.size()){ | |
306 | - select_end -= it.size() + 1; | |
307 | - select_start = 0; | |
308 | - }else{ | |
309 | - select_start = -1; | |
310 | - } | |
311 | - ++current_line; | |
312 | - }else if(select_start == -1){ | |
313 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
314 | - it.c_str(), text_color, font_handle_); | |
315 | - ++current_line; | |
316 | - } | |
317 | - } | |
318 | - }else{ | |
319 | - BOOST_FOREACH(auto it,lines_){ | |
320 | - int width = 0; | |
321 | - TCHAR c[2] = {0}; | |
322 | - for(int i = 0;i < select_start;++i){ | |
323 | - c[0] = it[i]; | |
324 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
325 | - c, text_color, font_handle_); | |
326 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
327 | - } | |
328 | - for(int i = select_start;i < select_end; ++i){ | |
329 | - c[0] = it[i]; | |
330 | - SetDrawBlendMode(DX_BLENDMODE_ALPHA, 180); | |
331 | - DrawBox(internal_x + width,internal_y + current_line * font_height_, | |
332 | - internal_x + width + GetDrawStringWidthToHandle(c,1,font_handle_),internal_y + ( current_line + 1 ) * font_height_,text_color,1); | |
333 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
334 | - c, !reverse_color_ ? GetColor(255, 255, 255) : GetColor(0, 0, 0), font_handle_); | |
335 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
336 | - SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); | |
337 | - } | |
338 | - for(unsigned int i = select_end;i < it.size(); ++i){ | |
339 | - c[0] = it[i]; | |
340 | - DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_, | |
341 | - c, text_color, font_handle_); | |
342 | - width += GetDrawStringWidthToHandle(c,1,font_handle_); | |
343 | - } | |
344 | - } | |
345 | - } | |
346 | - }else{ | |
347 | - for (auto it = lines_.begin(); it != lines_.end(); ++it) { | |
348 | - auto line = *it; | |
349 | - DrawStringToHandle(internal_x, internal_y + current_line * font_height_, | |
350 | - line.c_str(), text_color, font_handle_); | |
351 | - current_line++; | |
352 | - } | |
353 | - } | |
354 | - | |
162 | + for (auto it = lines_.begin(); it != lines_.end(); ++it) { | |
163 | + auto line = *it; | |
164 | + DrawStringToHandle(internal_x, internal_y + current_line * font_height_, | |
165 | + line.c_str(), text_color, font_handle_); | |
166 | + current_line++; | |
167 | + } | |
355 | 168 | |
356 | 169 | // カーソルを描画 |
357 | 170 | if (clause_lines_.size() <= 0 && active() && blink_count_ < 30) { |
@@ -445,21 +258,11 @@ void Input::Draw() | ||
445 | 258 | } |
446 | 259 | } |
447 | 260 | } |
448 | - { | |
449 | - if ( rightmenu_show_ ) { | |
450 | - right_click_list_.Draw(); | |
451 | - } | |
452 | - } | |
453 | 261 | } |
454 | 262 | |
455 | 263 | void Input::Update() |
456 | 264 | { |
457 | 265 | blink_count_ = (blink_count_ + 1) % 60; |
458 | - { | |
459 | - if ( rightmenu_show_ ) { | |
460 | - right_click_list_.Update(); | |
461 | - } | |
462 | - } | |
463 | 266 | } |
464 | 267 | |
465 | 268 | void Input::ProcessInput(InputManager* input) |
@@ -468,11 +271,7 @@ void Input::ProcessInput(InputManager* input) | ||
468 | 271 | return; |
469 | 272 | } |
470 | 273 | |
471 | - bool push_mouse_left = (input->GetMouseLeftCount() > 0); | |
472 | - bool prev_mouse_left = input->GetPrevMouseLeft(); | |
473 | - | |
474 | - bool push_mouse_right = (input->GetMouseRightCount() > 0); | |
475 | - bool prev_mouse_right = input->GetPrevMouseRight(); | |
274 | + // bool push_mouse_left = (input->GetMouseLeftCount() > 0); | |
476 | 275 | |
477 | 276 | // bool first_key_shift = (input->GetKeyCount(KEY_INPUT_RSHIFT) == 1 |
478 | 277 | // || input->GetKeyCount(KEY_INPUT_LSHIFT) == 1); |
@@ -493,7 +292,6 @@ void Input::ProcessInput(InputManager* input) | ||
493 | 292 | + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0; |
494 | 293 | bool push_repeat_key_down = (input->GetKeyCount(KEY_INPUT_DOWN) |
495 | 294 | + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0; |
496 | - | |
497 | 295 | // bool push_long_backspace = (input->GetKeyCount(KEY_INPUT_BACK) > 60 * 1.5); |
498 | 296 | |
499 | 297 | auto input_text = text(); |
@@ -609,184 +407,7 @@ void Input::ProcessInput(InputManager* input) | ||
609 | 407 | } |
610 | 408 | |
611 | 409 | if (active()) { |
612 | - if ( !rightmenu_show_ && | |
613 | - !( rightmenu_show_ && right_click_list_.absolute_x()<= input->GetMouseX() && input->GetMouseX() <= right_click_list_.absolute_x()+ right_click_list_.absolute_width() | |
614 | - && right_click_list_.absolute_y() <= input->GetMouseY() && input->GetMouseY() <= right_click_list_.absolute_y() + right_click_list_.absolute_height())) { | |
615 | - // マウス左ボタンが押された時 | |
616 | - if (push_mouse_left && !prev_mouse_left) { | |
617 | - auto mpos = input->GetMousePos(); | |
618 | - auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X); | |
619 | - auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y); | |
620 | - // カレット変更 | |
621 | - if( multiline_ ) { | |
622 | - auto line_num = offset_y / font_height_; | |
623 | - //if( ( offset_y % font_height_ ) != 0 )++line_num; | |
624 | - int tmp = 0,cnt = 0; | |
625 | - if( line_num < (int)lines_.size() && line_num >= 0 ){ | |
626 | - for(int i = 0;i < line_num; ++i){ | |
627 | - cnt += lines_[i].size(); | |
628 | - } | |
629 | - for(unsigned int i = 0;i < lines_[line_num].size(); ++i){ | |
630 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_); | |
631 | - if( tmp + tmp_x < offset_x ){ | |
632 | - tmp += tmp_x; | |
633 | - ++cnt; | |
634 | - } | |
635 | - } | |
636 | - SetKeyInputCursorPosition(line_num + cnt,input_handle_); | |
637 | - } | |
638 | - }else{ | |
639 | - int tmp = 0,cnt = 0; | |
640 | - for(unsigned int i = 0;i < lines_[0].size(); ++i){ | |
641 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_); | |
642 | - if( tmp + tmp_x < offset_x ){ | |
643 | - tmp += tmp_x; | |
644 | - ++cnt; | |
645 | - } | |
646 | - } | |
647 | - if( selecting_coursorpoint_.first = selecting_coursorpoint_.second ) { | |
648 | - SetKeyInputSelectArea( -1, -1, input_handle_ ); | |
649 | - }else{ | |
650 | - SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_); | |
651 | - } | |
652 | - SetKeyInputCursorPosition(cnt,input_handle_); | |
653 | - } | |
654 | - } | |
655 | - // マウス左ボタンがドラッグされた時 | |
656 | - if (push_mouse_left && prev_mouse_left ) { | |
657 | - int prev_cursor_pos = 0; | |
658 | - if( !drag_flag_ ){ | |
659 | - prev_cursor_pos = GetKeyInputCursorPosition(input_handle_); | |
660 | - }else{ | |
661 | - prev_cursor_pos = selecting_coursorpoint_.first; | |
662 | - } | |
663 | - auto mpos = input->GetMousePos(); | |
664 | - auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X); | |
665 | - auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y); | |
666 | - // カレット変更 | |
667 | - if( multiline_ ) { | |
668 | - auto line_num = offset_y / font_height_; | |
669 | - int tmp = 0,cnt = 0; | |
670 | - if( line_num < (int)lines_.size() && line_num >= 0){ | |
671 | - for(int i = 0;i < line_num; ++i,++cnt){ | |
672 | - cnt += lines_[i].size(); | |
673 | - } | |
674 | - for(unsigned int i = 0;i < lines_[line_num].size(); ++i){ | |
675 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_); | |
676 | - if( tmp + tmp_x < offset_x ){ | |
677 | - tmp += tmp_x; | |
678 | - ++cnt; | |
679 | - } | |
680 | - } | |
681 | - } | |
682 | - selecting_coursorpoint_ = std::make_pair<int,int>(prev_cursor_pos,cnt); | |
683 | - }else{ | |
684 | - int tmp = 0,cnt = 0; | |
685 | - for(unsigned int i = 0;i < lines_[0].size(); ++i){ | |
686 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_); | |
687 | - if( tmp + tmp_x < offset_x ){ | |
688 | - tmp += tmp_x; | |
689 | - ++cnt; | |
690 | - } | |
691 | - } | |
692 | - selecting_coursorpoint_ = std::make_pair<int,int>(prev_cursor_pos,cnt); | |
693 | - } | |
694 | - SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_); | |
695 | - SetKeyInputCursorPosition(selecting_coursorpoint_.second,input_handle_); | |
696 | - drag_flag_ = true; | |
697 | - } | |
698 | - // マウス左ボタンが離され、且つ前回ドラッグされていた時 | |
699 | - if (!push_mouse_left && prev_mouse_left && drag_flag_ ) { | |
700 | - drag_flag_ = false; | |
701 | - if( selecting_coursorpoint_.first == selecting_coursorpoint_.second ) { | |
702 | - SetKeyInputSelectArea( -1, -1, input_handle_ ); | |
703 | - }else{ | |
704 | - SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_); | |
705 | - } | |
706 | - SetKeyInputCursorPosition(selecting_coursorpoint_.second,input_handle_); | |
707 | - } | |
708 | - }else{ | |
709 | - if( push_mouse_left ){ | |
710 | - auto mpos = input->GetMousePos(); | |
711 | - auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X); | |
712 | - auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y); | |
713 | - // カレット変更 | |
714 | - if( multiline_ ) { | |
715 | - auto line_num = offset_y / font_height_; | |
716 | - //if( ( offset_y % font_height_ ) != 0 )++line_num; | |
717 | - int tmp = 0,cnt = 0; | |
718 | - if( line_num < (int)lines_.size() && line_num >= 0 ){ | |
719 | - for(int i = 0;i < line_num; ++i){ | |
720 | - cnt += lines_[i].size(); | |
721 | - } | |
722 | - for(unsigned int i = 0;i < lines_[line_num].size(); ++i){ | |
723 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_); | |
724 | - if( tmp + tmp_x < offset_x ){ | |
725 | - tmp += tmp_x; | |
726 | - ++cnt; | |
727 | - } | |
728 | - } | |
729 | - SetKeyInputCursorPosition(line_num + cnt,input_handle_); | |
730 | - } | |
731 | - }else{ | |
732 | - int tmp = 0,cnt = 0; | |
733 | - for(unsigned int i = 0;i < lines_[0].size(); ++i){ | |
734 | - auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_); | |
735 | - if( tmp + tmp_x < offset_x ){ | |
736 | - tmp += tmp_x; | |
737 | - ++cnt; | |
738 | - } | |
739 | - } | |
740 | - if( selecting_coursorpoint_.first = selecting_coursorpoint_.second ) { | |
741 | - SetKeyInputSelectArea( -1, -1, input_handle_ ); | |
742 | - }else{ | |
743 | - SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_); | |
744 | - } | |
745 | - SetKeyInputCursorPosition(cnt,input_handle_); | |
746 | - } | |
747 | - } | |
748 | - } | |
749 | - // マウス右ボタンが押されたとき | |
750 | - if ( push_mouse_right && !prev_mouse_right ) { | |
751 | - if( x() <= input->GetMouseX() && input->GetMouseX() <= x() + width() && | |
752 | - y() <= input->GetMouseY() && input->GetMouseY() <= y() + height()){ | |
753 | - auto mouse_pos_ = input->GetMousePos(); | |
754 | - if( mouse_pos_.second + right_click_list_.absolute_height() > config_manager_->screen_height()){ | |
755 | - right_click_list_.set_top(mouse_pos_.second - right_click_list_.absolute_height()); | |
756 | - if ( mouse_pos_.first + right_click_list_.absolute_width() > config_manager_->screen_width()){ | |
757 | - right_click_list_.set_left(mouse_pos_.first - right_click_list_.absolute_width()); | |
758 | - BOOST_FOREACH(auto it,right_click_list_.getItems()){ | |
759 | - it->set_left(mouse_pos_.first - right_click_list_.absolute_width()); | |
760 | - it->set_top(mouse_pos_.second - right_click_list_.absolute_height() + 12); | |
761 | - } | |
762 | - }else{ | |
763 | - right_click_list_.set_left(mouse_pos_.first); | |
764 | - BOOST_FOREACH(auto it,right_click_list_.getItems()){ | |
765 | - it->set_left(mouse_pos_.first); | |
766 | - it->set_top(mouse_pos_.second - right_click_list_.absolute_height() + 12); | |
767 | - } | |
768 | - } | |
769 | - }else{ | |
770 | - right_click_list_.set_top(mouse_pos_.second); | |
771 | - if ( mouse_pos_.first + right_click_list_.absolute_width() > config_manager_->screen_width()){ | |
772 | - right_click_list_.set_left(mouse_pos_.first - right_click_list_.absolute_width()); | |
773 | - BOOST_FOREACH(auto it,right_click_list_.getItems()){ | |
774 | - it->set_left(mouse_pos_.first - right_click_list_.absolute_width()); | |
775 | - it->set_top(mouse_pos_.second + 12); | |
776 | - } | |
777 | - }else{ | |
778 | - right_click_list_.set_left(mouse_pos_.first); | |
779 | - BOOST_FOREACH(auto it,right_click_list_.getItems()){ | |
780 | - it->set_left(mouse_pos_.first); | |
781 | - it->set_top(mouse_pos_.second + 12); | |
782 | - } | |
783 | - } | |
784 | - } | |
785 | - rightmenu_show_ = true; | |
786 | - } | |
787 | - } | |
788 | - | |
789 | - // カーソル位置(文字単位)を取得 | |
410 | + // カーソル位置(byte)を取得 | |
790 | 411 | cursor_byte_pos = GetKeyInputCursorPosition(input_handle_); |
791 | 412 | if (prev_cursor_pos_ != cursor_byte_pos) { |
792 | 413 | ResetCursorCount(); |
@@ -794,7 +415,6 @@ void Input::ProcessInput(InputManager* input) | ||
794 | 415 | |
795 | 416 | prev_cursor_pos_ = cursor_byte_pos; |
796 | 417 | |
797 | - | |
798 | 418 | // カーソルのドット単位の位置を取得する |
799 | 419 | cursor_dot_pos = GetDrawStringWidthToHandle(String, cursor_byte_pos, |
800 | 420 | font_handle_); |
@@ -1001,7 +621,6 @@ void Input::ProcessInput(InputManager* input) | ||
1001 | 621 | TCHAR c = *it; |
1002 | 622 | int width = GetDrawStringWidthToHandle(&c, 1, font_handle_); |
1003 | 623 | line_buffer += tstring(&c, 1); |
1004 | - char_count++; | |
1005 | 624 | #else |
1006 | 625 | unsigned char c = *it; |
1007 | 626 | TCHAR string[2] = { 0, 0 }; |
@@ -1040,7 +659,7 @@ void Input::ProcessInput(InputManager* input) | ||
1040 | 659 | && cursor_moveto_x_ <= line_width + width |
1041 | 660 | && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_ |
1042 | 661 | && cursor_moveto_y_ <= (static_cast<int>(lines_.size() + message_lines_.size()) + 1) * font_height_) { |
1043 | - SetKeyInputCursorPosition(char_count - 1, input_handle_); | |
662 | + SetKeyInputCursorPosition(prev_char_count, input_handle_); | |
1044 | 663 | cursor_moveto_x_ = -1; |
1045 | 664 | cursor_moveto_y_ = -1; |
1046 | 665 | } |
@@ -1097,14 +716,6 @@ void Input::ProcessInput(InputManager* input) | ||
1097 | 716 | if (active()) { |
1098 | 717 | input->CancelKeyCountAll(); |
1099 | 718 | } |
1100 | - | |
1101 | - if ( rightmenu_show_ ) { | |
1102 | - right_click_list_.ProcessInput(input); | |
1103 | - if( push_mouse_left ) { | |
1104 | - rightmenu_show_ = false; | |
1105 | - } | |
1106 | - } | |
1107 | - | |
1108 | 719 | } |
1109 | 720 | |
1110 | 721 | bool Input::active() |
@@ -1204,51 +815,6 @@ void Input::set_on_enter(const CallbackFunc& func) | ||
1204 | 815 | on_enter_ = func; |
1205 | 816 | } |
1206 | 817 | |
1207 | -tstring Input::selecting_text() const | |
1208 | -{ | |
1209 | - int select_start = 0,select_end = 0; | |
1210 | - GetKeyInputSelectArea(&select_start,&select_end,input_handle_); | |
1211 | - if( select_start > select_end )std::swap(select_start,select_end); | |
1212 | - tstring selecting_text; | |
1213 | - | |
1214 | - if( select_start > -1 && select_end != select_start ) { | |
1215 | - if ( multiline_ ) { | |
1216 | - BOOST_FOREACH(auto it,lines_){ | |
1217 | - TCHAR c[2] = {0}; | |
1218 | - if( select_start > it.size() && select_start != -1 ) { | |
1219 | - select_start -= it.size(); | |
1220 | - select_end -= it.size(); | |
1221 | - }else{ | |
1222 | - for(int i = select_start;i < select_end; ++i){ | |
1223 | - c[0] = it[i]; | |
1224 | - selecting_text += c; | |
1225 | - } | |
1226 | - select_start = -1; | |
1227 | - } | |
1228 | - } | |
1229 | - }else{ | |
1230 | - BOOST_FOREACH(auto it,lines_){ | |
1231 | - TCHAR c[2] = {0}; | |
1232 | - for(int i = select_start;i < select_end; ++i){ | |
1233 | - c[0] = it[i]; | |
1234 | - selecting_text += c; | |
1235 | - } | |
1236 | - } | |
1237 | - } | |
1238 | - } | |
1239 | - return selecting_text; | |
1240 | -} | |
1241 | - | |
1242 | -void Input::paste_text(tstring text) | |
1243 | -{ | |
1244 | - auto pos = GetKeyInputCursorPosition(input_handle_); | |
1245 | - TCHAR String[TEXT_BUFFER_SIZE]; | |
1246 | - GetKeyInputString(String, input_handle_); | |
1247 | - tstring dat(String, _tcslen(String)); | |
1248 | - dat.insert(pos,text); | |
1249 | - SetKeyInputString(dat.c_str(), input_handle_); | |
1250 | -} | |
1251 | - | |
1252 | 818 | bool Input::reverse_color() const |
1253 | 819 | { |
1254 | 820 | return reverse_color_; |
@@ -8,20 +8,16 @@ | ||
8 | 8 | #include <functional> |
9 | 9 | #include "../ResourceManager.hpp" |
10 | 10 | #include "../InputManager.hpp" |
11 | -#include "../ConfigManager.hpp" | |
12 | -#include "include.hpp" | |
13 | -#include <boost/enable_shared_from_this.hpp> | |
14 | 11 | |
15 | -class Input{ | |
12 | +class Input { | |
16 | 13 | typedef std::function<bool(const std::string&)> CallbackFunc; |
17 | 14 | |
18 | 15 | public: |
19 | - Input(ConfigManagerPtr config_manager); | |
16 | + Input(); | |
20 | 17 | |
21 | 18 | void Draw(); |
22 | 19 | void Update(); |
23 | 20 | void ProcessInput(InputManager* input); |
24 | - void Init(); | |
25 | 21 | |
26 | 22 | bool active(); |
27 | 23 | void set_active(bool flag); |
@@ -49,9 +45,6 @@ class Input{ | ||
49 | 45 | |
50 | 46 | void set_on_enter(const CallbackFunc& func); |
51 | 47 | |
52 | - tstring selecting_text() const; | |
53 | - void paste_text(tstring text); | |
54 | - | |
55 | 48 | public: |
56 | 49 | void CancelSelect(); |
57 | 50 |
@@ -80,20 +73,12 @@ class Input{ | ||
80 | 73 | std::vector<std::pair<int, int>> selecting_lines_; |
81 | 74 | std::vector<std::pair<int, int>> clause_lines_; |
82 | 75 | std::vector<std::pair<int, int>> selecting_clause_lines_; |
83 | - std::pair<int, int> selecting_coursorpoint_; | |
84 | - bool drag_flag_; | |
85 | 76 | |
86 | 77 | CallbackFunc on_enter_; |
87 | 78 | tstring message_; |
88 | 79 | |
89 | 80 | bool reverse_color_; |
90 | 81 | int blink_count_; |
91 | - bool rightmenu_show_; | |
92 | - //std::pair<int, int> mouse_pos_; | |
93 | - | |
94 | - UIList right_click_list_; | |
95 | - | |
96 | - ConfigManagerPtr config_manager_; | |
97 | 82 | |
98 | 83 | private: |
99 | 84 | const static size_t TEXT_BUFFER_SIZE; |
@@ -44,7 +44,7 @@ InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) : | ||
44 | 44 | manager_accessor_(manager_accessor), |
45 | 45 | card_(std::make_shared<Card>(manager_accessor_, "", "immo", "", "", |
46 | 46 | std::vector<std::string>())), |
47 | - input_(manager_accessor->config_manager().lock()) | |
47 | + input_() | |
48 | 48 | |
49 | 49 | { |
50 | 50 | absolute_rect_ = Rect(100, 100, 800, 100); |
@@ -103,7 +103,6 @@ InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) : | ||
103 | 103 | |
104 | 104 | return true; |
105 | 105 | }); |
106 | - input_.Init(); | |
107 | 106 | } |
108 | 107 | |
109 | 108 | InputBox::~InputBox() |
@@ -255,6 +255,7 @@ void UILabel::UpdatePosition() | ||
255 | 255 | |
256 | 256 | for (auto it = char_width_list_.begin(); it != char_width_list_.end(); ++it) { |
257 | 257 | if ( text_[text_cursor] == _T('\n')) { |
258 | + line_width = 0; | |
258 | 259 | line_num++; |
259 | 260 | substr_list_.push_back(text_cursor); |
260 | 261 | substr_list_.push_back(text_cursor + 1); |
@@ -36,6 +36,7 @@ def make_full_package(model = True): | ||
36 | 36 | zip.write(os.path.join(base_dir, 'mmd.txt'), 'mmd.txt') |
37 | 37 | |
38 | 38 | zip.write(os.path.join(bin_path, 'server/config.json'), 'server/config.json') |
39 | + zip.write(os.path.join(bin_path, 'server/channels/ch000/config.json'), 'server/channels/ch000/config.json') | |
39 | 40 | |
40 | 41 | zip.write(os.path.join(bin_path, 'config.json'), 'config.json') |
41 | 42 | zip.write(os.path.join(bin_path, 'server/server.exe'), 'server/server.exe') |
@@ -96,6 +97,7 @@ def make_server_package(): | ||
96 | 97 | bin_path = os.path.join(base_dir, 'client/bin/') |
97 | 98 | zip.write(os.path.join(bin_path, 'server/server.exe'), 'server.exe') |
98 | 99 | zip.write(os.path.join(bin_path, 'server/config.json'), 'config.json') |
100 | + zip.write(os.path.join(bin_path, 'server/channels/ch000/config.json'), 'channels/ch000/config.json') | |
99 | 101 | |
100 | 102 | zip.close() |
101 | 103 |