GSM AdsInhouse
Mục đích để quảng cáo chéo giữa các game của công ty đang phát triển
I. Cách tích hợp mới
Ví dụ demo ở Scene:
Plugins> GSM-SDK > Sample > SampleAdsScene
1.1 Tạo Game Object AdsController
1.1.1 Kéo Prefab GSMAdInhouse vào trong Game Object AdsController

1.1.2 Tạo class AdsController
Code mẫu:
1.1.3 Add Script AdsController vào GameObject AdsController
Thuộc tính: AdInhouseController thì sử dụng GSMAdInhouse ở mục 1.1.1

1.1.4 Thêm các network quảng cáo khác nếu có
Ví dụ: Sử dụng Ironsource
Tạo GameObject
IronSourceAdsControllerlà con của AdsControllerTạo class
IronSourceAdsControllerCần implement Interface
IAdsInterfaceNếu đã có
IAdsInterfacekhác trong project thì xóa bỏ, chỉ sử dụng trong GSM-SDK>AdsImplement các method của
IAdsInterface
Sau đó Add Script
IronSourceAdsControllercho GameObjectIronSourceAdsController
Code mẫu:

II. Cách sửa AdsController đã có
Đây là trường hợp mà các game đã có AdsController từ code cũ ngày xưa.
Các dự án cũ thường lấy code AdsController từ: https://gitlab.com/cscmobistudios/csc_ads_wrapper_mediation
Với trường hợp này thì cách chuyển đổi sẽ như sau:
1. Sửa class AdsController kế thừa từ class GSMAdManager
Code mẫu:

2. Sửa method Start
Xóa bỏ
private List adsController;Sửa
private void Start()thànhprotected override void Start()Thêm
base.Start();
Code Mẫu: Bên trái là code cũ, bên phải là code mới

3. Overide method CanShowAds
Code mẫu: Bên trái là code cũ, bên phải là code mới

4. Overide method IsRewardVideoAdsReady
Code mẫu: Bên trái là code cũ, bên phải là code mới

5. Sửa method ShowVideoReward
Code mẫu: Bên trái là code cũ, bên phải là code mới

6. Overide method IsInterstitialReady
Code mẫu: Bên trái là code cũ, bên phải là code mới

7. Sửa method ShowInterstitial
Code mẫu: Bên trái là code cũ, bên phải là code mới

III. Notes
Chú ý:
Nếu trong code đã có sẵn interface
IAdsInterfacethì xóa bỏ, chỉ dùngIAdsInterfacetrong GSM-SDK
Last updated