Esempio n. 1
0
            public void OnUpdateFrame(string arguments, UpdateType updateSource)
            {
                if ((updateSource & UpdateType.IGC) == UpdateType.IGC)
                {
                    while (listener.HasPendingMessage)
                    {
                        MyIGCMessage message = listener.AcceptMessage();
                        MyTuple <long, string, MatrixD, float> packet = message.As <MyTuple <long, string, MatrixD, float> >();
                        if (destinations.ContainsKey(packet.Item1))
                        {
                            destinations[packet.Item1].id     = packet.Item1;
                            destinations[packet.Item1].name   = packet.Item2;
                            destinations[packet.Item1].matrix = packet.Item3;
                            destinations[packet.Item1].size   = packet.Item4;
                        }
                        else
                        {
                            destinations.Add(packet.Item1, new Destination {
                                id = packet.Item1, name = packet.Item2, matrix = packet.Item3, size = packet.Item4
                            });
                        }
                    }
                }

                if ((updateSource & UpdateType.Trigger) == UpdateType.Trigger)
                {
                    HandleMenu(arguments);
                }

                if ((updateSource & UpdateType.Trigger) == UpdateType.Trigger || (updateSource & UpdateType.Terminal) == UpdateType.Terminal)
                {
                    commands.Execute(arguments);
                }

                if ((updateSource & UpdateType.Update10) == UpdateType.Update10)
                {
                    OnFlightUpdateFrame();
                }
                OnUpdateInfoFrame();
                debug.WriteText(menu.Draw(this));
            }