UpdateSystem.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. using SC;
  7. namespace SC.Tools.UpdateAPKSystem.UpdateSystem
  8. {
  9. public class UpdateSystem : SystemBase {
  10. public UpdateSystemData UpdateSystemDataSubSystem;
  11. public UpdateSystemGetData UpdateSystemGetDataSubSystem;
  12. public ProcessData UpdateSystemProcessDataSubSystem;
  13. public CanvasUI CanvasUI;
  14. private static UpdateSystem mInstant;
  15. public static UpdateSystem getInstant {
  16. get {
  17. if (mInstant == null) {
  18. Debug.Log("[UpdateSystem=====================================]: " + "Instantiate Start");
  19. mInstant = Instantiate((GameObject)Resources.Load("Prefabs/UpdateSystem")).GetComponent<UpdateSystem>();
  20. Debug.Log("[" + mInstant.GetType().ToString() + "]: " + "Instantiate Finish:" + mInstant);
  21. }
  22. return mInstant;
  23. }
  24. }
  25. public void RegisterDownStartCallBack(Action callback) {
  26. AndroidPluginUpdateAPK.getInstant.DownLoadStartCallBack.CallBack += callback;
  27. }
  28. public void RegisterDownCancelCallBack(Action callback) {
  29. AndroidPluginUpdateAPK.getInstant.DownLoadCancelCallBack.CallBack += callback;
  30. }
  31. public void RegisterDownFinishCallBack(Action callback) {
  32. AndroidPluginUpdateAPK.getInstant.DownLoadFinishCallBack.CallBack += callback;
  33. }
  34. public void UnRegisterDownStartCallBack(Action callback) {
  35. AndroidPluginUpdateAPK.getInstant.DownLoadStartCallBack.CallBack -= callback;
  36. }
  37. public void UnRegisterDownCancelCallBack(Action callback) {
  38. AndroidPluginUpdateAPK.getInstant.DownLoadCancelCallBack.CallBack -= callback;
  39. }
  40. public void UnRegisterDownFinishCallBack(Action callback) {
  41. AndroidPluginUpdateAPK.getInstant.DownLoadFinishCallBack.CallBack -= callback;
  42. }
  43. public override void Awake() {
  44. base.Awake();
  45. mInstant=this;
  46. AddSubSystem(UpdateSystemDataSubSystem = UpdateSystemData.getInstant);
  47. AddSubSystem(UpdateSystemGetDataSubSystem = new UpdateSystemGetData());
  48. AddSubSystem(UpdateSystemProcessDataSubSystem = new ProcessData());
  49. AddSubSystem(CanvasUI = CanvasUI.getInstant);
  50. //CanvasUI.SystemStop();
  51. }
  52. //public override void SystemStart() {
  53. // base.SystemStart();
  54. // CanvasUI.SystemStop();
  55. //}
  56. }
  57. }