源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

пре 1 месец
  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. }