跨房PK的功能全部完成

This commit is contained in:
fengshuo
2022-01-12 17:44:40 +08:00
committed by chenguilong
parent 0d6975c8c3
commit d293f0022f
77 changed files with 1984 additions and 78 deletions

View File

@@ -374,6 +374,12 @@
E884C36C2743951B00E1EBED /* GiftReceiveInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E884C36B2743951B00E1EBED /* GiftReceiveInfoModel.m */; };
E884C36F2743AAC800E1EBED /* AttachmentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E884C36E2743AAC800E1EBED /* AttachmentModel.m */; };
E884C3722743AEDE00E1EBED /* CustomAttachmentDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = E884C3712743AEDE00E1EBED /* CustomAttachmentDecoder.m */; };
E88863C3278E7BCC004BCFAB /* crossRoomPk_progress.svga in Resources */ = {isa = PBXBuildFile; fileRef = E88863C2278E7BCC004BCFAB /* crossRoomPk_progress.svga */; };
E88863C6278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88863C5278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m */; };
E88863C9278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88863C8278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m */; };
E88863CC278EC336004BCFAB /* AcrossRoomPKPrizeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E88863CB278EC336004BCFAB /* AcrossRoomPKPrizeModel.m */; };
E88863CF278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88863CE278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m */; };
E88863D3278ED4C0004BCFAB /* Timestamp.m in Sources */ = {isa = PBXBuildFile; fileRef = E88863D2278ED4C0004BCFAB /* Timestamp.m */; };
E8899C7F27853B6A007944BE /* DatingMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8899C7E27853B6A007944BE /* DatingMicroView.m */; };
E8899C822785A694007944BE /* DatingInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8899C812785A694007944BE /* DatingInfoModel.m */; };
E8899C852785CC69007944BE /* XPRoomDatingAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8899C842785CC69007944BE /* XPRoomDatingAnimationView.m */; };
@@ -1316,6 +1322,17 @@
E884C36E2743AAC800E1EBED /* AttachmentModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AttachmentModel.m; sourceTree = "<group>"; };
E884C3702743AEDE00E1EBED /* CustomAttachmentDecoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomAttachmentDecoder.h; sourceTree = "<group>"; };
E884C3712743AEDE00E1EBED /* CustomAttachmentDecoder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomAttachmentDecoder.m; sourceTree = "<group>"; };
E88863C2278E7BCC004BCFAB /* crossRoomPk_progress.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = crossRoomPk_progress.svga; sourceTree = "<group>"; };
E88863C4278EAFC3004BCFAB /* XPAcrossRoomPKResultView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKResultView.h; sourceTree = "<group>"; };
E88863C5278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKResultView.m; sourceTree = "<group>"; };
E88863C7278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKForceEndResultView.h; sourceTree = "<group>"; };
E88863C8278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKForceEndResultView.m; sourceTree = "<group>"; };
E88863CA278EC336004BCFAB /* AcrossRoomPKPrizeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AcrossRoomPKPrizeModel.h; sourceTree = "<group>"; };
E88863CB278EC336004BCFAB /* AcrossRoomPKPrizeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AcrossRoomPKPrizeModel.m; sourceTree = "<group>"; };
E88863CD278EC393004BCFAB /* XPAcrossRoomPKPrizeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKPrizeView.h; sourceTree = "<group>"; };
E88863CE278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKPrizeView.m; sourceTree = "<group>"; };
E88863D1278ED4C0004BCFAB /* Timestamp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Timestamp.h; sourceTree = "<group>"; };
E88863D2278ED4C0004BCFAB /* Timestamp.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Timestamp.m; sourceTree = "<group>"; };
E8899C7D27853B6A007944BE /* DatingMicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DatingMicroView.h; sourceTree = "<group>"; };
E8899C7E27853B6A007944BE /* DatingMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DatingMicroView.m; sourceTree = "<group>"; };
E8899C802785A694007944BE /* DatingInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DatingInfoModel.h; sourceTree = "<group>"; };
@@ -2148,6 +2165,7 @@
180116F6279E8C3100F2CBC0 /* Date */,
9B17F71527BD14FF00440843 /* SVGAParserManager */,
9B8585F22788699400D7D5C6 /* KVO */,
E88863D0278ED4A0004BCFAB /* Timestamp */,
E82D5C77276B25B000858D6D /* SpriteSheetManager */,
E865964E2701A1A900846EBD /* StatisticsService */,
E89DA6612700590A008483C1 /* IAPHelper */,
@@ -3742,6 +3760,8 @@
E880B3A8278BD82300A83B0D /* AcrossRoomPKInfoModel.m */,
E8D48251278D8228003C1D08 /* AcrossRoomPKPanelModel.h */,
E8D48252278D8228003C1D08 /* AcrossRoomPKPanelModel.m */,
E88863CA278EC336004BCFAB /* AcrossRoomPKPrizeModel.h */,
E88863CB278EC336004BCFAB /* AcrossRoomPKPrizeModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -3770,6 +3790,12 @@
E8D4824F278D68BA003C1D08 /* XPAcrpssRoomPKPanelView.m */,
E8D48254278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.h */,
E8D48255278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m */,
E88863C4278EAFC3004BCFAB /* XPAcrossRoomPKResultView.h */,
E88863C5278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m */,
E88863C7278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.h */,
E88863C8278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m */,
E88863CD278EC393004BCFAB /* XPAcrossRoomPKPrizeView.h */,
E88863CE278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m */,
);
path = SubViews;
sourceTree = "<group>";
@@ -3802,6 +3828,15 @@
path = Tool;
sourceTree = "<group>";
};
E88863D0278ED4A0004BCFAB /* Timestamp */ = {
isa = PBXGroup;
children = (
E88863D1278ED4C0004BCFAB /* Timestamp.h */,
E88863D2278ED4C0004BCFAB /* Timestamp.m */,
);
path = Timestamp;
sourceTree = "<group>";
};
E8899C7C27853B46007944BE /* Dating */ = {
isa = PBXGroup;
children = (
@@ -4034,6 +4069,7 @@
E8A1E45C276220B100B294CA /* Sources */ = {
isa = PBXGroup;
children = (
E88863C2278E7BCC004BCFAB /* crossRoomPk_progress.svga */,
E8937ABF276C3ECF00B2C7E1 /* enterroom */,
E8DEC98927637EA50078CB70 /* candyTree_open.svga */,
E8DEC98A27637EA50078CB70 /* candyTree_transform.svga */,
@@ -4822,6 +4858,7 @@
E8A1E460276220DA00B294CA /* candyTree_banner.svga in Resources */,
E8937ACA276C3EDE00B2C7E1 /* svga_member_in_lv50.svga in Resources */,
E8937ACD276C3EDE00B2C7E1 /* svga_member_in_lv30.svga in Resources */,
E88863C3278E7BCC004BCFAB /* crossRoomPk_progress.svga in Resources */,
E8A1E462276220DA00B294CA /* candyTree_light.svga in Resources */,
E8937ACF276C99C300B2C7E1 /* Launch Screen.storyboard in Resources */,
9B0997A127F19D8A00EB8F14 /* README.md in Resources */,
@@ -5063,6 +5100,8 @@
189DD55A26DE39D200AB55B1 /* BaseMvpPresenter.m in Sources */,
9BC5C8F9277B02EA007C8719 /* Api+NobleCenter.m in Sources */,
180806D827293794001FD836 /* NSObject+MJExtension.m in Sources */,
E88863D3278ED4C0004BCFAB /* Timestamp.m in Sources */,
E88863CF278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m in Sources */,
189DD6FF26E20E5900AB55B1 /* HttpRequestHelper.m in Sources */,
E8788945273A55C200BF1D57 /* XPGiftInfoView.m in Sources */,
9BD63FAB277EE885006EB744 /* Api+RoomRadio.m in Sources */,
@@ -5120,6 +5159,7 @@
E84BF7DD277C765400EF8877 /* XPRoomRoleEmptyTableViewCell.m in Sources */,
E8E5E1A027C36E3F00F457D8 /* HomeBannerInfoModel.m in Sources */,
E8EEB8F426FC2050007C6EBA /* SDBrowserImageView.m in Sources */,
E88863CC278EC336004BCFAB /* AcrossRoomPKPrizeModel.m in Sources */,
E824544626F5934700BE8163 /* XPMinePayPwdPresenter.m in Sources */,
189DD54B26DE338800AB55B1 /* BaseViewController.m in Sources */,
E8B846C226FD82DC00A777FE /* XPMineUserInfoAlbumCollectionViewCell.m in Sources */,
@@ -5213,6 +5253,7 @@
E8E7DAEB2745158500C631CC /* XPGiftUserInfoModel.m in Sources */,
E83DB487274670DA00D8CBD1 /* XPRoomGiftBroadCastModel.m in Sources */,
9BCF585C279909D7008401A4 /* XPSkillCardEditPropCell.m in Sources */,
E88863C6278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m in Sources */,
E8AC722C26F49580007D6E91 /* XPMineNotificaViewController.m in Sources */,
189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */,
E83DB4842746661800D8CBD1 /* XPRoomGiftBroadcastView.m in Sources */,
@@ -5408,6 +5449,7 @@
E8412FA92779C2ED006E1101 /* XPRoomSettingItemModel.m in Sources */,
9B92A3692798145000AD168F /* XPSkillCardTypeModel.m in Sources */,
189DD58F26DF97E700AB55B1 /* LoginPresenter.m in Sources */,
E88863C9278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m in Sources */,
E896EFB22771C93B00AD2CC1 /* XPMineFriendNumberView.m in Sources */,
9BB5495F2782E9DB0090CD26 /* NobleAuthInfo.m in Sources */,
E89DA67227008D59008483C1 /* WalletInfoModel.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_panel_small_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_panel_small_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_prize_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_prize_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_prize_ko@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_prize_ko@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_fail_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_fail_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_fail_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_fail_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_fail_person_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_fail_person_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_forcednd_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_forcednd_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_forceend_blue_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_forceend_blue_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_forceend_pk_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_forceend_pk_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_forceend_red_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_forceend_red_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_pk_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_pk_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_red_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_red_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_tie_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_tie_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_tie_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_tie_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_tie_person_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_tie_person_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_win_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_win_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_win_blue_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_win_blue_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_win_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_win_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_win_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_win_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_across_pk_result_win_person_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_across_pk_result_win_person_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,20 @@
//
// Timestamp.h
// xplan-ios
//
// Created by 冯硕 on 2022/1/12.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface Timestamp : NSObject
/// 获取当前的时间戳
/// @param succes 成功
/// @param failure 失败
+ (void)getInternetDateWithSuccess:(void(^)(NSTimeInterval timeInterval))succes
failure:(void(^)(NSError *error))failure;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,68 @@
//
// Timestamp.m
// xplan-ios
//
// Created by on 2022/1/12.
//
#import "Timestamp.h"
#import "ApiHost.h"
@implementation Timestamp
///
/// @param succes
/// @param failure
+ (void)getInternetDateWithSuccess:(void(^)(NSTimeInterval timeInterval))succes
failure:(void(^)(NSError *error))failure{
//1.URL
NSString *urlString = API_HOST_URL;
urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
//2.request
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString: urlString]];
[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
[request setTimeoutInterval:5];
[request setHTTPShouldHandleCookies:FALSE];
[request setHTTPMethod:@"GET"];
//3.URLSession
NSURLSession *session = [NSURLSession sharedSession];
//4.block
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error == nil && response != nil) {
//MMMMM
NSArray *monthEnglishArray = @[@"Jan",@"Feb",@"Mar",@"Apr",@"May",@"Jun",@"Jul",@"Aug",@"Sept",@"Sep",@"Oct",@"Nov",@"Dec"];
NSArray *monthNumArray = @[@"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"09",@"10",@"11",@"12"];
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
NSDictionary *allHeaderFields = [httpResponse allHeaderFields];
NSString *dateStr = [allHeaderFields objectForKey:@"Date"];
dateStr = [dateStr substringFromIndex:5];
dateStr = [dateStr substringToIndex:[dateStr length]-4];
dateStr = [dateStr stringByAppendingString:@" +0000"];
//
for (NSInteger i = 0 ; i < monthEnglishArray.count ; i++) {
NSString *monthEngStr = monthEnglishArray[i];
NSString *monthNumStr = monthNumArray[i];
dateStr = [dateStr stringByReplacingOccurrencesOfString:monthEngStr withString:monthNumStr];
}
NSDateFormatter *dMatter = [[NSDateFormatter alloc] init];
[dMatter setDateFormat:@"dd MM yyyy HH:mm:ss Z"];
NSDate *netDate = [dMatter dateFromString:dateStr];
NSTimeInterval timeInterval = [netDate timeIntervalSince1970];
dispatch_async(dispatch_get_main_queue(), ^{
succes(timeInterval);
});
}else{
dispatch_async(dispatch_get_main_queue(), ^{
failure(error);
});
}
}];
//5
[task resume];
}
@end

View File

@@ -0,0 +1,29 @@
//
// AcrossRoomPKPrizeModel.h
// xplan-ios
//
// Created by 冯硕 on 2022/1/12.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface AcrossRoomPKPrizeModel : NSObject
///赢方UID
@property (nonatomic, copy) NSString * winUid;
///输方UID
@property (nonatomic, copy) NSString * failUid;
///赢方头像
@property (nonatomic, copy) NSString *winAvatar;
///输方头像
@property (nonatomic, copy) NSString *failAvatar;
///赢方标题
@property (nonatomic, copy) NSString *winTitle;
///输方标题
@property (nonatomic, copy) NSString *failTitle;
///描述
@property (nonatomic, copy) NSString *msg;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// AcrossRoomPKPrizeModel.m
// xplan-ios
//
// Created by on 2022/1/12.
//
#import "AcrossRoomPKPrizeModel.h"
@implementation AcrossRoomPKPrizeModel
@end

View File

@@ -0,0 +1,16 @@
//
// XPAcrossRoomPKForceEndResultView.h
// xplan-ios
//
// Created by 冯硕 on 2022/1/12.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class AcrossRoomPKPanelModel;
@interface XPAcrossRoomPKForceEndResultView : UIView
@property (nonatomic, strong) AcrossRoomPKPanelModel *data;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,279 @@
//
// XPAcrossRoomPKForceEndResultView.m
// xplan-ios
//
// Created by on 2022/1/12.
//
#import "XPAcrossRoomPKForceEndResultView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NetImageView.h"
#import "TTPopup.h"
///Model
#import "AcrossRoomPKPanelModel.h"
@interface XPAcrossRoomPKForceEndResultView()
/** bgImageView */
@property (nonatomic, strong) UIImageView *bgImageView;
///
@property (nonatomic, strong) UIButton *closeBtn;
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic, strong) UIImageView *redBgImageView;
///
@property (nonatomic, strong) NetImageView *redHeadImageView;
///
@property (nonatomic, strong) UILabel *redRoomTitleLabel;
///
@property (nonatomic, strong) UILabel *redValueLabel;
///PKicon
@property (nonatomic, strong) UIImageView *middleImageView;
///
@property (nonatomic, strong) UIImageView *blueBgImageView;
///icon
@property (nonatomic, strong) UIImageView *blueWinIconView;
///
@property (nonatomic, strong) NetImageView *blueHeadImageView;
///
@property (nonatomic, strong) UILabel *blueRoomTitleLabel;
///
@property (nonatomic, strong) UILabel *blueValueLabel;
@end
@implementation XPAcrossRoomPKForceEndResultView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initView];
[self initConstrations];
}
return self;
}
- (void)initView {
[self addSubview:self.bgImageView];
[self addSubview:self.closeBtn];
[self addSubview:self.titleLabel];
[self addSubview:self.redBgImageView];
[self addSubview:self.redHeadImageView];
[self addSubview:self.redRoomTitleLabel];
[self addSubview:self.redValueLabel];
[self addSubview:self.blueBgImageView];
[self addSubview:self.blueHeadImageView];
[self addSubview:self.blueRoomTitleLabel];
[self addSubview:self.blueValueLabel];
[self addSubview:self.middleImageView];
}
- (void)initConstrations {
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(18);
make.height.mas_equalTo(18);
}];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-17);
make.width.height.mas_equalTo(22);
make.centerY.mas_equalTo(self.titleLabel);
}];
[self.redBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(55);
make.left.mas_equalTo(17);
make.width.mas_equalTo(133);
make.height.mas_equalTo(119);
}];
[self.redHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(75);
make.left.mas_equalTo(54);
make.width.height.mas_equalTo(52);
}];
[self.redRoomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.redHeadImageView.mas_bottom).mas_offset(8);
make.centerX.mas_equalTo(self.redHeadImageView);
make.height.mas_equalTo(12);
make.left.mas_equalTo(self.redBgImageView.mas_left).mas_offset(20);
}];
[self.redValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.redHeadImageView);
make.top.mas_equalTo(self.redRoomTitleLabel.mas_bottom).offset(6);
make.height.mas_equalTo(12);
make.left.mas_equalTo(self.redBgImageView.mas_left).mas_offset(20);
}];
[self.middleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(87);
make.centerX.mas_equalTo(self);
make.width.mas_equalTo(62);
make.height.mas_equalTo(43);
}];
[self.blueBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(61);
make.right.mas_equalTo(-17);
make.width.mas_equalTo(133);
make.height.mas_equalTo(119);
}];
[self.blueHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(81);
make.right.mas_equalTo(-54);
make.width.height.mas_equalTo(52);
}];
[self.blueRoomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.blueHeadImageView.mas_bottom).mas_offset(8);
make.centerX.mas_equalTo(self.blueHeadImageView);
make.height.mas_equalTo(12);
make.left.mas_equalTo(self.blueBgImageView.mas_left).mas_offset(16);
}];
[self.blueValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.blueHeadImageView);
make.left.mas_equalTo(self.blueBgImageView.mas_left).mas_offset(16);
make.top.mas_equalTo(self.blueRoomTitleLabel.mas_bottom).offset(6);
make.height.mas_equalTo(12);
}];
}
- (void)setData:(AcrossRoomPKPanelModel *)data {
if (data) {
self.redHeadImageView.imageUrl = data.cAvatar;
self.blueHeadImageView.imageUrl = data.aAvatar;
self.redRoomTitleLabel.text = data.cTitle;
self.blueRoomTitleLabel.text = data.aTitle;
self.redValueLabel.text = [NSString stringWithFormat:@"%lld", data.cAmount];
self.blueValueLabel.text = [NSString stringWithFormat:@"%lld", data.aAmount];
}
}
- (void)onCloseBtnClick:(UIButton *)btn {
[TTPopup dismiss];
}
#pragma mark - getters and setters
- (UIImageView *)bgImageView {
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] init];
_bgImageView.image = [UIImage imageNamed:@"room_across_pk_result_forcednd_bg"];
}
return _bgImageView;
}
- (UIButton *)closeBtn {
if (!_closeBtn) {
_closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_closeBtn addTarget:self action:@selector(onCloseBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_closeBtn setImage:[UIImage imageNamed:@"room_across_pk_invite_result_close"] forState:UIControlStateNormal];
}
return _closeBtn;
}
- (UIImageView *)redBgImageView {
if (!_redBgImageView) {
_redBgImageView = [[UIImageView alloc] init];
_redBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_forceend_red_bg"];
}
return _redBgImageView;
}
- (NetImageView *)redHeadImageView {
if (!_redHeadImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_redHeadImageView = [[NetImageView alloc] initWithConfig:config];
_redHeadImageView.layer.cornerRadius = 26;
_redHeadImageView.layer.masksToBounds = YES;
_redHeadImageView.layer.borderWidth = 1;
_redHeadImageView.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _redHeadImageView;
}
- (UILabel *)redRoomTitleLabel {
if (!_redRoomTitleLabel) {
_redRoomTitleLabel = [[UILabel alloc] init];
_redRoomTitleLabel.textColor = [UIColor whiteColor];
_redRoomTitleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_redRoomTitleLabel.textAlignment = NSTextAlignmentCenter;
}
return _redRoomTitleLabel;
}
- (UILabel *)redValueLabel {
if (!_redValueLabel) {
_redValueLabel = [[UILabel alloc] init];
_redValueLabel.textColor = [UIColor whiteColor];
_redValueLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
_redValueLabel.textAlignment = NSTextAlignmentCenter;
}
return _redValueLabel;
}
- (UIImageView *)middleImageView {
if (!_middleImageView) {
_middleImageView = [[UIImageView alloc] init];
_middleImageView.image = [UIImage imageNamed:@"room_across_pk_result_forceend_pk_icon"];
}
return _middleImageView;
}
- (UIImageView *)blueBgImageView {
if (!_blueBgImageView) {
_blueBgImageView = [[UIImageView alloc] init];
_blueBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_forceend_blue_bg"];
}
return _blueBgImageView;
}
- (NetImageView *)blueHeadImageView {
if (!_blueHeadImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_blueHeadImageView = [[NetImageView alloc] initWithConfig:config];
_blueHeadImageView.layer.cornerRadius = 26;
_blueHeadImageView.layer.masksToBounds = YES;
_blueHeadImageView.layer.borderWidth = 1;
_blueHeadImageView.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _blueHeadImageView;
}
- (UILabel *)blueRoomTitleLabel {
if (!_blueRoomTitleLabel) {
_blueRoomTitleLabel = [[UILabel alloc] init];
_blueRoomTitleLabel.textColor = [UIColor whiteColor];
_blueRoomTitleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_blueRoomTitleLabel.textAlignment = NSTextAlignmentCenter;
}
return _blueRoomTitleLabel;
}
- (UILabel *)blueValueLabel {
if (!_blueValueLabel) {
_blueValueLabel = [[UILabel alloc] init];
_blueValueLabel.textColor = [UIColor whiteColor];
_blueValueLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
_blueValueLabel.textAlignment = NSTextAlignmentCenter;
}
return _blueValueLabel;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
_titleLabel.text = @"PK结束";
}
return _titleLabel;
}
@end

View File

@@ -24,7 +24,7 @@ typedef NS_ENUM(NSInteger, AcrossRoomPKPanelUserType) {
///类型
@property (nonatomic,assign) AcrossRoomPKPanelUserType type;
@property (nonatomic,strong) AcrossRoomPkRankModel * panelInfo;
@property (nonatomic,strong, nullable) AcrossRoomPkRankModel * panelInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -50,12 +50,13 @@
}];
[self.headwearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self);
make.left.right.centerY.mas_equalTo(self);
make.height.mas_equalTo(38);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self);
make.left.right.mas_equalTo(self);
make.bottom.mas_equalTo(self.headwearImageView);
make.height.mas_equalTo(self.avatarImageView.mas_width);
}];
@@ -96,7 +97,6 @@
self.headwearImageView.image = [UIImage imageNamed:headwearName];
self.avatarImageView.image = [UIImage imageNamed:avatarPlaceName];
[self.coinButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[coinColorStart, coinColorEnd] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
CGFloat width = 32;
if (self.tag == 1000) {
self.headwearImageView.hidden = NO;
} else {
@@ -112,6 +112,10 @@
NSString * amount = _panelInfo.amount.length > 0 ? _panelInfo.amount : @"";
[self.coinButton setTitle:amount forState:UIControlStateNormal];
self.coinButton.hidden = !amount;
} else {
self.avatarImageView.image = nil;
[self.coinButton setTitle:@"0" forState:UIControlStateNormal];
self.coinButton.hidden = YES;
}
}
@@ -130,6 +134,8 @@
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 32 / 2;
}
return _avatarImageView;
}

