/// <summary> /// Is the application focused? /// </summary> /// <remarks> /// There are issues on some platforms with getting an accurate reading. /// </remarks> /// <returns>true/false if the application has focus.</returns> public static bool IsFocused() { #if UNITY_XBOXONE && !UNITY_EDITOR return(!XboxOnePLM.AmConstrained()); #elif UNITY_PS4 && !UNITY_EDITOR return(true); #else return(Application.isFocused); #endif }
public void Update() { User appCurrentUser = UsersManager.GetAppCurrentUser(); ManagerManager.Manager.mDebugString = "firsttime: " + firstTime + " activeuserid: " + activeUserId + " user count: " + UsersManager.Users.Count + " toggle: " + KeyMan.GetKeyDown("DepthToggle", true) + " gettappcurrentuser: "******"null" : UsersManager.GetAppCurrentUser().Id.ToString()); if (firstTime) { firstTime = false; SanityCheckApplicationSetup(); //easiest way to set active user (rather than scanning for first input) ManagerManager.Log("first time sign in"); RequestSignin(); } else { //after initial user prompt, these if statements will catch the following things: if (activeUserId == -1) { RequestSignin(); } if (UsersManager.Users.Count == 0) //no users { RequestSignin(); } if (KeyMan.GetKeyDown("DepthToggle", true)) //menu key is tied to depth toggle for XB1 { RequestSignin(); } //I really have no idea what getappcurrentuser does, just don't use it.. //if (appCurrentUser == null || (lastAppCurrentUserId != UsersManager.GetAppCurrentUser().Id && UsersManager.GetAppCurrentUser().Id != activeUserId)) //RequestSignin(); } if (!IsActiveUserInitialized && ManagerManager.Manager.mCharacterBundleManager.is_initial_loaded() && ActiveUser != null) { //title screen ManagerManager.Log("User Initialized " + ActiveUser.GameDisplayName); ManagerManager.Manager.mTransitionCameraManager.you_are_playing_as(ActiveUser.GameDisplayName); //game if (!XboxOnePLM.AmConstrained()) { ManagerManager.Manager.GameEventDistributor("RESUME", null); } //event ManagerManager.Manager.GameEventDistributor("START", null); //rich user presence SetRichUserPresence(CharacterIndex.sGrave); //this is the "null" character index //storage MicrosoftZig.Inst.mStorage.InitializeUserStorage(); ManagerManager.Manager.mMetaManager.StartSaveThread(); IsActiveUserInitialized = true; } //debug stuff if (KeyMan.GetKeyDown("LeftThumbstick")) { //ManagerManager.Log("getSingle"); //StatisticsManager.GetSingleUserStatisticsAsyncMultipleStats(UsersManager.Users[0].Id, UsersManager.Users[0].UID, ConsoleUtilsManager.PrimaryServiceConfigId(), stats,null); } /* * if (UsersManager.Users.Count == 0) * ManagerManager.Manager.mDebugString = "NO USERS"; * else * ManagerManager.Manager.mDebugString = "Current user: "******" " + UsersManager.GetAppCurrentUser().GameDisplayName; */ //this is for special case where the sign in dialog is canceled but the callback isn't called if (!MicrosoftZig.Inst.mPLM.Constrained && MicrosoftZig.Inst.mPLM.NotConstrainedTimer > 2) { siDialog = false; } }