Revisión | 7ad45337ec050e56afa6027c8436da0fdff547e7 (tree) |
---|---|
Tiempo | 2012-09-28 06:39:25 |
Autor | h2so5 <h2so5@git....> |
Commiter | h2so5 |
package.pyを更新
シーン遷移の構造を少し変更
@@ -64,6 +64,12 @@ void ConfigManager::Load(const std::string& filename) | ||
64 | 64 | |
65 | 65 | void ConfigManager::Save(const std::string& filename) |
66 | 66 | { |
67 | + namespace fs = boost::filesystem; | |
68 | + auto dir_path = fs::path(filename).parent_path(); | |
69 | + if (!fs::exists(dir_path)) { | |
70 | + fs::create_directory(dir_path); | |
71 | + } | |
72 | + | |
67 | 73 | ptree pt; |
68 | 74 | |
69 | 75 | pt.put("show_nametag", show_nametag_); |
@@ -21,7 +21,11 @@ class Base : public std::enable_shared_from_this<Base> { | ||
21 | 21 | virtual void ProcessInput(InputManager*) = 0; |
22 | 22 | virtual void Draw() = 0; |
23 | 23 | virtual void End() = 0; |
24 | - virtual BasePtr NextScene() {return BasePtr();}; | |
24 | + virtual BasePtr NextScene() {return next_scene_;}; | |
25 | + | |
26 | + protected: | |
27 | + BasePtr next_scene_; | |
28 | + | |
25 | 29 | }; |
26 | 30 | |
27 | 31 | } |
@@ -97,6 +97,12 @@ void Connect::Update() | ||
97 | 97 | button_.Update(); |
98 | 98 | button_label_.Update(); |
99 | 99 | message_.Update(); |
100 | + | |
101 | + if (command_manager_->status() == CommandManager::STATUS_READY) { | |
102 | + next_scene_= std::make_shared<scene::MainLoop>(manager_accessor_); | |
103 | + } else if (return_flag_) { | |
104 | + next_scene_= std::make_shared<scene::Title>(manager_accessor_); | |
105 | + } | |
100 | 106 | } |
101 | 107 | |
102 | 108 | void Connect::ProcessInput(InputManager* input) |
@@ -119,16 +125,4 @@ void Connect::End() | ||
119 | 125 | { |
120 | 126 | } |
121 | 127 | |
122 | -BasePtr Connect::NextScene() | |
123 | -{ | |
124 | - InputManager input; | |
125 | - if (command_manager_->status() == CommandManager::STATUS_READY) { | |
126 | - return BasePtr(new scene::MainLoop(manager_accessor_)); | |
127 | - } else if (return_flag_) { | |
128 | - return BasePtr(new scene::Title(manager_accessor_)); | |
129 | - } else { | |
130 | - return BasePtr(); | |
131 | - } | |
132 | -} | |
133 | - | |
134 | 128 | } |
@@ -22,7 +22,6 @@ class Connect : public Base { | ||
22 | 22 | void ProcessInput(InputManager*); |
23 | 23 | void Draw(); |
24 | 24 | void End(); |
25 | - BasePtr NextScene(); | |
26 | 25 | |
27 | 26 | private: |
28 | 27 | void AsyncInitialize(); |
@@ -40,7 +39,6 @@ class Connect : public Base { | ||
40 | 39 | |
41 | 40 | bool return_flag_; |
42 | 41 | |
43 | - BasePtr next_scene_; | |
44 | 42 | }; |
45 | 43 | |
46 | 44 | } |
@@ -3,6 +3,7 @@ | ||
3 | 3 | // |
4 | 4 | |
5 | 5 | #include "Dashboard.hpp" |
6 | +#include "Option.hpp" | |
6 | 7 | #include "../ManagerAccessor.hpp" |
7 | 8 | #include "../AccountManager.hpp" |
8 | 9 | #include "../CommandManager.hpp" |
@@ -27,11 +28,6 @@ Dashboard::Dashboard(const ManagerAccessorPtr& manager_accessor, | ||
27 | 28 | start_count_(0), |
28 | 29 | end_count_(0) |
29 | 30 | { |
30 | - | |
31 | - // TODO: 描画をDashbordに移管するためにNullにしているが、 | |
32 | - // 紛らわしいので修正予定 | |
33 | - manager_accessor_->set_window_manager(WindowManagerWeakPtr()); | |
34 | - | |
35 | 31 | manager_accessor_->set_config_manager(config_manager_); |
36 | 32 | manager_accessor_->set_card_manager(card_manager_); |
37 | 33 | manager_accessor_->set_account_manager(account_manager_); |
@@ -50,6 +46,9 @@ Dashboard::~Dashboard() | ||
50 | 46 | |
51 | 47 | void Dashboard::Begin() |
52 | 48 | { |
49 | + // TODO: 描画をDashbordに移管するためにNullにしているが、 | |
50 | + // 紛らわしいので修正予定 | |
51 | + manager_accessor_->set_window_manager(WindowManagerWeakPtr()); | |
53 | 52 | } |
54 | 53 | |
55 | 54 | void Dashboard::Update() |
@@ -101,6 +100,13 @@ void Dashboard::ProcessInput(InputManager* input) | ||
101 | 100 | (!hover && (input->GetMouseLeftCount() == 1 || input->GetMouseRightCount() == 1))) { |
102 | 101 | end_count_++; |
103 | 102 | } |
103 | + | |
104 | + if (end_count_ > 10) { | |
105 | + next_scene_ = background_scene_; | |
106 | + } else if(input->GetKeyCount(KEY_INPUT_F1) == 1) { | |
107 | + next_scene_ = std::make_shared<Option>(manager_accessor_, background_scene_); | |
108 | + } | |
109 | + | |
104 | 110 | } |
105 | 111 | |
106 | 112 | void Dashboard::Draw() |
@@ -161,16 +167,7 @@ void Dashboard::Draw() | ||
161 | 167 | |
162 | 168 | void Dashboard::End() |
163 | 169 | { |
164 | - | |
170 | + manager_accessor_->set_window_manager(window_manager_); | |
165 | 171 | } |
166 | 172 | |
167 | -BasePtr Dashboard::NextScene() | |
168 | -{ | |
169 | - if (end_count_ > 10) { | |
170 | - manager_accessor_->set_window_manager(window_manager_); | |
171 | - return background_scene_; | |
172 | - } else { | |
173 | - return BasePtr(); | |
174 | - } | |
175 | -} | |
176 | 173 | } |
\ No newline at end of file |
@@ -25,7 +25,6 @@ class Dashboard : public Base { | ||
25 | 25 | void ProcessInput(InputManager*); |
26 | 26 | void Draw(); |
27 | 27 | void End(); |
28 | - BasePtr NextScene(); | |
29 | 28 | |
30 | 29 | private: |
31 | 30 | ManagerAccessorPtr manager_accessor_; |
@@ -25,7 +25,6 @@ class Init : public Base { | ||
25 | 25 | void Draw(); |
26 | 26 | void ProcessInput(InputManager*); |
27 | 27 | void End(); |
28 | - BasePtr NextScene(); | |
29 | 28 | |
30 | 29 | private: |
31 | 30 | void AsyncInitialize(); |
@@ -40,8 +39,6 @@ class Init : public Base { | ||
40 | 39 | int start_count_; |
41 | 40 | |
42 | 41 | boost::thread loading_thread_; |
43 | - std::shared_ptr<BasePtr> next_scene_; | |
44 | - | |
45 | 42 | std::array<ImageHandlePtr, 5> loading_image_handle_; |
46 | 43 | |
47 | 44 | boost::mutex mutex_; |
@@ -72,10 +72,23 @@ void MainLoop::Update() | ||
72 | 72 | card_manager_->Update(); |
73 | 73 | world_manager_->Update(); |
74 | 74 | ResourceManager::music()->Update(); |
75 | + | |
75 | 76 | } |
76 | 77 | |
77 | 78 | void MainLoop::ProcessInput(InputManager* input) |
78 | 79 | { |
80 | + if(world_manager_->stage()->host_change_flag()) | |
81 | + { | |
82 | + //account_manager_->set_host(world_manager_->stage()->host_change_flag().second); | |
83 | + next_scene_ = std::make_shared<scene::ServerChange>(manager_accessor_); | |
84 | + } else if (input->GetKeyCount(KEY_INPUT_F1) == 1) { | |
85 | + inputbox_->Inactivate(); | |
86 | + next_scene_ = std::make_shared<scene::Option>(manager_accessor_, shared_from_this()); | |
87 | + } else if (input->GetKeyCount(KEY_INPUT_F2) == 1) { | |
88 | + inputbox_->Inactivate(); | |
89 | + next_scene_ = std::make_shared<scene::Dashboard>(manager_accessor_, shared_from_this()); | |
90 | + } | |
91 | + | |
79 | 92 | if (auto window_manager = manager_accessor_->window_manager().lock()) { |
80 | 93 | window_manager->ProcessInput(input); |
81 | 94 | } |
@@ -99,6 +112,7 @@ void MainLoop::ProcessInput(InputManager* input) | ||
99 | 112 | SaveDrawScreenToPNG( 0, 0, config_manager_->screen_width(), config_manager_->screen_height(),tmp_str); |
100 | 113 | snapshot_number_++; |
101 | 114 | } |
115 | + | |
102 | 116 | } |
103 | 117 | |
104 | 118 | void MainLoop::Draw() |
@@ -113,24 +127,7 @@ void MainLoop::Draw() | ||
113 | 127 | |
114 | 128 | void MainLoop::End() |
115 | 129 | { |
116 | -} | |
117 | - | |
118 | -BasePtr MainLoop::NextScene() | |
119 | -{ | |
120 | - InputManager input; | |
121 | - if(world_manager_->stage()->host_change_flag()) | |
122 | - { | |
123 | - //account_manager_->set_host(world_manager_->stage()->host_change_flag().second); | |
124 | - return BasePtr(new scene::ServerChange(manager_accessor_)); | |
125 | - } else if (input.GetKeyCount(KEY_INPUT_F1) == 1) { | |
126 | - inputbox_->Inactivate(); | |
127 | - return BasePtr(new scene::Option(manager_accessor_, shared_from_this())); | |
128 | - } else if (input.GetKeyCount(KEY_INPUT_F2) == 1) { | |
129 | - inputbox_->Inactivate(); | |
130 | - return BasePtr(new scene::Dashboard(manager_accessor_, shared_from_this())); | |
131 | - } else{ | |
132 | - return nullptr; | |
133 | - } | |
130 | + next_scene_ = BasePtr(); | |
134 | 131 | } |
135 | 132 | |
136 | 133 | } |
@@ -29,7 +29,6 @@ class MainLoop : public Base { | ||
29 | 29 | void Draw(); |
30 | 30 | void ProcessInput(InputManager*); |
31 | 31 | void End(); |
32 | - BasePtr NextScene(); | |
33 | 32 | |
34 | 33 | private: |
35 | 34 | std::function<void(const tstring&)> push_message_; |
@@ -3,6 +3,7 @@ | ||
3 | 3 | // |
4 | 4 | |
5 | 5 | #include "Option.hpp" |
6 | +#include "Dashboard.hpp" | |
6 | 7 | #include "../ManagerAccessor.hpp" |
7 | 8 | #include "../ConfigManager.hpp" |
8 | 9 | #include "../CommandManager.hpp" |
@@ -89,6 +90,12 @@ void Option::Update() | ||
89 | 90 | |
90 | 91 | void Option::ProcessInput(InputManager* input) |
91 | 92 | { |
93 | + if (end_count_ > 10) { | |
94 | + next_scene_ = background_scene_; | |
95 | + } else if(input->GetKeyCount(KEY_INPUT_F2) == 1) { | |
96 | + next_scene_ = std::make_shared<Dashboard>(manager_accessor_, background_scene_); | |
97 | + } | |
98 | + | |
92 | 99 | bool hover = (base_rect_.x <= input->GetMouseX() && input->GetMouseX() <= base_rect_.x + base_rect_.width |
93 | 100 | && base_rect_.y <= input->GetMouseY() && input->GetMouseY() <= base_rect_.y + base_rect_.height); |
94 | 101 |
@@ -120,6 +127,7 @@ void Option::ProcessInput(InputManager* input) | ||
120 | 127 | } |
121 | 128 | |
122 | 129 | tabs_[selecting_tab_index]->ProcessInput(input); |
130 | + | |
123 | 131 | } |
124 | 132 | |
125 | 133 | void Option::Draw() |
@@ -211,15 +219,6 @@ void Option::End() | ||
211 | 219 | |
212 | 220 | } |
213 | 221 | |
214 | -BasePtr Option::NextScene() | |
215 | -{ | |
216 | - if (end_count_ > 10) { | |
217 | - return background_scene_; | |
218 | - } else { | |
219 | - return BasePtr(); | |
220 | - } | |
221 | -} | |
222 | - | |
223 | 222 | OptionTabBase::OptionTabBase(const tstring name, const ManagerAccessorPtr& manager_accessor) : |
224 | 223 | name_(name), |
225 | 224 | manager_accessor_(manager_accessor) |
@@ -31,7 +31,6 @@ class Option : public Base { | ||
31 | 31 | void ProcessInput(InputManager*); |
32 | 32 | void Draw(); |
33 | 33 | void End(); |
34 | - BasePtr NextScene(); | |
35 | 34 | |
36 | 35 | private: |
37 | 36 | void AsyncInitialize(); |
@@ -31,6 +31,11 @@ void ServerChange::End() | ||
31 | 31 | |
32 | 32 | void ServerChange::Update() |
33 | 33 | { |
34 | + if(world_manager_->stage()->host_change_flag()) | |
35 | + { | |
36 | + //account_manager_->set_host(world_manager_->stage()->host_change_flag().second); | |
37 | + next_scene_ = std::make_shared<scene::MainLoop>(manager_accessor_); | |
38 | + } | |
34 | 39 | } |
35 | 40 | |
36 | 41 | void ServerChange::ProcessInput(InputManager* input) |
@@ -42,16 +47,4 @@ void ServerChange::Draw() | ||
42 | 47 | { |
43 | 48 | } |
44 | 49 | |
45 | -BasePtr ServerChange::NextScene() | |
46 | -{ | |
47 | - if(world_manager_->stage()->host_change_flag()) | |
48 | - { | |
49 | - //account_manager_->set_host(world_manager_->stage()->host_change_flag().second); | |
50 | - return BasePtr(new scene::MainLoop(manager_accessor_)); | |
51 | - }else{ | |
52 | - return nullptr; | |
53 | - } | |
54 | -} | |
55 | - | |
56 | - | |
57 | 50 | } |
\ No newline at end of file |
@@ -20,15 +20,13 @@ class ServerChange : public Base{ | ||
20 | 20 | void ProcessInput(InputManager*); |
21 | 21 | void Draw(); |
22 | 22 | void End(); |
23 | - BasePtr NextScene(); | |
23 | + | |
24 | 24 | private: |
25 | 25 | ManagerAccessorPtr manager_accessor_; |
26 | 26 | CardManagerPtr card_manager_; |
27 | 27 | AccountManagerPtr account_manager_; |
28 | 28 | ConfigManagerPtr config_manager_; |
29 | 29 | WorldManagerPtr world_manager_; |
30 | - | |
31 | - BasePtr next_scene_; | |
32 | 30 | }; |
33 | 31 | |
34 | 32 | } |
\ No newline at end of file |
@@ -23,7 +23,6 @@ class Title : public Base { | ||
23 | 23 | void ProcessInput(InputManager*); |
24 | 24 | void Draw(); |
25 | 25 | void End(); |
26 | - BasePtr NextScene(); | |
27 | 26 | |
28 | 27 | private: |
29 | 28 | void AsyncInitialize(); |
@@ -41,7 +40,6 @@ class Title : public Base { | ||
41 | 40 | bool connect_flag_; |
42 | 41 | int screen_count_; |
43 | 42 | |
44 | - BasePtr next_scene_; | |
45 | 43 | }; |
46 | 44 | |
47 | 45 | } |
@@ -36,13 +36,25 @@ def make_full_package(): | ||
36 | 36 | zip.write(os.path.join(bin_path, 'config.json'), 'config.json') |
37 | 37 | zip.write(os.path.join(bin_path, 'server/server.exe'), 'server/server.exe') |
38 | 38 | |
39 | - for root, dirs, files in os.walk(os.path.join(bin_path, 'cards')): | |
39 | + for root, dirs, files in os.walk(os.path.join(bin_path, 'widgets')): | |
40 | 40 | for file in files: |
41 | 41 | absolute_path = os.path.join(root, file) |
42 | 42 | relative_path = os.path.relpath(absolute_path, bin_path) |
43 | 43 | zip.write(absolute_path, relative_path) |
44 | 44 | |
45 | - for root, dirs, files in os.walk(os.path.join(bin_path, 'resources')): | |
45 | + for root, dirs, files in os.walk(os.path.join(bin_path, 'models')): | |
46 | + for file in files: | |
47 | + absolute_path = os.path.join(root, file) | |
48 | + relative_path = os.path.relpath(absolute_path, bin_path) | |
49 | + zip.write(absolute_path, relative_path) | |
50 | + | |
51 | + for root, dirs, files in os.walk(os.path.join(bin_path, 'motions')): | |
52 | + for file in files: | |
53 | + absolute_path = os.path.join(root, file) | |
54 | + relative_path = os.path.relpath(absolute_path, bin_path) | |
55 | + zip.write(absolute_path, relative_path) | |
56 | + | |
57 | + for root, dirs, files in os.walk(os.path.join(bin_path, 'system')): | |
46 | 58 | for file in files: |
47 | 59 | absolute_path = os.path.join(root, file) |
48 | 60 | relative_path = os.path.relpath(absolute_path, bin_path) |