GameApplctionMono.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using Excel2Json;
  3. using Fort23.Core;
  4. using Fort23.UTool;
  5. using UnityEditor;
  6. using UnityEngine;
  7. namespace GameUI
  8. {
  9. public class GameApplctionMono : MonoBehaviour
  10. {
  11. public GameApplction GameApplction;
  12. public void Update()
  13. {
  14. #if UNITY_EDITOR
  15. // if (EditorApplication.isPaused)
  16. // {
  17. // return;
  18. // }
  19. #endif
  20. EventSystem.Instance.Update();
  21. AssetBundleLoadManager.Instance.UpdateBundle();
  22. TimeHelper.clientFrame = TimeHelper.ClientFrame() + (long)(Time.deltaTime * 1000);
  23. }
  24. private class TestHERO
  25. {
  26. public int level;
  27. public int exp;
  28. public void AddExp(int e)
  29. {
  30. this.exp += e;
  31. HeroPowerUpConfig allPowerUp = ConfigComponent.Instance.Get<HeroPowerUpConfig>(level);
  32. while (exp > allPowerUp.levelUpExp && allPowerUp.levelUpExp > 0)
  33. {
  34. exp = exp - allPowerUp.levelUpExp;
  35. level++;
  36. allPowerUp = ConfigComponent.Instance.Get<HeroPowerUpConfig>(level);
  37. }
  38. }
  39. }
  40. // [ContextMenu("monster")]
  41. // public void Test()
  42. // {
  43. // LevelBattleConfig[] levelBattleConfigs = ConfigComponent.Instance.GetAll<LevelBattleConfig>();
  44. // TestHERO testHero = new TestHERO();
  45. // testHero.level = 1;
  46. // string m = "";
  47. // for (int i = 0; i < levelBattleConfigs.Length; i++)
  48. // {
  49. // LevelBattleConfig levelBattleConfig = levelBattleConfigs[i];
  50. // int jy = levelBattleConfig.exp * levelBattleConfig.miniExpAndGold[0] / 4;
  51. // testHero.AddExp(jy);
  52. // m += testHero.level + "\n";
  53. // }
  54. // Debug.Log(m);
  55. // }
  56. private async void OnApplicationPause(bool pauseStatus)
  57. {
  58. if (pauseStatus)
  59. {
  60. // 退出时记录时间
  61. AccountFileInfo.Instance.playerData.ExitTime = TimeHelper.ClientNow();
  62. AccountFileInfo.Instance.SavePlayerData();
  63. }
  64. else
  65. {
  66. PlayerManager.Instance.CalculateOfflineRewards();
  67. }
  68. }
  69. public void LateUpdate()
  70. {
  71. EventSystem.Instance.LateUpdate();
  72. }
  73. }
  74. }