View File

@@ -0,0 +1,16 @@
//
// XPAcrossRoomPKPrizeView.h
// xplan-ios
//
// Created by 冯硕 on 2022/1/12.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class AcrossRoomPKPrizeModel;
@interface XPAcrossRoomPKPrizeView : UIView
@property (nonatomic, strong) AcrossRoomPKPrizeModel *data;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,211 @@
//
// XPAcrossRoomPKPrizeView.m
// xplan-ios
//
// Created by on 2022/1/12.
// PK
#import "XPAcrossRoomPKPrizeView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NetImageView.h"
#import "UIImage+Utils.h"
///Model
#import "AcrossRoomPKPrizeModel.h"
@interface XPAcrossRoomPKPrizeView ()
/** bgImageView */
@property (nonatomic, strong) UIImageView *bgImageView;
///
@property (nonatomic, strong) UIButton *onLookBtn;
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic, strong) NetImageView *redHeadImageView;
///
@property (nonatomic, strong) UILabel *redRoomTitleLabel;
///PKicon
@property (nonatomic, strong) UIImageView *middleImageView;
///
@property (nonatomic, strong) NetImageView *blueHeadImageView;
///
@property (nonatomic, strong) UILabel *blueRoomTitleLabel;
@end
@implementation XPAcrossRoomPKPrizeView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initView];
[self initConstrations];
}
return self;
}
- (void)initView {
[self addSubview:self.bgImageView];
[self addSubview:self.onLookBtn];
[self addSubview:self.titleLabel];
[self addSubview:self.redHeadImageView];
[self addSubview:self.redRoomTitleLabel];
[self addSubview:self.blueHeadImageView];
[self addSubview:self.blueRoomTitleLabel];
[self addSubview:self.middleImageView];
}
- (void)initConstrations {
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.redHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(12);
make.left.mas_equalTo(22);
make.width.height.mas_equalTo(44);
}];
[self.redRoomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.redHeadImageView.mas_bottom).mas_offset(8);
make.centerX.mas_equalTo(self.redHeadImageView);
make.height.mas_equalTo(12);
make.width.mas_equalTo(72);
}];
[self.middleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.redHeadImageView);
make.width.mas_equalTo(60);
make.height.mas_equalTo(40);
make.left.mas_equalTo(self.redHeadImageView.mas_right).mas_offset(9);
}];
[self.blueHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.redHeadImageView);
make.left.mas_equalTo(self.middleImageView.mas_right).mas_offset(9);
make.width.height.mas_equalTo(44);
}];
[self.blueRoomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.blueHeadImageView.mas_bottom).mas_offset(8);
make.centerX.mas_equalTo(self.blueHeadImageView);
make.height.mas_equalTo(12);
make.width.mas_equalTo(72);
}];
[self.onLookBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(50);
make.height.mas_equalTo(18);
make.right.mas_equalTo(-14);
make.bottom.mas_equalTo(-14);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.redHeadImageView);
make.right.mas_equalTo(self.onLookBtn);
make.height.mas_equalTo(14);
make.left.mas_equalTo(self.blueHeadImageView.mas_right).mas_offset(20);
}];
}
- (void)setData:(AcrossRoomPKPrizeModel *)data {
_data = data;
self.redHeadImageView.imageUrl = data.winAvatar;
self.blueHeadImageView.imageUrl = data.failAvatar;
self.redRoomTitleLabel.text = data.winTitle;
self.blueRoomTitleLabel.text = data.failTitle;
self.titleLabel.text = data.msg;
}
#pragma mark - getters and setters
- (UIImageView *)bgImageView {
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] init];
_bgImageView.image = [UIImage imageNamed:@"room_across_pk_prize_bg"];
}
return _bgImageView;
}
- (UIButton *)onLookBtn {
if (!_onLookBtn) {
_onLookBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_onLookBtn setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateNormal];
[_onLookBtn setTitle:@"来围观" forState:UIControlStateNormal];
[_onLookBtn setTitleColor:UIColorFromRGB(0xffffff) forState:UIControlStateNormal];
_onLookBtn.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_onLookBtn.userInteractionEnabled = NO;
_onLookBtn.layer.masksToBounds = YES;
_onLookBtn.layer.cornerRadius = 9;
_onLookBtn.layer.borderWidth = 1;
_onLookBtn.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _onLookBtn;
}
- (NetImageView *)redHeadImageView {
if (!_redHeadImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_redHeadImageView = [[NetImageView alloc] initWithConfig:config];
_redHeadImageView.layer.cornerRadius = 22;
_redHeadImageView.layer.masksToBounds = YES;
_redHeadImageView.layer.borderWidth = 1;
_redHeadImageView.layer.borderColor = UIColorFromRGB(0xec677d).CGColor;
}
return _redHeadImageView;
}
- (UILabel *)redRoomTitleLabel {
if (!_redRoomTitleLabel) {
_redRoomTitleLabel = [[UILabel alloc] init];
_redRoomTitleLabel.textColor = [UIColor whiteColor];
_redRoomTitleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
_redRoomTitleLabel.textAlignment = NSTextAlignmentCenter;
}
return _redRoomTitleLabel;
}
- (UIImageView *)middleImageView {
if (!_middleImageView) {
_middleImageView = [[UIImageView alloc] init];
_middleImageView.image = [UIImage imageNamed:@"room_across_pk_prize_ko"];
}
return _middleImageView;
}
- (NetImageView *)blueHeadImageView {
if (!_blueHeadImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_blueHeadImageView = [[NetImageView alloc] initWithConfig:config];
_blueHeadImageView.layer.cornerRadius = 22;
_blueHeadImageView.layer.masksToBounds = YES;
_blueHeadImageView.layer.borderWidth = 1;
_blueHeadImageView.layer.borderColor = UIColorFromRGB(0x76c1F5).CGColor;
}
return _blueHeadImageView;
}
- (UILabel *)blueRoomTitleLabel {
if (!_blueRoomTitleLabel) {
_blueRoomTitleLabel = [[UILabel alloc] init];
_blueRoomTitleLabel.textColor = [UIColor whiteColor];
_blueRoomTitleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
_blueRoomTitleLabel.textAlignment = NSTextAlignmentCenter;
}
return _blueRoomTitleLabel;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
_titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
}
return _titleLabel;
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPAcrossRoomPKResultView.h
// xplan-ios
//
// Created by 冯硕 on 2022/1/12.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class AcrossRoomPKPanelModel;
@interface XPAcrossRoomPKResultView : UIView
@property (nonatomic, strong) AcrossRoomPKPanelModel *data;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,512 @@
//
// XPAcrossRoomPKResultView.m
// xplan-ios
//
// Created by on 2022/1/12.
//
#import "XPAcrossRoomPKResultView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NetImageView.h"
#import "TTPopup.h"
///Model
#import "AcrossRoomPKPanelModel.h"
@interface XPAcrossRoomPKResultView()
/** bgImageView */
@property (nonatomic, strong) UIImageView *bgImageView;
///
@property (nonatomic, strong) UIButton *closeBtn;
///view
@property (nonatomic, strong) UIView *mainView;
///
@property (nonatomic, strong) UIImageView *redBgImageView;
///icon
@property (nonatomic, strong) UIImageView *redWinIconView;
///
@property (nonatomic, strong) NetImageView *redHeadImageView;
///
@property (nonatomic, strong) UILabel *redRoomTitleLabel;
///
@property (nonatomic, strong) UILabel *redValueLabel;
///PKicon
@property (nonatomic, strong) UIImageView *middleImageView;
///
@property (nonatomic, strong) UIImageView *blueBgImageView;
///icon
@property (nonatomic, strong) UIImageView *blueWinIconView;
///
@property (nonatomic, strong) NetImageView *blueHeadImageView;
///
@property (nonatomic, strong) UILabel *blueRoomTitleLabel;
///
@property (nonatomic, strong) UILabel *blueValueLabel;
///
@property (nonatomic, strong) UIImageView *contributeBgImageView;
///
@property (nonatomic, strong) NetImageView *contributeAvatar;
///
@property (nonatomic, strong) UIImageView *contributeHeadWear;
///
@property (nonatomic, strong) UILabel *contributeNick;
///
@property (nonatomic, strong) UILabel *contributeValue;
///
@property (nonatomic, strong) UIImageView *charmBgImageView;
///
@property (nonatomic, strong) NetImageView *charmAvatar;
///
@property (nonatomic, strong) UIImageView *charmHeadWear;
///
@property (nonatomic, strong) UILabel *charmNick;
///
@property (nonatomic, strong) UILabel *charmValue;
@end
@implementation XPAcrossRoomPKResultView
#pragma mark - life cycle
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initView];
[self initConstrations];
}
return self;
}
- (void)initView {
[self addSubview:self.bgImageView];
[self addSubview:self.closeBtn];
[self addSubview:self.mainView];
[self.mainView addSubview:self.redBgImageView];
[self.mainView addSubview:self.redWinIconView];
[self.mainView addSubview:self.redHeadImageView];
[self.mainView addSubview:self.redRoomTitleLabel];
[self.mainView addSubview:self.redValueLabel];
[self.mainView addSubview:self.blueBgImageView];
[self.mainView addSubview:self.blueWinIconView];
[self.mainView addSubview:self.blueHeadImageView];
[self.mainView addSubview:self.blueRoomTitleLabel];
[self.mainView addSubview:self.blueValueLabel];
[self.mainView addSubview:self.middleImageView];
[self.mainView addSubview:self.contributeBgImageView];
[self.mainView addSubview:self.contributeAvatar];
[self.mainView addSubview:self.contributeHeadWear];
[self.mainView addSubview:self.contributeNick];
[self.mainView addSubview:self.contributeValue];
[self.mainView addSubview:self.charmBgImageView];
[self.mainView addSubview:self.charmAvatar];
[self.mainView addSubview:self.charmHeadWear];
[self.mainView addSubview:self.charmNick];
[self.mainView addSubview:self.charmValue];
}
- (void)initConstrations {
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.mas_equalTo(0);
make.width.height.mas_equalTo(22);
}];
[self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(120);
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.bottom.mas_equalTo(-23);
}];
[self.redBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(12);
make.left.mas_equalTo(6);
make.width.mas_equalTo(151);
make.height.mas_equalTo(135);
}];
[self.redWinIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(_redBgImageView);
make.left.mas_equalTo(18);
make.width.mas_equalTo(49);
make.height.mas_equalTo(27);
}];
[self.redHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(34);
make.left.mas_equalTo(47);
make.width.height.mas_equalTo(60);
}];
[self.redRoomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.redHeadImageView.mas_bottom).mas_offset(8);
make.centerX.mas_equalTo(self.redHeadImageView);
make.height.mas_equalTo(12);
make.left.mas_equalTo(self.redBgImageView.mas_left).mas_offset(20);
}];
[self.redValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.redHeadImageView);
make.top.mas_equalTo(self.redRoomTitleLabel.mas_bottom).offset(8);
make.left.mas_equalTo(self.redBgImageView.mas_left).mas_offset(20);
}];
[self.middleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(60);
make.centerX.mas_equalTo(self.mainView);
make.width.mas_equalTo(70);
make.height.mas_equalTo(49);
}];
[self.blueBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(18);
make.right.mas_equalTo(-6);
make.width.mas_equalTo(151);
make.height.mas_equalTo(135);
}];
[self.blueWinIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.blueBgImageView);
make.right.mas_equalTo(-16);
make.width.mas_equalTo(49);
make.height.mas_equalTo(27);
}];
[self.blueHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(41);
make.right.mas_equalTo(-47);
make.width.height.mas_equalTo(60);
}];
[self.blueRoomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.blueHeadImageView.mas_bottom).mas_offset(8);
make.centerX.mas_equalTo(self.blueHeadImageView);
make.height.mas_equalTo(12);
make.left.mas_equalTo(self.blueBgImageView.mas_left).mas_offset(16);
}];
[self.blueValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.blueHeadImageView);
make.top.mas_equalTo(self.blueRoomTitleLabel.mas_bottom).offset(8);
make.left.mas_equalTo(self.blueBgImageView.mas_left).mas_offset(16);
}];
[self.contributeBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(0);
make.top.mas_equalTo(self.blueBgImageView.mas_bottom).mas_offset(10);
make.height.mas_equalTo(64);
}];
[self.contributeAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(70);
make.bottom.mas_equalTo(self.contributeBgImageView.mas_bottom).mas_offset(-6);
make.width.height.mas_equalTo(44);
}];
[self.contributeHeadWear mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contributeAvatar);
make.bottom.mas_equalTo(self.contributeAvatar);
make.width.mas_equalTo(44);
make.height.mas_equalTo(53);
}];
[self.contributeNick mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contributeHeadWear.mas_right).mas_offset(7);
make.bottom.mas_equalTo(self.contributeAvatar.mas_centerY).mas_offset(-3);
make.height.mas_equalTo(14);
make.right.mas_equalTo(-20);
}];
[self.contributeValue mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contributeNick);
make.top.mas_equalTo(self.contributeNick.mas_bottom).mas_offset(6);
make.height.mas_equalTo(13);
make.right.mas_equalTo(-20);
}];
[self.charmBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(0);
make.top.mas_equalTo(self.contributeBgImageView.mas_bottom).mas_offset(6);
make.height.mas_equalTo(64);
}];
[self.charmAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(70);
make.bottom.mas_equalTo(self.charmBgImageView.mas_bottom).mas_offset(-6);
make.width.height.mas_equalTo(44);
}];
[self.charmHeadWear mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.charmAvatar);
make.bottom.mas_equalTo(self.charmAvatar);
make.width.mas_equalTo(44);
make.height.mas_equalTo(53);
}];
[self.charmNick mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.charmHeadWear.mas_right).mas_offset(7);
make.bottom.mas_equalTo(self.charmAvatar.mas_centerY).mas_offset(-3);
make.height.mas_equalTo(14);
make.right.mas_equalTo(-20);
}];
[self.charmValue mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.charmNick);
make.top.mas_equalTo(self.charmNick.mas_bottom).mas_offset(6);
make.height.mas_equalTo(13);
make.right.mas_equalTo(-20);
}];
}
- (void)setData:(AcrossRoomPKPanelModel *)data {
if (data.winUid == data.cUid) {//
self.bgImageView.image = [UIImage imageNamed:@"room_across_pk_result_win_bg"];
self.contributeBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_win_person_bg"];
self.charmBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_win_person_bg"];
[self.closeBtn setImage:[UIImage imageNamed:@"room_across_pk_result_win_close"] forState:UIControlStateNormal];
self.redWinIconView.hidden = NO;
self.blueWinIconView.hidden = YES;
} else if (data.winUid == data.aUid) {//
self.bgImageView.image = [UIImage imageNamed:@"room_across_pk_result_fail_bg"];
self.contributeBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_fail_person_bg"];
self.charmBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_fail_person_bg"];
[self.closeBtn setImage:[UIImage imageNamed:@"room_across_pk_result_fail_close"] forState:UIControlStateNormal];
self.redWinIconView.hidden = YES;
self.blueWinIconView.hidden = NO;
} else {//
self.bgImageView.image = [UIImage imageNamed:@"room_across_pk_result_tie_bg"];
self.contributeBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_tie_person_bg"];
self.charmBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_tie_person_bg"];
[self.closeBtn setImage:[UIImage imageNamed:@"room_across_pk_result_tie_close"] forState:UIControlStateNormal];
self.redWinIconView.hidden = YES;
self.blueWinIconView.hidden = YES;
}
self.redHeadImageView.imageUrl = data.cAvatar;
self.blueHeadImageView.imageUrl = data.aAvatar;
self.redRoomTitleLabel.text = data.cTitle;
self.blueRoomTitleLabel.text = data.aTitle;
self.redValueLabel.text = [NSString stringWithFormat:@"%lld", data.cAmount];
self.blueValueLabel.text = [NSString stringWithFormat:@"%lld", data.aAmount];
if (data.csRank.count > 0) {//
AcrossRoomPkRankModel *contributeInfo = [data.csRank objectAtIndex:0];
self.contributeNick.text = contributeInfo.nick ? contributeInfo.nick : @"";
self.contributeValue.text = [NSString stringWithFormat:@"神豪值:%@", contributeInfo.amount? contributeInfo.amount : @""];
self.contributeAvatar.imageUrl = contributeInfo.avatar;
}
if (data.crRank.count > 0) {
AcrossRoomPkRankModel *charmInfo = [data.crRank objectAtIndex:0];
self.charmNick.text = charmInfo.nick ? charmInfo.nick : @"";
self.charmValue.text = [NSString stringWithFormat:@"魅力值:%@", charmInfo.amount? charmInfo.amount : @""];
self.charmAvatar.imageUrl = charmInfo.avatar;
}
}
- (void)onCloseBtnClick:(UIButton *)btn {
[TTPopup dismiss];
}
#pragma mark - getters and setters
- (UIImageView *)bgImageView {
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] init];
_bgImageView.image = [UIImage imageNamed:@"room_across_pk_result_win_bg"];
}
return _bgImageView;
}
- (UIButton *)closeBtn {
if (!_closeBtn) {
_closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_closeBtn addTarget:self action:@selector(onCloseBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _closeBtn;
}
- (UIView *)mainView {
if (!_mainView) {
_mainView = [[UIView alloc] init];
}
return _mainView;
}
- (UIImageView *)redBgImageView {
if (!_redBgImageView) {
_redBgImageView = [[UIImageView alloc] init];
_redBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_red_bg"];
}
return _redBgImageView;
}
- (UIImageView *)redWinIconView {
if (!_redWinIconView) {
_redWinIconView = [[UIImageView alloc] init];
_redWinIconView.image = [UIImage imageNamed:@"room_across_pk_result_win_icon"];
}
return _redWinIconView;
}
- (NetImageView *)redHeadImageView {
if (!_redHeadImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_redHeadImageView = [[NetImageView alloc] initWithConfig:config];
_redHeadImageView.layer.cornerRadius = 30;
_redHeadImageView.layer.masksToBounds = YES;
_redHeadImageView.layer.borderWidth = 1;
_redHeadImageView.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _redHeadImageView;
}
- (UILabel *)redRoomTitleLabel {
if (!_redRoomTitleLabel) {
_redRoomTitleLabel = [[UILabel alloc] init];
_redRoomTitleLabel.textColor = [UIColor whiteColor];
_redRoomTitleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_redRoomTitleLabel.textAlignment = NSTextAlignmentCenter;
}
return _redRoomTitleLabel;
}
- (UILabel *)redValueLabel {
if (!_redValueLabel) {
_redValueLabel = [[UILabel alloc] init];
_redValueLabel.textColor = [UIColor whiteColor];
_redValueLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
_redValueLabel.textAlignment = NSTextAlignmentCenter;
}
return _redValueLabel;
}
- (UIImageView *)middleImageView {
if (!_middleImageView) {
_middleImageView = [[UIImageView alloc] init];
_middleImageView.image = [UIImage imageNamed:@"room_across_pk_result_pk_icon"];
}
return _middleImageView;
}
- (UIImageView *)blueBgImageView {
if (!_blueBgImageView) {
_blueBgImageView = [[UIImageView alloc] init];
_blueBgImageView.image = [UIImage imageNamed:@"room_across_pk_result_win_blue_bg"];
}
return _blueBgImageView;
}
- (UIImageView *)blueWinIconView {
if (!_blueWinIconView) {
_blueWinIconView = [[UIImageView alloc] init];
_blueWinIconView.image = [UIImage imageNamed:@"room_across_pk_result_win_icon"];
}
return _blueWinIconView;
}
- (NetImageView *)blueHeadImageView {
if (!_blueHeadImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_blueHeadImageView = [[NetImageView alloc] initWithConfig:config];
_blueHeadImageView.layer.masksToBounds = YES;
_blueHeadImageView.layer.cornerRadius = 30;
_blueHeadImageView.layer.borderWidth = 1;
_blueHeadImageView.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _blueHeadImageView;
}
- (UILabel *)blueRoomTitleLabel {
if (!_blueRoomTitleLabel) {
_blueRoomTitleLabel = [[UILabel alloc] init];
_blueRoomTitleLabel.textColor = [UIColor whiteColor];
_blueRoomTitleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_blueRoomTitleLabel.textAlignment = NSTextAlignmentCenter;
}
return _blueRoomTitleLabel;
}
- (UILabel *)blueValueLabel {
if (!_blueValueLabel) {
_blueValueLabel = [[UILabel alloc] init];
_blueValueLabel.textColor = [UIColor whiteColor];
_blueValueLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
_blueValueLabel.textAlignment = NSTextAlignmentCenter;
}
return _blueValueLabel;
}
- (UIImageView *)contributeBgImageView {
if (!_contributeBgImageView) {
_contributeBgImageView = [[UIImageView alloc] init];
}
return _contributeBgImageView;
}
- (NetImageView *)contributeAvatar {
if (!_contributeAvatar) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_contributeAvatar = [[NetImageView alloc] initWithConfig:config];
_contributeAvatar.layer.masksToBounds = YES;
_contributeAvatar.layer.cornerRadius = 22;
}
return _contributeAvatar;
}
- (UIImageView *)contributeHeadWear {
if (!_contributeHeadWear) {
_contributeHeadWear = [[UIImageView alloc] init];
_contributeHeadWear.image = [UIImage imageNamed:@"room_across_pk_panel_contribute_head"];
}
return _contributeHeadWear;
}
- (UILabel *)contributeNick {
if (!_contributeNick) {
_contributeNick = [[UILabel alloc] init];
_contributeNick.textColor = [UIColor whiteColor];
_contributeNick.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
}
return _contributeNick;
}
- (UILabel *)contributeValue {
if (!_contributeValue) {
_contributeValue = [[UILabel alloc] init];
_contributeValue.textColor = [UIColor whiteColor];
_contributeValue.font = [UIFont systemFontOfSize:13];
}
return _contributeValue;
}
- (UIImageView *)charmBgImageView {
if (!_charmBgImageView) {
_charmBgImageView = [[UIImageView alloc] init];
}
return _charmBgImageView;
}
- (NetImageView *)charmAvatar {
if (!_charmAvatar) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_charmAvatar = [[NetImageView alloc] initWithConfig:config];
_charmAvatar.layer.masksToBounds = YES;
_charmAvatar.layer.cornerRadius = 22;
}
return _charmAvatar;
}
- (UIImageView *)charmHeadWear {
if (!_charmHeadWear) {
_charmHeadWear = [[UIImageView alloc] init];
_charmHeadWear.image = [UIImage imageNamed:@"room_across_pk_panel_charm_head"];
}
return _charmHeadWear;
}
- (UILabel *)charmNick {
if (!_charmNick) {
_charmNick = [[UILabel alloc] init];
_charmNick.textColor = [UIColor whiteColor];
_charmNick.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
}
return _charmNick;
}
- (UILabel *)charmValue {
if (!_charmValue) {
_charmValue = [[UILabel alloc] init];
_charmValue.textColor = [UIColor whiteColor];
_charmValue.font = [UIFont systemFontOfSize:13];
}
return _charmValue;
}
@end

View File

@@ -3,17 +3,31 @@
// xplan-ios
//
// Created by 冯硕 on 2022/1/11.
//
// 跨房PK 正在Pk的面板数据
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class AcrossRoomPKPanelModel;
@class AcrossRoomPKPanelModel, XPAcrpssRoomPKPanelView;
@protocol XPAcrpssRoomPKPanelViewDelegate <NSObject>
///展示用户卡片
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view showUserCard:(NSString *)uid;
///送礼物
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view sendGiftToUser:(NSString *)uid;
///去房间
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view onlookRoom:(NSString *)roomUid;
@end
@interface XPAcrpssRoomPKPanelView : UIView
///开启pk
- (void)openCountdownWithTime:(long)time;
///pk 信息
@property (nonatomic,strong) AcrossRoomPKPanelModel *pkPanelInfo;
@property (nonatomic,strong, nullable) AcrossRoomPKPanelModel *pkPanelInfo;
///代理
@property (nonatomic,weak) id<XPAcrpssRoomPKPanelViewDelegate> delegate;
///重置数据
- (void)resetAcrossPKViewData;
@end
NS_ASSUME_NONNULL_END

View File

@@ -14,6 +14,8 @@
#import "NetImageView.h"
#import "XPMacro.h"
#import "UIImage+Utils.h"
#import "UIButton+EnlargeTouchArea.h"
#import "Timestamp.h"
///Model
#import "UserInfoModel.h"
#import "AcrossRoomPKPanelModel.h"
@@ -50,6 +52,8 @@
///
@property (nonatomic, strong) UIButton *onlookButton;
#pragma mark -
///PK
@property (nonatomic, strong) UIView *progressView;
///PK
@property (nonatomic, strong) UIView *progressContentView;
///
@@ -100,7 +104,6 @@
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.userInteractionEnabled = YES;
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(changeLocation:)];
// delaysTouchesBegantouchBegin,
// YES,touchesBegan ;
@@ -114,6 +117,15 @@
return self;
}
#pragma mark - Public Method
- (void)resetAcrossPKViewData {
if (self.timer) {
dispatch_source_cancel(self.timer);
self.timer = nil;
}
self.pkPanelInfo = nil;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backImageView];
@@ -135,13 +147,14 @@
[self.teamContainerView addSubview:self.blueTitleLabel];
[self.teamContainerView addSubview:self.blueAvatarImageView];
[self.teamContainerView addSubview:self.onlookButton];
[self.teamContainerView addSubview:self.progressContentView];
[self.teamContainerView addSubview:self.progressView];
///
[self.progressView addSubview:self.progressContentView];
[self.progressView addSubview:self.svgDisplayView];
[self.progressContentView addSubview:self.redCountImageView];
[self.progressContentView addSubview:self.buleCountImageView];
[self.progressContentView addSubview:self.redCountLabel];
[self.progressContentView addSubview:self.buleCountLabel];
[self.progressContentView addSubview:self.svgDisplayView];
///PKView
[self.userStackView addArrangedSubview:self.contributeStackView];
[self.userStackView addArrangedSubview:self.charmStackView];
@@ -169,6 +182,8 @@
XPAcrossRoomPKPanelUserView * userView = [[XPAcrossRoomPKPanelUserView alloc] init];
userView.tag = (1000 + i);
userView.type = AcrossRoomPKPanelUserType_Red_Contribute;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapUserRecognizer:)];
[userView addGestureRecognizer:tap];
[self.redContributeStackView addArrangedSubview:userView];
}
@@ -176,6 +191,8 @@
XPAcrossRoomPKPanelUserView * userView = [[XPAcrossRoomPKPanelUserView alloc] init];
userView.tag = (1000 + i);
userView.type = AcrossRoomPKPanelUserType_Blue_Contribute;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapUserRecognizer:)];
[userView addGestureRecognizer:tap];
[self.blueContributeStackView addArrangedSubview:userView];
}
@@ -183,6 +200,8 @@
XPAcrossRoomPKPanelUserView * userView = [[XPAcrossRoomPKPanelUserView alloc] init];
userView.tag = (1000 + i);
userView.type = AcrossRoomPKPanelUserType_Red_Charm;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapUserRecognizer:)];
[userView addGestureRecognizer:tap];
[self.redCharmStackView addArrangedSubview:userView];
}
@@ -190,6 +209,8 @@
XPAcrossRoomPKPanelUserView * userView = [[XPAcrossRoomPKPanelUserView alloc] init];
userView.tag = (1000 + i);
userView.type = AcrossRoomPKPanelUserType_Blue_Charm;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapUserRecognizer:)];
[userView addGestureRecognizer:tap];
[self.blueCharmStackView addArrangedSubview:userView];
}
}
@@ -197,7 +218,7 @@
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(339);
make.bottom.mas_equalTo(self.backImageView);
make.height.mas_equalTo(233);
}];
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -211,7 +232,7 @@
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.helpButton);
make.centerX.mas_equalTo(self.helpButton.mas_right).mas_offset(66);
make.centerX.mas_equalTo(self.helpButton.mas_right).offset(66);
}];
[self.ruleBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -240,8 +261,7 @@
[self.foldButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(16, 8));
}];
///
[self.userStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(38 * 2 + 8);
make.left.right.mas_equalTo(self.stackView).inset(12);
@@ -255,12 +275,12 @@
[self.redAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.teamContainerView).offset(30);
make.top.mas_equalTo(self.redTitleLabel.mas_bottom).mas_offset(11);
make.top.mas_equalTo(self.redTitleLabel.mas_bottom).offset(11);
make.width.height.mas_equalTo(44);
}];
[self.assistButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.redAvatarImageView.mas_right).mas_offset(8);
make.left.mas_equalTo(self.redAvatarImageView.mas_right).offset(8);
make.top.mas_equalTo(self.redAvatarImageView);
make.width.mas_equalTo(50);
make.height.mas_equalTo(18);
@@ -273,57 +293,59 @@
}];
[self.blueAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-30);
make.right.mas_equalTo(self.teamContainerView).offset(-30);
make.centerY.mas_equalTo(self.redAvatarImageView);
make.width.height.mas_equalTo(44);
}];
[self.onlookButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.blueAvatarImageView.mas_left).mas_offset(-8);
make.right.mas_equalTo(self.blueAvatarImageView.mas_left).offset(-8);
make.centerY.mas_equalTo(self.assistButton);
make.width.mas_equalTo(50);
make.height.mas_equalTo(18);
}];
///
[self.progressContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.assistButton);
make.right.mas_equalTo(self.onlookButton);
[self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.teamContainerView);
make.width.mas_equalTo(174);
make.height.mas_equalTo(12);
make.top.mas_equalTo(self.assistButton.mas_bottom).offset(8);
}];
[self.progressContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.progressView);
}];
[self.redCountImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.height.mas_equalTo(12);
make.centerY.mas_equalTo(0);
make.top.mas_equalTo(0);
make.right.mas_equalTo(self.buleCountImageView.mas_left);
}];
[self.redCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.redCountImageView.mas_left).mas_offset(6);
make.right.mas_lessThanOrEqualTo(self.redCountImageView);
make.centerY.mas_equalTo(self.redCountImageView);
make.left.mas_equalTo(self.progressContentView.mas_left).offset(6);
make.centerY.mas_equalTo(self.progressContentView);
}];
[self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.redCountImageView);
make.bottom.mas_equalTo(self.progressContentView.mas_bottom).mas_offset(-5);
make.centerX.mas_equalTo(self.buleCountImageView.mas_left);
make.bottom.mas_equalTo(self.progressView.mas_bottom);
make.height.mas_equalTo(27);
make.width.mas_equalTo(18);
}];
[self.buleCountImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.progressContentView).offset(-6);
make.right.mas_equalTo(0);
make.height.mas_equalTo(12);
make.centerY.mas_equalTo(self.progressContentView);
make.width.mas_equalTo(self.progressContentView.mas_width).multipliedBy(0.5);
make.centerY.mas_equalTo(self.redCountImageView);
make.width.mas_equalTo(174 * 0.5);
}];
[self.buleCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.buleCountImageView.mas_right).mas_offset((-6));
make.left.mas_lessThanOrEqualTo(self.buleCountImageView);
make.centerY.mas_equalTo(self.buleCountImageView);
make.right.mas_equalTo(self.progressContentView.mas_right).offset(-6);
make.centerY.mas_equalTo(self.progressContentView);
}];
[self.contributeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -353,31 +375,30 @@
#pragma mark -
- (void)openCountdownWithTime:(long)time {
__block long tempTime = time; //
if (self.timer != nil) {
dispatch_source_cancel(self.timer);
if (self.timer == nil) {
@kWeakify(self);
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //
dispatch_source_set_event_handler(self.timer, ^{
@kStrongify(self);
if(tempTime <= 0){ //
dispatch_source_cancel(self.timer);
self.timer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
self.timeLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
self.timeLabel.text = @"PK结果计算中";
});
} else {
dispatch_async(dispatch_get_main_queue(), ^{
//
[self acrossRoomPKCutdownOpen:tempTime];
});
tempTime--;
}
});
dispatch_resume(self.timer);
}
@kWeakify(self);
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //
dispatch_source_set_event_handler(self.timer, ^{
@kStrongify(self);
if(tempTime <= 0){ //
dispatch_source_cancel(self.timer);
self.timer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
self.timeLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
self.timeLabel.text = @"PK结果计算中";
});
} else {
dispatch_async(dispatch_get_main_queue(), ^{
//
[self acrossRoomPKCutdownOpen:tempTime];
});
tempTime--;
}
});
dispatch_resume(self.timer);
}
///pk,
@@ -405,11 +426,19 @@
sender.selected = !sender.selected;
if (sender.isSelected) {
self.userStackView.hidden = NO;
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(233);
}];
self.backImageView.image = [UIImage imageNamed:@"room_across_pk_panel_bg"];
[UIView animateWithDuration:0.5 animations:^{
self.foldButton.transform = CGAffineTransformIdentity;
}];
} else {
self.userStackView.hidden = YES;
self.backImageView.image = [UIImage imageNamed:@"room_across_pk_panel_small_bg"];
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(137);
}];
[UIView animateWithDuration:0.5 animations:^{
self.foldButton.transform = CGAffineTransformMakeRotation(M_PI);
}];
@@ -422,19 +451,34 @@
}
- (void)tapRedAvatarRecognizer:(UITapGestureRecognizer *)ges {
//TODO:
if (self.delegate && [self.delegate respondsToSelector:@selector(xPAcrpssRoomPKPanelView:showUserCard:)]) {
[self.delegate xPAcrpssRoomPKPanelView:self showUserCard:self.pkPanelInfo.cUid];
}
}
- (void)tapBlueAvatarRecognizer:(UITapGestureRecognizer *)ges {
//TODO:
if (self.delegate && [self.delegate respondsToSelector:@selector(xPAcrpssRoomPKPanelView:showUserCard:)]) {
[self.delegate xPAcrpssRoomPKPanelView:self showUserCard:self.pkPanelInfo.aUid];
}
}
- (void)assistButtonAction:(UIButton *)sender {
//TODO:
if (self.delegate && [self.delegate respondsToSelector:@selector(xPAcrpssRoomPKPanelView:sendGiftToUser:)]) {
[self.delegate xPAcrpssRoomPKPanelView:self sendGiftToUser:self.pkPanelInfo.cUid];
}
}
- (void)onlookButtonAction:(UIButton *)sender {
//TODO:
if (self.delegate && [self.delegate respondsToSelector:@selector(xPAcrpssRoomPKPanelView:onlookRoom:)]) {
[self.delegate xPAcrpssRoomPKPanelView:self onlookRoom:self.pkPanelInfo.aUid];
}
}
- (void)tapUserRecognizer:(UITapGestureRecognizer *)tap {
XPAcrossRoomPKPanelUserView * userView= (XPAcrossRoomPKPanelUserView *)tap.view;
if (userView.panelInfo && userView.panelInfo.uid.length > 0 && self.delegate && [self.delegate respondsToSelector:@selector(xPAcrpssRoomPKPanelView:showUserCard:)]) {
[self.delegate xPAcrpssRoomPKPanelView:self showUserCard:userView.panelInfo.uid];
}
}
- (void)changeLocation:(UIPanGestureRecognizer*)p {
@@ -482,14 +526,10 @@
newCenter = CGPointMake(panPoint.x, screenHeight - touchWidth / 3);
}
[UIView animateWithDuration:0.25 animations:^{
if (newCenter.y + self.frame.size.height / 2 > KScreenHeight - kSafeAreaBottomHeight - 44) {
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(CGPointMake(newCenter.x, KScreenHeight - self.frame.size.height / 2 - kSafeAreaBottomHeight - 44));
}];
if ((newCenter.y + self.frame.size.height / 2) > (KScreenHeight - kSafeAreaBottomHeight - 44)) {
self.center = CGPointMake(newCenter.x, KScreenHeight - self.frame.size.height / 2 - kSafeAreaBottomHeight - 44);
}else {
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(newCenter);
}];
self.center = newCenter;
}
}];
}
@@ -499,6 +539,17 @@
- (void)setPkPanelInfo:(AcrossRoomPKPanelModel *)pkPanelInfo {
_pkPanelInfo = pkPanelInfo;
if (_pkPanelInfo) {
[Timestamp getInternetDateWithSuccess:^(NSTimeInterval timeInterval) {
timeInterval = timeInterval * 1000;
long aTime = (pkPanelInfo.endTime - timeInterval) / 1000;
[self openCountdownWithTime:aTime];
} failure:^(NSError * _Nonnull error) {
NSDate *datenow = [NSDate date];//
long time2 = (long)([datenow timeIntervalSince1970]*1000);
long aTime = (pkPanelInfo.endTime - time2) / 1000;
[self openCountdownWithTime:aTime];
}];
self.redTitleLabel.text = _pkPanelInfo.cTitle;
self.redAvatarImageView.imageUrl = _pkPanelInfo.cAvatar;
self.redCountLabel.text = [NSString stringWithFormat:@"%lld", _pkPanelInfo.cAmount];
@@ -507,7 +558,7 @@
self.buleCountLabel.text = [NSString stringWithFormat:@"%lld", _pkPanelInfo.aAmount];
for (int i = 0; i<_pkPanelInfo.csRank.count; i++) {
AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.csRank objectAtIndex:i];
if (i < self.redContributeStackView.subviews.count) {
if (i >= self.redContributeStackView.subviews.count) {
break;
}
XPAcrossRoomPKPanelUserView *userView = self.redContributeStackView.subviews[i];
@@ -515,7 +566,7 @@
}
for (int i = 0; i<_pkPanelInfo.crRank.count; i++) {
AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.crRank objectAtIndex:i];
if (i < self.redCharmStackView.subviews.count) {
if (i >= self.redCharmStackView.subviews.count) {
break;
}
XPAcrossRoomPKPanelUserView *userView = self.redCharmStackView.subviews[i];
@@ -524,7 +575,7 @@
for (int i = 0; i<_pkPanelInfo.asRank.count; i++) {
AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.asRank objectAtIndex:i];
if (i < self.blueContributeStackView.subviews.count) {
if (i >= self.blueContributeStackView.subviews.count) {
break;
}
XPAcrossRoomPKPanelUserView *userView = self.blueContributeStackView.subviews[i];
@@ -533,7 +584,7 @@
for (int i = 0; i<_pkPanelInfo.arRank.count; i++) {
AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.arRank objectAtIndex:i];
if (i < self.blueCharmStackView.subviews.count) {
if (i >= self.blueCharmStackView.subviews.count) {
break;
}
XPAcrossRoomPKPanelUserView *userView = self.blueCharmStackView.subviews[i];
@@ -543,8 +594,38 @@
if (_pkPanelInfo.aPercent > 1) {
_pkPanelInfo.aPercent = 1;
}
CGFloat width = 174;
[self.buleCountImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(self.progressContentView.mas_width).multipliedBy(_pkPanelInfo.aPercent);
make.width.mas_equalTo(width * _pkPanelInfo.aPercent);
}];
} else {
self.redTitleLabel.text = @"";
self.redAvatarImageView.image = nil;
self.redCountLabel.text = @"0";
self.blueTitleLabel.text = @"";
self.blueAvatarImageView.image = nil;
self.buleCountLabel.text = @"0";
for (int i = 0; i<self.redContributeStackView.subviews.count; i++) {
XPAcrossRoomPKPanelUserView *userView = self.redContributeStackView.subviews[i];
userView.panelInfo = nil;
}
for (int i = 0; i<self.redCharmStackView.subviews.count; i++) {
XPAcrossRoomPKPanelUserView *userView = self.redCharmStackView.subviews[i];
userView.panelInfo = nil;
}
for (int i = 0; i<self.blueContributeStackView.subviews.count; i++) {
XPAcrossRoomPKPanelUserView *userView = self.blueContributeStackView.subviews[i];
userView.panelInfo = nil;
}
for (int i = 0; i<self.blueCharmStackView.subviews.count; i++) {
XPAcrossRoomPKPanelUserView *userView = self.blueCharmStackView.subviews[i];
userView.panelInfo = nil;
}
CGFloat width = 174;
[self.buleCountImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width * 0.5);
}];
}
}
@@ -553,6 +634,7 @@
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.image = [UIImage imageNamed:@"room_across_pk_panel_bg"];
_backImageView.userInteractionEnabled = YES;
}
return _backImageView;
}
@@ -562,6 +644,7 @@
_helpButton = [[UIButton alloc] init];
[_helpButton setImage:[UIImage imageNamed:@"room_across_pk_panel_help"] forState:UIControlStateNormal];
[_helpButton addTarget:self action:@selector(helpButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_helpButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
}
return _helpButton;
}
@@ -618,13 +701,21 @@
- (UIView *)progressContentView {
if (!_progressContentView) {
_progressContentView = [[UIView alloc] init];
_progressContentView.backgroundColor = [UIColor whiteColor];
_progressContentView.backgroundColor = [UIColor clearColor];
_progressContentView.layer.cornerRadius = 6;
_progressContentView.layer.masksToBounds = YES;
}
return _progressContentView;
}
- (UIView *)progressView {
if (!_progressView) {
_progressView = [[UIView alloc] init];
_progressView.backgroundColor = [UIColor clearColor];
}
return _progressView;
}
- (UIImageView *)redCountImageView {
if (!_redCountImageView) {
_redCountImageView = [[UIImageView alloc] init];
@@ -681,6 +772,7 @@
_redAvatarImageView.layer.masksToBounds = YES;
_redAvatarImageView.layer.cornerRadius = 22;
_redAvatarImageView.layer.borderWidth = 1;
_redAvatarImageView.userInteractionEnabled = YES;
_redAvatarImageView.layer.borderColor = UIColorFromRGB(0xFF6574).CGColor;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRedAvatarRecognizer:)];
[_redAvatarImageView addGestureRecognizer:tap];
@@ -708,13 +800,13 @@
_blueAvatarImageView.layer.cornerRadius = 22;
_blueAvatarImageView.layer.borderWidth = 1;
_blueAvatarImageView.layer.borderColor = UIColorFromRGB(0x45C0FF).CGColor;
_blueAvatarImageView.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBlueAvatarRecognizer:)];
[_blueAvatarImageView addGestureRecognizer:tap];
}
return _blueAvatarImageView;
}
- (UIButton *)assistButton {
if (!_assistButton) {
_assistButton = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -753,6 +845,8 @@
[_foldButton setImage:[UIImage imageNamed:@"room_across_pk_panel_fold"] forState:UIControlStateNormal];
[_foldButton addTarget:self action:@selector(foldButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_foldButton.transform = CGAffineTransformMakeRotation(M_PI);
_foldButton.selected = YES;
[_foldButton setEnlargeEdgeWithTop:5 right:10 bottom:10 left:10];
}
return _foldButton;
}
@@ -779,7 +873,6 @@
return _contributeStackView;
}
- (UIStackView *)charmStackView {
if (!_charmStackView) {
_charmStackView = [[UIStackView alloc] init];

View File

@@ -32,6 +32,7 @@
#import "XPRoomGiftBroadCastModel.h"
#import "XPMessageRemoteExtModel.h"
#import "DatingInfoModel.h"
#import "AcrossRoomPKPrizeModel.h"
///View
#import "XPRoomGiftBannerView.h"
#import "XPRoomGiftBroadcastView.h"
@@ -39,6 +40,8 @@
#import "XPRoomDatingAnimationView.h"
#import "XPRoomNobleLevelUpView.h"
#import "QGVAPWrapView.h"
#import "XPAcrossRoomPKPrizeView.h"
#import "XPRoomViewController.h"
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate>
///
@@ -98,6 +101,8 @@
#pragma mark -
@property (nonatomic, strong) NSMutableArray<DatingInfoModel *> *datingEffectQueue;
@property (nonatomic,strong) SVGAImageView *datingEffectView;
#pragma mark - PK
@property (nonatomic, strong) NSMutableArray<AcrossRoomPKPrizeModel *> *acrossRoomPKQueue;
@end
@implementation XPRoomAnimationView
@@ -177,6 +182,8 @@
[self receiveDriveCarEnterRoom:attachment];
} else if(attachment.first == CustomMessageType_RoomPlay_Dating && attachment.second == Custom_Message_Sub_Room_Play_Dating_Public_Result) {
[self roomDatingPublicResult:attachment];
} else if(attachment.first == CustomMessageType_Across_Room_PK && attachment.second == Custom_Message_Sub_AcrossRoomPK_Result) {
[self acrossRoomPKBannerAnimation:attachment];
}
}
}
@@ -191,6 +198,46 @@
[self userEnterRoom:content ext:extModel];
}
}
#pragma mark - PK
- (void)acrossRoomPKBannerAnimation:(AttachmentModel *)attacment {
AcrossRoomPKPrizeModel * prizeModel = [AcrossRoomPKPrizeModel modelWithJSON:attacment.data];
[self.acrossRoomPKQueue addObject:prizeModel];
if (self.acrossRoomPKQueue.count > 0) {
[self startAcrossRoomPKAnimation:self.acrossRoomPKQueue.firstObject];
}
}
- (void)startAcrossRoomPKAnimation:(AcrossRoomPKPrizeModel *)model {
XPAcrossRoomPKPrizeView *wishEffectView = [[XPAcrossRoomPKPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight+10, KScreenWidth, 87)];
wishEffectView.data = model;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoPkWinRoom:)];
[wishEffectView addGestureRecognizer:tap];
[self.middleLevelView addSubview:wishEffectView];
[UIView animateWithDuration:0.5 animations:^{
wishEffectView.frame = CGRectMake(0, kNavigationHeight+10, KScreenWidth, 87);
} completion:^(BOOL finished) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.5 animations:^{
wishEffectView.hidden = YES;
} completion:^(BOOL finished) {
[wishEffectView removeFromSuperview];
[self.acrossRoomPKQueue removeObject:model];
if (self.acrossRoomPKQueue.count > 0) {
[self startAcrossRoomPKAnimation:self.acrossRoomPKQueue.firstObject];
}
}];
});
}];
}
- (void)gotoPkWinRoom:(UITapGestureRecognizer *)tap {
XPAcrossRoomPKPrizeView *wishEffectView = (XPAcrossRoomPKPrizeView *)tap.view;
if (wishEffectView.data.winUid.integerValue > 0) {
[self.delegate exitRoom];
[XPRoomViewController openRoom:wishEffectView.data.winUid viewController:self.delegate.getCurrentNav];
}
}
#pragma mark -
- (void)roomDatingPublicResult:(AttachmentModel *)attachment {
self.datingEffectQueue = [NSMutableArray array];
@@ -1299,5 +1346,12 @@
}
- (NSMutableArray<AcrossRoomPKPrizeModel *> *)acrossRoomPKQueue {
if (!_acrossRoomPKQueue) {
_acrossRoomPKQueue = [NSMutableArray array];
}
return _acrossRoomPKQueue;
}
@end

