Commit MetaInfo

Revisiona5aff6bde5451479a0f6188c0f6e5b2f6f4e9680 (tree)
Zeit2012-10-29 15:53:29
Autorh2so5 <h2so5@git....>
Commiterh2so5

Log Message

ver0.4.0
UILabelの改行バグを修正
コピペ機能を削除
ステージを持っていないチャンネルへのワープゾーンを表示しないように変更

Ändern Zusammenfassung

Diff

--- a/Readme.txt
+++ b/Readme.txt
@@ -1,4 +1,4 @@
1-Miku Miku Online 0.3.10
1+Miku Miku Online 0.4.0
22
33 // ******************************** 警告 *********************************** //
44 // ***
@@ -105,5 +105,5 @@ Client.exeを終了した状態で、server/Server.exe を実行すると単独
105105
106106 --
107107 mailto:mmo@h2so5.net
108-http://mmo.h2so5.net/
108+http://m2op.net/
109109 http://sourceforge.jp/projects/mmo/
\ No newline at end of file
--- a/client/3d/Stage.cpp
+++ b/client/3d/Stage.cpp
@@ -46,32 +46,7 @@ Stage::Stage(const ChannelPtr& channel,const ConfigManagerPtr &config_manager) :
4646 warpobj_handles_.push_back(handle);
4747 }
4848
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:スカイドーム"));
7550 skymap_handle_ = ResourceManager::LoadModelFromName(unicode::ToTString(skymap_name));
7651
7752 float skymap_scale = skymap_handle_.property().get<float>("scale", 80.0);
@@ -96,18 +71,16 @@ void Stage::Draw()
9671 }
9772 }
9873
74+ auto skymep_rotate = MV1GetRotationXYZ(skymap_handle_.handle());
75+ skymep_rotate.y += 0.0001;
76+ MV1SetRotationXYZ(skymap_handle_.handle(), skymep_rotate);
77+
9978 MV1DrawModel(skymap_handle_.handle());
10079
10180 BOOST_FOREACH(const auto& warp_point_handle, warpobj_handles_) {
10281 MV1DrawModel(warp_point_handle.handle());
10382 }
10483
105- /*
106- BOOST_FOREACH(auto warp_handle,warpobj_array_)
107- {
108- MV1DrawModel(warp_handle.handle());
109- }
110- */
11184 }
11285
11386 void Stage::DrawAfter()
--- a/client/CommandManager.cpp
+++ b/client/CommandManager.cpp
@@ -119,7 +119,7 @@ void CommandManager::FetchCommand(const network::Command& command)
119119 channels_[id] = ptr;
120120 }
121121
122- // 存在しないチャンネルへのワープポイントを削除
122+ // 存在しない・ステージデータがないチャンネルへのワープポイントを削除
123123 BOOST_FOREACH(const auto& channel, channels_) {
124124 auto& warp_points = channel.second->warp_points;
125125 auto end_it = std::remove_if(warp_points.begin(),
@@ -127,6 +127,12 @@ void CommandManager::FetchCommand(const network::Command& command)
127127 [this](Channel::WarpPoint& point) -> bool {
128128 auto it = channels_.find(point.channel);
129129 if (it != channels_.end()) {
130+
131+ if (ResourceManager::NameToFullPath(
132+ unicode::ToTString(it->second->stage)).empty()) {
133+ return true;
134+ }
135+
130136 point.name = it->second->name;
131137 return false;
132138 } else {
--- a/client/bin/system/default.info.json
+++ b/client/bin/system/default.info.json
@@ -15,7 +15,6 @@
1515 "start_points":
1616 [
1717 {"x":0.0, "y":0.0, "z":0.0}
18- ],
19- "skydome": "skydome:入道雲のある風景"
18+ ]
2019 }
2120 }
\ No newline at end of file
--- a/client/scene/ChannelChange.cpp
+++ b/client/scene/ChannelChange.cpp
@@ -45,6 +45,8 @@ void ChannelChange::Update()
4545 player_manager_->ResetStage();
4646 manager_accessor_->set_world_manager(WorldManagerPtr());
4747
48+ ResourceManager::ClearModelHandle();
49+
4850 command_manager_->Write(network::ServerUpdateAccountProperty(CHANNEL, network::Utils::Serialize(channel_)));
4951
5052 auto channel_ptr = command_manager_->channels().at(channel_);
--- a/client/scene/MainLoop.cpp
+++ b/client/scene/MainLoop.cpp
@@ -176,13 +176,14 @@ void MainLoop::Draw()
176176
177177 UILabel label_;
178178 label_.set_width(160);
179+ auto text = _T("【") + unicode::ToTString(warp_point.name) + _T("】");
179180 if (distance < 50) {
180- label_.set_text(unicode::ToTString(warp_point.name) + _T("\nMキーで転送します"));
181+ text += _T("\nMキーで転送します");
181182 label_.set_bgcolor(UIBase::Color(255,0,0,150));
182183 } else {
183- label_.set_text(unicode::ToTString(warp_point.name));
184184 label_.set_bgcolor(UIBase::Color(0,0,0,150));
185185 }
186+ label_.set_text(text);
186187 label_.set_textcolor(UIBase::Color(255,255,255,255));
187188
188189 label_.set_left(x - 60);
Binary files a/client/scene/Title.cpp and b/client/scene/Title.cpp differ
--- a/client/ui/Input.cpp
+++ b/client/ui/Input.cpp
@@ -8,7 +8,7 @@
88
99 const size_t Input::TEXT_BUFFER_SIZE = 1024;
1010 const size_t Input::HISTORY_MAX_SIZE = 50;
11-const int Input::KEY_REPEAT_FRAME = 8;
11+const int Input::KEY_REPEAT_FRAME = 6;
1212
1313 const int Input::INPUT_MARGIN_X = 8;
1414 const int Input::INPUT_MARGIN_Y = 6;
@@ -19,12 +19,9 @@ const int Input::IME_MARGIN_Y = 16;
1919 const int Input::IME_MAX_PAGE_SIZE = 6;
2020 const int Input::IME_MIN_WIDTH = 120;
2121
22-Input::Input(ConfigManagerPtr config_manager) :
22+Input::Input() :
2323 multiline_(true),
24- reverse_color_(false),
25- drag_flag_(false),
26- rightmenu_show_(false),
27- config_manager_(config_manager)
24+ reverse_color_(false)
2825 {
2926 input_bg_image_handle_ = ResourceManager::LoadCachedDivGraph<4>(
3027 _T("system/images/gui/gui_inputbox_input_bg.png"), 2, 2, 12, 12);
@@ -48,104 +45,6 @@ Input::Input(ConfigManagerPtr config_manager) :
4845 y_ = 100;
4946 width_ = 160;
5047 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);
14948 }
15049
15150 void Input::Draw()
@@ -260,98 +159,12 @@ void Input::Draw()
260159 }
261160 }
262161
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+ }
355168
356169 // カーソルを描画
357170 if (clause_lines_.size() <= 0 && active() && blink_count_ < 30) {
@@ -445,21 +258,11 @@ void Input::Draw()
445258 }
446259 }
447260 }
448- {
449- if ( rightmenu_show_ ) {
450- right_click_list_.Draw();
451- }
452- }
453261 }
454262
455263 void Input::Update()
456264 {
457265 blink_count_ = (blink_count_ + 1) % 60;
458- {
459- if ( rightmenu_show_ ) {
460- right_click_list_.Update();
461- }
462- }
463266 }
464267
465268 void Input::ProcessInput(InputManager* input)
@@ -468,11 +271,7 @@ void Input::ProcessInput(InputManager* input)
468271 return;
469272 }
470273
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);
476275
477276 // bool first_key_shift = (input->GetKeyCount(KEY_INPUT_RSHIFT) == 1
478277 // || input->GetKeyCount(KEY_INPUT_LSHIFT) == 1);
@@ -493,7 +292,6 @@ void Input::ProcessInput(InputManager* input)
493292 + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0;
494293 bool push_repeat_key_down = (input->GetKeyCount(KEY_INPUT_DOWN)
495294 + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0;
496-
497295 // bool push_long_backspace = (input->GetKeyCount(KEY_INPUT_BACK) > 60 * 1.5);
498296
499297 auto input_text = text();
@@ -609,184 +407,7 @@ void Input::ProcessInput(InputManager* input)
609407 }
610408
611409 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)を取得
790411 cursor_byte_pos = GetKeyInputCursorPosition(input_handle_);
791412 if (prev_cursor_pos_ != cursor_byte_pos) {
792413 ResetCursorCount();
@@ -794,7 +415,6 @@ void Input::ProcessInput(InputManager* input)
794415
795416 prev_cursor_pos_ = cursor_byte_pos;
796417
797-
798418 // カーソルのドット単位の位置を取得する
799419 cursor_dot_pos = GetDrawStringWidthToHandle(String, cursor_byte_pos,
800420 font_handle_);
@@ -1001,7 +621,6 @@ void Input::ProcessInput(InputManager* input)
1001621 TCHAR c = *it;
1002622 int width = GetDrawStringWidthToHandle(&c, 1, font_handle_);
1003623 line_buffer += tstring(&c, 1);
1004- char_count++;
1005624 #else
1006625 unsigned char c = *it;
1007626 TCHAR string[2] = { 0, 0 };
@@ -1040,7 +659,7 @@ void Input::ProcessInput(InputManager* input)
1040659 && cursor_moveto_x_ <= line_width + width
1041660 && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_
1042661 && 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_);
1044663 cursor_moveto_x_ = -1;
1045664 cursor_moveto_y_ = -1;
1046665 }
@@ -1097,14 +716,6 @@ void Input::ProcessInput(InputManager* input)
1097716 if (active()) {
1098717 input->CancelKeyCountAll();
1099718 }
1100-
1101- if ( rightmenu_show_ ) {
1102- right_click_list_.ProcessInput(input);
1103- if( push_mouse_left ) {
1104- rightmenu_show_ = false;
1105- }
1106- }
1107-
1108719 }
1109720
1110721 bool Input::active()
@@ -1204,51 +815,6 @@ void Input::set_on_enter(const CallbackFunc& func)
1204815 on_enter_ = func;
1205816 }
1206817
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-
1252818 bool Input::reverse_color() const
1253819 {
1254820 return reverse_color_;
--- a/client/ui/Input.hpp
+++ b/client/ui/Input.hpp
@@ -8,20 +8,16 @@
88 #include <functional>
99 #include "../ResourceManager.hpp"
1010 #include "../InputManager.hpp"
11-#include "../ConfigManager.hpp"
12-#include "include.hpp"
13-#include <boost/enable_shared_from_this.hpp>
1411
15-class Input{
12+class Input {
1613 typedef std::function<bool(const std::string&)> CallbackFunc;
1714
1815 public:
19- Input(ConfigManagerPtr config_manager);
16+ Input();
2017
2118 void Draw();
2219 void Update();
2320 void ProcessInput(InputManager* input);
24- void Init();
2521
2622 bool active();
2723 void set_active(bool flag);
@@ -49,9 +45,6 @@ class Input{
4945
5046 void set_on_enter(const CallbackFunc& func);
5147
52- tstring selecting_text() const;
53- void paste_text(tstring text);
54-
5548 public:
5649 void CancelSelect();
5750
@@ -80,20 +73,12 @@ class Input{
8073 std::vector<std::pair<int, int>> selecting_lines_;
8174 std::vector<std::pair<int, int>> clause_lines_;
8275 std::vector<std::pair<int, int>> selecting_clause_lines_;
83- std::pair<int, int> selecting_coursorpoint_;
84- bool drag_flag_;
8576
8677 CallbackFunc on_enter_;
8778 tstring message_;
8879
8980 bool reverse_color_;
9081 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_;
9782
9883 private:
9984 const static size_t TEXT_BUFFER_SIZE;
--- a/client/ui/InputBox.cpp
+++ b/client/ui/InputBox.cpp
@@ -44,7 +44,7 @@ InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) :
4444 manager_accessor_(manager_accessor),
4545 card_(std::make_shared<Card>(manager_accessor_, "", "immo", "", "",
4646 std::vector<std::string>())),
47- input_(manager_accessor->config_manager().lock())
47+ input_()
4848
4949 {
5050 absolute_rect_ = Rect(100, 100, 800, 100);
@@ -103,7 +103,6 @@ InputBox::InputBox(const ManagerAccessorPtr& manager_accessor) :
103103
104104 return true;
105105 });
106- input_.Init();
107106 }
108107
109108 InputBox::~InputBox()
--- a/client/ui/UILabel.cpp
+++ b/client/ui/UILabel.cpp
@@ -255,6 +255,7 @@ void UILabel::UpdatePosition()
255255
256256 for (auto it = char_width_list_.begin(); it != char_width_list_.end(); ++it) {
257257 if ( text_[text_cursor] == _T('\n')) {
258+ line_width = 0;
258259 line_num++;
259260 substr_list_.push_back(text_cursor);
260261 substr_list_.push_back(text_cursor + 1);
--- a/package.py
+++ b/package.py
@@ -36,6 +36,7 @@ def make_full_package(model = True):
3636 zip.write(os.path.join(base_dir, 'mmd.txt'), 'mmd.txt')
3737
3838 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')
3940
4041 zip.write(os.path.join(bin_path, 'config.json'), 'config.json')
4142 zip.write(os.path.join(bin_path, 'server/server.exe'), 'server/server.exe')
@@ -96,6 +97,7 @@ def make_server_package():
9697 bin_path = os.path.join(base_dir, 'client/bin/')
9798 zip.write(os.path.join(bin_path, 'server/server.exe'), 'server.exe')
9899 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')
99101
100102 zip.close()
101103
Show on old repository browser