源战役客户端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

36 righe
1.2 KiB

  1. using UnityEngine;
  2. public class ReloadLayoutOnExitGame : MonoBehaviour
  3. {
  4. #if UNITY_EDITOR
  5. private bool hadSaveOnRunTime = false;
  6. private bool isRunningGame = false;
  7. public bool SetHadSaveOnRunTime(bool value)
  8. {
  9. if (isRunningGame)
  10. hadSaveOnRunTime = value;
  11. return hadSaveOnRunTime;
  12. }
  13. private void Start()
  14. {
  15. hadSaveOnRunTime = false;
  16. isRunningGame = true;
  17. //Debug.Log("ReloadLayoutOnExitGame Start()");
  18. }
  19. //after exit game from unity editor, reload layouts which has been saved during the run
  20. private void OnApplicationQuit()
  21. {
  22. //Debug.Log("ReloadLayoutOnExitGame OnApplicationQuit()"+ hadSaveOnRunTime.ToString());
  23. if (hadSaveOnRunTime && U3DExtends.Configure.ReloadLayoutOnExitGame)
  24. {
  25. //��Ϊ������Ҫ�����ؼ���������Ϸ�ͽ�����Ϸ�¼�,���Բ���ExecuteInEditMode,����Ϸ���н�������һ���¼���OnApplicationQuit,���¼���unity�Ż�������������ʱ���޸�,����������Ҫ�ӳ�һ��ʱ�������¼��ؽ���,�������¼��غ��ֱ�������
  26. U3DExtends.UIEditorHelper.DelayReLoadLayout(gameObject, true);
  27. hadSaveOnRunTime = false;
  28. }
  29. isRunningGame = false;
  30. }
  31. #endif
  32. }