コード例 #1
0
        public static void NotifyDeath(ProtoCrewMember kerbal)
        {
            var title = $"{kerbal.name} has died";
            var text  = $"{kerbal.name} has died while on EVA.";
            const MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.RED;
            const MessageSystemButton.ButtonIcons        icon  = MessageSystemButton.ButtonIcons.FAIL;
            var message = new MessageSystem.Message(title, text, color, icon);

            MessageSystem.Instance.AddMessage(message);
        }
コード例 #2
0
 // show a generic notification
 public static void Notification(string title, string msg, string type)
 {
   MessageSystemButton.MessageButtonColor msg_clr = MessageSystemButton.MessageButtonColor.BLUE;
   MessageSystemButton.ButtonIcons msg_icon = MessageSystemButton.ButtonIcons.MESSAGE;
   if (type == "ALERT")
   {
     msg_clr = MessageSystemButton.MessageButtonColor.RED;
     msg_icon = MessageSystemButton.ButtonIcons.ALERT;
   }
   MessageSystem.Instance.AddMessage(new MessageSystem.Message(title, msg, msg_clr, msg_icon));
 }
コード例 #3
0
 /// <summary>
 /// Quick wrapper to post a user notification with less hassle.
 /// </summary>
 static void PostMessage(string title,
                         string message,
                         MessageSystemButton.MessageButtonColor messageButtonColor,
                         MessageSystemButton.ButtonIcons buttonIcons)
 {
     MessageSystem.Message msg = new MessageSystem.Message(
         title,
         message,
         messageButtonColor,
         buttonIcons);
     MessageSystem.Instance.AddMessage(msg);
 }
コード例 #4
0
 /// <summary>
 /// Posts a new message to the messaging system unless notifications have been disabled in the general settings.
 /// </summary>
 public static void PostMessage(string title, string message, MessageSystemButton.MessageButtonColor messageButtonColor, MessageSystemButton.ButtonIcons buttonIcons,
                                bool overrideMute = false)
 {
     if (DangIt.Instance.CurrentSettings.Messages || overrideMute)
     {
         MessageSystem.Message msg = new MessageSystem.Message(
             title,
             message,
             messageButtonColor,
             buttonIcons);
         MessageSystem.Instance.AddMessage(msg);
     }
 }
コード例 #5
0
        // Get the nearest open base and range to it
        public static void getNearestOpenBase(Vector3 position, out string sBase, out float flRange, out LaunchSite lNearest)
        {
            SpaceCenter KSC             = SpaceCenter.Instance;
            var         smallestDist    = Vector3.Distance(KSC.gameObject.transform.position, position);
            string      sNearestBase    = "";
            string      sOpenCloseState = "";
            LaunchSite  lNearestBase    = null;
            LaunchSite  lKSC            = null;

            List <LaunchSite> basesites = LaunchSiteManager.getLaunchSites();

            foreach (LaunchSite site in basesites)
            {
                sOpenCloseState = site.openclosestate;

                if (!MiscUtils.isCareerGame())
                {
                    sOpenCloseState = "Open";
                }

                //if (site.recoveryfactor == 0) continue;

                if (sOpenCloseState == "Open")
                {
                    var radialposition = site.GameObject.transform.position;
                    var dist           = Vector3.Distance(position, radialposition);

                    if (site.name == "Runway")
                    {
                        if (lNearestBase == null)
                        {
                            lNearestBase = site;
                        }
                        lKSC = site;
                    }
                    else
                    if (site.name != "LaunchPad")
                    {
                        if ((float)dist < (float)smallestDist)
                        {
                            {
                                sNearestBase = site.name;
                                lNearestBase = site;
                                smallestDist = dist;
                            }
                        }
                    }
                    else
                    {
                        lKSC = site;
                    }
                }
            }

            if (sNearestBase == "")
            {
                sNearestBase = "KSC";
                lNearestBase = lKSC;
            }

            RangeNearestOpenBase = (float)smallestDist;

            // Air traffic control messaging
            if (KerbalKonstructs.instance.enableATC)
            {
                if (sNearestBase != NearestOpenBase)
                {
                    if (RangeNearestOpenBase < 25000)
                    {
                        NearestOpenBase = sNearestBase;
                        MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.BLUE;
                        MessageSystem.Message m = new MessageSystem.Message("KK ATC", "You have entered the airspace of " + sNearestBase + " ATC. Please keep this channel open and obey all signal lights. Thank you. " + sNearestBase + " Air Traffic Control out.", color, MessageSystemButton.ButtonIcons.MESSAGE);
                        MessageSystem.Instance.AddMessage(m);
                    }
                    else
                    if (NearestOpenBase != "")
                    {
                        // you have left ...
                        MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.GREEN;
                        MessageSystem.Message m = new MessageSystem.Message("KK ATC", "You are now leaving the airspace of " + sNearestBase + ". Safe journey. " + sNearestBase + " Air Traffic Control out.", color, MessageSystemButton.ButtonIcons.MESSAGE);
                        MessageSystem.Instance.AddMessage(m);
                        NearestOpenBase = "";
                    }
                }
            }

            sBase    = sNearestBase;
            flRange  = RangeNearestOpenBase;
            lNearest = lNearestBase;
        }
