VideoLog.ts 853 B

1234567891011121314151617181920212223
  1. import { _decorator, Component, Node, game } from 'cc';
  2. import { DataSystem } from '../core/data/DataSystem';
  3. import { Http, HttpMethod } from '../core/net/Http';
  4. import { ADData } from '../data/jsb/ADData';
  5. import { UserData } from '../data/UserData';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('VideoLog')
  8. export class VideoLog extends Component {
  9. start () {
  10. game.addPersistRootNode(this.node);//常驻节点
  11. }
  12. update(){
  13. if (DataSystem.getData(UserData) && DataSystem.getData(ADData).splashADShow && DataSystem.getData(UserData).id) {//开屏
  14. DataSystem.getData(ADData).splashADShow = false;
  15. DataSystem.getData(ADData).ad_type = 6;
  16. //上报展示
  17. this.node.addComponent(Http).send("/api/ad/videoLog", { adData: DataSystem.getData(ADData).obj });
  18. }
  19. }
  20. }