예제 #1
0
 public void UpdateImage(float interval, List <string> images)
 {
     _panel.ContentType = ContentType.TEXT_AND_IMAGE;
     _panel.ClearImagesFromSelection();
     _panel.ChangeInterval = interval;
     _panel.AddImagesToSelection(images, true); // This truely acts weird.
 }
예제 #2
0
 public void UpdateImage(float interval, List <string> images)
 {
     _panel.ClearImagesFromSelection();
     _panel.ShowPublicTextOnScreen();
     _panel.SetValueFloat("ChangeIntervalSlider", interval);
     _panel.AddImagesToSelection(images, true); // This truely acts weird.
     _panel.ShowTextureOnScreen();
 }
예제 #3
0
            public void Update()
            {
                try
                {
                    string input = connector.CustomData;
                    connector.CustomData = string.Empty;

                    if (state == HangarState.Retracted)
                    {
                        for (int i = 0; i < lights.Count; i++)
                        {
                            lights[i].Color = Color.White;
                        }
                    }
                    else
                    {
                        for (int i = 0; i < lights.Count; i++)
                        {
                            lights[i].Color = Color.Red;
                        }
                    }

                    if (state == HangarState.Extending)
                    {
                        if (input.Equals("Retract"))
                        {
                            state = HangarState.Retracting;
                        }

                        bool gatesOK  = true;
                        bool pistonOK = false;
                        for (int i = 0; i < gates.Count; i++)
                        {
                            if (gates[i].Status != DoorStatus.Open)
                            {
                                gatesOK = false;
                                gates[i].OpenDoor();
                            }
                        }

                        if (gatesOK)
                        {
                            extender.Velocity = 1;
                            if (extender.CurrentPosition == extender.MaxLimit)
                            {
                                pistonOK = true;
                            }
                        }

                        if (pistonOK)
                        {
                            state = HangarState.Extended;
                        }
                    }
                    else if (state == HangarState.Retracting)
                    {
                        if (input.Equals("Extend"))
                        {
                            state = HangarState.Extending;
                        }

                        bool rotorOK  = false;
                        bool pistonOK = false;
                        bool gatesOK  = false;

                        double targetAngle = getWorldBoxTargetAngle();
                        rotorOK = connector.Status != MyShipConnectorStatus.Connected || Math.Abs(AngleSubtract(rotor.Angle, targetAngle)) < 0.001;

                        if (!rotorOK)
                        {
                            MoveRotorTowards(targetAngle);
                        }

                        if (rotorOK)
                        {
                            rotor.TargetVelocityRad = 0;
                            extender.Velocity       = -1;
                            if (extender.CurrentPosition == extender.MinLimit)
                            {
                                pistonOK = true;
                            }
                        }

                        if (pistonOK)
                        {
                            gatesOK = true;
                            for (int i = 0; i < gates.Count; i++)
                            {
                                if (gates[i].Status != DoorStatus.Closed)
                                {
                                    gatesOK = false;
                                    gates[i].CloseDoor();
                                }
                            }
                        }

                        if (gatesOK)
                        {
                            state = HangarState.Retracted;
                        }
                    }
                    else if (state == HangarState.Calibrate)
                    {
                        bool rotorOK = false;

                        double targetAngle = getWorldBoxTargetAngle();
                        rotorOK = connector.Status != MyShipConnectorStatus.Connected || Math.Abs(AngleSubtract(rotor.Angle, targetAngle)) < 0.001;

                        if (!rotorOK)
                        {
                            MoveRotorTowards(targetAngle);
                        }

                        if (rotorOK)
                        {
                            rotor.TargetVelocityRad = 0;
                            state = HangarState.Extended;
                        }
                    }
                    else if (state == HangarState.Extended)
                    {
                        if (input.Equals("Retract"))
                        {
                            state = HangarState.Retracting;
                        }
                        if (input.Equals("Calibrate"))
                        {
                            state = HangarState.Calibrate;
                        }
                        if (input.Equals("Launch") && connector.Status == MyShipConnectorStatus.Connected)
                        {
                            connector.OtherConnector.CustomData = "Launch";
                        }
                    }
                    else if (state == HangarState.Retracted)
                    {
                        var angle = getWorldBoxTargetAngle();
                        if (Math.Abs(AngleSubtract(rotor.Angle, angle)) > 0.001)
                        {
                            MoveRotorTowards(angle);
                        }
                        if (input.Equals("Extend"))
                        {
                            state = HangarState.Extending;
                        }
                    }
                }
                catch
                {
                }

                display.ClearImagesFromSelection();
                display.WriteText(GetStatus());
            }