コード例 #6
0
 public static void PostMessage(string sTitle, string sMessage, MessageSystemButton.MessageButtonColor cColor,
                                MessageSystemButton.ButtonIcons bIcon)
 {
     MessageSystem.Message m = new MessageSystem.Message(sTitle, sMessage, cColor, bIcon);
     MessageSystem.Instance.AddMessage(m);
 }
コード例 #7
0
 protected void DisplayMessage(string title, string message, MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.GREEN)
 {
     MessageSystem.Instance.AddMessage(new MessageSystem.Message(title, message, color,
                                                                 MessageSystemButton.ButtonIcons.MESSAGE));
 }
コード例 #8
0
 protected void SendStateMessage(string title, string message, MessageSystemButton.MessageButtonColor color, MessageSystemButton.ButtonIcons icon);
コード例 #9
0
        // Returns the nearest open Launchsite to a position and range to the Launchsite in m
        // The basic ATC feature is in here for now
        public static void GetNearestOpenBase(Vector3 position, out string sBase, out float flRange, out KKLaunchSite lNearest)
        {
            SpaceCenter  KSC          = SpaceCenter.Instance;
            var          smallestDist = Vector3.Distance(KSC.gameObject.transform.position, position);
            string       sNearestBase = "";
            KKLaunchSite lNearestBase = null;
            KKLaunchSite lKSC         = null;

            foreach (KKLaunchSite site in allLaunchSites)
            {
                if (site.isOpen)
                {
                    var radialposition = site.staticInstance.transform.position;
                    var dist           = Vector3.Distance(position, radialposition);

                    if (site.LaunchSiteName == "Runway")
                    {
                        if (lNearestBase == null)
                        {
                            lNearestBase = site;
                        }

                        lKSC = site;
                    }
                    else
                    if (site.LaunchSiteName != "LaunchPad")
                    {
                        if ((float)dist < (float)smallestDist)
                        {
                            {
                                sNearestBase = site.LaunchSiteName;
                                lNearestBase = site;
                                smallestDist = dist;
                            }
                        }
                    }
                    else
                    {
                        lKSC = site;
                    }
                }
            }

            if (sNearestBase.Length == 0)
            {
                sNearestBase = "KSC";
                lNearestBase = lKSC;
            }

            rangeNearestOpenBase = (float)smallestDist;

            // Air traffic control messaging
            if (LandingGuideUI.instance.IsOpen())
            {
                if (sNearestBase != nearestOpenBase)
                {
                    if (rangeNearestOpenBase < 25000)
                    {
                        nearestOpenBase = sNearestBase;
                        MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.BLUE;
                        MessageSystem.Message m = new MessageSystem.Message("KK ATC", "You have entered the airspace of " + sNearestBase + " ATC. Please keep this channel open and obey all signal lights. Thank you. " + sNearestBase + " Air Traffic Control out.", color, MessageSystemButton.ButtonIcons.MESSAGE);
                        MessageSystem.Instance.AddMessage(m);
                    }
                    else
                    if (nearestOpenBase.Length != 0)
                    {
                        // you have left ...
                        MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.GREEN;
                        MessageSystem.Message m = new MessageSystem.Message("KK ATC", "You are now leaving the airspace of " + sNearestBase + ". Safe journey. " + sNearestBase + " Air Traffic Control out.", color, MessageSystemButton.ButtonIcons.MESSAGE);
                        MessageSystem.Instance.AddMessage(m);
                        nearestOpenBase = "";
                    }
                }
            }

            sBase    = sNearestBase;
            flRange  = rangeNearestOpenBase;
            lNearest = lNearestBase;
        }
コード例 #10
0
ファイル: KCT_Utilities.cs プロジェクト: Tonweight/KCT
 public static void DisplayMessage(String title, StringBuilder text, MessageSystemButton.MessageButtonColor color, MessageSystemButton.ButtonIcons icon)
 {
     MessageSystem.Message m = new MessageSystem.Message(title, text.ToString(), color, icon);
     MessageSystem.Instance.AddMessage(m);
 }
コード例 #11
0
 protected void DisplayMessages(ConditionDetail.Condition condition, string parameterID, MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.GREEN)
 {
     foreach (ConditionDetail cd in conditions.Where(cd => !cd.disabled && cd.condition == condition && cd.parameter == parameterID))
     {
         DisplayMessage(title, message, color);
         cd.disabled = true;
     }
 }
コード例 #12
0
 protected void DisplayMessages(ConditionDetail.Condition condition, MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.GREEN)
 {
     DisplayMessages(condition, "", color);
 }