A fork of Eusth's IPA
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

PluginComponent.cs 1.2KB

7 anos atrás
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using UnityEngine;
  5. namespace IllusionInjector
  6. {
  7. public class PluginComponent : MonoBehaviour
  8. {
  9. private CompositePlugin plugins;
  10. private bool freshlyLoaded = false;
  11. void Awake()
  12. {
  13. DontDestroyOnLoad(gameObject);
  14. plugins = new CompositePlugin(PluginManager.Plugins);
  15. plugins.OnApplicationStart();
  16. }
  17. void Start()
  18. {
  19. OnLevelWasLoaded(Application.loadedLevel);
  20. }
  21. void Update()
  22. {
  23. if (freshlyLoaded)
  24. {
  25. freshlyLoaded = false;
  26. plugins.OnLevelWasInitialized(Application.loadedLevel);
  27. }
  28. plugins.OnUpdate();
  29. }
  30. void LateUpdate()
  31. {
  32. plugins.OnLateUpdate();
  33. }
  34. void FixedUpdate()
  35. {
  36. plugins.OnFixedUpdate();
  37. }
  38. void OnDestroy()
  39. {
  40. plugins.OnApplicationQuit();
  41. }
  42. void OnLevelWasLoaded(int level)
  43. {
  44. plugins.OnLevelWasLoaded(level);
  45. freshlyLoaded = true;
  46. }
  47. }
  48. }