Commit 86a25e19 authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

wheel

parent 53d8f47e
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/>
...@@ -34,21 +35,9 @@ ...@@ -34,21 +35,9 @@
</connections> </connections>
</button> </button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7k7-WV-MqR"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7k7-WV-MqR">
<rect key="frame" x="114.5" y="223.5" width="149" height="70"/> <rect key="frame" x="116" y="223.5" width="146.5" height="70"/>
<attributedString key="attributedText"> <attributedString key="attributedText">
<fragment content="0"> <fragment content="0.00">
<attributes>
<color key="NSColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<font key="NSFont" metaFont="system" size="58"/>
</attributes>
</fragment>
<fragment content=".">
<attributes>
<color key="NSColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<font key="NSFont" size="58" name=".SFNS-Regular"/>
</attributes>
</fragment>
<fragment content="00">
<attributes> <attributes>
<color key="NSColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="NSColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<font key="NSFont" metaFont="system" size="58"/> <font key="NSFont" metaFont="system" size="58"/>
...@@ -57,26 +46,26 @@ ...@@ -57,26 +46,26 @@
<fragment content="元"> <fragment content="元">
<attributes> <attributes>
<color key="NSColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="NSColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<font key="NSFont" size="28" name=".PingFangSC-Regular"/> <font key="NSFont" metaFont="system" size="28"/>
</attributes> </attributes>
</fragment> </fragment>
</attributedString> </attributedString>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="恭喜上榜" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5tD-2K-GfI"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="恭喜获得红包奖励" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5tD-2K-GfI">
<rect key="frame" x="116" y="82" width="146" height="43"/> <rect key="frame" x="44" y="82" width="290.5" height="43"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="36"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="36"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="highlightedColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="第0名" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1ce-bN-Yiy"> <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="第0名" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1ce-bN-Yiy">
<rect key="frame" x="162.5" y="145" width="53" height="24"/> <rect key="frame" x="162.5" y="145" width="53" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/> <fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>
<constraint firstItem="5tD-2K-GfI" firstAttribute="centerY" secondItem="r6z-et-N8I" secondAttribute="centerY" multiplier="0.4" id="0N1-On-us6"/> <constraint firstItem="5tD-2K-GfI" firstAttribute="centerY" secondItem="r6z-et-N8I" secondAttribute="centerY" multiplier="0.4" id="0N1-On-us6"/>
<constraint firstItem="7k7-WV-MqR" firstAttribute="centerY" secondItem="r6z-et-N8I" secondAttribute="centerY" id="16W-7o-Taa"/> <constraint firstItem="7k7-WV-MqR" firstAttribute="centerY" secondItem="r6z-et-N8I" secondAttribute="centerY" id="16W-7o-Taa"/>
......
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "组 2@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "组 2@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "组 2@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "组 2@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
...@@ -151,6 +151,7 @@ This method is called when video ad is about to close. ...@@ -151,6 +151,7 @@ This method is called when video ad is about to close.
*/ */
- (void)nativeExpressRewardedVideoAdWillClose:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd{ - (void)nativeExpressRewardedVideoAdWillClose:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd{
NSLog(@"close"); NSLog(@"close");
rewardedVideoAd = nil;
// if (self.adsFinishCallBack) { // if (self.adsFinishCallBack) {
// self.adsFinishCallBack(true, nil); // self.adsFinishCallBack(true, nil);
// } // }
......
...@@ -49,8 +49,9 @@ ...@@ -49,8 +49,9 @@
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="t4G-Kb-nWs"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="t4G-Kb-nWs">
<rect key="frame" x="95" y="622" width="224" height="58.5"/> <rect key="frame" x="95" y="622" width="224" height="58.5"/>
<fontDescription key="fontDescription" type="system" pointSize="23"/> <fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="免费抽奖" backgroundImage="wheel_btn_bg"/> <inset key="titleEdgeInsets" minX="0.0" minY="24" maxX="0.0" maxY="0.0"/>
<state key="normal" backgroundImage="wheel_btn_free"/>
<connections> <connections>
<action selector="startBtn:" destination="Drb-cr-bUK" eventType="touchUpInside" id="ReI-2A-bXq"/> <action selector="startBtn:" destination="Drb-cr-bUK" eventType="touchUpInside" id="ReI-2A-bXq"/>
</connections> </connections>
...@@ -271,9 +272,9 @@ ...@@ -271,9 +272,9 @@
<image name="setting_copy" width="70" height="28"/> <image name="setting_copy" width="70" height="28"/>
<image name="setting_underLine" width="307" height="2"/> <image name="setting_underLine" width="307" height="2"/>
<image name="wheel_bg" width="375" height="667"/> <image name="wheel_bg" width="375" height="667"/>
<image name="wheel_btn_bg" width="224" height="58.5"/> <image name="wheel_btn_free" width="224" height="58.5"/>
<image name="wheel_cancel" width="38.5" height="38"/> <image name="wheel_cancel" width="38.5" height="38"/>
<image name="wheel_corona" width="348" height="348"/> <image name="wheel_corona" width="341" height="341"/>
<image name="wheel_header" width="203.5" height="89"/> <image name="wheel_header" width="203.5" height="89"/>
<image name="wheel_point_select" width="72" height="99.5"/> <image name="wheel_point_select" width="72" height="99.5"/>
<systemColor name="systemBackgroundColor"> <systemColor name="systemBackgroundColor">
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
@property (nonatomic, assign) BOOL isVideo; @property (nonatomic, assign) BOOL isVideo;
@property (nonatomic, strong) dispatch_source_t timer;
@end @end
#define perSection M_PI*2/8 #define perSection M_PI*2/8
...@@ -37,13 +39,29 @@ ...@@ -37,13 +39,29 @@
[self.navigationController setNavigationBarHidden:true animated:true]; [self.navigationController setNavigationBarHidden:true animated:true];
_countLab.text = [NSString stringWithFormat:@"剩余次数:0"]; _countLab.text = [NSString stringWithFormat:@"剩余次数:0"];
[_startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_free"] forState:(UIControlStateNormal)];
[[CGNetworkTools shared] getWithAction:getWheelSurfList parameters:@{} success:^(id _Nonnull response) { [[CGNetworkTools shared] getWithAction:getWheelSurfList parameters:@{} success:^(id _Nonnull response) {
NSString * countDownSecond = [[[response objectForKey:@"result"] objectForKey:@"data"] objectForKey:@"countDownSecond"]; NSString * countDownSecond = [[[response objectForKey:@"result"] objectForKey:@"data"] objectForKey:@"countDownSecond"];
NSString * lotteryNum = [[[response objectForKey:@"result"] objectForKey:@"data"] objectForKey:@"lotteryNum"]; NSString * lotteryNum = [[[response objectForKey:@"result"] objectForKey:@"data"] objectForKey:@"lotteryNum"];
NSString * showVideo = [[[response objectForKey:@"result"] objectForKey:@"data"] objectForKey:@"showVideo"]; NSString * showVideo = [[[response objectForKey:@"result"] objectForKey:@"data"] objectForKey:@"showVideo"];
self.isVideo = [showVideo integerValue] != 0;
if (self.isVideo) {
[self getVideoDataSource];
}
if (self.isVideo){
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_video"] forState:(UIControlStateNormal)];
}else{
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_free"] forState:(UIControlStateNormal)];
}
if([lotteryNum integerValue] == 0){
self.startBtn.userInteractionEnabled = false;
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_time"] forState:(UIControlStateNormal)];
[self countDown:[countDownSecond integerValue]];
}
NSArray * turntables = [[[response objectForKey:@"result"] objectForKey:@"data"] objectForKey:@"turntables"]; NSArray * turntables = [[[response objectForKey:@"result"] objectForKey:@"data"] objectForKey:@"turntables"];
self.turntablesModelList = [[NSMutableArray alloc] init]; self.turntablesModelList = [[NSMutableArray alloc] init];
for (NSDictionary * dic in turntables) { for (NSDictionary * dic in turntables) {
...@@ -63,6 +81,11 @@ ...@@ -63,6 +81,11 @@
- (IBAction)startBtn:(UIButton *)sender{ - (IBAction)startBtn:(UIButton *)sender{
if (self.isVideo) {
[[GYAdsManager shared] play];
return;
}
//奖励类型 1 水滴 2 果子 3 种子 4 金币 5 加速剂 6 现金红包 //奖励类型 1 水滴 2 果子 3 种子 4 金币 5 加速剂 6 现金红包
[[CGNetworkTools shared] postWithAction:WheelSurf parameters:@{} success:^(id _Nonnull response) { [[CGNetworkTools shared] postWithAction:WheelSurf parameters:@{} success:^(id _Nonnull response) {
...@@ -91,11 +114,16 @@ ...@@ -91,11 +114,16 @@
} }
self.remainderCount = model.lotteryNum; self.remainderCount = model.lotteryNum;
if (model.showVideo != 0){ self.isVideo = [model.showVideo integerValue] != 0;
self.isVideo = true; if (self.isVideo) {
[self getVideoDataSource];
} }
if([model.lotteryNum integerValue] == 0){
self.startBtn.userInteractionEnabled = false;
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_time"] forState:(UIControlStateNormal)];
[self countDown:[model.countDownSecond integerValue]];
}
NSArray * seedIndexs = @[@1, @3, @5]; NSArray * seedIndexs = @[@1, @3, @5];
NSArray * goldIndexs = @[@2, @4, @6]; NSArray * goldIndexs = @[@2, @4, @6];
...@@ -142,8 +170,20 @@ ...@@ -142,8 +170,20 @@
- (void)getVideoDataSource{ - (void)getVideoDataSource{
[[GYAdsManager shared] initWithAdsType:Video_ads window:self.view.window currentVC:self flowBgView:nil callBack:^(BOOL result, UIView * _Nullable flowView) { [[GYAdsManager shared] initWithAdsType:Video_ads window:self.view.window currentVC:self flowBgView:nil callBack:^(BOOL result, UIView * _Nullable flowView) {
if (result && flowView) { // if (result && flowView) {
[[GYAdsManager shared] play]; // [[GYAdsManager shared] play];
// }
if (result && !flowView) {
self.isVideo = false;
if (self.isVideo){
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_video"] forState:(UIControlStateNormal)];
}else{
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_free"] forState:(UIControlStateNormal)];
}
if([self.remainderCount integerValue] == 0){
self.startBtn.userInteractionEnabled = false;
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_time"] forState:(UIControlStateNormal)];
}
} }
}]; }];
...@@ -209,6 +249,52 @@ ...@@ -209,6 +249,52 @@
_countLab.text = [NSString stringWithFormat:@"剩余次数:%@", _remainderCount]; _countLab.text = [NSString stringWithFormat:@"剩余次数:%@", _remainderCount];
// self.needleImgView.image = [UIImage imageNamed:@"lottery_start_needle_enable"]; // self.needleImgView.image = [UIImage imageNamed:@"lottery_start_needle_enable"];
// self.textImgView.image = [UIImage imageNamed:@"lottery_state_start"]; // self.textImgView.image = [UIImage imageNamed:@"lottery_state_start"];
if (self.isVideo){
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_video"] forState:(UIControlStateNormal)];
}else{
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_free"] forState:(UIControlStateNormal)];
}
if([_remainderCount integerValue] == 0){
self.startBtn.userInteractionEnabled = false;
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_time"] forState:(UIControlStateNormal)];
}
}
- (void)countDown:(NSInteger)secondsCountDown{
// __weak __typeof(self) weakSelf = self;
if (_timer == nil) {
__block NSInteger timeout = secondsCountDown; // 倒计时时间
if (timeout!=0) {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0), 1.0*NSEC_PER_SEC, 0); //每秒执行
dispatch_source_set_event_handler(_timer, ^{
timeout --;
if(timeout <= 0){ // 当倒计时结束时做需要的操作: 关闭 活动到期不能提交
dispatch_source_cancel(self.timer);
self.timer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_free"] forState:(UIControlStateNormal)];
[self.startBtn setTitle:nil forState:UIControlStateNormal];
});
} else { // 倒计时重新计算 时/分/秒
NSInteger hours = (int)((timeout)/3600);
NSInteger minute = (int)(timeout-hours*3600)/60;
NSInteger second = timeout - hours*3600 - minute*60;
dispatch_async(dispatch_get_main_queue(), ^{
[self.startBtn setBackgroundImage:[UIImage imageNamed:@"wheel_btn_time"] forState:(UIControlStateNormal)];
[self.startBtn setTitle:[NSString stringWithFormat:@"%02ld:%02ld:%02ld", hours, minute, second] forState:UIControlStateNormal];
});
}
});
dispatch_resume(_timer);
}
}
} }
@end @end
...@@ -78,8 +78,8 @@ ...@@ -78,8 +78,8 @@
filePath = "GYDemo/GYDemo/SCAds/GYAdsManager+RewardedVideo.m" filePath = "GYDemo/GYDemo/SCAds/GYAdsManager+RewardedVideo.m"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "181" startingLineNumber = "182"
endingLineNumber = "181" endingLineNumber = "182"
landmarkName = "-nativeExpressRewardedVideoAdDidPlayFinish:didFailWithError:" landmarkName = "-nativeExpressRewardedVideoAdDidPlayFinish:didFailWithError:"
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
...@@ -87,50 +87,18 @@ ...@@ -87,50 +87,18 @@
<BreakpointProxy <BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent <BreakpointContent
uuid = "47C4763B-F203-47AC-A17F-612EF67749E0" uuid = "11E6103D-C6C4-4AC2-89BA-27EAD730297C"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "GYDemo/GYDemo/SCAds/GYAdsManager+RewardedVideo.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "154"
endingLineNumber = "154"
landmarkName = "-nativeExpressRewardedVideoAdWillClose:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "1AA2D2EB-F818-4350-A2B6-5F21A6F1D10B"
shouldBeEnabled = "Yes" shouldBeEnabled = "Yes"
ignoreCount = "0" ignoreCount = "0"
continueAfterRunningActions = "No" continueAfterRunningActions = "No"
filePath = "GYDemo/GYDemo/ViewController/GYWheelSurfViewController.m" filePath = "GYDemo/GYDemo/ViewController/GYWheelSurfViewController.m"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "92" startingLineNumber = "122"
endingLineNumber = "92" endingLineNumber = "122"
landmarkName = "-startBtn:" landmarkName = "-startBtn:"
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "9031C09E-48A5-4595-B88E-6056A5D38B07"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "GYDemo/GYDemo/ViewController/GYWheelSurfViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "43"
endingLineNumber = "43"
landmarkName = "-viewDidLoad"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment