Преглед изворни кода

修改:删除无用类文件

杜哥很忙 пре 9 месеци
родитељ
комит
276e5f1f51

+ 1 - 10
Classes/IAP/Shop/IAPCardView.cpp

@@ -8,12 +8,6 @@
 #include "IAPCardView.hpp"
 
 
-void IAPCardView::setDelegate(IAPCardViewDelegate *delegate){
-    if(delegate){
-        _delegate = delegate;
-    }
-}
-
 IAPCardView* IAPCardView::create(cocos2d::Size &viewSize, sDotCfg &dotCfg){
     // 创建 PageView 用于分页滑动卡片
     IAPCardView* ret = new IAPCardView();
@@ -117,10 +111,7 @@ bool IAPCardView::_init(Size &viewSize, sDotCfg &dotCfg){
                 indicator->setTexture(_dotCfg.normalSp); // 切换为未选中图片
             }
         }
-        // 如果delegate存在通知delegate卡片页数改变
-        if(_delegate){
-            _delegate->onCardChanged(currentPageIndex);
-        }
+
     });
     
     return true;

+ 0 - 9
Classes/IAP/Shop/IAPCardView.hpp

@@ -25,12 +25,6 @@
  
  */
 
-class IAPCardView;
-class IAPCardViewDelegate{
-public:
-    virtual void onCardChanged(int currentPageIndex) = 0; // 页面切换时调用
-};
-
 class IAPCardView : public Layer{
 public:
     struct sDotCfg{
@@ -42,8 +36,6 @@ public:
     
     static IAPCardView* create(cocos2d::Size& viewSize, sDotCfg& dotCfg);
     
-    void setDelegate(IAPCardViewDelegate* delegate);
-    
     void addCard(Node* card);
     
     void removeCard(int index);
@@ -53,7 +45,6 @@ private:
     bool _init(Size& viewSize, sDotCfg& dotCfg);
     
 private:
-    IAPCardViewDelegate* _delegate = nullptr;  // 委托对象
     
     sDotCfg _dotCfg;
     Size _viewSize;

+ 0 - 5
Classes/IAP/Shop/IAPCtlShopUI.cpp

@@ -16,10 +16,8 @@
 #include "IAPCtlShopUI.hpp"
 #include "IAPCtlShopItem.hpp"
 #include "IAPDefine.hpp"
-#include "IAPTestCard.hpp"
 
 #include "IAPCardView.hpp"
-#include "IAPTestCardViewDelegate.hpp"
 
 #include "IAPRunTimeData.hpp"
 
@@ -560,9 +558,6 @@ Node* IAPCtlShopUI::createPlacementUI(const iapshop::IAPPlacement& placement){
     cocos2d::Size sz = cocos2d::Size(584, 250);
     IAPCardView* cardView = IAPCardView::create(sz, cfg);
     
-    IAPTestCardViewDelegate* cardViewDelegate = new IAPTestCardViewDelegate();
-    cardView->setDelegate(cardViewDelegate);
-    
     // 遍历 placement 中的卡片,依次创建并添加到 PageView 中
     for (int i = 0; i < placement.cards.size(); i++) {
         cardView->addCard(placement.cards[i]->create());

+ 0 - 17
Classes/IAPTestCardViewDelegate.cpp

@@ -1,17 +0,0 @@
-//
-//  IAPTestCardViewDelegate.cpp
-//  demo
-//
-//  Created by Red_mini on 2024/10/25.
-//
-
-#include "IAPTestCardViewDelegate.hpp"
-#include "cocos2d.h"
-
-IAPTestCardViewDelegate::IAPTestCardViewDelegate(){
-    
-}
-
-void IAPTestCardViewDelegate::onCardChanged(int currentPageIndex){
-    log("页面切换到第%d页",currentPageIndex + 1);
-}

+ 0 - 23
Classes/IAPTestCardViewDelegate.hpp

@@ -1,23 +0,0 @@
-//
-//  IAPTestCardViewDelegate.hpp
-//  demo
-//
-//  Created by Red_mini on 2024/10/25.
-//
-
-#ifndef IAPTestCardViewDelegate_hpp
-#define IAPTestCardViewDelegate_hpp
-
-#include <stdio.h>
-#include "IAPCardView.hpp"
-
-
-class IAPTestCardViewDelegate : public IAPCardViewDelegate
-{
-public:
-    virtual void onCardChanged(int currentPageIndex) override;
-    
-    IAPTestCardViewDelegate();
-};
-
-#endif /* IAPTestCardViewDelegate_hpp */

+ 0 - 8
proj.ios_mac/demo.xcodeproj/project.pbxproj

@@ -56,8 +56,6 @@
 		C17ACCBD2CB903BA0072A711 /* TestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C17ACCBB2CB903BA0072A711 /* TestScene.cpp */; };
 		C18082282CCB3338009DE140 /* IAPCardView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C18082262CCB3338009DE140 /* IAPCardView.cpp */; };
 		C18082292CCB3338009DE140 /* IAPCardView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C18082262CCB3338009DE140 /* IAPCardView.cpp */; };
-		C18082332CCB71D3009DE140 /* IAPTestCardViewDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C18082312CCB71D3009DE140 /* IAPTestCardViewDelegate.cpp */; };
-		C18082342CCB71D3009DE140 /* IAPTestCardViewDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C18082312CCB71D3009DE140 /* IAPTestCardViewDelegate.cpp */; };
 		C180823B2CCB82BD009DE140 /* IAPRunTimeData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C18082382CCB82BD009DE140 /* IAPRunTimeData.cpp */; };
 		C19B68A42CD1E4C800536ED4 /* PBConfigData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C19B68A22CD1E4C800536ED4 /* PBConfigData.cpp */; };
 		C19B68A52CD1E4C800536ED4 /* PBConfigData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C19B68A22CD1E4C800536ED4 /* PBConfigData.cpp */; };
@@ -213,8 +211,6 @@
 		C17ACCC52CB904460072A711 /* TestScene.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestScene.h; sourceTree = "<group>"; };
 		C18082262CCB3338009DE140 /* IAPCardView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = IAPCardView.cpp; sourceTree = "<group>"; };
 		C18082272CCB3338009DE140 /* IAPCardView.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = IAPCardView.hpp; sourceTree = "<group>"; };
-		C18082312CCB71D3009DE140 /* IAPTestCardViewDelegate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = IAPTestCardViewDelegate.cpp; sourceTree = "<group>"; };
-		C18082322CCB71D3009DE140 /* IAPTestCardViewDelegate.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = IAPTestCardViewDelegate.hpp; sourceTree = "<group>"; };
 		C18082382CCB82BD009DE140 /* IAPRunTimeData.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = IAPRunTimeData.cpp; sourceTree = "<group>"; };
 		C18082392CCB82BD009DE140 /* IAPRunTimeData.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = IAPRunTimeData.hpp; sourceTree = "<group>"; };
 		C19B68A22CD1E4C800536ED4 /* PBConfigData.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PBConfigData.cpp; sourceTree = "<group>"; };
@@ -491,8 +487,6 @@
 				C19B68BD2CD222A400536ED4 /* IAPDelegateImpl.cpp */,
 				C17946162CC7502600779B63 /* IAPTestCard.hpp */,
 				C17946152CC7502600779B63 /* IAPTestCard.cpp */,
-				C18082322CCB71D3009DE140 /* IAPTestCardViewDelegate.hpp */,
-				C18082312CCB71D3009DE140 /* IAPTestCardViewDelegate.cpp */,
 			);
 			name = Classes;
 			path = ../Classes;
@@ -796,7 +790,6 @@
 				C17ACCBC2CB903BA0072A711 /* TestScene.cpp in Sources */,
 				E4D223402BD667D4006F1F8D /* AdUtilsInterstitial.cpp in Sources */,
 				E4D2234F2BD66CDE006F1F8D /* RedWise.cpp in Sources */,
-				C18082332CCB71D3009DE140 /* IAPTestCardViewDelegate.cpp in Sources */,
 				C18082282CCB3338009DE140 /* IAPCardView.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -831,7 +824,6 @@
 				C19B68C02CD222A400536ED4 /* IAPDelegateImpl.cpp in Sources */,
 				C17ACCBD2CB903BA0072A711 /* TestScene.cpp in Sources */,
 				2F15C5F52CB8F65A0057855D /* IAPCtlArea23.cpp in Sources */,
-				C18082342CCB71D3009DE140 /* IAPTestCardViewDelegate.cpp in Sources */,
 				E4E7A1232BD75C3F00107AED /* RPRedAudio.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;