From 8dbb02228f71660511d2edf3dbb3b325af6c8b68 Mon Sep 17 00:00:00 2001 From: edwinQQQ Date: Wed, 3 Sep 2025 16:32:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20Turbo=20Mode=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E5=8C=85=E5=90=AB=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?=20Action=20=E7=B1=BB=E3=80=81=E5=B8=B8=E9=87=8F=E5=92=8C?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=8E=A7=E5=88=B6=E5=99=A8=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=88=BF=E9=97=B4=E6=9B=B4=E5=A4=9A=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD=E6=89=A9=E5=B1=95=E6=80=A7=E3=80=82?= =?UTF-8?q?=E5=90=8C=E6=97=B6=EF=BC=8C=E6=9B=B4=E6=96=B0=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BB=A5=E6=94=AF=E6=8C=81=20Turbo=20Mode=20?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E7=8A=B6=E6=80=81=E7=9A=84=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E5=8D=87=E4=BB=A3=E7=A0=81=E5=8F=AF=E7=BB=B4?= =?UTF-8?q?=E6=8A=A4=E6=80=A7=E5=92=8C=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi.xcodeproj/project.pbxproj | 30 +- YuMi/Assets.xcassets/20.20.62/Contents.json | 6 + .../icon_turbo_mode.imageset/Contents.json | 21 ++ .../icon_turbo_mode.imageset/房间背景@3x.png | Bin 0 -> 3259 bytes .../View/AnimationView/RoomAnimationView.m | 220 ++++++++++++- .../View/MoreView/Action/XPRoomEffectAction.h | 24 ++ .../View/MoreView/Action/XPRoomEffectAction.m | 21 ++ ...GiftEffectAction.h => XPTurboModeAction.h} | 2 +- ...GiftEffectAction.m => XPTurboModeAction.m} | 20 +- .../Factory/XPRoomMoreMenuActionFactory.h | 10 +- .../Factory/XPRoomMoreMenuActionFactory.m | 39 ++- .../View/MoreView/Model/XPRoomMoreItemModel.h | 6 +- .../MoreView/Presenter/XPMoreMenuPresenter.h | 18 +- .../MoreView/Presenter/XPMoreMenuPresenter.m | 289 ++---------------- .../View/XPRoomMoreMenuViewController.m | 181 +++++++++-- .../View/MoreView/View/XPTurboModeConstants.h | 55 ++++ .../View/MoreView/View/XPTurboModeConstants.m | 27 ++ .../MoreView/View/XPTurboModeViewController.h | 23 ++ .../MoreView/View/XPTurboModeViewController.m | 263 ++++++++++++++++ .../View/MoreView/XPTurboModeConstants.h | 55 ++++ .../View/MoreView/XPTurboModeConstants.m | 27 ++ .../SendGiftView/Presenter/XPGiftStorage.m | 55 +--- YuMi/Network/HttpRequestHelper.m | 8 +- YuMi/ar.lproj/Localizable.strings | 9 + YuMi/en.lproj/Localizable.strings | 9 + YuMi/pt-BR.lproj/Localizable.strings | 9 + YuMi/tr.lproj/Localizable.strings | 9 + YuMi/zh-Hant.lproj/Localizable.strings | 10 + 28 files changed, 1061 insertions(+), 385 deletions(-) create mode 100644 YuMi/Assets.xcassets/20.20.62/Contents.json create mode 100644 YuMi/Assets.xcassets/20.20.62/icon_turbo_mode.imageset/Contents.json create mode 100644 YuMi/Assets.xcassets/20.20.62/icon_turbo_mode.imageset/房间背景@3x.png create mode 100644 YuMi/Modules/YMRoom/View/MoreView/Action/XPRoomEffectAction.h create mode 100644 YuMi/Modules/YMRoom/View/MoreView/Action/XPRoomEffectAction.m rename YuMi/Modules/YMRoom/View/MoreView/Action/{XPGiftEffectAction.h => XPTurboModeAction.h} (91%) rename YuMi/Modules/YMRoom/View/MoreView/Action/{XPGiftEffectAction.m => XPTurboModeAction.m} (51%) create mode 100644 YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeConstants.h create mode 100644 YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeConstants.m create mode 100644 YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeViewController.h create mode 100644 YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeViewController.m create mode 100644 YuMi/Modules/YMRoom/View/MoreView/XPTurboModeConstants.h create mode 100644 YuMi/Modules/YMRoom/View/MoreView/XPTurboModeConstants.m diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index d6c19093..8fa326f2 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -506,7 +506,9 @@ 4C3851992DD5F4D50089CFCC /* EventConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3851982DD5F4D50089CFCC /* EventConfigModel.m */; }; 4C38C2AD2D84064400CFA4A8 /* LoginInputItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C38C2AC2D84064300CFA4A8 /* LoginInputItemView.m */; }; 4C38C2B02D84070600CFA4A8 /* AccountBindingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C38C2AF2D84070600CFA4A8 /* AccountBindingViewController.m */; }; + 4C4283F62E66C769006779B0 /* XPTurboModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4283F52E66C769006779B0 /* XPTurboModeViewController.m */; }; 4C44BD5D2D151B5C00F321FA /* RoomSideMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C44BD5C2D151B5C00F321FA /* RoomSideMenu.m */; }; + 4C45C1A52E6825F300E73A44 /* XPTurboModeConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C45C1A42E6825F300E73A44 /* XPTurboModeConstants.m */; }; 4C4707A52D53430300C8CD24 /* NSData+GZIP.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4707A42D53430300C8CD24 /* NSData+GZIP.m */; }; 4C51B09C2DA3B4C600D8DFB5 /* LudoGameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C51B09B2DA3B4C600D8DFB5 /* LudoGameViewController.m */; }; 4C51B09F2DA50FDA00D8DFB5 /* CPRelationshipChangeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C51B09E2DA50FDA00D8DFB5 /* CPRelationshipChangeView.m */; }; @@ -571,6 +573,7 @@ 4CC312272D79A10100F57A07 /* ShareProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC312262D79A10100F57A07 /* ShareProvider.m */; }; 4CC6195A2CEC7770008C1EE8 /* MyDressingDataPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */; }; 4CC6195D2CEC996E008C1EE8 /* MyDressingDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */; }; + 4CC77BBD2E66A33C0067DA96 /* XPRoomEffectAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC77BBC2E66A33C0067DA96 /* XPRoomEffectAction.m */; }; 4CCA0C6E2DDED89F00E30513 /* Custom9MicLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C672DDED89F00E30513 /* Custom9MicLayout.m */; }; 4CCA0C6F2DDED89F00E30513 /* UserRoomMicPositionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C6D2DDED89F00E30513 /* UserRoomMicPositionView.m */; }; 4CCA0C702DDED89F00E30513 /* UserRoomMicPositionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C6B2DDED89F00E30513 /* UserRoomMicPositionCell.m */; }; @@ -585,7 +588,7 @@ 4CD47BB52E61514900BCDA46 /* StageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BB42E61514900BCDA46 /* StageViewManager.m */; }; 4CD47BBE2E619F1700BCDA46 /* XPRoomMoreMenuAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BBB2E619F1700BCDA46 /* XPRoomMoreMenuAction.m */; }; 4CD47BBF2E619F1700BCDA46 /* XPRoomMoreMenuActionContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BBD2E619F1700BCDA46 /* XPRoomMoreMenuActionContext.m */; }; - 4CD47BC42E61A4E000BCDA46 /* XPGiftEffectAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BC32E61A4E000BCDA46 /* XPGiftEffectAction.m */; }; + 4CD47BC42E61A4E000BCDA46 /* XPTurboModeAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BC32E61A4E000BCDA46 /* XPTurboModeAction.m */; }; 4CD47BC62E61A4FA00BCDA46 /* XPRoomMoreMenuActionFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BC52E61A4FA00BCDA46 /* XPRoomMoreMenuActionFactory.m */; }; 4CD47BC92E61A78D00BCDA46 /* XPRoomSettingAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BC82E61A78D00BCDA46 /* XPRoomSettingAction.m */; }; 4CD47BCC2E61ADE400BCDA46 /* XPSocialAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BCB2E61ADE400BCDA46 /* XPSocialAction.m */; }; @@ -2675,8 +2678,12 @@ 4C38C2AC2D84064300CFA4A8 /* LoginInputItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginInputItemView.m; sourceTree = ""; }; 4C38C2AE2D84070600CFA4A8 /* AccountBindingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountBindingViewController.h; sourceTree = ""; }; 4C38C2AF2D84070600CFA4A8 /* AccountBindingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AccountBindingViewController.m; sourceTree = ""; }; + 4C4283F42E66C769006779B0 /* XPTurboModeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTurboModeViewController.h; sourceTree = ""; }; + 4C4283F52E66C769006779B0 /* XPTurboModeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeViewController.m; sourceTree = ""; }; 4C44BD5B2D151B5C00F321FA /* RoomSideMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomSideMenu.h; sourceTree = ""; }; 4C44BD5C2D151B5C00F321FA /* RoomSideMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomSideMenu.m; sourceTree = ""; }; + 4C45C1A32E6825F300E73A44 /* XPTurboModeConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTurboModeConstants.h; sourceTree = ""; }; + 4C45C1A42E6825F300E73A44 /* XPTurboModeConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeConstants.m; sourceTree = ""; }; 4C4707A32D53430300C8CD24 /* NSData+GZIP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+GZIP.h"; sourceTree = ""; }; 4C4707A42D53430300C8CD24 /* NSData+GZIP.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+GZIP.m"; sourceTree = ""; }; 4C4DE6442E2513DA00122763 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/InfoPlist.strings"; sourceTree = ""; }; @@ -2803,6 +2810,8 @@ 4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataPresent.m; sourceTree = ""; }; 4CC6195B2CEC996E008C1EE8 /* MyDressingDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyDressingDataModel.h; sourceTree = ""; }; 4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataModel.m; sourceTree = ""; }; + 4CC77BBB2E66A33C0067DA96 /* XPRoomEffectAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomEffectAction.h; sourceTree = ""; }; + 4CC77BBC2E66A33C0067DA96 /* XPRoomEffectAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomEffectAction.m; sourceTree = ""; }; 4CCA0C662DDED89F00E30513 /* Custom9MicLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Custom9MicLayout.h; sourceTree = ""; }; 4CCA0C672DDED89F00E30513 /* Custom9MicLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Custom9MicLayout.m; sourceTree = ""; }; 4CCA0C682DDED89F00E30513 /* Custom19MicLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Custom19MicLayout.h; sourceTree = ""; }; @@ -2825,13 +2834,13 @@ 4CD15D942D7FE9E400D9279F /* LoginTypesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginTypesViewController.m; sourceTree = ""; }; 4CD47BB32E61514900BCDA46 /* StageViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StageViewManager.h; sourceTree = ""; }; 4CD47BB42E61514900BCDA46 /* StageViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StageViewManager.m; sourceTree = ""; }; - 4CD47BB62E619F0B00BCDA46 /* XPGiftEffectAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftEffectAction.h; sourceTree = ""; }; + 4CD47BB62E619F0B00BCDA46 /* XPTurboModeAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTurboModeAction.h; sourceTree = ""; }; 4CD47BB82E619F0B00BCDA46 /* XPRoomMoreMenuActionFactory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuActionFactory.h; sourceTree = ""; }; 4CD47BBA2E619F1700BCDA46 /* XPRoomMoreMenuAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuAction.h; sourceTree = ""; }; 4CD47BBB2E619F1700BCDA46 /* XPRoomMoreMenuAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMoreMenuAction.m; sourceTree = ""; }; 4CD47BBC2E619F1700BCDA46 /* XPRoomMoreMenuActionContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuActionContext.h; sourceTree = ""; }; 4CD47BBD2E619F1700BCDA46 /* XPRoomMoreMenuActionContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMoreMenuActionContext.m; sourceTree = ""; }; - 4CD47BC32E61A4E000BCDA46 /* XPGiftEffectAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftEffectAction.m; sourceTree = ""; }; + 4CD47BC32E61A4E000BCDA46 /* XPTurboModeAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeAction.m; sourceTree = ""; }; 4CD47BC52E61A4FA00BCDA46 /* XPRoomMoreMenuActionFactory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMoreMenuActionFactory.m; sourceTree = ""; }; 4CD47BC72E61A78D00BCDA46 /* XPRoomSettingAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomSettingAction.h; sourceTree = ""; }; 4CD47BC82E61A78D00BCDA46 /* XPRoomSettingAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomSettingAction.m; sourceTree = ""; }; @@ -6913,8 +6922,8 @@ 4C0B4A392E6579C700D67F73 /* XPPKAction.m */, 4CD47BCA2E61ADE400BCDA46 /* XPSocialAction.h */, 4CD47BCB2E61ADE400BCDA46 /* XPSocialAction.m */, - 4CD47BB62E619F0B00BCDA46 /* XPGiftEffectAction.h */, - 4CD47BC32E61A4E000BCDA46 /* XPGiftEffectAction.m */, + 4CD47BB62E619F0B00BCDA46 /* XPTurboModeAction.h */, + 4CD47BC32E61A4E000BCDA46 /* XPTurboModeAction.m */, 4CD47BC72E61A78D00BCDA46 /* XPRoomSettingAction.h */, 4CD47BC82E61A78D00BCDA46 /* XPRoomSettingAction.m */, 4C0B4A3C2E659A2C00D67F73 /* XPRoomTypeSettingAction.h */, @@ -6931,6 +6940,8 @@ 4C0B4A4C2E65A63400D67F73 /* XPRoomRoomPhotoAction.m */, 4C0B4A4E2E65A68800D67F73 /* XPRoomAppManagerAction.h */, 4C0B4A4F2E65A68800D67F73 /* XPRoomAppManagerAction.m */, + 4CC77BBB2E66A33C0067DA96 /* XPRoomEffectAction.h */, + 4CC77BBC2E66A33C0067DA96 /* XPRoomEffectAction.m */, ); path = Action; sourceTree = ""; @@ -11168,6 +11179,8 @@ E8DEC9962764A51F0078CB70 /* MoreView */ = { isa = PBXGroup; children = ( + 4C45C1A32E6825F300E73A44 /* XPTurboModeConstants.h */, + 4C45C1A42E6825F300E73A44 /* XPTurboModeConstants.m */, 4CD47BB72E619F0B00BCDA46 /* Action */, 4CD47BB92E619F0B00BCDA46 /* Factory */, E8DEC99B2764A5620078CB70 /* Model */, @@ -11199,6 +11212,8 @@ E8DEC9992764A54C0078CB70 /* View */ = { isa = PBXGroup; children = ( + 4C4283F42E66C769006779B0 /* XPTurboModeViewController.h */, + 4C4283F52E66C769006779B0 /* XPTurboModeViewController.m */, E8DEC9A92764A6AF0078CB70 /* Cell */, E8DEC99C2764A5B60078CB70 /* XPRoomMoreMenuViewController.h */, E8DEC99D2764A5B60078CB70 /* XPRoomMoreMenuViewController.m */, @@ -12315,7 +12330,7 @@ E8A3538528FD67320014A784 /* GiftLuckyBroadcastModel.m in Sources */, 9B4C5B86292F81FA00CEA41B /* XPSessionListFansPartyModel.m in Sources */, 547080DB2CD0EEB4009879E5 /* CustomRoomBGContentViewController.m in Sources */, - 4CD47BC42E61A4E000BCDA46 /* XPGiftEffectAction.m in Sources */, + 4CD47BC42E61A4E000BCDA46 /* XPTurboModeAction.m in Sources */, 237B94BD2A984DA7007853E3 /* XPNobleTrumpetModel.m in Sources */, E82325F5274E2E09003A3332 /* XPUserCardPresenter.m in Sources */, 236B2E4C2AA07D06003967A8 /* XPLittleGameRoomOpenView.m in Sources */, @@ -12359,6 +12374,7 @@ E84BF7D1277BFCDD00EF8877 /* RoomTagModel.m in Sources */, E8AC723526F49939007D6E91 /* XPMineNotificaPresenter.m in Sources */, 1427218E29A75F6F00C7C423 /* HTTPMessage.m in Sources */, + 4C45C1A52E6825F300E73A44 /* XPTurboModeConstants.m in Sources */, 239D0FE72C049D61002977CE /* MSRoomGameMsgView.m in Sources */, 238B37BE2AC55A2C00BFC9D5 /* XPTreasureFairyBottomView.m in Sources */, 9B42869828C1E06B009034D2 /* XPRedPacketModel.m in Sources */, @@ -12757,6 +12773,7 @@ 23E9EAAD2A84C9B800B792F2 /* XPMineUserInfoTagItemView.m in Sources */, 18A61BE8274F9CF000A09A54 /* SessionListViewController.m in Sources */, E8C1CD6A27D8937800376F83 /* XPRoomFaceCollectionViewCell.m in Sources */, + 4CC77BBD2E66A33C0067DA96 /* XPRoomEffectAction.m in Sources */, 9B2EA7C02804037700ED17BF /* AnchorPKStageView.m in Sources */, 4C1392992D6DB4CD00A6DFB5 /* MoliMoneyLabel.m in Sources */, 23CEFC622AFB8FC100576D89 /* BSLogNetDetailViewController.m in Sources */, @@ -13402,6 +13419,7 @@ 9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */, E85E7BA02A4EC99300B6D00A /* XPMineGiveDiamondDetailsModel.m in Sources */, 4CE746C32D9290430094E496 /* RoomBoomManager.m in Sources */, + 4C4283F62E66C769006779B0 /* XPTurboModeViewController.m in Sources */, 4CBBB44C2DA66334001B1C6D /* MessageCPNotifyModel.m in Sources */, E81A654C28351D9900F55894 /* XPMonentsTopicCollectionViewCell.m in Sources */, E85E7B9F2A4EC99300B6D00A /* XPMineGiveDiamondPresenter.m in Sources */, diff --git a/YuMi/Assets.xcassets/20.20.62/Contents.json b/YuMi/Assets.xcassets/20.20.62/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.62/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.62/icon_turbo_mode.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.62/icon_turbo_mode.imageset/Contents.json new file mode 100644 index 00000000..ac659e41 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.62/icon_turbo_mode.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "房间背景@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.62/icon_turbo_mode.imageset/房间背景@3x.png b/YuMi/Assets.xcassets/20.20.62/icon_turbo_mode.imageset/房间背景@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..51f5bdb7db06bc2b1049935371c6ff3318c53582 GIT binary patch literal 3259 zcmV;s3`FyZP)t%-rqiy{+!*su#YldKJ3nwr^YTztz>%mGJiP zf#HM0hlY;`9~VA3d`kGV@af?jgr)A~pOpLK!^$6$RDE&|Sg>1_`h|fTAa;Zgixo$O zj|-m|J}G>BSe|D)bA3=4SSv}9)V=&`B;(Mq^4CqOJ~>{@QRIhrB!3|^S8(H~R(e=c zKmg&GczvDlAz>f@E|*i2`s7?I5{?Lye`54uJ;L*3&xbk(H;w^RSG{&zIyJ170`tIJ zcdeg%dafB=dc>)*=g6>L(>c(TM{jwG13=|e)q0{qsypX$VMPCt(SAZ$*bt*T1Gy7$ z11!1XpjLW#9MM&iEDed*!jbTFbZu{Ot-z#xh*g$jI!P*sGTvTl-N&UlDL)km-;(ChaVS74dkq5Oy1APl!K4+31oD zpUebqj5r`{pz_vrv4(1wx)?u>iC+dhEqZEWrv^954GKp`v$yQ6=W@Rx{unb1cKn>m zv8lifu;QzEqrr7DN@Hx`7ym4;`8%fQ@JFq|4X~zF2CajKi`?&W`DvizcPr;w zfg51GLGhKsR*LrV!u+*g!T-jtGzK@oialGY#cl=>z*;aIHa{DB-w50QYt*!Cq+qC^ zEt1K9dlT@O=yD@)BgM#R4x7s@PjJxCCIT@L+_YL#E#MkGCkosG1>kUaZ~^jIcgKPo z0Rp(UMBrFKTkIh`%z@!E()E$x23TMMK$N8Jbt;t>l9$Imzvb0+H_6#)tp%oXD z$u9fEca8qnhrbzqZ}^GfJBF`c^J#T@+oTT;zaaei@Ylo72^;m3%uMhR9@sS?Y#=kh zs=xtZVW7eSGra7FM*myG?+D)~+!iF??SOsv)E)3WdD9S_OwZufSAUoSL3(6U@2fqh zo2a>Y7^u%pdaLj(#5Vx@fH{ktjdjf&e2Lzex2+G{y45NuSoalN(2YUqUeT@V-y&(- zmYOO9q=nrkxep4LB6#_dLH4@LK5&z3Y3I%6aw+KHvEq!dxptDGB*c^)u(ezvV%^Bi z;A*u1UN5k~iw8vaQ^VqalHw$W3lF6P>t%fna~<3|B=}fYO4+n>*mSp47GF&VbJ-aQ z4Sj&jsHtyY<48{)C4J4h_h8QH^`h@_;Vwc!#P*TR@Ei8!%yt7my}y#O5!`t=Qz@PB z=lOYlv+z6!5GBE7vqmain=K?Hh!?oZT+knH{ZY|<=kUgtp4-ld&o_?r60?wqsmLiF za@W937UA=9DC!2t6y|oxeL}bmoteU42!AO2sqk;Zd%|tVe76FlO{Fnq;Rw%la0!<= zrcS4i45V7Ew22}Bek=taAAU*r4dGXWpA>$7cz3udbph_qM1vKFj&(FkQu${{yRjVWF3z7dF% zG$O6?)hYS!@G$b+PT1MQ9uCR#a`q0%pCzk`1i;mDW(IdkOKzQdPYE+7NhA76N{O{e zMiSudn2jv3;Q?S*H{6%Fgy(@haJAkNLfgnN^|R0Fa7mkbe`{Fy4-Lz80WLfb0&bgD z)6m{V#U7DT_F$8=A_xAORIs<(q}(|v^q+8Ps=zHB%$pc_mlU!Jn?|<{a9C{s&!wyF<$rbNkhmy(8aBNcZ=t;Jv z8T^D9Q@gPRr+B!tD{zGx`>*$pQO^p$D*VClC&MobPilE7GM0QdBX@Jx2dGaz4;x$i z>W7!*@>k(5XghFmY2izF#yL9R0|zX&e^{zLr$a7qNXNuTD{7OY-%AbDpuf% zK`rXEDr#rSu9tAJ$X0B+B^2mYtsI!4@GdQv;u&O2tZIAER{~2`d#4jCbWq^ek!is( z&lkMA2X3k9SbP{t_E#P0bb{vRDPfy0$z14)Xn9e19&t8mDuQPf7L1x*x86!){`@BV zys%{|z;oFt=_!`Rf9zDtpm2Cr;2LbYjJrM6r{}_&|F22k6gJp3{S=ept%+a03|on{ zt~_G};8u$WP1wzh@+MXX=DSkLP8NOUo3;jhY}9-5s3`p@(tL8axXI;QY1hii%HHky z16YzEtRjH{O(mnK zOxInoGg*#n+9dLy2#LEU^FC`|8inS>HhhGP+|EqG&W~o6GMxZ8!gK9VNLnwXtBmR7 zO{}HcQ`##i_TD=;ZwcQdtoH~H&dh!__p@|mzWgvUHtNgm+-P@==Nh=R+JDt)7s;rw zLkkgx9mwRkx zk;_Kp^G~CK1q+#8vUgqNW^grY-EzG^!HXY9R+FCLq@$BKersmoA*5*0Pfz`CgqsXh zivU-{1aM4Tqdsu!CJlX~`&x-|f6Ycd-B6q`am$o_dsvtN=vle;JBbe@T^}@ZJ&eTe zVfkIwCY ze?J!50kabZ{M>d1>{tB)D7>oP>p; zaz}!zbSetcU4#eXOS0~114!&HDR-1C`Tz@`QDyq}7KRoIzzjC^A#iA!qM6Gt3=WqD z7nqE-c5KVtP}9f`0=U%^MY6UE^Y{GP|HeMI0+-Y%uxqxJS}Sbl?` zF}DVn@7Q*X)nTC?>*X=Qg)leo)dqh zGuvJSTvo&&ao9j-HZjv1CvVQoUbY*!_)$cCF>qNEfQ1Qf-Ikxj#=4kC%gXFCW}Fq< zFAv)UDrW0+;7(9q8)>k!=gN44--KFoeQa7Kl<8$Qx{HF^^Q04S2@k-lVRJ+So_K8e ztowPqD5l@wYct+}b!BW6Ydf*0GjMy>GCu5x4{&|TF+aBFs!Mj#VtTrhl24C;Rx3R- zwm4g`CuwJ(MsG!(gIj5-|8OYmE2)-)wIUnxcJy`CSshlN9AFAZ *animationListB; // 玩法 -@property(nonatomic, assign) CGFloat broadCastHieght; +@property (nonatomic, assign) CGFloat broadCastHieght; @property (nonatomic, strong) NetImageView *imageLoader; @property (nonatomic, strong) SVGAImageView *datingEffectView; @property (nonatomic, strong) NSMutableArray *sailingQueue; @@ -183,6 +184,12 @@ BannerSchedulerDelegate @property (nonatomic, strong) UISwipeGestureRecognizer *swipeWhenPlayGame; +// 🔧 新增:Turbo Mode 开关状态 +@property (nonatomic, assign) BOOL turboGiftEffectsEnabled; // 临时礼物特效状态 +@property (nonatomic, assign) BOOL turboGlobalGiftScreenEnabled; // 全局礼物屏幕状态 +@property (nonatomic, assign) BOOL turboGlobalGameScreenEnabled; // 全局游戏屏幕状态 +@property (nonatomic, strong) NSString *currentRoomId; // 当前房间 ID + @end @implementation RoomAnimationView @@ -381,6 +388,12 @@ BannerSchedulerDelegate selector:@selector(handleRoomTypeChanged:) name:@"RoomTypeChanged" object:nil]; + + // 🔧 新增:初始化Turbo Mode开关状态 + [self setupTurboModeSwitches]; + + // 🔧 新增:监听Turbo Mode开关变化 + [self setupTurboModeNotifications]; } - (void)setupUI { @@ -441,6 +454,48 @@ BannerSchedulerDelegate _animationListB = @[].mutableCopy; } +// 🔧 新增:初始化Turbo Mode开关状态 +- (void)setupTurboModeSwitches { + NSString *roomId = @(self.hostDelegate.getRoomInfo.roomId).stringValue; + self.currentRoomId = roomId; + + // 礼物特效:从当前会话状态读取(不持久化) + self.turboGiftEffectsEnabled = self.hostDelegate.getRoomInfo.hasAnimationEffect; + + // 其他两个开关:从房间特定的 NSUserDefaults 读取(区分未设置与显式 NO) + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + id giftScreenObj = [defaults objectForKey:kTurboGlobalGiftScreenEnabledKey(roomId)]; + self.turboGlobalGiftScreenEnabled = (giftScreenObj != nil) ? [defaults boolForKey:kTurboGlobalGiftScreenEnabledKey(roomId)] : YES; + id gameScreenObj = [defaults objectForKey:kTurboGlobalGameScreenEnabledKey(roomId)]; + self.turboGlobalGameScreenEnabled = (gameScreenObj != nil) ? [defaults boolForKey:kTurboGlobalGameScreenEnabledKey(roomId)] : YES; + + NSLog(@"🎮 RoomAnimationView Turbo Mode开关初始化 - 房间ID: %@, 礼物特效: %@, 全局礼物屏幕: %@, 全局游戏屏幕: %@", + roomId, + self.turboGiftEffectsEnabled ? @"开启" : @"关闭", + self.turboGlobalGiftScreenEnabled ? @"开启" : @"关闭", + self.turboGlobalGameScreenEnabled ? @"开启" : @"关闭"); +} + +// 🔧 新增:设置Turbo Mode通知监听 +- (void)setupTurboModeNotifications { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(handleTurboGiftEffectsChanged:) + name:kTurboGiftEffectsEnabledChanged + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(handleTurboGlobalGiftScreenChanged:) + name:kTurboGlobalGiftScreenEnabledChanged + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(handleTurboGlobalGameScreenChanged:) + name:kTurboGlobalGameScreenEnabledChanged + object:nil]; + + NSLog(@"🎮 Turbo Mode通知监听设置完成"); +} + #pragma mark - Method: Enter Roooooom - (void)enterRoom:(NIMMessage *)message content:(NIMChatroomNotificationContent *)content { NIMMessageChatroomExtension *messageExt = (NIMMessageChatroomExtension *)message.messageExt; @@ -533,6 +588,12 @@ BannerSchedulerDelegate effectPath:(NSString *)effectPath isCPEnter:(BOOL)isCP { + // 🔧 新增:Turbo Mode进房特效开关检查 + if (!self.turboGiftEffectsEnabled) { + NSLog(@"🎮 Turbo Mode进房特效已关闭,跳过进房动画"); + return; + } + NSDictionary *attributes = @{ NSFontAttributeName:kFontRegular(26), NSForegroundColorAttributeName:[UIColor whiteColor] @@ -657,6 +718,24 @@ BannerSchedulerDelegate return; } + // 🔧 新增:Turbo Mode Banner开关检查 + if (obj.second == Custom_Message_Sub_General_Floating_Screen_One_Room || + obj.second == Custom_Message_Sub_General_Floating_Screen_All_Room) { + // 游戏相关banner + if (!self.turboGlobalGameScreenEnabled) { + NSLog(@"🎮 Turbo Mode全局游戏屏幕已关闭,跳过游戏banner"); + return; + } + } else if (obj.second == Custom_Message_Sub_Super_Gift_Banner || + obj.second == Custom_Message_Sub_Gift_ChannelNotify || + obj.second == Custom_Message_Sub_LuckyPackage) { + // 礼物相关banner + if (!self.turboGlobalGiftScreenEnabled) { + NSLog(@"🎮 Turbo Mode全局礼物屏幕已关闭,跳过礼物banner"); + return; + } + } + #if 0 // DEBUG环境:复制banner数据用于测试 BOOL enableBannerCopy = obj.second == Custom_Message_Sub_Super_Gift_Banner;// YES; // 设置为NO可以禁用复制功能 @@ -881,6 +960,12 @@ BannerSchedulerDelegate } - (void)receiveCPEvent:(AttachmentModel *)attachment { + // 🔧 新增:检查 Turbo Mode 礼物特效开关 + if (!self.turboGiftEffectsEnabled) { + NSLog(@"🎮 RoomAnimationView 礼物特效已关闭,跳过CP动画"); + return; + } + [self inserBannerModelToQueue:attachment]; } @@ -1254,6 +1339,12 @@ BannerSchedulerDelegate #pragma mark - Method: Send Gifts - (void)receiveGiftHandleSendGiftAnimationWith:(GiftReceiveInfoModel *)receiveInfo attachment:(AttachmentModel *)attachment { + // 🔧 新增:检查 Turbo Mode 礼物特效开关 + if (!self.turboGiftEffectsEnabled) { + NSLog(@"🎮 RoomAnimationView 礼物特效已关闭,跳过动画"); + return; + } + if (!self.hostDelegate.getRoomInfo.hasAnimationEffect) { return; } @@ -3786,6 +3877,89 @@ BannerSchedulerDelegate NSLog(@"🔄 缓存管理器清理完成"); } +// 🔧 新增:清理礼物特效 +- (void)cleanupGiftEffects { + NSLog(@"🎮 清理礼物特效"); + + // 停止当前播放的礼物特效 + if (self.isPlayingGiftEffect) { + self.isPlayingGiftEffect = NO; + } + + // 清理礼物特效视图 + if (self.pagGiftEffectView && self.pagGiftEffectView.superview) { + [self.pagGiftEffectView stop]; + [self.pagGiftEffectView removeFromSuperview]; + } + + if (self.vapGiftEffectView && self.vapGiftEffectView.superview) { + [self.vapGiftEffectView stopHWDMP4]; + [self.vapGiftEffectView removeFromSuperview]; + } + + if (self.vggGiftEffectView && self.vggGiftEffectView.superview) { + [self.vggGiftEffectView stopAnimation]; + [self.vggGiftEffectView removeFromSuperview]; + } + + // 清空礼物队列 + [self.svgaQueue removeAllObjects]; + + NSLog(@"🎮 礼物特效清理完成"); +} + +// 🔧 新增:清理礼物相关banner +- (void)cleanupGiftBanners { + NSLog(@"🎮 清理礼物相关banner"); + + // 清理礼物相关的banner + NSMutableArray *viewsToRemove = [NSMutableArray array]; + for (UIView *subview in self.bannerContainer.subviews) { + if ([subview isKindOfClass:[BravoGiftBannerView class]] || + [subview isKindOfClass:[LuckyGiftWinningBannerView class]] || + [subview isKindOfClass:[RoomHighValueGiftBannerAnimation class]]) { + [viewsToRemove addObject:subview]; + } + } + + for (UIView *view in viewsToRemove) { + [view removeFromSuperview]; + } + + // 标记banner播放完成,继续下一个 + if (self.isRoomBannerV2Displaying) { + self.isRoomBannerV2Displaying = NO; + [self.bannerScheduler markBannerFinished]; + } + + NSLog(@"🎮 礼物相关banner清理完成"); +} + +// 🔧 新增:清理游戏相关banner +- (void)cleanupGameBanners { + NSLog(@"🎮 清理游戏相关banner"); + + // 清理游戏相关的banner + NSMutableArray *viewsToRemove = [NSMutableArray array]; + for (UIView *subview in self.bannerContainer.subviews) { + if ([subview isKindOfClass:[GameUniversalBannerView class]]) { + [viewsToRemove addObject:subview]; + } + } + + for (UIView *view in viewsToRemove) { + [view removeFromSuperview]; + } + + // 标记banner播放完成,继续下一个 + if (self.isRoomBannerV2Displaying) { + self.isRoomBannerV2Displaying = NO; + [self.bannerScheduler markBannerFinished]; + } + + NSLog(@"🎮 游戏相关banner清理完成"); +} + - (void)cleanupBannerScheduler { if (self.bannerScheduler) { NSLog(@"�� 清理 BannerScheduler"); @@ -3806,6 +3980,11 @@ BannerSchedulerDelegate // 🔧 新增:移除房间类型变化通知监听 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"RoomTypeChanged" object:nil]; + // 🔧 新增:移除Turbo Mode通知监听 + [[NSNotificationCenter defaultCenter] removeObserver:self name:kTurboGiftEffectsEnabledChanged object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:kTurboGlobalGiftScreenEnabledChanged object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:kTurboGlobalGameScreenEnabledChanged object:nil]; + // 移除其他可能添加的通知监听 [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -4023,6 +4202,45 @@ BannerSchedulerDelegate } } +// 🔧 新增:处理Turbo Mode礼物特效开关变化 +- (void)handleTurboGiftEffectsChanged:(NSNotification *)notification { + BOOL enabled = [notification.userInfo[@"on"] boolValue]; + self.turboGiftEffectsEnabled = enabled; + + // 如果关闭,清理当前效果 + if (!enabled) { + [self cleanupGiftEffects]; + } + + NSLog(@"🎮 RoomAnimationView 礼物特效状态变化: %@", enabled ? @"开启" : @"关闭"); +} + +// 🔧 新增:处理Turbo Mode全局礼物屏幕开关变化 +- (void)handleTurboGlobalGiftScreenChanged:(NSNotification *)notification { + BOOL enabled = [notification.userInfo[@"on"] boolValue]; + self.turboGlobalGiftScreenEnabled = enabled; + + // 如果关闭,清理礼物相关 banner + if (!enabled) { + [self cleanupGiftBanners]; + } + + NSLog(@"🎮 RoomAnimationView 全局礼物屏幕状态变化: %@", enabled ? @"开启" : @"关闭"); +} + +// 🔧 新增:处理Turbo Mode全局游戏屏幕开关变化 +- (void)handleTurboGlobalGameScreenChanged:(NSNotification *)notification { + BOOL enabled = [notification.userInfo[@"on"] boolValue]; + self.turboGlobalGameScreenEnabled = enabled; + + // 如果关闭,清理游戏相关 banner + if (!enabled) { + [self cleanupGameBanners]; + } + + NSLog(@"🎮 RoomAnimationView 全局游戏屏幕状态变化: %@", enabled ? @"开启" : @"关闭"); +} + // 🔧 新增:检查重要动画状态 - (BOOL)hasImportantAnimationPlaying { // 检查 topContainer 中是否有正在播放的重要动画 diff --git a/YuMi/Modules/YMRoom/View/MoreView/Action/XPRoomEffectAction.h b/YuMi/Modules/YMRoom/View/MoreView/Action/XPRoomEffectAction.h new file mode 100644 index 00000000..b05f6f88 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/MoreView/Action/XPRoomEffectAction.h @@ -0,0 +1,24 @@ +// +// XPTurboModeAction.h +// YuMi +// +// Created by P on 2025/9/2. +// + +#import "../Model/XPRoomMoreMenuAction.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * Turbo模式操作 + */ +@interface XPRoomEffectAction : XPRoomMoreMenuAction + +/** + * 创建Turbo模式操作 + */ ++ (instancetype)action; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/MoreView/Action/XPRoomEffectAction.m b/YuMi/Modules/YMRoom/View/MoreView/Action/XPRoomEffectAction.m new file mode 100644 index 00000000..97de04dc --- /dev/null +++ b/YuMi/Modules/YMRoom/View/MoreView/Action/XPRoomEffectAction.m @@ -0,0 +1,21 @@ +// +// XPTurboModeAction.m +// YuMi +// +// Created by P on 2025/9/2. +// + +#import "XPRoomEffectAction.h" + +@implementation XPRoomEffectAction + ++ (instancetype)action { + XPRoomEffectAction *action = [[XPRoomEffectAction alloc] init]; + action.title = YMLocalizedString(@"20.20.62_text_14"); + action.imageName = @"room_more_menu_gift_effect"; + action.type = RoomMoreMenuType_Turbo_Mode; + action.titleColor = [DJDKMIMOMColor appCellBackgroundColor]; + return action; +} + +@end diff --git a/YuMi/Modules/YMRoom/View/MoreView/Action/XPGiftEffectAction.h b/YuMi/Modules/YMRoom/View/MoreView/Action/XPTurboModeAction.h similarity index 91% rename from YuMi/Modules/YMRoom/View/MoreView/Action/XPGiftEffectAction.h rename to YuMi/Modules/YMRoom/View/MoreView/Action/XPTurboModeAction.h index 209948aa..a970269b 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Action/XPGiftEffectAction.h +++ b/YuMi/Modules/YMRoom/View/MoreView/Action/XPTurboModeAction.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN /** * 礼物特效开关操作 */ -@interface XPGiftEffectAction : XPRoomMoreMenuAction +@interface XPTurboModeAction : XPRoomMoreMenuAction /** * 创建开启礼物特效的操作 diff --git a/YuMi/Modules/YMRoom/View/MoreView/Action/XPGiftEffectAction.m b/YuMi/Modules/YMRoom/View/MoreView/Action/XPTurboModeAction.m similarity index 51% rename from YuMi/Modules/YMRoom/View/MoreView/Action/XPGiftEffectAction.m rename to YuMi/Modules/YMRoom/View/MoreView/Action/XPTurboModeAction.m index cf4a81f0..0e3e4e0b 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Action/XPGiftEffectAction.m +++ b/YuMi/Modules/YMRoom/View/MoreView/Action/XPTurboModeAction.m @@ -5,25 +5,25 @@ // Created by Linus on 2025/1/13. // -#import "XPGiftEffectAction.h" +#import "XPTurboModeAction.h" #import "RoomInfoModel.h" -@implementation XPGiftEffectAction +@implementation XPTurboModeAction + (instancetype)openAction { - XPGiftEffectAction *action = [[XPGiftEffectAction alloc] init]; - action.title = YMLocalizedString(@"XPMoreMenuPresenter5"); - action.imageName = @"room_more_menu_gift_effect"; - action.type = RoomMoreMenuType_Gift_Effect_Open; + XPTurboModeAction *action = [[XPTurboModeAction alloc] init]; + action.title = YMLocalizedString(@"20.20.62_text_9.1"); + action.imageName = @"icon_turbo_mode"; + action.type = RoomMoreMenuType_UI_Effect_Open; action.titleColor = [DJDKMIMOMColor appCellBackgroundColor]; return action; } + (instancetype)closeAction { - XPGiftEffectAction *action = [[XPGiftEffectAction alloc] init]; - action.title = YMLocalizedString(@"XPMoreMenuPresenter28"); - action.imageName = @"room_more_menu_gift_effect"; - action.type = RoomMoreMenuType_Gift_Effect_Close; + XPTurboModeAction *action = [[XPTurboModeAction alloc] init]; + action.title = YMLocalizedString(@"20.20.62_text_9.2"); + action.imageName = @"icon_turbo_mode"; + action.type = RoomMoreMenuType_UI_Effect_Close; action.titleColor = [DJDKMIMOMColor appCellBackgroundColor]; return action; } diff --git a/YuMi/Modules/YMRoom/View/MoreView/Factory/XPRoomMoreMenuActionFactory.h b/YuMi/Modules/YMRoom/View/MoreView/Factory/XPRoomMoreMenuActionFactory.h index 4cce101c..dfb26841 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Factory/XPRoomMoreMenuActionFactory.h +++ b/YuMi/Modules/YMRoom/View/MoreView/Factory/XPRoomMoreMenuActionFactory.h @@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN /** * 房间更多菜单操作工厂类 * 负责根据上下文创建合适的操作列表 + * 原意是替换通过 action 替换 item model,并将点击后的事件也封装到 action */ @interface XPRoomMoreMenuActionFactory : NSObject @@ -23,13 +24,18 @@ NS_ASSUME_NONNULL_BEGIN * @param context 操作上下文 * @return 操作列表 */ -//+ (NSArray *)createActionsWithContext:(XPRoomMoreMenuActionContext *)context; /// 超管直接回使用固定组合 models (trumpet, giftEffect, appManager, report) + (NSArray *)createSuperAdminActionsWithContext:(XPRoomMoreMenuActionContext *)context; -+ (NSArray *)createPanelActionsWithContext:(XPRoomMoreMenuActionContext *)context isCreator:(BOOL)isCreator isManager:(BOOL)isManager isSuperAdmin:(BOOL)isSuperAdmin isOnMic:(BOOL)isOnMic; +/// 普通用户需要综合判断 ++ (NSArray *)createPanelActionsWithContext:(XPRoomMoreMenuActionContext *)context + isCreator:(BOOL)isCreator + isManager:(BOOL)isManager + isSuperAdmin:(BOOL)isSuperAdmin + isOnMic:(BOOL)isOnMic; +/// 没有取到云信用户数据的情况 + (NSArray *)createPanelActionsForNoCharRoomMembersWithContext:(XPRoomMoreMenuActionContext *)context; @end diff --git a/YuMi/Modules/YMRoom/View/MoreView/Factory/XPRoomMoreMenuActionFactory.m b/YuMi/Modules/YMRoom/View/MoreView/Factory/XPRoomMoreMenuActionFactory.m index c7598d36..8c6bdb5c 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Factory/XPRoomMoreMenuActionFactory.m +++ b/YuMi/Modules/YMRoom/View/MoreView/Factory/XPRoomMoreMenuActionFactory.m @@ -8,7 +8,7 @@ #import "XPRoomMoreMenuActionFactory.h" #import "XPRoomMoreMenuActionContext.h" #import "XPRoomMoreMenuAction.h" -#import "XPGiftEffectAction.h" +#import "XPTurboModeAction.h" #import "XPRoomSettingAction.h" #import "XPRoomBackGroundSettingAction.h" #import "XPSocialAction.h" @@ -19,6 +19,7 @@ #import "XPRoomRoomPhotoAction.h" #import "XPRoomAppManagerAction.h" #import "XPRoomCleanMessagesAction.h" +#import "XPRoomEffectAction.h" #import "RoomInfoModel.h" #import "ClientConfig.h" @@ -28,7 +29,7 @@ NSMutableArray *actions = [NSMutableArray array]; [actions addObject:[XPSocialAction trumpetAction]]; - [actions addObject:[XPGiftEffectAction actionWithRoomInfo:context.roomInfo]]; + [actions addObject:[XPTurboModeAction actionWithRoomInfo:context.roomInfo]]; [actions addObject:[XPRoomAppManagerAction action]]; [actions addObject:[XPSocialAction reportAction]]; @@ -43,25 +44,30 @@ NSMutableArray *actions = [NSMutableArray array]; RoomInfoModel *roomInfo = context.roomInfo; RoomType type = roomInfo.type; + BOOL userNotNormal = (isCreator || isManager || isSuperAdmin); // 1. PK相关功能 - 按优先级顺序 - if ((isCreator || isManager || isSuperAdmin) && + if (userNotNormal && type != RoomType_MiniGame && type != RoomType_Anchor) { [actions addObject:[XPPKAction roomPKActionWithRoomInfo:roomInfo]]; } - if (isCreator && type != RoomType_MiniGame && type != RoomType_Anchor) { + if (isCreator && + type != RoomType_MiniGame && + type != RoomType_Anchor) { [actions addObject:[XPPKAction corssPKActionWithRoomInfo:roomInfo]]; } - if (isCreator && type == RoomType_Anchor) { + if (isCreator && + type == RoomType_Anchor) { [actions addObject:[XPPKAction anchorPKActionWithRoomInfo:roomInfo]]; } // 2. 相亲模式 - 插入到最前面 - if ((isCreator || isManager || isSuperAdmin) && + if (userNotNormal && roomInfo.canOpenBlindDate && - type != RoomType_Anchor && type != RoomType_MiniGame) { + type != RoomType_Anchor && + type != RoomType_MiniGame) { [actions insertObject:[XPPKAction blindActionWithRoomInfo:roomInfo] atIndex:0]; } @@ -71,25 +77,26 @@ } // 4. 基础功能 - 根据权限 - if (isCreator || isManager || isSuperAdmin) { + if (userNotNormal) { [actions addObject:[XPSocialAction trumpetAction]]; - [actions addObject:[XPGiftEffectAction actionWithRoomInfo:roomInfo]]; + [actions addObject:[XPRoomEffectAction action]]; [actions addObject:[XPRoomSettingAction action]]; [actions addObject:[XPRoomBackGroundSettingAction action]]; [actions addObject:[XPRoomCleanMessagesAction action]]; } else { [actions addObject:[XPSocialAction trumpetAction]]; - [actions addObject:[XPGiftEffectAction actionWithRoomInfo:roomInfo]]; + [actions addObject:[XPRoomEffectAction action]]; } // 5. 通用功能 [actions addObject:[XPSocialAction reportAction]]; // 6. 房间类型设置 - if ((isCreator || isManager || isSuperAdmin) && + if (userNotNormal && roomInfo.isPermitRoom != PermitRoomType_License && roomInfo.roomModeType != RoomModeType_Open_Blind && - type != RoomType_MiniGame && type != RoomType_Anchor) { + type != RoomType_MiniGame && + type != RoomType_Anchor) { [actions addObject:[XPRoomTypeSettingAction action]]; } @@ -100,10 +107,14 @@ } // 8. 红包功能 - 插入到指定位置 - if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open && roomInfo.redEnvelopeOpen) { + if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open && + roomInfo.redEnvelopeOpen) { [actions insertObject:[XPRoomRedPacketAction action] atIndex:1]; } + // 9. 极速模式 + [actions addObject:[XPTurboModeAction actionWithRoomInfo:roomInfo]]; + return actions; } @@ -128,7 +139,7 @@ NSMutableArray *actions = [NSMutableArray array]; [actions addObject:[XPSocialAction trumpetAction]]; - [actions addObject:[XPGiftEffectAction actionWithRoomInfo:context.roomInfo]]; + [actions addObject:[XPTurboModeAction actionWithRoomInfo:context.roomInfo]]; [actions addObject:[XPRoomAppManagerAction action]]; [actions addObject:[XPSocialAction reportAction]]; diff --git a/YuMi/Modules/YMRoom/View/MoreView/Model/XPRoomMoreItemModel.h b/YuMi/Modules/YMRoom/View/MoreView/Model/XPRoomMoreItemModel.h index f5133eb7..4dbf9f23 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Model/XPRoomMoreItemModel.h +++ b/YuMi/Modules/YMRoom/View/MoreView/Model/XPRoomMoreItemModel.h @@ -19,9 +19,9 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) { // ///公屏开启 // RoomMoreMenuType_Message_Screen_Open = 4, // ///我的礼物特效关闭 - RoomMoreMenuType_Gift_Effect_Close = 5, + RoomMoreMenuType_UI_Effect_Close = 5, ///我的礼物特效开启 - RoomMoreMenuType_Gift_Effect_Open = 6, + RoomMoreMenuType_UI_Effect_Open = 6, ///房间设置 RoomMoreMenuType_Room_Setting = 7, ///邀请粉丝 @@ -66,6 +66,8 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) { RoomMoreMenuType_Room_Music_Panel = 27, RoomMoreMenuType_App_Manager = 28, + + RoomMoreMenuType_Turbo_Mode = 29, }; @interface XPRoomMoreItemModel : PIBaseModel diff --git a/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.h b/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.h index 467bc1c7..19f94071 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.h +++ b/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.h @@ -11,26 +11,12 @@ NS_ASSUME_NONNULL_BEGIN @class RoomInfoModel; @interface XPMoreMenuPresenter : BaseMvpPresenter +///获取更多菜单 - (void)getMoreMenuDataSourceWithNewArchitecture:(RoomInfoModel *)roomInfo isSuperAdmin:(BOOL)isSuperAdmin isOnMic:(BOOL)isOnMic isAppSuperAdmin:(BOOL)isAppSuperAdmin; -///获取更多菜单 -- (void)getMoreMenuDataSource:(RoomInfoModel *)roomInfo isSuperAdmin:(BOOL)isSuperAdmin isOnMic:(BOOL)isOnMic isAppSuperAdmin:(BOOL)isAppSuperAdmin; - -/// 开启房间礼物值 -/// @param roomUid 房间的uid -- (void)openRoomGiftValue:(NSString *)roomUid; - -/// 关闭房间礼物值 -/// @param roomUid 房间的uid -- (void)closeRoomGiftValue:(NSString *)roomUid; - -/// 更新公屏状态 -/// @param isCloseScreen 是否关闭公屏 -/// @param roomId 房间的id -- (void)updateRoomMessageScreenState:(BOOL)isCloseScreen roomId:(NSString *)roomId; /// 开启相亲模式 /// @param roomUid 房主的uid @@ -43,8 +29,10 @@ NS_ASSUME_NONNULL_BEGIN ///获取房间广播模板内容 /// @param type 房间类型 - (void)getRoomRadioMessageListWithType:(NSString *)type; + /// 获取房间VIP小喇叭信息 - (void)getRoomgetUserVipRoomTrumpet:(NSString *)roomUid; + ///结束个播跨房PK - (void)requestFinishAnchorPK:(NSString *)roundId; diff --git a/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.m b/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.m index 92ea925e..fbdb4038 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.m +++ b/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.m @@ -56,7 +56,7 @@ isOnMic:(BOOL)isOnMic isAppSuperAdmin:(BOOL)isAppSuperAdmin { // 创建上下文 - XPRoomMoreMenuActionContext *context = [XPRoomMoreMenuActionContext + XPRoomMoreMenuActionContext *context = [XPRoomMoreMenuActionContext contextWithRoomInfo:roomInfo userInfo:nil hostDelegate:nil @@ -65,35 +65,35 @@ isSuperAdmin:isSuperAdmin isAppSuperAdmin:isAppSuperAdmin]; - if (isAppSuperAdmin) { - // 超管使用固定组合 - NSArray *actions = [XPRoomMoreMenuActionFactory createSuperAdminActionsWithContext:context]; + if (isAppSuperAdmin) { + // 超管使用固定组合 + NSArray *actions = [XPRoomMoreMenuActionFactory createSuperAdminActionsWithContext:context]; + [self convertActionsToModels:actions]; + } else { + // 普通用户根据权限创建 + @kWeakify(self); + [self loadNIMMemberData:^(NSArray * _Nullable members) { + @kStrongify(self); + + BOOL isCreator = NO; + BOOL isManager = NO; + + if (members && members.count > 0) { + NIMChatroomMember *member = members.firstObject; + isCreator = member.type == NIMChatroomMemberTypeCreator; + isManager = member.type == NIMChatroomMemberTypeManager; + } + + NSArray *actions = [XPRoomMoreMenuActionFactory + createPanelActionsWithContext:context + isCreator:isCreator + isManager:isManager + isSuperAdmin:isSuperAdmin + isOnMic:isOnMic]; + [self convertActionsToModels:actions]; - } else { - // 普通用户根据权限创建 - @kWeakify(self); - [self loadNIMMemberData:^(NSArray * _Nullable members) { - @kStrongify(self); - - BOOL isCreator = NO; - BOOL isManager = NO; - - if (members && members.count > 0) { - NIMChatroomMember *member = members.firstObject; - isCreator = member.type == NIMChatroomMemberTypeCreator; - isManager = member.type == NIMChatroomMemberTypeManager; - } - - NSArray *actions = [XPRoomMoreMenuActionFactory - createPanelActionsWithContext:context - isCreator:isCreator - isManager:isManager - isSuperAdmin:isSuperAdmin - isOnMic:isOnMic]; - - [self convertActionsToModels:actions]; - } withRoomInfo:roomInfo]; - } + } withRoomInfo:roomInfo]; + } } // 将 Action 转换为数据模型 @@ -105,237 +105,6 @@ [[self getView] getMoreMenuDataSuccess:models]; } -- (void)getMoreMenuDataSource:(RoomInfoModel *)roomInfo isSuperAdmin:(BOOL)isSuperAdmin isOnMic:(BOOL)isOnMic isAppSuperAdmin:(BOOL)isAppSuperAdmin{ - XPRoomMoreItemModel * roomPK = [[XPRoomMoreItemModel alloc] init]; - roomPK.title = roomInfo.roomModeType == RoomModeType_Open_PK_Mode ?YMLocalizedString(@"XPMoreMenuPresenter26") : YMLocalizedString(@"XPMoreMenuPresenter1"); - roomPK.imageName= @"room_pk_menu_icon"; - roomPK.type = roomInfo.roomModeType == RoomModeType_Open_PK_Mode ? RoomMoreMenuType_Room_PK_Close : RoomMoreMenuType_Room_PK_Open; - roomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * acrossRoomPK = [[XPRoomMoreItemModel alloc] init]; - acrossRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? YMLocalizedString(@"XPMoreMenuPresenter30") : YMLocalizedString(@"XPMoreMenuPresenter31"); - acrossRoomPK.imageName = @"crossroom_pk_menu_icon"; - acrossRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Across_PK_Close : RoomMoreMenuType_Room_Across_PK_Open; - acrossRoomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel *bgValue = [[XPRoomMoreItemModel alloc] init]; - bgValue.title = YMLocalizedString(@"1.0.18_0"); - bgValue.imageName= @"room_menu_background"; - bgValue.type = RoomMoreMenuType_Room_Type_Background; - bgValue.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * giftEffect = [[XPRoomMoreItemModel alloc] init]; - giftEffect.title = roomInfo.hasAnimationEffect ? YMLocalizedString(@"XPMoreMenuPresenter28") : YMLocalizedString(@"XPMoreMenuPresenter5"); - giftEffect.imageName = @"room_more_menu_gift_effect"; - giftEffect.type = roomInfo.hasAnimationEffect ? RoomMoreMenuType_Gift_Effect_Close : RoomMoreMenuType_Gift_Effect_Open; - giftEffect.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * dating = [[XPRoomMoreItemModel alloc] init]; - dating.title = roomInfo.roomModeType == RoomModeType_Open_Blind ? YMLocalizedString(@"XPMoreMenuPresenter29") : YMLocalizedString(@"XPMoreMenuPresenter8"); - dating.imageName = @"room_more_menu_dating"; - dating.type = roomInfo.roomModeType == RoomModeType_Open_Blind ? RoomMoreMenuType_Room_Dating_Close : RoomMoreMenuType_Room_Dating_Open; - dating.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * anchorRoomPK = [[XPRoomMoreItemModel alloc] init]; - anchorRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? YMLocalizedString(@"XPMoreMenuPresenter32") : YMLocalizedString(@"XPMoreMenuPresenter33"); - anchorRoomPK.imageName = @"room_more_menu_anchor_pk"; - anchorRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Anchor_PK_Close : RoomMoreMenuType_Room_Anchor_PK_Open; - anchorRoomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - if (roomInfo.pkState == AcrossRoomPkStateTypePenalty) { - if ([roomInfo.winUid isEqualToString:[AccountInfoStorage instance].getUid]) { - anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter15"); - } else if ([roomInfo.winUid isEqualToString:roomInfo.pkUid]) { - anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter14"); - } else { - anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter15"); - } - } else if (roomInfo.pkState == AcrossRoomPkStateTypePenaltyEnd) { - anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter15"); - } - if (roomInfo.pkMatchStartTime) { - anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter17"); - } - - XPRoomMoreItemModel * clearScreen = [[XPRoomMoreItemModel alloc] init]; - clearScreen.title = YMLocalizedString(@"XPMoreMenuPresenter20"); - clearScreen.imageName = @"room_more_menu_message_clean"; - clearScreen.type = RoomMoreMenuType_Message_Screen_Clear; - clearScreen.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * roomSetting = [[XPRoomMoreItemModel alloc] init]; - roomSetting.title = YMLocalizedString(@"XPMoreMenuPresenter21"); - roomSetting.imageName = @"room_more_menu_setting"; - roomSetting.type = RoomMoreMenuType_Room_Setting; - roomSetting.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * trumpet = [[XPRoomMoreItemModel alloc] init]; - trumpet.title = YMLocalizedString(@"XPMoreMenuPresenter35"); - trumpet.imageName = @"room_more_menu_trumpet"; - trumpet.type = RoomMoreMenuType_Room_trumpet; - trumpet.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * redPacket = [[XPRoomMoreItemModel alloc] init]; - redPacket.title = YMLocalizedString(@"XPMoreMenuPresenter24"); - redPacket.imageName = @"pi_red_packet_entrance"; - redPacket.type = RoomMoreMenuType_Room_redPacket; - redPacket.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * report = [[XPRoomMoreItemModel alloc] init]; - report.title = YMLocalizedString(@"XPMoreMenuPresenter36"); - report.imageName = @"room_info_report"; - report.type = RoomMoreMenuType_Room_report; - report.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * roomPhotoAlbum = [[XPRoomMoreItemModel alloc] init]; - roomPhotoAlbum.title = YMLocalizedString(@"XPMoreMenuPresenter37"); - roomPhotoAlbum.imageName = @"room_info_photo_album"; - roomPhotoAlbum.type = RoomMoreMenuType_Room_Room_Photo_Album; - roomPhotoAlbum.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * roomTypeSetting = [[XPRoomMoreItemModel alloc] init]; - roomTypeSetting.title = YMLocalizedString(@"XPMoreMenuPresenter25"); - roomTypeSetting.imageName = @"room_type_selection_icon"; - roomTypeSetting.type = RoomMoreMenuType_Room_Type_Setting; - roomTypeSetting.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel * musicPanel = [[XPRoomMoreItemModel alloc] init]; - musicPanel.title = YMLocalizedString(@"XPRoomMusicVoiceSettingView1"); - musicPanel.imageName = @"menu_music"; - musicPanel.type = RoomMoreMenuType_Room_Music_Panel; - musicPanel.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor]; - - XPRoomMoreItemModel *appManager = [[XPRoomMoreItemModel alloc] init]; - appManager.type = RoomMoreMenuType_App_Manager; - appManager.title = YMLocalizedString(@"1.0.34_text_1"); - appManager.imageName = @"app_admin_icon"; - appManager.titleColor = [UIColor orangeColor]; - - NSString * uid = [AccountInfoStorage instance].getUid; - if (uid.length <= 0) { - return; - } - NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; - NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init]; - request.roomId = roomId; - request.userIds = @[uid]; - - if (isAppSuperAdmin) { - NSMutableArray * array = [NSMutableArray array]; - [array addObject:trumpet]; - [array addObject:giftEffect]; - [array addObject:appManager]; - [array addObject:report]; - [[self getView] getMoreMenuDataSuccess:array]; - return; - } - - [[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray * _Nullable members) { - NSMutableArray * array = [NSMutableArray array]; - BOOL isCreator = NO; - BOOL isManager = NO; - NSInteger indexOfRoomAlbum = 0; - if (error == nil) { - NIMChatroomMember * member = members.firstObject; - isCreator = member.type == NIMChatroomMemberTypeCreator; - isManager = member.type == NIMChatroomMemberTypeManager; - - if ((isCreator || isManager || isSuperAdmin) && roomInfo.type != RoomType_MiniGame && roomInfo.type != RoomType_Anchor) { - [array addObject:roomPK]; - indexOfRoomAlbum += 1; - } - - if (isCreator && roomInfo.type != RoomType_MiniGame) { - if(roomInfo.type != RoomType_Anchor){ - [array addObject:acrossRoomPK]; - indexOfRoomAlbum += 1; - } - } - - if (isOnMic) { - [array addObject:musicPanel]; - indexOfRoomAlbum += 1; - } - - if (isCreator && roomInfo.type == RoomType_Anchor) { - [array addObject:anchorRoomPK]; - indexOfRoomAlbum += 1; - } - - if (isCreator || isManager || isSuperAdmin) { - if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor && roomInfo.type != RoomType_MiniGame) { - [array insertObject:dating atIndex:0]; - indexOfRoomAlbum += 1; - } - [array addObject:trumpet]; - [array addObject:giftEffect]; - [array addObject:roomSetting]; - if (isCreator || isManager || isSuperAdmin) { - [array addObject:bgValue]; - indexOfRoomAlbum += 1; - } - [array addObject:clearScreen]; - } else { - [array addObject:trumpet]; - [array addObject:giftEffect]; - } - }else{ - [array addObject:giftEffect]; - } - - [array addObject:report]; - - if ((isCreator || isManager || isSuperAdmin) && // 房主 & 管理 - roomInfo.isPermitRoom != PermitRoomType_License && // 非牌照 - roomInfo.roomModeType != RoomModeType_Open_Blind && // 非相亲 - roomInfo.type != RoomType_MiniGame && // 非 10/15 麦 - roomInfo.type != RoomType_Anchor) { - [array addObject:roomTypeSetting]; - } - - if(roomInfo.hasRoomAlbum == YES){ - [array insertObject:roomPhotoAlbum atIndex:indexOfRoomAlbum]; - } - if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open && roomInfo.redEnvelopeOpen) { - [array insertObject:redPacket atIndex:1]; - } - [[self getView] getMoreMenuDataSuccess:array]; - }]; -} - -/// 开启房间礼物值 -/// @param roomUid 房间的uid -- (void)openRoomGiftValue:(NSString *)roomUid { - NSString * uid = [AccountInfoStorage instance].getUid; - [Api openRoomGiftValue:[self createHttpCompletion:^(BaseModel * _Nonnull data) { - [[self getView] openRoomGiftValueSuccess]; - }] uid:uid roomUid:roomUid]; -} - -/// 关闭房间礼物值 -/// @param roomUid 房间的uid -- (void)closeRoomGiftValue:(NSString *)roomUid { - NSString * uid = [AccountInfoStorage instance].getUid; - [Api closeRoomGiftValue:[self createHttpCompletion:^(BaseModel * _Nonnull data) { - [[self getView] closeRoomGiftValueSuccess]; - }fail:^(NSInteger code, NSString * _Nullable msg) { -// NSLog(@"%@",msg); - }] uid:uid roomUid:roomUid]; -} - - -/// 更新公屏状态 -/// @param isCloseScreen 是否关闭公屏 -/// @param roomId 房间的id -- (void)updateRoomMessageScreenState:(BOOL)isCloseScreen roomId:(NSString *)roomId { - NSString * uid = [AccountInfoStorage instance].getUid; - NSString * ticket = [AccountInfoStorage instance].getTicket; - NSString * isCleScreenStr = isCloseScreen ? @"1" : @"0"; - [Api updateRoomInfoMessageState:[self createHttpCompletion:^(BaseModel * _Nonnull data) { - RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:data.data]; - [[self getView] updateRoomMessageScreenStateSuccess:roomInfo]; - }] roomId:roomId isCloseScreen:isCleScreenStr ticket:ticket uid:uid]; -} - /// 开启相亲模式 /// @param roomUid 房主的uid - (void)openRoomDating:(NSString *)roomUid { diff --git a/YuMi/Modules/YMRoom/View/MoreView/View/XPRoomMoreMenuViewController.m b/YuMi/Modules/YMRoom/View/MoreView/View/XPRoomMoreMenuViewController.m index e085474d..e9cc09c1 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/View/XPRoomMoreMenuViewController.m +++ b/YuMi/Modules/YMRoom/View/MoreView/View/XPRoomMoreMenuViewController.m @@ -51,8 +51,15 @@ #import "XPRoomMoreMenuAction.h" #import "XPPKAction.h" +#import "XPTurboModeViewController.h" +#import "XPTurboModeConstants.h" +#import "XPRoomSettingPresenter.h" + UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; +// 🔧 新增:Turbo Mode 相关常量声明 +extern NSString *const kTurboModeButtonStateChanged; + @interface XPRoomMoreMenuViewController () ///顶部的View @property (nonatomic,strong) UIView * topView; @@ -70,10 +77,100 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; @property (nonatomic,assign) id hostDelegate; @property(nonatomic, assign) BOOL isOnMic; + +// 🔧 新增:Turbo_Mode 按钮 +@property (nonatomic, strong) UIButton *turboModeButton; + @end @implementation XPRoomMoreMenuViewController +// 🔧 新增:设置 Turbo_Mode 按钮 +- (void)setupTurboModeButton { + self.turboModeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [self.turboModeButton setTitle:YMLocalizedString(@"20.20.62_text_9") forState:UIControlStateNormal]; + [self.turboModeButton setImage:[UIImage imageNamed:@"icon_turbo_mode"] forState:UIControlStateNormal]; + [self.turboModeButton addTarget:self action:@selector(turboModeButtonTapped) forControlEvents:UIControlEventTouchUpInside]; + + // 设置按钮样式 + self.turboModeButton.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.8]; + self.turboModeButton.layer.cornerRadius = 8; + self.turboModeButton.titleLabel.font = [UIFont systemFontOfSize:14]; + + [self.view addSubview:self.turboModeButton]; + + // 设置约束 - 使用 Masonry + [self.turboModeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.topView.mas_bottom).offset(20); + make.centerX.mas_equalTo(self.view); + make.width.mas_equalTo(120); + make.height.mas_equalTo(40); + }]; + + // 初始化按钮状态 + [self updateTurboModeButtonStateOnRoomEnter]; +} + +// 🔧 新增:设置 Turbo Mode 通知监听 +- (void)setupTurboModeNotifications { + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(handleTurboModeButtonStateChanged:) + name:kTurboModeButtonStateChanged + object:nil]; +} + +// 🔧 新增:处理 Turbo Mode 按钮状态变化 +- (void)handleTurboModeButtonStateChanged:(NSNotification *)notification { + BOOL allOn = [notification.userInfo[@"allOn"] boolValue]; + [self updateTurboModeButtonState:allOn]; +} + +// 🔧 新增:更新 Turbo Mode 按钮状态 +- (void)updateTurboModeButtonState:(BOOL)allOn { + if (allOn) { + [self.turboModeButton setTitleColor:[UIColor greenColor] forState:UIControlStateNormal]; + self.turboModeButton.backgroundColor = [UIColor colorWithRed:0.2 green:0.8 blue:0.2 alpha:0.8]; + } else { + [self.turboModeButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; + self.turboModeButton.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.8]; + } +} + +// 🔧 新增:Turbo Mode 按钮点击事件 +- (void)turboModeButtonTapped { + // 打开 Turbo 配置面板 + [self dismissViewControllerAnimated:NO completion:nil]; + XPTurboModeViewController *vc = [[XPTurboModeViewController alloc] init]; + vc.roomInfo = self.roomInfo; + vc.modalPresentationStyle = UIModalPresentationOverFullScreen; + [self.hostDelegate.getCurrentNav presentViewController:vc + animated:YES + completion:nil]; +} + +// 🔧 新增:进入房间时更新按钮状态 +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self updateTurboModeButtonStateOnRoomEnter]; +} + +- (void)updateTurboModeButtonStateOnRoomEnter { + NSString *roomId = @(self.roomInfo.roomId).stringValue; + + // 读取三个开关状态 + BOOL giftEffectsEnabled = self.roomInfo.hasAnimationEffect; + BOOL globalGiftScreenEnabled = [[NSUserDefaults standardUserDefaults] + boolForKey:kTurboGlobalGiftScreenEnabledKey(roomId)] ?: YES; + BOOL globalGameScreenEnabled = [[NSUserDefaults standardUserDefaults] + boolForKey:kTurboGlobalGameScreenEnabledKey(roomId)] ?: YES; + + BOOL allOn = giftEffectsEnabled && globalGiftScreenEnabled && globalGameScreenEnabled; + [self updateTurboModeButtonState:allOn]; +} + + + - (instancetype)initWithDelegate:(id)delegate isUserOnMic:(BOOL)isOnMic { if (self = [super init]) { self.modalPresentationStyle = UIModalPresentationOverFullScreen; @@ -91,6 +188,8 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; - (void)viewDidLoad { [super viewDidLoad]; [self initSubViews]; +// [self setupTurboModeButton]; + [self setupTurboModeNotifications]; [self initSubViewConstraints]; ///自己是公会超管 @@ -101,10 +200,6 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; break; } } -// [self.presenter getMoreMenuDataSource:self.roomInfo -// isSuperAdmin:meIsSuperAdmin -// isOnMic:self.isOnMic -// isAppSuperAdmin:[self.hostDelegate.getUserInfo platformRole]==1]; [self.presenter getMoreMenuDataSourceWithNewArchitecture:self.roomInfo isSuperAdmin:meIsSuperAdmin @@ -156,6 +251,7 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; self.datasource = list; [self.collectionView reloadData]; + CGFloat contentHeight= 24 + 36; CGFloat itemHeight = 50; int page = list.count % 5; @@ -166,7 +262,9 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; contentHeight += ((scale+1) *itemHeight + scale * 12); } CAShapeLayer * layer = [CAShapeLayer layer]; - UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, contentHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)]; + UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, contentHeight) + byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight + cornerRadii:CGSizeMake(8, 8)]; layer.path = path.CGPath; self.collectionView.layer.mask = layer; [self.collectionView mas_updateConstraints:^(MASConstraintMaker *make) { @@ -253,9 +351,6 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; XPAnchorPKViewController * acrossRoomPKVC = [[XPAnchorPKViewController alloc] initWithRoomUid:roomUid]; [self.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC animated:YES completion:nil]; - -// XPAnchorPKSelectTypeController *selectVc = [[XPAnchorPKSelectTypeController alloc] initWithRoomUid:roomUid]; -// [self.hostDelegate.getCurrentNav presentViewController:selectVc animated:YES completion:nil]; } #pragma mark - UICollectionViewDelegate And UICollectionViewDatasource @@ -282,19 +377,54 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; NSString * roomUid = [NSString stringWithFormat:@"%ld",self.roomInfo.uid]; switch (item.type) { - case RoomMoreMenuType_Gift_Effect_Open: + case RoomMoreMenuType_UI_Effect_Open: + case RoomMoreMenuType_UI_Effect_Close: { - [self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController4")]; - NSDictionary * dic = @{@"hasAnimationEffect": @(1)}; - [[NSNotificationCenter defaultCenter] postNotificationName:kRoomGiftEffectUpdateNotificationKey object:dic]; - [self dismissViewControllerAnimated:YES completion:nil]; - } - break; - case RoomMoreMenuType_Gift_Effect_Close: - { - [self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController5")]; - NSDictionary * dic = @{@"hasAnimationEffect": @(0)}; - [[NSNotificationCenter defaultCenter] postNotificationName:kRoomGiftEffectUpdateNotificationKey object:dic]; + BOOL newOn = !self.roomInfo.hasAnimationEffect; + + // 子开关本地持久化(默认 key 与 Turbo 面板保持一致) + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + [ud setBool:newOn forKey:@"kTurboGlobalGiftScreenEnabled"]; + [ud setBool:newOn forKey:@"kTurboGlobalGameScreenEnabled"]; + [ud synchronize]; + + // 广播:子开关通知 + [[NSNotificationCenter defaultCenter] postNotificationName:@"kTurboGlobalGiftScreenEnabledChanged" + object:nil + userInfo:@{ @"on": @(newOn) }]; + [[NSNotificationCenter defaultCenter] postNotificationName:@"kTurboGlobalGameScreenEnabledChanged" + object:nil + userInfo:@{ @"on": @(newOn) }]; + // 广播:总开关通知 + [[NSNotificationCenter defaultCenter] postNotificationName:@"kTurboGiftEffectsEnabledChanged" + object:nil + userInfo:@{ @"on": @(newOn) }]; + + // 同步到服务端房间属性 hasAnimationEffect + XPRoomSettingPresenter *p = [[XPRoomSettingPresenter alloc] init]; + RoomInfoModel *ri = self.roomInfo; + [p updateRoomInfo:ri.title + roomPwd:ri.roomPwd + tagId:ri.roomTag + classifyId:ri.singleRoomSortId + hasAnimationEffect:newOn + roomUid:@(ri.uid).stringValue + roomId:@(ri.roomId).stringValue + type:ri.type + itemType:RoomSettingItemType_Gift_Effect + mgId:@(ri.mgId).stringValue + backPic:ri.backPic + avatar:ri.avatar]; + + // 本地提示 + if (newOn) { + [self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController4")]; + } else { + [self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController5")]; + } + + // 更新本地 roomInfo 并关闭 + self.roomInfo.hasAnimationEffect = newOn; [self dismissViewControllerAnimated:YES completion:nil]; } break; @@ -534,6 +664,16 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; [self.hostDelegate.getCurrentNav pushViewController:vc animated:YES]; } break; + case RoomMoreMenuType_Turbo_Mode: { + [self dismissViewControllerAnimated:NO completion:nil]; + XPTurboModeViewController *vc = [[XPTurboModeViewController alloc] init]; + vc.roomInfo = self.roomInfo; + vc.modalPresentationStyle = UIModalPresentationOverFullScreen; + [self.hostDelegate.getCurrentNav presentViewController:vc + animated:YES + completion:nil]; + } + break; default: break; } @@ -569,7 +709,6 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; _topView.backgroundColor = [UIColor clearColor]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissRecognizer)]; tap.cancelsTouchesInView = NO; - tap.delegate = self; [_topView addGestureRecognizer:tap]; } return _topView; diff --git a/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeConstants.h b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeConstants.h new file mode 100644 index 00000000..84f00a44 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeConstants.h @@ -0,0 +1,55 @@ +// +// XPTurboModeConstants.h +// YuMi +// +// Created by P on 2025/1/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +// MARK: - 缓存 Key 生成函数 +/** + * 生成礼物特效开关的缓存 Key + * @param roomId 房间 ID + * @return 格式化的缓存 Key + */ +NSString *kTurboGiftEffectsEnabledKey(NSString *roomId); + +/** + * 生成全局礼物屏幕开关的缓存 Key + * @param roomId 房间 ID + * @return 格式化的缓存 Key + */ +NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId); + +/** + * 生成全局游戏屏幕开关的缓存 Key + * @param roomId 房间 ID + * @return 格式化的缓存 Key + */ +NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId); + +// MARK: - 通知名称常量 +/** + * 礼物特效开关状态改变通知 + */ +extern NSString *const kTurboGiftEffectsEnabledChanged; + +/** + * 全局礼物屏幕开关状态改变通知 + */ +extern NSString *const kTurboGlobalGiftScreenEnabledChanged; + +/** + * 全局游戏屏幕开关状态改变通知 + */ +extern NSString *const kTurboGlobalGameScreenEnabledChanged; + +/** + * Turbo Mode 按钮状态改变通知 + */ +extern NSString *const kTurboModeButtonStateChanged; + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeConstants.m b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeConstants.m new file mode 100644 index 00000000..422c6d54 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeConstants.m @@ -0,0 +1,27 @@ +// +// XPTurboModeConstants.m +// YuMi +// +// Created by P on 2025/1/13. +// + +#import "XPTurboModeConstants.h" + +// MARK: - 缓存 Key 生成函数实现 +NSString *kTurboGiftEffectsEnabledKey(NSString *roomId) { + return [NSString stringWithFormat:@"TurboGiftEffects_%@", roomId]; +} + +NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId) { + return [NSString stringWithFormat:@"TurboGlobalGiftScreen_%@", roomId]; +} + +NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId) { + return [NSString stringWithFormat:@"TurboGlobalGameScreen_%@", roomId]; +} + +// MARK: - 通知名称常量定义 +NSString *const kTurboGiftEffectsEnabledChanged = @"kTurboGiftEffectsEnabledChanged"; +NSString *const kTurboGlobalGiftScreenEnabledChanged = @"kTurboGlobalGiftScreenEnabledChanged"; +NSString *const kTurboGlobalGameScreenEnabledChanged = @"kTurboGlobalGameScreenEnabledChanged"; +NSString *const kTurboModeButtonStateChanged = @"kTurboModeButtonStateChanged"; diff --git a/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeViewController.h b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeViewController.h new file mode 100644 index 00000000..b06a30a6 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeViewController.h @@ -0,0 +1,23 @@ +// +// XPTurboModeViewController.h +// YuMi +// +// Created by P on 2025/9/2. +// + +#import "MvpViewController.h" + +@class RoomInfoModel; + +NS_ASSUME_NONNULL_BEGIN + +/** + * Turbo模式设置控制器 + */ +@interface XPTurboModeViewController : MvpViewController + +@property (nonatomic, strong) RoomInfoModel *roomInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeViewController.m b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeViewController.m new file mode 100644 index 00000000..df6c269f --- /dev/null +++ b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeViewController.m @@ -0,0 +1,263 @@ +// +// XPTurboModeViewController.m +// YuMi +// +// Created by Linus on 2025/1/13. +// + +#import "XPTurboModeViewController.h" +#import +#import +#import "RoomInfoModel.h" +#import "XPTurboModeConstants.h" + +@interface XPTurboModeViewController () + +@property (nonatomic, strong) UIView *bottomAreaBackground; +@property (nonatomic, strong) UIButton *dismissButton; +@property (nonatomic, strong) UILabel *titleLabel; + +// 三个开关 +@property (nonatomic, strong) UISwitch *giftEffectsSwitch; // 礼物特效开关 +@property (nonatomic, strong) UISwitch *globalGiftScreenSwitch; // 全局礼物屏幕开关 +@property (nonatomic, strong) UISwitch *globalGameScreenSwitch; // 全局游戏屏幕开关 + +// 开关状态 +@property (nonatomic, assign) BOOL giftEffectsEnabled; // 礼物特效开关状态(临时) +@property (nonatomic, assign) BOOL globalGiftScreenEnabled; // 全局礼物屏幕开关状态(持久化) +@property (nonatomic, assign) BOOL globalGameScreenEnabled; // 全局游戏屏幕开关状态(持久化) + +// 房间信息 +@property (nonatomic, strong) NSString *roomId; // 当前房间 ID + +@end + +@implementation XPTurboModeViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setupUI]; + [self setupSwitchStates]; +} + +- (void)setupUI { + self.view.backgroundColor = [UIColor clearColor]; + + [self setupBottomArea]; + [self setupDismissButton]; + [self setupTitle]; + [self setupSwitches]; +} + +- (void)setupBottomArea { + self.bottomAreaBackground = [[UIView alloc] init]; + self.bottomAreaBackground.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.95]; + self.bottomAreaBackground.layer.cornerRadius = 20; + self.bottomAreaBackground.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner; + [self.view addSubview:self.bottomAreaBackground]; + + // 设置约束 - 使用 Masonry + [self.bottomAreaBackground mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.bottom.mas_equalTo(self.view); + make.height.mas_equalTo(300); + }]; +} + +- (void)setupDismissButton { + self.dismissButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [self.dismissButton setTitle:@"✕" forState:UIControlStateNormal]; + [self.dismissButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + self.dismissButton.titleLabel.font = [UIFont systemFontOfSize:24]; + [self.dismissButton addTarget:self action:@selector(dismissViewController) forControlEvents:UIControlEventTouchUpInside]; + [self.bottomAreaBackground addSubview:self.dismissButton]; + + // 设置约束 - 使用 Masonry + [self.dismissButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.bottomAreaBackground).offset(20); + make.trailing.mas_equalTo(self.bottomAreaBackground).offset(-20); + make.width.height.mas_equalTo(44); + }]; +} + +- (void)setupTitle { + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.text = YMLocalizedString(@"20.20.62_text_9"); // Turbo Mode + self.titleLabel.textColor = [UIColor whiteColor]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:18]; + self.titleLabel.textAlignment = NSTextAlignmentCenter; + [self.bottomAreaBackground addSubview:self.titleLabel]; + + // 设置约束 - 使用 Masonry + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.dismissButton); + make.centerX.mas_equalTo(self.bottomAreaBackground); + make.leading.mas_greaterThanOrEqualTo(self.bottomAreaBackground).offset(60); + make.trailing.mas_lessThanOrEqualTo(self.bottomAreaBackground).offset(-60); + }]; +} + +- (void)setupSwitches { + // 礼物特效开关(临时状态) + [self setupSwitchItem:YMLocalizedString(@"20.20.62_text_10") // Gift effects + switch:self.giftEffectsSwitch + atIndex:0]; + + // 全局礼物屏幕开关(持久化) + [self setupSwitchItem:YMLocalizedString(@"20.20.62_text_11") // Global gift screen + switch:self.globalGiftScreenSwitch + atIndex:1]; + + // 全局游戏屏幕开关(持久化) + [self setupSwitchItem:YMLocalizedString(@"20.20.62_text_12") // Global game screen + switch:self.globalGameScreenSwitch + atIndex:2]; +} + +- (void)setupSwitchItem:(NSString *)title + switch:(UISwitch *)switchControl + atIndex:(NSInteger)index { + + UIView *switchView = [[UIView alloc] init]; + switchView.backgroundColor = [UIColor colorWithWhite:0.2 alpha:0.8]; + switchView.layer.cornerRadius = 12; + [self.bottomAreaBackground addSubview:switchView]; + + UILabel *titleLabel = [[UILabel alloc] init]; + titleLabel.text = title; + titleLabel.textColor = [UIColor whiteColor]; + titleLabel.font = [UIFont systemFontOfSize:16]; + [switchView addSubview:titleLabel]; + + UISwitch *switchViewControl = [[UISwitch alloc] init]; + switchViewControl.onTintColor = [UIColor systemBlueColor]; + [switchView addSubview:switchViewControl]; + + // 设置约束 - 使用 Masonry + [switchView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.bottomAreaBackground).offset(20); + make.trailing.mas_equalTo(self.bottomAreaBackground).offset(-20); + make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(30 + index * 70); + make.height.mas_equalTo(50); + }]; + + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(switchView).offset(16); + make.centerY.mas_equalTo(switchView); + }]; + + [switchViewControl mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(switchView).offset(-16); + make.centerY.mas_equalTo(switchView); + }]; + + // 添加开关事件 + [switchViewControl addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged]; + switchViewControl.tag = index; + + // 保存 switch 引用 + if (index == 0) { + self.giftEffectsSwitch = switchViewControl; + } else if (index == 1) { + self.globalGiftScreenSwitch = switchViewControl; + } else if (index == 2) { + self.globalGameScreenSwitch = switchViewControl; + } +} + +- (void)setupSwitchStates { + NSString *roomId = @(self.roomInfo.roomId).stringValue; + self.roomId = roomId; + + // 礼物特效:从当前会话状态读取(不持久化) + self.giftEffectsEnabled = self.roomInfo.hasAnimationEffect; + + // 其他两个开关:从房间特定的 NSUserDefaults 读取(区分未设置与显式 NO) + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + id giftScreenObj = [defaults objectForKey:kTurboGlobalGiftScreenEnabledKey(roomId)]; + self.globalGiftScreenEnabled = (giftScreenObj != nil) ? [defaults boolForKey:kTurboGlobalGiftScreenEnabledKey(roomId)] : YES; // 默认开启 + id gameScreenObj = [defaults objectForKey:kTurboGlobalGameScreenEnabledKey(roomId)]; + self.globalGameScreenEnabled = (gameScreenObj != nil) ? [defaults boolForKey:kTurboGlobalGameScreenEnabledKey(roomId)] : YES; // 默认开启 + + // 设置开关初始状态 + self.giftEffectsSwitch.on = self.giftEffectsEnabled; + self.globalGiftScreenSwitch.on = self.globalGiftScreenEnabled; + self.globalGameScreenSwitch.on = self.globalGameScreenEnabled; + + NSLog(@"🎮 Turbo Mode开关初始化完成 - 房间ID: %@, 礼物特效: %@, 全局礼物屏幕: %@, 全局游戏屏幕: %@", + roomId, + self.giftEffectsEnabled ? @"开启" : @"关闭", + self.globalGiftScreenEnabled ? @"开启" : @"关闭", + self.globalGameScreenEnabled ? @"开启" : @"关闭"); +} + +- (void)switchValueChanged:(UISwitch *)sender { + BOOL isOn = sender.isOn; + + if (sender.tag == 0) { // 礼物特效开关 + // 临时更改房间状态,不影响 roomInfo.hasAnimationEffect + self.giftEffectsEnabled = isOn; + // 发送通知,让 RoomAnimationView 临时应用 + [self sendTurboGiftEffectsNotification:isOn]; + + } else if (sender.tag == 1) { // 全局礼物屏幕 + self.globalGiftScreenEnabled = isOn; + // 按房间 ID 持久化 + [[NSUserDefaults standardUserDefaults] + setBool:isOn forKey:kTurboGlobalGiftScreenEnabledKey(self.roomId)]; + [[NSUserDefaults standardUserDefaults] synchronize]; + [self sendTurboGlobalGiftScreenNotification:isOn]; + + } else if (sender.tag == 2) { // 全局游戏屏幕 + self.globalGameScreenEnabled = isOn; + // 按房间 ID 持久化 + [[NSUserDefaults standardUserDefaults] + setBool:isOn forKey:kTurboGlobalGameScreenEnabledKey(self.roomId)]; + [[NSUserDefaults standardUserDefaults] synchronize]; + [self sendTurboGlobalGameScreenNotification:isOn]; + } + + // 通知父控制器更新 Turbo_Mode 按钮状态 + [self notifyParentUpdateTurboModeButton]; + + NSLog(@"🎮 Turbo Mode开关变化 - 索引: %ld, 状态: %@", (long)sender.tag, isOn ? @"开启" : @"关闭"); +} + +- (void)notifyParentUpdateTurboModeButton { + BOOL allSwitchesOn = self.giftEffectsEnabled && + self.globalGiftScreenEnabled && + self.globalGameScreenEnabled; + + [[NSNotificationCenter defaultCenter] + postNotificationName:kTurboModeButtonStateChanged + object:nil + userInfo:@{@"allOn": @(allSwitchesOn)}]; +} + +#pragma mark - Notification Methods + +- (void)sendTurboGiftEffectsNotification:(BOOL)enabled { + [[NSNotificationCenter defaultCenter] + postNotificationName:kTurboGiftEffectsEnabledChanged + object:nil + userInfo:@{@"on": @(enabled)}]; +} + +- (void)sendTurboGlobalGiftScreenNotification:(BOOL)enabled { + [[NSNotificationCenter defaultCenter] + postNotificationName:kTurboGlobalGiftScreenEnabledChanged + object:nil + userInfo:@{@"on": @(enabled)}]; +} + +- (void)sendTurboGlobalGameScreenNotification:(BOOL)enabled { + [[NSNotificationCenter defaultCenter] + postNotificationName:kTurboGlobalGameScreenEnabledChanged + object:nil + userInfo:@{@"on": @(enabled)}]; +} + +- (void)dismissViewController { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +@end diff --git a/YuMi/Modules/YMRoom/View/MoreView/XPTurboModeConstants.h b/YuMi/Modules/YMRoom/View/MoreView/XPTurboModeConstants.h new file mode 100644 index 00000000..84f00a44 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/MoreView/XPTurboModeConstants.h @@ -0,0 +1,55 @@ +// +// XPTurboModeConstants.h +// YuMi +// +// Created by P on 2025/1/13. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +// MARK: - 缓存 Key 生成函数 +/** + * 生成礼物特效开关的缓存 Key + * @param roomId 房间 ID + * @return 格式化的缓存 Key + */ +NSString *kTurboGiftEffectsEnabledKey(NSString *roomId); + +/** + * 生成全局礼物屏幕开关的缓存 Key + * @param roomId 房间 ID + * @return 格式化的缓存 Key + */ +NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId); + +/** + * 生成全局游戏屏幕开关的缓存 Key + * @param roomId 房间 ID + * @return 格式化的缓存 Key + */ +NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId); + +// MARK: - 通知名称常量 +/** + * 礼物特效开关状态改变通知 + */ +extern NSString *const kTurboGiftEffectsEnabledChanged; + +/** + * 全局礼物屏幕开关状态改变通知 + */ +extern NSString *const kTurboGlobalGiftScreenEnabledChanged; + +/** + * 全局游戏屏幕开关状态改变通知 + */ +extern NSString *const kTurboGlobalGameScreenEnabledChanged; + +/** + * Turbo Mode 按钮状态改变通知 + */ +extern NSString *const kTurboModeButtonStateChanged; + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/MoreView/XPTurboModeConstants.m b/YuMi/Modules/YMRoom/View/MoreView/XPTurboModeConstants.m new file mode 100644 index 00000000..422c6d54 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/MoreView/XPTurboModeConstants.m @@ -0,0 +1,27 @@ +// +// XPTurboModeConstants.m +// YuMi +// +// Created by P on 2025/1/13. +// + +#import "XPTurboModeConstants.h" + +// MARK: - 缓存 Key 生成函数实现 +NSString *kTurboGiftEffectsEnabledKey(NSString *roomId) { + return [NSString stringWithFormat:@"TurboGiftEffects_%@", roomId]; +} + +NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId) { + return [NSString stringWithFormat:@"TurboGlobalGiftScreen_%@", roomId]; +} + +NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId) { + return [NSString stringWithFormat:@"TurboGlobalGameScreen_%@", roomId]; +} + +// MARK: - 通知名称常量定义 +NSString *const kTurboGiftEffectsEnabledChanged = @"kTurboGiftEffectsEnabledChanged"; +NSString *const kTurboGlobalGiftScreenEnabledChanged = @"kTurboGlobalGiftScreenEnabledChanged"; +NSString *const kTurboGlobalGameScreenEnabledChanged = @"kTurboGlobalGameScreenEnabledChanged"; +NSString *const kTurboModeButtonStateChanged = @"kTurboModeButtonStateChanged"; diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/Presenter/XPGiftStorage.m b/YuMi/Modules/YMRoom/View/SendGiftView/Presenter/XPGiftStorage.m index d9f86c7f..5bf4c025 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/Presenter/XPGiftStorage.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/Presenter/XPGiftStorage.m @@ -100,64 +100,21 @@ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ giftIdMapCache = [[NSCache alloc] init]; - giftIdMapCache.countLimit = 50; + giftIdMapCache.countLimit = 100; // 设置合理的缓存限制 }); - NSDictionary *giftMap = [giftIdMapCache objectForKey:roomUid]; + __block NSDictionary *giftMap = [giftIdMapCache objectForKey:roomUid]; if (!giftMap) { + // 构建映射表 NSMutableDictionary *map = [NSMutableDictionary new]; for (GiftInfoModel *gift in giftLists) { map[@(gift.giftId)] = gift; } - giftMap = [map copy]; - [giftIdMapCache setObject:giftMap forKey:roomUid]; + NSDictionary *newGiftMap = [map copy]; + [giftIdMapCache setObject:newGiftMap forKey:roomUid]; + giftMap = newGiftMap; } return giftMap[@(giftIdInt)]; - - -// NSInteger giftIdInt = giftId.integerValue; -// NSArray *giftLists = [self getRoomGiftDatasource:self.currentRoomUid]; -// if (giftLists.count == 0) return nil; -// -// // 确保 giftLists 按 giftId 递增排序 -// NSArray *sortedGiftLists = [giftLists sortedArrayUsingComparator:^NSComparisonResult(GiftInfoModel *obj1, GiftInfoModel *obj2) { -// return [@(obj1.giftId) compare:@(obj2.giftId)]; -// }]; -// -// NSInteger left = 0, right = sortedGiftLists.count - 1; -// while (left <= right) { -// NSInteger mid = left + (right - left) / 2; -// if (sortedGiftLists[mid].giftId == giftIdInt) return sortedGiftLists[mid]; -// if (sortedGiftLists[mid].giftId < giftIdInt) left = mid + 1; -// else right = mid - 1; -// } -// return nil; - -// if (self.currentRoomUid) { -// NSArray *giftLists = [self.roomGiftCache objectForKey:self.currentRoomUid]; -// if (giftLists.count == 0) { -// giftLists = [self.roomGiftCache objectForKey:[self defaultKey]]; -// } -// if (giftLists.count > 0) { -// NSInteger left = 0; -// NSInteger right = giftLists.count - 1; -// -// while (left <= right) { -// NSInteger mid = left + (right - left) / 2; -// GiftInfoModel *midObject = giftLists[mid]; -// -// if (midObject.giftId == giftIdInt) { -// return midObject; -// } else if (midObject.giftId < giftIdInt) { -// left = mid + 1; -// } else { -// right = mid - 1; -// } -// } -// return nil; // 如果没有找到匹配的对象,返回 nil -// } -// } -// return nil; } diff --git a/YuMi/Network/HttpRequestHelper.m b/YuMi/Network/HttpRequestHelper.m index 38918b51..29764659 100644 --- a/YuMi/Network/HttpRequestHelper.m +++ b/YuMi/Network/HttpRequestHelper.m @@ -94,7 +94,7 @@ editParam = [MSParamsDecode msDecodeParams:editParam]; params = [self configBaseParmars:editParam]; -#if 0 +#if DEBUG // 构建完整的 URL NSString *baseUrl = [HttpRequestHelper getHostUrl]; NSString *fullUrl = [NSString stringWithFormat:@"%@/%@", baseUrl, method]; @@ -118,7 +118,7 @@ @kWeakify(self); [manager GET:method parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; -#if 0 +#if DEBUG NSLog(@"%@ - \n%@\n", method, [baseModel toJSONString]); #else #endif @@ -338,7 +338,7 @@ constructingBodyWithBlock:^(id _Nonnull formData) { params = [MSParamsDecode msDecodeParams:[params mutableCopy] ]; params = [self configBaseParmars:params]; AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; -#if 0 +#if DEBUG // 构建完整的 URL NSString *baseUrl = [HttpRequestHelper getHostUrl]; NSString *fullUrl = [NSString stringWithFormat:@"%@/%@", baseUrl, method]; @@ -363,7 +363,7 @@ constructingBodyWithBlock:^(id _Nonnull formData) { @kWeakify(self); [manager DELETE:method parameters:params headers:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; -#if 0 +#if DEBUG NSLog(@"\n%@\n", [baseModel toJSONString]); #else #endif diff --git a/YuMi/ar.lproj/Localizable.strings b/YuMi/ar.lproj/Localizable.strings index 02ac0f6c..87af4aa7 100644 --- a/YuMi/ar.lproj/Localizable.strings +++ b/YuMi/ar.lproj/Localizable.strings @@ -4235,3 +4235,12 @@ ineHeadView12" = "الحمل"; "20.20.62_text_6" = "الميكروفون مشغول. يُرجى المحاولة لاحقًا."; "20.20.62_text_7" = "ليس لديك إذن لدعوة المستخدم إلى الميكروفون."; "20.20.62_text_8" = "فشل إرسال الدعوة. يُرجى التحقق من الشبكة."; + +"20.20.62_text_9" = "Turn effects on/off"; +"20.20.62_text_9.1" = "Turn effects on"; +"20.20.62_text_9.2" = "Turn effects off"; +"20.20.62_text_10" = "Gift effects"; +"20.20.62_text_11" = "Global gift screen"; +"20.20.62_text_12" = "Global game screen"; +"20.20.62_text_13" = "Turbo mode"; +"20.20.62_text_14" = "我的特效"; diff --git a/YuMi/en.lproj/Localizable.strings b/YuMi/en.lproj/Localizable.strings index a92cad46..5eb8e28d 100644 --- a/YuMi/en.lproj/Localizable.strings +++ b/YuMi/en.lproj/Localizable.strings @@ -4022,3 +4022,12 @@ "20.20.62_text_6" = "The mic is occupied. Please try again later."; "20.20.62_text_7" = "You do not have permission to invite the user to the mic."; "20.20.62_text_8" = "The invitation failed to be sent. Please check the network."; + +"20.20.62_text_9" = "Turn effects on/off"; +"20.20.62_text_9.1" = "Turn effects on"; +"20.20.62_text_9.2" = "Turn effects off"; +"20.20.62_text_10" = "Gift effects"; +"20.20.62_text_11" = "Global gift screen"; +"20.20.62_text_12" = "Global game screen"; +"20.20.62_text_13" = "Turbo mode"; +"20.20.62_text_14" = "我的特效"; diff --git a/YuMi/pt-BR.lproj/Localizable.strings b/YuMi/pt-BR.lproj/Localizable.strings index 65037694..27680676 100644 --- a/YuMi/pt-BR.lproj/Localizable.strings +++ b/YuMi/pt-BR.lproj/Localizable.strings @@ -3315,3 +3315,12 @@ "20.20.62_text_6" = "O microfone está ocupado. Tente novamente mais tarde."; "20.20.62_text_7" = "Você não tem permissão para convidar o usuário para o microfone."; "20.20.62_text_8" = "O convite não foi enviado. Verifique a rede."; + +"20.20.62_text_9" = "Turn effects on/off"; +"20.20.62_text_9.1" = "Turn effects on"; +"20.20.62_text_9.2" = "Turn effects off"; +"20.20.62_text_10" = "Gift effects"; +"20.20.62_text_11" = "Global gift screen"; +"20.20.62_text_12" = "Global game screen"; +"20.20.62_text_13" = "Turbo mode"; +"20.20.62_text_14" = "我的特效"; diff --git a/YuMi/tr.lproj/Localizable.strings b/YuMi/tr.lproj/Localizable.strings index 8c2a5522..27e0a33c 100644 --- a/YuMi/tr.lproj/Localizable.strings +++ b/YuMi/tr.lproj/Localizable.strings @@ -3816,3 +3816,12 @@ "20.20.62_text_6" = "Mikrofon meşgul. Lütfen daha sonra tekrar deneyin."; "20.20.62_text_7" = "Kullanıcıyı mikrofona davet etme izniniz yok."; "20.20.62_text_8" = "Davet gönderilemedi. Lütfen ağı kontrol edin."; + +"20.20.62_text_9" = "Turn effects on/off"; +"20.20.62_text_9.1" = "Turn effects on"; +"20.20.62_text_9.2" = "Turn effects off"; +"20.20.62_text_10" = "Gift effects"; +"20.20.62_text_11" = "Global gift screen"; +"20.20.62_text_12" = "Global game screen"; +"20.20.62_text_13" = "Turbo mode"; +"20.20.62_text_14" = "我的特效"; diff --git a/YuMi/zh-Hant.lproj/Localizable.strings b/YuMi/zh-Hant.lproj/Localizable.strings index 6ac33b7c..d72ae771 100644 --- a/YuMi/zh-Hant.lproj/Localizable.strings +++ b/YuMi/zh-Hant.lproj/Localizable.strings @@ -3686,3 +3686,13 @@ "20.20.62_text_6" = "麥克風已被佔用,請稍後再試。"; "20.20.62_text_7" = "您無權邀請該使用者加入麥克風。"; "20.20.62_text_8" = "邀請發送失敗,請檢查網路。"; + +"20.20.62_text_9" = "Turn effects on/off"; +"20.20.62_text_9.1" = "Turbo mode on"; +"20.20.62_text_9.2" = "Turbo mode off"; +"20.20.62_text_10" = "Gift effects"; +"20.20.62_text_11" = "Global gift screen"; +"20.20.62_text_12" = "Global game screen"; +"20.20.62_text_13" = "Turbo mode"; +"20.20.62_text_14" = "我的特效"; +