コード例 #1
0
 private void OnDestroy()
 {
     Plugin.Log?.Debug($"{name}: OnDestroy()");
     if (Instance == this)
     {
         Instance = null; // This MonoBehaviour is being destroyed, so set the static instance property to null.
     }
 }
コード例 #2
0
 void Awake()
 {
     if (!settingsView)
     {
         settingsView = BeatSaberUI.CreateViewController <SettingsView>();
     }
     if (!antiLagModController)
     {
         antiLagModController = FindObjectOfType <AntiLagModController>();
     }
 }
コード例 #3
0
 private void Awake()
 {
     // For this particular MonoBehaviour, we only want one instance to exist at any time, so store a reference to it in a static property
     //   and destroy any that are created while one already exists.
     if (Instance != null)
     {
         Plugin.Log?.Warn($"Instance of {GetType().Name} already exists, destroying.");
         DestroyImmediate(this);
         return;
     }
     DontDestroyOnLoad(this); // Don't destroy this object on scene changes
     Instance = this;
     Plugin.Log?.Debug($"{name}: Awake()");
 }
コード例 #4
0
 protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
 {
     try
     {
         if (firstActivation)
         {
             SetTitle("Anti Lag Mod");
             showBackButton = true;
             ProvideInitialViewControllers(settingsView);
         }
     } catch (Exception exception)
     {
         AntiLagModController.ExternalCriticalError("ALMFlowCoordinator.cs", 37, exception);
     }
 }
コード例 #5
0
ファイル: TextObj.cs プロジェクト: Naquino14/AntiLagMod
        public void Create()
        {
            try
            {
                Plugin.Log.Debug("Creating text object");
                // setup text obj
                gameObject.transform.localScale = scale;
                dasCanvas            = gameObject.AddComponent <Canvas>();
                dasCanvas.renderMode = RenderMode.WorldSpace;
                var rectTransform = (RectTransform)dasCanvas.transform;
                rectTransform.sizeDelta = canvScale;

                indicatorTMPText              = BeatSaberUI.CreateText(rectTransform, "", canvAnchorPos);
                indicatorTMPText.alignment    = TextAlignmentOptions.Center;
                indicatorTMPText.overflowMode = TextOverflowModes.Overflow;
                indicatorTMPText.fontSize     = textFontSize;
                //indicatorTMPText.enableWordWrapping = false;
                indicatorTMPText.rectTransform.position = rectTransformPos;
            } catch (Exception exception)
            {
                AntiLagModController.ExternalCriticalError("TextObj.cs", 0, exception);
            }
        }