在斯威夫特的每第3场比赛中播放插页式广告

时间:2015-10-21 20:30:18

标签: ios swift sprite-kit heyzap

我在这里找到了一个可接受的Objective-C答案:

Play interstitial ad every 3rd game

但是,我正试图在Swift中做同样的事情。我正在寻找如何编写静态变量。

这是Objective-C代码:

static int count = 0;

-(void) GameOver {
   if(count != 0 && count % 3 == 0)
     [HZInterstitialAd show];

   count++;
}

1 个答案:

答案 0 :(得分:2)

private var count = 0

func GameOver {
  if (count != 0 && count % 3 == 0) {
    HZInterstitialAd.show()
  }
  count++
}
相关问题