コード例 #1
0
        void InfoWindow(int windowID)
        {
            GUILayout.BeginVertical();

            List <uint> keys = new List <uint> (transponders.Keys);

            keys.Sort();
            for (int i = 0; i < keys.Count; i++)
            {
                TransponderInfo ti       = transponders[keys[i]];
                bool            targeted = false;

                GUIStyle style = normal;
                if (ti.transponder == null)
                {
                    style = no_signal;
                }
                else
                {
                    targeted = FlightGlobals.fetch.VesselTarget == (ti.transponder as ITargetable);
                }

                GUILayout.BeginHorizontal();
                if (targeted)
                {
                    if (GUILayout.Button(tgt_targeted, style))
                    {
                        FlightGlobals.fetch.SetVesselTarget(null);
                    }
                }
                else
                {
                    if (GUILayout.Button(tgt_idle, style))
                    {
                        FlightGlobals.fetch.SetVesselTarget(ti.transponder);
                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.Label(ti.name, style);
                GUILayout.FlexibleSpace();
                GUILayout.Label(ti.situation.ToString(), style);
                GUILayout.FlexibleSpace();
                if (ti.transponder != null)
                {
                    GUILayout.Label(String.Format("{0:F0}", ti.altitude), style);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(String.Format("{0:F0}", ti.velocity), style);
                }
                else
                {
                    GUILayout.Label("no signal", style);
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();
            GUI.DragWindow();
        }
コード例 #2
0
 public void AddTransponder(ST_Transponder ponder)
 {
     uint id = ponder.part.flightID;
     //Debug.Log (String.Format ("[ST Tracker] AddTransponder: {0}", id));
     if (transponders.ContainsKey (id)) {
         // may have temporarlily lost contact
         transponders[id].transponder = ponder;
         return;
     }
     transponders[id] = new TransponderInfo (ponder);
 }
コード例 #3
0
        public void AddTransponder(ST_Transponder ponder)
        {
            uint id = ponder.part.flightID;

            //Debug.Log (String.Format ("[ST Tracker] AddTransponder: {0}", id));
            if (transponders.ContainsKey(id))
            {
                // may have temporarlily lost contact
                transponders[id].transponder = ponder;
                return;
            }
            transponders[id] = new TransponderInfo(ponder);
        }
コード例 #4
0
    public void HandleCommand(ZACommons commons, EventDriver eventDriver,
                              string argument)
    {
        argument = argument.Trim();
        var parts = argument.Split(new char[] { ';' }, 9);

        if (parts.Length < 9)
        {
            return;
        }
        var command = parts[0];

        if (command == "xponder")
        {
            var    id = parts[1];
            double posX, posY, posZ;
            if (!double.TryParse(parts[2], out posX) ||
                !double.TryParse(parts[3], out posY) ||
                !double.TryParse(parts[4], out posZ))
            {
                return;
            }
            double orientX, orientY, orientZ, orientW;
            if (!double.TryParse(parts[5], out orientX) ||
                !double.TryParse(parts[6], out orientY) ||
                !double.TryParse(parts[7], out orientZ) ||
                !double.TryParse(parts[8], out orientW))
            {
                return;
            }

            var info = new TransponderInfo(id,
                                           new Vector3D(posX, posY, posZ),
                                           new QuaternionD(orientX, orientY, orientZ, orientW),
                                           eventDriver.TimeSinceStart + ExpireTimeout);
            ReceivedInfos[id] = info;
        }
    }
コード例 #5
0
 public bool TryGetTransponderInfo(string ID, out TransponderInfo info)
 {
     return(ReceivedInfos.TryGetValue(ID, out info));
 }