public SNotificationAnimationSequence(float durationIdle, float durationFadeOut, float durationDecay, NotificationController controller)
 {
     IdleDuration           = durationIdle;
     FadeOutDuration        = durationFadeOut;
     DecayDuration          = durationDecay;
     NotificationController = controller;
 }
Exemple #2
0
        public override void PreGameManagerAlive()
        {
            Logger.Info("Initializing SGUI");

            GUIRoot = SGUIRoot.Setup();
            SGUIIMBackend.GetFont = (SGUIIMBackend backend) => {
                System.Console.WriteLine($"GETFONT INSTANCE: {CorePatches.MainMenuFoyerController.Instance}");
                if (CorePatches.MainMenuFoyerController.Instance?.VersionLabel == null)
                {
                    return(null);
                }
                return(FontCache.GungeonFont ?? (FontCache.GungeonFont = FontConverter.DFFontToUnityFont((dfFont)CorePatches.MainMenuFoyerController.Instance.VersionLabel.Font, 2)));
            };

            _GameObject = new GameObject("GUI");
            DontDestroyOnLoad(_GameObject);

            Logger.Info("Initializing menu controller");
            MenuController = _GameObject.AddComponent <MenuController>();
            DontDestroyOnLoad(MenuController);

            Logger.Info("Initializing notification controller");
            NotificationController = _GameObject.AddComponent <NotificationController>();
            DontDestroyOnLoad(NotificationController);

            _Bullet = UnityUtil.LoadTexture2D(Path.Combine(Paths.ResourcesFolder, "bullet.png"));

            AppDomain.CurrentDomain.UnhandledException += (obj, e) => {
                NotificationController.Notify(new Notification(
                                                  title: "An unhandled error has occured",
                                                  content: "More information in the log."
                                                  )
                {
                    BackgroundColor = UnityUtil.NewColorRGB(57, 7, 7)
                });
            };

            ModTheGungeon.ModLoader.LuaError += (info, method, e) => {
                NotificationController.Notify(new Notification(
                                                  title: $"An error has occured while loading mod {info.Name}",
                                                  content: $"The '{method}' method had raised an error. More information in the log."
                                                  )
                {
                    BackgroundColor = UnityUtil.NewColorRGB(57, 7, 7)
                });
            };

            ModTheGungeon.ErrorLoadingMod += (filename, e) => {
                NotificationController.Notify(new Notification(
                                                  title: $"An error has occured while loading '{filename}'",
                                                  content: "More information in the log."
                                                  )
                {
                    BackgroundColor = UnityUtil.NewColorRGB(57, 7, 7)
                });
            };

            ModTheGungeon.ErrorCreatingModsDirectory += (e) => {
                NotificationController.Notify(new Notification(
                                                  title: $"An error has occured while trying to create the Mods directory",
                                                  content: "More information in the log."
                                                  )
                {
                    BackgroundColor = UnityUtil.NewColorRGB(57, 7, 7)
                });
            };

            ModTheGungeon.ModsReloaded += (manual) => {
                if (manual)
                {
                    NotificationController.Notify(new Notification(
                                                      title: $"Reloaded!",
                                                      content: "All mods have been reloaded as a result of pressing the F5 key."
                                                      ));
                }
                else
                {
                    NotificationController.Notify(new Notification(
                                                      title: $"Reloaded!",
                                                      content: "All mods have been reloaded automatically as a result of at least one of them being modified."
                                                      ));
                }
            };
        }
 public SNotificationDecayAnimation(float duration, NotificationController n)
     : base(duration)
 {
     NotificationController = n;
 }
 public SNotificationDecayAnimation(NotificationController n)
     : this(0.3f, n)
 {
 }