Beispiel #1
0
        public static void CreateAndAddNotification(GermExposureMonitor.Instance monitor, string sicknessName)
        {
            string text = string.Format(DUPE_EXPOSED_TO_GERMS_NOTIFICATION, sicknessName);

            Notification.ClickCallback callback = new Notification.ClickCallback(Notification_Callback);
            MinionIdentity             minion   = monitor.gameObject.GetComponent <MinionIdentity>();
            ShowLocationObject         slo      = new ShowLocationObject(minion);

            slo.ShowLocation = MinionsLoaded && showLocation;
            Notification notification = new Notification(text, NotificationType.BadMinor, HashedString.Invalid,
                                                         (List <Notification> n, object d) => string.Format(DUPE_EXPOSED_TO_GERMS_TOOLTIP, sicknessName) + n.ReduceMessages(true),
                                                         null, false, 0, callback, slo);

            monitor.gameObject.AddOrGet <Notifier>().Add(notification);
            Action <object> act = null;

            act = x =>
            {
                monitor.gameObject.AddOrGet <Notifier>().Remove(notification);
                monitor.Unsubscribe((int)GameHashes.SleepFinished, act);
                monitor.Unsubscribe((int)GameHashes.DuplicantDied, act);
            };
            monitor.Subscribe((int)GameHashes.SleepFinished, act);
            monitor.Subscribe((int)GameHashes.DuplicantDied, act);
        }
Beispiel #2
0
        public static void Notification_Callback(object d)
        {
            ShowLocationObject slo = (ShowLocationObject)d;

            if (slo.ShowLocation)
            {
                CameraController.Instance.CameraGoTo(slo.Pos, 4);
                SelectTool.Instance.Select(slo.Minion.GetComponent <KSelectable>(), true);
            }
            else
            {
                SelectTool.Instance.SelectAndFocus(slo.Minion.transform.GetPosition(), slo.Minion.GetComponent <KSelectable>(), new Vector3(0, 0, 0));
            }
        }