Commit 22495953e9be03eb76ca6d14f4579b5d3fb62078
1 parent
d28ecdb0
打开多点触控,开启游戏时使用hud遮罩
Showing
8 changed files
with
33 additions
and
3 deletions
ios/Podfile
ios/Runner/Runner-Bridging-Header.h
ios/Runner/Wowgame/Classes/game_animal/AniSettingsLayer.cpp
... | ... | @@ -124,6 +124,8 @@ bool AniSettingsLayer::init(float width, float height, std::function<void(int)> |
124 | 124 | // adjust the weird menu post-layout // quick fix |
125 | 125 | menuCenter->setPositionY(webLinkButton->getBoundingBox().getMinY() - menuItemAbout->getBoundingBox().size.height - paddingTop); |
126 | 126 | |
127 | + menuCenter->setVisible(false); | |
128 | + | |
127 | 129 | return true; |
128 | 130 | } |
129 | 131 | ... | ... |
ios/Runner/Wowgame/Classes/game_food/SettingsLayer.cpp
... | ... | @@ -144,6 +144,8 @@ bool SettingsLayer::init(float width, float height, std::function<void(int)> onL |
144 | 144 | |
145 | 145 | menuCenter->setPosition(lowerStuffContainer->getContentSize().width/2, lowerStuffContainer->getContentSize().height/2); |
146 | 146 | |
147 | + menuCenter->setVisible(false); | |
148 | + | |
147 | 149 | wholeContainer->setContentSize(cocos2d::Size(getContentSize().width, upperStuffContainer->getContentSize().height + lowerStuffContainer->getContentSize().height + paddingBottom + paddingTop)); |
148 | 150 | wholeContainer->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); |
149 | 151 | wholeContainer->setPosition(width/2, height/2); | ... | ... |
ios/Runner/Wowgame/Classes/game_halloween/HSettingsLayer.cpp
... | ... | @@ -99,6 +99,8 @@ bool HSettingsLayer::init(float width, float height, std::function<void(int)> on |
99 | 99 | |
100 | 100 | menuCenter->setPosition(lowerStuffContainer->getContentSize().width/2, lowerStuffContainer->getContentSize().height/2); |
101 | 101 | |
102 | + menuCenter->setVisible(false); | |
103 | + | |
102 | 104 | wholeContainer->wrapContents(); |
103 | 105 | wholeContainer->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); |
104 | 106 | wholeContainer->setPosition(width/2, height/2); | ... | ... |
ios/Runner/Wowgame/Classes/game_toy/ToySettingsLayer.cpp
... | ... | @@ -109,6 +109,8 @@ bool ToySettingsLayer::init(float width, float height, std::function<void(int)> |
109 | 109 | |
110 | 110 | menuCenter->setPosition(lowerStuffContainer->getContentSize().width/2, lowerStuffContainer->getContentSize().height/2); |
111 | 111 | |
112 | + menuCenter->setVisible(false); | |
113 | + | |
112 | 114 | wholeContainer->setContentSize(cocos2d::Size(getContentSize().width, upperStuffContainer->getContentSize().height + lowerStuffContainer->getContentSize().height + paddingTop)); |
113 | 115 | wholeContainer->setAnchorPoint(cocos2d::Vec2(0.5, 0.5)); |
114 | 116 | wholeContainer->setPosition(width/2, height/2); | ... | ... |
ios/Runner/Wowgame/WowGameClasses/WowGameCocosManager.mm
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | #include "cocos2d.h" |
11 | 11 | |
12 | 12 | #import "CocosAppDelegate.h" |
13 | +#import <DMProgressHUD.h> | |
13 | 14 | |
14 | 15 | @interface WowGameCocosManager () { |
15 | 16 | cocos2d::Application *_app; |
... | ... | @@ -50,10 +51,24 @@ static CocosAppDelegate cocosAppDelegate; |
50 | 51 | [self.gameViewController dismissViewControllerAnimated:YES completion:nil]; |
51 | 52 | } |
52 | 53 | |
54 | +static DMProgressHUD *hud; | |
53 | 55 | - (void)runGame:(NSInteger)gameid { |
54 | 56 | UIWindow *window = UIApplication.sharedApplication.delegate.window; |
55 | 57 | UIViewController *rootvc = window.rootViewController; |
56 | - if ([rootvc isKindOfClass:WowGameViewController.class]) { | |
58 | + | |
59 | + hud = [DMProgressHUD showHUDAddedTo:window maskType:DMProgressHUDMaskTypeClear]; | |
60 | + hud.loadingType = DMProgressHUDLoadingTypeIndicator;//默认 | |
61 | + hud.text = @"Waiting..."; | |
62 | + | |
63 | + if ([rootvc isKindOfClass:WowGameViewController.class] || | |
64 | + [rootvc.presentedViewController isKindOfClass:WowGameViewController.class]) { | |
65 | + if ([NSThread isMainThread]) { | |
66 | + [hud dismiss]; | |
67 | + } else { | |
68 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
69 | + [hud dismiss]; | |
70 | + }); | |
71 | + } | |
57 | 72 | return; |
58 | 73 | } |
59 | 74 | if (!self.gameViewController) { |
... | ... | @@ -67,6 +82,13 @@ static CocosAppDelegate cocosAppDelegate; |
67 | 82 | } else { |
68 | 83 | cocos2d::Director::getInstance()->resume(); |
69 | 84 | } |
85 | + if ([NSThread isMainThread]) { | |
86 | + [hud dismiss]; | |
87 | + } else { | |
88 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
89 | + [hud dismiss]; | |
90 | + }); | |
91 | + } | |
70 | 92 | |
71 | 93 | [rootvc presentViewController:self.gameViewController animated:YES completion:nil]; |
72 | 94 | ... | ... |
ios/Runner/Wowgame/WowGameClasses/WowGameViewController.mm
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | numberOfSamples: cocos2d::GLViewImpl::_multisamplingCount ]; |
29 | 29 | |
30 | 30 | // Enable or disable multiple touches |
31 | - [eaglView setMultipleTouchEnabled:NO]; | |
31 | + [eaglView setMultipleTouchEnabled:YES]; | |
32 | 32 | |
33 | 33 | // Set EAGLView as view of RootViewController |
34 | 34 | self.view = eaglView; | ... | ... |