2

有人告诉我,在玩游戏时接到来电时如何在windows phone 8中获得控制权?

有来电时要触发的功能吗?

请有人帮忙解决这个问题?

4

2 回答 2

2

如果有人遇到同样的问题,如果您使用的是 Unity Engine,以下将是解决方案。

//For interrupt handling
 private bool isGameInterrupted;

void OnApplicationPause(bool isInterrupted)
 {
    if( !isGameInterrupted && isInterrupted )
     {   
      isGameInterrupted = true;
     }  

    if( isGameInterrupted )
    {    
     // Call your pause screen here //   
     isGameInterrupted = false;
    }
 }
于 2013-07-23T12:59:00.060 回答
1

不确定您在问什么,但听起来您误解了手机中的工作方式。

如果在用户玩您的游戏时有电话打进来,您对此没有任何控制权。手机会弹出“来电”界面,接管控制权。此时,您的应用程序将进入后台。此时,您的标准生命周期管理将发挥作用(暂停/重新激活/等)。通话结束后,控制权将返回给您的游戏,您可以从上次中断的地方继续。

这里这里对这一切是如何工作的有一个不错的概述。这些都是 Phone 7.x 特有的,但原理在 8 中是相同的。

于 2013-07-23T12:01:09.693 回答