View File

@@ -38,7 +38,12 @@
#import "XPAcrossRoomPKInviteView.h"
#import "XPAcrossRoomPKInviteResultView.h"
#import "XPAcrpssRoomPKPanelView.h"
@interface XPRoomFunctionContainerView ()
#import "XPAcrossRoomPKResultView.h"
#import "XPAcrossRoomPKForceEndResultView.h"
#import "XPSendGiftView.h"
#import "XPUserCardViewController.h"
#import "XPRoomViewController.h"
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate>
///host
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
///
@@ -302,7 +307,18 @@
break;
case Custom_Message_Sub_AcrossRoomPK_End:
{
[self.acrossPKPanelView resetAcrossPKViewData];
[self.acrossPKPanelView removeFromSuperview];
AcrossRoomPKPanelModel * model = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
if (model.isForce) {
XPAcrossRoomPKForceEndResultView *view = [[XPAcrossRoomPKForceEndResultView alloc] initWithFrame:CGRectMake(0, 0, 281, 208)];
view.data = model;
[TTPopup popupView:view style:TTPopupStyleAlert];
} else {
XPAcrossRoomPKResultView *view = [[XPAcrossRoomPKResultView alloc] initWithFrame:CGRectMake(0, 0, 320, 453)];
view.data = model;
[TTPopup popupView:view style:TTPopupStyleAlert];
}
}
default:
break;
@@ -340,6 +356,67 @@
}
}
#pragma mark - XPAcrpssRoomPKPanelViewDelegate
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view onlookRoom:(NSString *)roomUid {
[self.delegate exitRoom];
[XPRoomViewController openRoom:roomUid viewController:self.delegate.getCurrentNav];
}
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view sendGiftToUser:(NSString *)uid {
NSString * roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
giftView.delegate = self.delegate;
NSArray * giftUses = [self configGiftUsers:[self.delegate getMicroQueue]];
[giftView configGiftUsers:giftUses];
[TTPopup popupView:giftView style:TTPopupStyleActionSheet];
}
- (NSArray<XPGiftUserInfoModel *> *)configGiftUsers:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
NSMutableArray * array = [NSMutableArray array];
for (MicroQueueModel * microModel in queue.allValues) {
if (microModel.userInfo && microModel.userInfo.uid >0) {
UserInfoModel * userInfo = microModel.userInfo;
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
userModel.avatar = userInfo.avatar;
userModel.position = [NSString stringWithFormat:@"%d", microModel.microState.position];
userModel.uid = userInfo.uid;
[array addObject:userModel];
}
}
if (self.delegate.getRoomInfo.leaveMode) {
RoomInfoModel * roomInfo= self.delegate.getRoomInfo;
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
userModel.avatar = roomInfo.avatar;
userModel.position = @"-1";
userModel.uid = roomInfo.uid;
[array addObject:userModel];
}
return array;
}
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view showUserCard:(NSString *)uid {
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
NSString * targetUid = uid;
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
[[self.delegate.getMicroQueue allValues] enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (targetUid.integerValue == obj.userInfo.uid) {
model.position = [NSString stringWithFormat:@"%d", obj.microState.position];
model.posState = obj.microState.posState;
model.micState = obj.microState.micState;
*stop = YES;
}
}];
model.nick = self.delegate.getUserInfo.nick;
model.uid = targetUid;
model.delegate = self.delegate;
model.roomInfo = roomInfo;
model.micQueue = self.delegate.getMicroQueue;
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
[self.delegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
}
#pragma mark - Event Response
- (void)contributionButtonAction:(UIButton *)sender {
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
@@ -608,6 +685,7 @@
- (XPAcrpssRoomPKPanelView *)acrossPKPanelView {
if (!_acrossPKPanelView) {
_acrossPKPanelView = [[XPAcrpssRoomPKPanelView alloc] init];
_acrossPKPanelView.delegate = self;
}
return _acrossPKPanelView;
}