TCShowLiveView.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. //
  2. // TCShowLiveView.h
  3. // TCShow
  4. //
  5. // Created by AlexiChen on 16/4/14.
  6. // Copyright © 2016年 AlexiChen. All rights reserved.
  7. // 左右滑动层
  8. #import <UIKit/UIKit.h>
  9. #import "GiftView.h"
  10. #import "AddGiftRunLoop.h"
  11. #import "GetGiftRunLoop.h"
  12. #import "ShopGoodsUIView.h"
  13. #import "TCShowLiveTopView.h"
  14. #import "TCShowLiveMessageView.h"
  15. #import "TCShowLiveBottomView.h"
  16. #import "TCShowLiveInputView.h"
  17. #import "GoldFlowView.h"
  18. #import "LiveGameModel.h"
  19. #import "GameDataModel.h"
  20. #import "GameHistoryView.h"
  21. #import "GameWinView.h"
  22. #import "ApplyBankerView.h"
  23. #import "GameBankerModel.h"
  24. #import "GameBankerView.h"
  25. #import "SelectBankerView.h"
  26. #import "ExchangeCoinView.h"
  27. #import "MoreToolsView.h"
  28. #import "BMPopBaseView.h"
  29. #import "GuessSizeView.h"
  30. //心愿view
  31. #import "MGShowLiveWishView.h"
  32. //贵族中心view
  33. #import "MGShowVIPListView.h"
  34. #import "TCShowVoiceBottomView.h"
  35. @class TCShowLiveView;
  36. /**
  37. 用来给SDK层的代理
  38. */
  39. @protocol TCShowLiveViewForSDKDelegate <NSObject>
  40. @optional
  41. /**
  42. 隐藏回放时的滚动条
  43. @param isHided 是否需要隐藏 YES:隐藏 NO:显示
  44. */
  45. - (void)hideReLiveSlide:(BOOL)isHided;
  46. /**
  47. 主播点击屏幕时,判断是否点击了连麦窗口
  48. @param touch UITouch
  49. */
  50. - (void)hostReceiveTouch:(UITouch *)touch;
  51. //点击语音房间麦位麦克风
  52. -(void)clickVoiceMic:(TCShowLiveView *)showLiveView;
  53. //点击more
  54. -(void)clickVoiceMore:(TCShowLiveView *)showLiveView;
  55. /**
  56. PC直播或者PC回播,观众端的点击全屏事件
  57. */
  58. - (void)clickFullScreen;
  59. @end
  60. /**
  61. 给Service层的代理
  62. */
  63. @protocol TCShowLiveViewServiceDelegate <NSObject>
  64. @optional
  65. // 观众在直播间点击分享按钮
  66. - (void)clickShareBtn:(TCShowLiveView *)showLiveView;
  67. // 显示充值
  68. - (void)rechargeView:(TCShowLiveView *)showLiveView;
  69. // 钻石兑换游戏币
  70. - (void)exchangeCoin:(NSString *)diamond;
  71. // 连麦
  72. - (void)clickMikeBtn:(TCShowLiveView *)showLiveView;
  73. // IM
  74. - (void)clickIM:(TCShowLiveView *)showLiveView;
  75. // face
  76. - (void)clickFace:(TCShowLiveView *)showLiveView;
  77. - (void)clickMusic:(TCShowLiveView *)showLiveView;
  78. // 星店
  79. - (void)clickStarShop:(TCShowLiveView *)showLiveView;
  80. // 拍卖
  81. - (void)clickAuction:(TCShowLiveView *)showLiveView;
  82. // 点击空白
  83. - (void)clickBlank:(TCShowLiveView *)showLiveView;
  84. //点击pk列表
  85. - (void)clickPkList:(TCShowLiveView *)showLiveView;
  86. //点击购物view
  87. - (void)clickShowShopView:(TCShowLiveView *)showLiveView;
  88. //点击pk列表
  89. - (void)clickWishView:(TCShowLiveView *)showLiveView;
  90. //点击房间管理
  91. - (void)clickRoomManage:(TCShowLiveView *)showLiveView;
  92. // 删除底部的微信,qq,映客好友
  93. - (void)moveAddFriendView;
  94. - (void)closeGoodsView:(TCShowLiveView *)showLiveView;
  95. // 游戏
  96. - (void)clickGameBtn:(TCShowLiveView *)showLiveView;
  97. // 点击空白关闭插件中心列表
  98. - (void)closeGamesView:(TCShowLiveView *)showLiveView;
  99. // 我的小店
  100. - (void)clickMyShop:(TCShowLiveView *)showLiveView;
  101. // 观众点击更多按钮
  102. - (void)clickMoreTools:(TCShowLiveView *)showLiveView;
  103. - (void)closeRechargeView:(TCShowLiveView *)showLiveView;
  104. //点击关闭按钮
  105. -(void)clickCloseBtn:(TCShowLiveView *)showLiveView;
  106. @end
  107. /**
  108. 给UI层的代理
  109. */
  110. @protocol TCShowLiveViewForUIDelegate <NSObject>
  111. // 切换付费
  112. - (void)clickChangePay:(TCShowLiveView *)showLiveView;
  113. // 提档
  114. - (void)clickMention:(TCShowLiveView *)showLiveView;
  115. - (void)changePayViewFrame:(TCShowLiveView *)showLiveView;
  116. // 显示音效设置界面
  117. - (void)showSoundSetView:(TCShowLiveView *)showLiveView;
  118. // 显示贵族中心界面
  119. - (void)showVipView:(TCShowLiveView *)showLiveView;
  120. @end
  121. @interface TCShowLiveView : BGBaseView <TCShowLiveBottomViewDelegate, GiftViewDelegate,UIGestureRecognizerDelegate,GoldFlowViewDelegate,TCShowLiveInputViewDelegate,ApplyBankerViewDelegate,SelectBankerViewDelegate,ExchangeCoinViewDelegate,MoreToolsViewDelegate,GuessSizeViewDelegate,GameWinViewDelegate>
  122. {
  123. @protected
  124. TCShowLiveTopView *_topView;
  125. TCShowLiveMessageView *_msgView;
  126. TCShowLiveBottomView *_bottomView;
  127. TCShowLiveInputView *_liveInputView;
  128. UIView *_historyBgView; // 游戏记录显示时的黑色背景
  129. UIView *_winBgView; // 游戏获胜时的黑色背景
  130. UIView *_bankerBgView; // 申请上庄视图背景
  131. GameHistoryView *_gamehistoryView; // 游戏记录视图
  132. GameWinView *_gameWinView; // 押注获胜视图
  133. ExchangeCoinView *_exchangeView; // 兑换
  134. CGPoint _goldPoint; // 押注获胜金额的点位置
  135. CGPoint _coinPoint; // 余额金币的中心位置
  136. CGFloat _goldFlowerViewHeiht; // 炸金花视图的高度
  137. BOOL _goldViewCanNotSee;
  138. @protected
  139. __weak id<FWShowLiveRoomAble> _liveItem;
  140. GiftView *_giftView;
  141. CGFloat _giftViewHeight; // GiftView的高度
  142. ShopGoodsUIView *_shopGoodsView; // 星店视图
  143. NSString *_roomIDStr; // 房间ID
  144. id<FWLiveControllerAble> _liveController; // 当前SDK控制类
  145. UIButton *_soundSetBt; //音效button
  146. }
  147. @property (nonatomic, weak) id<TCShowLiveViewForSDKDelegate> sdkDelegate;
  148. @property (nonatomic, weak) id<TCShowLiveViewServiceDelegate> serveceDelegate;
  149. @property (nonatomic, weak) id<TCShowLiveViewForUIDelegate> uiDelegate;
  150. @property (nonatomic, assign) BOOL isHost; // 是否主播
  151. @property (nonatomic, assign) BOOL canApplyConnectMike; // 是否还能够申请连麦
  152. @property (nonatomic, strong) TCShowLiveInputView *liveInputView;
  153. @property (nonatomic, readonly) TCShowLiveTopView *topView;
  154. @property (nonatomic, readonly) TCShowLiveMessageView *msgView;
  155. @property (nonatomic, readonly) TCShowLiveBottomView *bottomView;
  156. @property (nonatomic, copy) TCShowVoiceBottomView *voicebottomView;
  157. @property (nonatomic, copy) NSString *share_type; // 分享类型
  158. @property (nonatomic, copy) NSString *private_share; // 私人分享
  159. @property (nonatomic, strong) GiftView *giftView; // 礼物列表视图
  160. @property (nonatomic, strong) ApplyBankerView *bankerView; // 申请上庄视图
  161. @property (nonatomic, assign) BOOL canShowLightMessage; // 是否能够显示点亮消息到直播间消息列表
  162. @property (nonatomic, assign) NSInteger currentDiamonds; // 当前账户钻石数量
  163. @property (nonatomic, assign) NSInteger currentCoin; // 当前账户游戏币数量
  164. @property (nonatomic, assign) NSInteger live_in; // 当前视频状态,对应的枚举为:FW_LIVE_STATE
  165. @property (nonatomic, assign) BOOL hadClickStarShop;
  166. @property (nonatomic, strong) MoreToolsView *moreToolsView;
  167. @property (nonatomic, copy) NSString *toolsTitle;
  168. @property (nonatomic, strong) CurrentLiveInfo *currentLiveInfo;
  169. @property (nonatomic, strong) MenuButton *closeLiveBtn; // 关闭推流按钮(不是关闭直播间按钮)
  170. @property (nonatomic, strong) BMPopBaseView *dailyTaskPop; // 每日任务的view
  171. @property(nonatomic, assign) BOOL is_voice;
  172. /**
  173. *@pragma : 游戏相关
  174. **/
  175. @property (nonatomic, strong) GoldFlowView *goldFlowerView; // 炸金花
  176. @property (nonatomic, strong) UIView *historyBgView; // 游戏记录显示时的黑色背景
  177. @property (nonatomic, strong) UIView *winBgView; // 游戏获胜时的黑色背景
  178. @property (nonatomic, strong) UIView *bankerBgView; // 申请上庄视图背景
  179. @property (nonatomic, strong) GameHistoryView *gamehistoryView; // 游戏记录视图
  180. @property (nonatomic, strong) GameWinView *gameWinView; // 押注获胜视图
  181. @property (nonatomic, strong) ExchangeCoinView *exchangeView; // 兑换
  182. @property (nonatomic, assign) CGFloat goldFlowerViewHeiht; // 炸金花视图的高度
  183. @property (nonatomic, assign) BOOL goldViewCanNotSee;
  184. @property (nonatomic, assign) BOOL bankerViewCanSee; // 能否出现上庄视图
  185. @property (nonatomic, assign) NSInteger gameId; // 游戏ID
  186. @property (nonatomic, strong) LiveGameModel *liveGameModel; // 直播间游戏实体
  187. @property (nonatomic, strong) GameDataModel *gameDataModel; // 游戏数据
  188. @property (nonatomic, assign) NSInteger game_log_id; // 游戏id(游戏轮数id)
  189. @property (nonatomic, strong) NSMutableArray *gameDataArray; // 在直播间接收到的一轮游戏推送信息
  190. @property (nonatomic, strong) NSMutableArray *coinImgArray; // 金币下落的图片数组
  191. @property (nonatomic, assign) BOOL shouldReloadGame; // 前后台切换后需要重新加载游戏数据
  192. @property (nonatomic, strong) NSMutableArray *gameArray; // 存放用户前后台切换过程中的推送数据
  193. @property (nonatomic, assign) int coinWindowNumber; // 展示金币弹窗次数
  194. @property (nonatomic, assign) BOOL canNotLoadData;
  195. @property (nonatomic, assign) BOOL sureOnceGame; // 用于确保调用get_video之后返回的数据和由推送获取到的数据只执行其中之一
  196. @property (nonatomic, assign) NSInteger banker_status; // 上庄状态,0:未开启上庄,1:玩家申请上庄,2:玩家上庄
  197. @property (nonatomic, assign) GameBankerModel *gameBankerModel;
  198. @property (nonatomic, strong) GameBankerView *gameBankerView;
  199. @property (nonatomic, strong) NSMutableArray *bankerListArr;
  200. @property (nonatomic, strong) SelectBankerView *selectctBankerView;
  201. @property (nonatomic, strong) NSArray *bankerSwitchArray;
  202. @property (nonatomic, strong) NSMutableArray *bankerDataArr; // 用于进行前后台切换时存放切回前台时的上庄相关的消息
  203. @property (nonatomic, assign) BOOL isArc;
  204. @property (nonatomic, assign) int gameAction;
  205. @property (nonatomic, assign) BOOL hadBeginNext;
  206. @property (nonatomic, assign) double timestamp; // 时间戳
  207. @property (nonatomic, strong) GuessSizeView *guessSizeView; // 猜大小游戏视图
  208. @property (nonatomic, assign) BOOL guessSizeViewCanNotSee;
  209. @property(nonatomic, strong) MGShowLiveWishView *livewWishView;//直播心愿view(左侧)
  210. @property(nonatomic, strong) UIButton *liveVipBtn;//贵族列表(右侧)
  211. /**
  212. 初始化房间信息等
  213. @param liveItem 房间信息
  214. @param liveController 直播VC
  215. @return self
  216. */
  217. - (instancetype)initWith:(id<FWShowLiveRoomAble>)liveItem liveController:(id<FWLiveControllerAble>)liveController;
  218. /**
  219. 请求完接口后,刷新直播间相关信息
  220. @param liveItem 视频Item
  221. @param liveInfo get_video2接口获取下来的数据实体
  222. */
  223. - (void)refreshLiveItem:(id<FWShowLiveRoomAble>)liveItem liveInfo:(CurrentLiveInfo *)liveInfo;
  224. - (void)addOwnViews;
  225. - (void)hideInputView;
  226. // 开始直播
  227. - (void)startLive;
  228. // 暂停直播
  229. - (void)pauseLive;
  230. // 重新开始直播
  231. - (void)resumeLive;
  232. // 结束直播
  233. - (void)endLive;
  234. - (void)onRecvLight:(NSString *)lightName;
  235. #if kSupportIMMsgCache
  236. - (void)onRecvPraise:(AVIMCache *)cache;
  237. #endif
  238. - (void)onTapBlank:(UITapGestureRecognizer *)tap;
  239. // 隐藏giftView
  240. - (void)hiddenGiftView;
  241. -(void)showGiftView:(NSString *)uid;
  242. /**
  243. *@pragma : 游戏相关
  244. **/
  245. //异步请求直播间数据
  246. - (void)loadGameData;
  247. //主播调
  248. - (void)addGameView;
  249. //观众调
  250. - (void)loadGoldFlowerViewWithBetArray:(NSArray *) betArray withGameID:(NSInteger)gameID;
  251. //移除游戏历史和游戏获胜视图
  252. - (void)removeGameHistoryAndGameWin;
  253. - (void)gameOverWithCustomMessageModel:(CustomMessageModel *)customMessageModel;
  254. - (void)gameAllMessageWithCustomMessageModel:(CustomMessageModel *)customMessageModel;
  255. - (void)gameBankerMessageWithCustomMessageModel:(CustomMessageModel *)customMessageModel;
  256. - (void)disAboutClick;
  257. - (void)beginGame;
  258. - (void)closeGitfView;
  259. @end