GoldFlowView.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. //
  2. // GoldFlowView.h
  3. // GoldenFlowerDemo
  4. //
  5. // Created by GuoMs on 16/11/17.
  6. // Copyright © 2016年 zcd. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <AVFoundation/AVFoundation.h>
  10. #import "PokerView.h"
  11. #import "PokerDownView.h"
  12. #import "CoinView.h"
  13. #import "BetView.h"
  14. #import "BullPoker.h"
  15. #import "TexasPokerLeftAndRight.h"
  16. #import "TexasPokerBetween.h"
  17. #import "GameGainModel.h"
  18. @class GoldFlowView;
  19. @protocol GoldFlowViewDelegate <NSObject>
  20. // 显示充值
  21. - (void)clickRecharge;
  22. //让游戏记录弹出
  23. - (void)displayGameHistory;
  24. //弹出游戏获胜视图
  25. - (void)displayGameWinWithGainModel:(GameGainModel *)gainModel;
  26. //倒计时还是5秒时主动请求接口,防止推送接收不到出现的问题
  27. -(void)reloadGameData;
  28. -(void)choseArcOrMrcGameWithView:(GoldFlowView *)goldFlowView ;
  29. @end
  30. @interface GoldFlowView : UIView<CAAnimationDelegate,UIGestureRecognizerDelegate,BetViewDelegate>
  31. {
  32. BullPoker *_bullPokerView;//存放五张扑克牌(斗牛)
  33. PokerView *_pokerView;//存放三张扑克牌炸金花)
  34. TexasPokerLeftAndRight *_texasLR;//存放左右两边的扑克牌(德州扑克)
  35. TexasPokerBetween *_texasBetween;//存放中间的五张扑克牌(德州扑克)
  36. PokerDownView *_pokerDownView;//存放押注视图
  37. BetView *_historyView;
  38. BetView *_gameOverView;//游戏结束
  39. UILabel *_timeLable;//显示倒计时
  40. NetHttpsManager *_httpManager;
  41. GlobalVariables *_BuguLive;
  42. CGPoint _amountPoint; //押注金额的中心位置
  43. CGPoint _betPoint; //押注视图的中心位置
  44. CGPoint _coinPoint; //金币余额的中心位置
  45. CGPoint _winCoinPoint; //游戏胜利金额的中心位置
  46. NSInteger _bet; //押注区域选项
  47. NSInteger _betCount; //押注金额的选项
  48. NSString *_betMoney; //押注金额
  49. UIImageView *_breathImg; //金币动画的图片
  50. BOOL _isClick; //是否点击
  51. }
  52. @property (nonatomic, assign) BOOL isArc;
  53. @property (nonatomic, strong) BetView *arcOrMrcGameView;
  54. @property (nonatomic, strong) AVAudioPlayer *audioPlayer;//声音播放器
  55. @property (weak, nonatomic) id<GoldFlowViewDelegate>delegate;
  56. @property (nonatomic, strong) CoinView *coinView;//底部金币视图
  57. @property (nonatomic, strong) UIView *firstView;//第一副牌胜
  58. @property (nonatomic, strong) UIView *secondView;//第二副牌胜
  59. @property (nonatomic, strong) UIView *thirdView;//第三副牌胜
  60. @property (nonatomic, strong) BetView *betView;//第三副牌胜
  61. @property (strong, nonatomic) UIImageView *willStartIMG;
  62. @property (strong, nonatomic) UIImageView *animationIMG;//游戏的背景图片
  63. @property (strong, nonatomic) UIImageView *movingIMG;//移动的图片
  64. @property (nonatomic, strong) NSMutableArray * betImageArray; //装三个放押注数据的图的数组
  65. @property (nonatomic, strong) NSMutableArray * betMoneyLabArray;//押注数据的label的数组
  66. @property (nonatomic, strong) NSMutableArray * pokerArray; //9张牌
  67. @property (nonatomic, strong) NSMutableArray * animationArray;//动画组
  68. @property (nonatomic, strong) NSMutableArray * coinMoveArray; //金币移动的位置
  69. @property (nonatomic, strong) NSMutableArray * coinBtnArray; //选择押注金额的按钮的数组
  70. @property (nonatomic, strong) NSMutableArray * breathImgArray; //呼吸灯图片数组
  71. @property (nonatomic, strong) NSMutableArray * coinBeignArray; //押注金额的开始位置的数组
  72. @property (nonatomic, strong) NSMutableArray * betViewArray; //押注视图的数组
  73. @property (nonatomic, strong) NSMutableArray * betArr;
  74. @property (nonatomic, strong) NSMutableArray * userBetArr;
  75. @property (nonatomic, strong) NSTimer * prokerTimer;
  76. @property (nonatomic, assign) NSInteger count;
  77. @property (nonatomic, assign) NSInteger currentMoney; //当前账户余额
  78. @property (nonatomic)BOOL isStartOpenCard;//判断是否开始开牌
  79. @property (nonatomic)BOOL isStopAnimation;//判断是否发牌结束
  80. @property (nonatomic, strong) UIImageView *compareImg;//开始比较牌的大小
  81. @property (nonatomic,copy) NSString * game_log_id;
  82. @property (nonatomic, strong) NSMutableArray * smallArray;//装上面三组扑克牌视图的数组
  83. @property (nonatomic, assign) BOOL canBet;//可以点击下注
  84. @property (nonatomic, assign) BOOL isHost;//是否是主播
  85. @property (nonatomic, assign) BOOL canCloseGame;//是否可以结束游戏(防止重复点击)
  86. @property (nonatomic, assign) BOOL banker; //是否是主播
  87. @property (nonatomic, strong) NSArray * betOptionArray;//投注金额选项
  88. @property (nonatomic, assign) CGFloat width;
  89. @property (nonatomic, assign) CGFloat height;
  90. @property (nonatomic, strong) UIImageView * alarmClock;//倒计时闹钟
  91. @property (nonatomic, strong) NSMutableArray * betLabelArr;//押注label数组
  92. @property (nonatomic, strong) NSMutableArray * userBetLabelArr;//个人押注label数组
  93. @property (nonatomic, strong) dispatch_source_t gameTimer;//GCD定时器
  94. @property (nonatomic, strong) CAAnimationGroup * groupAntimation;
  95. @property (nonatomic, strong) NSTimer * showPokerTimer;
  96. @property (nonatomic, strong) NSDictionary * dic;
  97. @property (nonatomic, copy) NSString * game_id;
  98. @property (nonatomic, assign) int gameAction;
  99. -(instancetype)initWithFrame:(CGRect)frame withBetArray:(NSArray *)betArray withIsHost:(BOOL ) isHost;
  100. /**
  101. 创建扑克牌视图
  102. @param hiden:创建时候是否隐藏视图
  103. @param type:游戏的类型
  104. @param card:存放需要创建视图时候需要的扑克牌
  105. */
  106. -(void)creatPokerhiden:(BOOL)hiden gameType:(NSString *)type card:(NSArray *)card;
  107. /**
  108. 创建押注视图
  109. @param hiden:创建视图时候是否需要隐藏
  110. @param type:游戏的类型
  111. */
  112. -(void)creatBetAmount:(BOOL)hiden type:(NSString *)type;
  113. /**
  114. 发牌结束进入倒计时操作(主播端)
  115. @param time:本局游戏所剩下的时间
  116. */
  117. -(void)overPokerKJTime:(int)time;
  118. /**
  119. 倒计时(观众端)
  120. @param time:本局游戏所剩下的时间
  121. */
  122. -(void)timeCountDown:(int)time;
  123. /**
  124. 是否能够进行押注
  125. @param isBet:判断当前是否能够押注
  126. */
  127. - (void)whetherBet:(BOOL)isBet;
  128. /**
  129. 关闭发牌音效
  130. */
  131. -(void)closeVideo;
  132. /**
  133. 游戏准备
  134. @param type:游戏类型(炸金花是1,斗牛是2 ,3德州扑克)
  135. @param card:存放扑克牌
  136. */
  137. -(void)gameToPrepareTypeGoldenFlowerOrBull:(NSString *)type card:(NSArray *)card;
  138. /**
  139. 即将发牌等待中
  140. @param type:游戏类型
  141. */
  142. -(void)beAbleToLicensingType:(NSString *)type;
  143. /**
  144. 正在发牌
  145. @param type:游戏类型
  146. */
  147. -(void)licensingGameTypeGoldenFlowerOrBull:(NSString *)type;
  148. /**
  149. * 游戏结束之后更新余额
  150. * @param ID:游戏ID
  151. */
  152. - (void)updateCoinWithID:(NSString *)ID;
  153. /**
  154. 开牌比较大小(倒计时未结束)
  155. @param leftdic :存放第一副牌
  156. @param betweendic:存放第二副牌
  157. @param rigthdic :存放第三副牌
  158. @param result :三副牌的结果
  159. @param gameid :游戏id
  160. */
  161. -(void)startOpenCard:(NSDictionary *)leftdic between:(NSDictionary *)betweendic rigth:(NSDictionary *)rigthdic andResult:(NSInteger )result gameId:(id)gameid;
  162. /**
  163. 开牌比较大小(倒计时结束)
  164. @param leftdic :存放第一副牌
  165. @param betweendic:存放第二副牌
  166. @param rigthdic :存放第三副牌
  167. @param result :三副牌的结果
  168. @param gameid :游戏id
  169. */
  170. -(void)startOpenCard2:(NSDictionary *)leftdic between2:(NSDictionary *)betweendic rigth2:(NSDictionary *)rigthdic andResult:(NSInteger )result;
  171. /**
  172. *加载押注数据
  173. *@param betArray:存放押注数据
  174. */
  175. //-(void)loadBetDataWith:(NSArray *)betArray;
  176. /**
  177. 押注发送请求
  178. @param str:传入游戏轮数
  179. @param tag:按钮的tag
  180. */
  181. - (void)postBetMoneyStr:(NSString *)str withTag:(NSInteger)tag;
  182. /**
  183. *押注按钮颜色变化
  184. @param coin:传入金额
  185. */
  186. - (void)judgmentBetView:(NSInteger)coin;
  187. /**
  188. 获取开牌数据
  189. @param gameDataArray:开牌游戏数据
  190. */
  191. -(void)openCardWith:(NSArray *)gameDataArray;
  192. -(void)loadBetDataWithBetArray:(NSArray *)betArray andUserBetArray:(NSArray *)userBetArray;
  193. /**
  194. @param optionArray:
  195. */
  196. -(void)loadOptionArray:(NSArray *)optionArray;
  197. /**
  198. 获取呼吸灯和起始位置
  199. @param tag:按钮的tag值
  200. */
  201. - (void)getCoinBreathAndPoint:(NSInteger)tag;
  202. -(void)cancelTimer;
  203. -(void)endAnmination;
  204. //直播间关闭时关闭游戏相关的所有定时器
  205. -(void)closeGameAboutTimer;
  206. -(void)showPokerWithData:(NSArray *)dataPoker andResult:(NSString *)result;
  207. @end