Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from lanjuzi/master
Update ==> 增加游戏作弊功能 by @lanjuzi
- Loading branch information
Showing
27 changed files
with
1,924 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// EmoticonGameCheat.h | ||
// | ||
// Created by lanjuzi on 2017/9/22. | ||
// Copyright © 2017年 lanjuzi. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "zhPopupController.h" | ||
#import "zhFullView.h" | ||
#import "zhIconLabel.h" | ||
|
||
@interface EmoticonGameCheat : NSObject | ||
|
||
+ (void)showEoticonCheat:(NSInteger)uiGameType callback:(void (^)(NSInteger random))callback; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// EmoticonGameCheat.m | ||
// | ||
// Created by lanjuzi on 2017/9/22. | ||
// Copyright © 2017年 lanjuzi. All rights reserved. | ||
// | ||
|
||
#import "EmoticonGameCheat.h" | ||
|
||
@implementation EmoticonGameCheat | ||
|
||
+ (void)showEoticonCheat:(NSInteger)uiGameType callback:(void (^)(NSInteger random))callback { | ||
NSArray *array; | ||
if (uiGameType == 1) { | ||
array = @[@[@1, @"剪刀"], @[@2, @"石头"], @[@3, @"布"]]; | ||
} else if (uiGameType == 2) { | ||
array = @[@[@4, @"1"], @[@5, @"2"], @[@6, @"3"], @[@7, @"4"], @[@8, @"5"], @[@9, @"6"]]; | ||
} else { | ||
NSLog(@"不支持的 uiGameType 类型: %ld", (long)uiGameType); | ||
return; | ||
} | ||
|
||
CGRect frame = [[UIApplication sharedApplication] keyWindow].rootViewController.view.frame; | ||
zhFullView *fullView = [[zhFullView alloc] initWithFrame:frame andRows:uiGameType]; | ||
|
||
NSMutableArray *models = [NSMutableArray arrayWithCapacity:array.count]; | ||
for (NSArray *arr in array) { | ||
zhIconLabelModel *item = [zhIconLabelModel new]; | ||
|
||
if ([arr[0] intValue] > 0) { | ||
if ([arr[0] intValue] > 3) { | ||
NSString *imagePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"dice_%@", arr[1]] ofType:@"pic"]; | ||
item.icon = [UIImage imageWithContentsOfFile:imagePath]; | ||
} else { | ||
NSString *jsb; | ||
switch ([arr[0] intValue]) { | ||
case 1: | ||
jsb = @"JSB_J"; | ||
break; | ||
case 2: | ||
jsb = @"JSB_S"; | ||
break; | ||
case 3: | ||
jsb = @"JSB_B"; | ||
break; | ||
default: | ||
jsb = @"JSB_S"; | ||
break; | ||
} | ||
NSString *imagePath = [[NSBundle mainBundle] pathForResource:jsb ofType:@"pic"]; | ||
item.icon = [UIImage imageWithContentsOfFile:imagePath]; | ||
} | ||
} | ||
item.text = arr[1]; | ||
[models addObject:item]; | ||
} | ||
fullView.models = models; | ||
|
||
fullView.didClickFullView = ^(zhFullView * _Nonnull fullView) { | ||
[self.zh_popupController dismiss]; | ||
}; | ||
|
||
fullView.didClickItems = ^(zhFullView *fullView, NSInteger index) { | ||
self.zh_popupController.didDismiss = ^(zhPopupController * _Nonnull popupController) { | ||
callback([array[index][0] intValue]); | ||
}; | ||
|
||
[fullView endAnimationsCompletion:^(zhFullView *fullView) { | ||
[self.zh_popupController dismiss]; | ||
}]; | ||
}; | ||
|
||
self.zh_popupController = [zhPopupController popupControllerWithMaskType:zhPopupMaskTypeWhiteBlur]; | ||
self.zh_popupController.allowPan = YES; | ||
[self.zh_popupController presentContentView:fullView]; | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// UIColor+Extend.h | ||
// categoryKitDemo | ||
// | ||
// Created by zhanghao on 2016/7/23. | ||
// Copyright © 2016年 zhanghao. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface UIColor (Extend) | ||
|
||
+ (UIColor *)randomColor; | ||
+ (instancetype)r:(uint8_t)r g:(uint8_t)g b:(uint8_t)b alphaComponent:(CGFloat)alpha; | ||
+ (instancetype)r:(uint8_t)r g:(uint8_t)g b:(uint8_t)b; | ||
+ (instancetype)r:(uint8_t)r g:(uint8_t)g b:(uint8_t)b a:(uint8_t)a; | ||
+ (instancetype)rgba:(NSUInteger)rgba; | ||
+ (instancetype)colorWithHexString:(NSString*)hexString; | ||
|
||
- (NSUInteger)rgbaValue; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// UIColor+Extend.m | ||
// categoryKitDemo | ||
// | ||
// Created by zhanghao on 2016/7/23. | ||
// Copyright © 2016年 zhanghao. All rights reserved. | ||
// | ||
|
||
#import "UIColor+Extend.h" | ||
|
||
@implementation UIColor (Extend) | ||
|
||
+ (UIColor *)randomColor { | ||
NSInteger aRedValue = arc4random() % 255; | ||
NSInteger aGreenValue = arc4random() % 255; | ||
NSInteger aBlueValue = arc4random() % 255; | ||
UIColor *randColor = [UIColor colorWithRed:aRedValue / 255.0f green:aGreenValue / 255.0f blue:aBlueValue / 255.0f alpha:1.0f]; | ||
return randColor; | ||
} | ||
|
||
+ (instancetype)r:(uint8_t)r g:(uint8_t)g b:(uint8_t)b alphaComponent:(CGFloat)alpha { | ||
return [[self r:r g:g b:b] colorWithAlphaComponent:alpha]; | ||
} | ||
|
||
+ (instancetype)r:(uint8_t)r g:(uint8_t)g b:(uint8_t)b { | ||
return [self r:r g:g b:b a:0xff]; | ||
} | ||
|
||
+ (instancetype)r:(uint8_t)r g:(uint8_t)g b:(uint8_t)b a:(uint8_t)a { | ||
return [self colorWithRed:r / 255. green:g / 255. blue:b / 255. alpha:a / 255.]; | ||
} | ||
|
||
+ (instancetype)rgba:(NSUInteger)rgba { | ||
return [self r:(rgba >> 24)&0xFF g:(rgba >> 16)&0xFF b:(rgba >> 8)&0xFF a:rgba&0xFF]; | ||
} | ||
|
||
+ (instancetype)colorWithHexString:(NSString *)hexString { | ||
if (!hexString) | ||
return nil; | ||
|
||
NSString* hex = [NSString stringWithString:hexString]; | ||
if ([hex hasPrefix:@"#"]) | ||
hex = [hex substringFromIndex:1]; | ||
|
||
if (hex.length == 6) | ||
hex = [hex stringByAppendingString:@"FF"]; | ||
else if (hex.length != 8) | ||
return nil; | ||
|
||
uint32_t rgba; | ||
NSScanner* scanner = [NSScanner scannerWithString:hex]; | ||
[scanner scanHexInt:&rgba]; | ||
return [UIColor rgba:rgba]; | ||
} | ||
|
||
- (NSUInteger)rgbaValue { | ||
CGFloat r, g, b, a; | ||
if ([self getRed:&r green:&g blue:&b alpha:&a]) { | ||
NSUInteger rr = (NSUInteger)(r * 255 + 0.5); | ||
NSUInteger gg = (NSUInteger)(g * 255 + 0.5); | ||
NSUInteger bb = (NSUInteger)(b * 255 + 0.5); | ||
NSUInteger aa = (NSUInteger)(a * 255 + 0.5); | ||
|
||
return (rr << 24) | (gg << 16) | (bb << 8) | aa; | ||
} else { | ||
return 0; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// UIScreen+Extend.h | ||
// categoryKitDemo | ||
// | ||
// Created by zhanghao on 2016/7/23. | ||
// Copyright © 2016年 zhanghao. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface UIScreen (Extend) | ||
|
||
+ (CGSize)size; | ||
+ (CGSize)sizeSwap; | ||
+ (CGFloat)width; | ||
+ (CGFloat)height; | ||
+ (CGFloat)scale; | ||
|
||
@end |
Oops, something went wrong.