Exemplo n.º 1
0
 public static void Main()
 {
     var connection = new KRPC.Client.Connection (address: IPAddress.Parse ("10.0.2.2"));
     var vessel = connection.SpaceCenter ().ActiveVessel;
     KRPC.Client.Tuple<double,double,double,double> q = vessel.Flight ().Rotation;
     Console.WriteLine (q.Item1 + "," + q.Item2 + "," + q.Item3 + "," + q.Item4);
 }
Exemplo n.º 2
0
    public static void Main()
    {
        var connection = new KRPC.Client.Connection();
        var vessel     = connection.SpaceCenter().ActiveVessel;

        KRPC.Client.Tuple <double, double, double> v = vessel.Flight().Prograde;
        Console.WriteLine(v.Item1 + "," + v.Item2 + "," + v.Item3);
    }
Exemplo n.º 3
0
 public static void Main()
 {
     var connection = new KRPC.Client.Connection (name: "Kerbal Alarm Clock Example", address: IPAddress.Parse ("10.0.2.2"));
     var kac = connection.KerbalAlarmClock ();
     var alarm = kac.CreateAlarm (AlarmType.Raw, "My New Alarm", connection.SpaceCenter ().UT + 10);
     alarm.Notes = "10 seconds have now passed since the alarm was created.";
     alarm.Action = AlarmAction.MessageOnly;
 }
Exemplo n.º 4
0
    public static void Main()
    {
        var connection = new KRPC.Client.Connection();
        var vessel     = connection.SpaceCenter().ActiveVessel;

        KRPC.Client.Tuple <double, double, double, double> q = vessel.Flight().Rotation;
        Console.WriteLine(q.Item1 + "," + q.Item2 + "," + q.Item3 + "," + q.Item4);
    }
Exemplo n.º 5
0
    public static void Main()
    {
        var connection = new KRPC.Client.Connection(name: "Kerbal Alarm Clock Example");
        var kac        = connection.KerbalAlarmClock();
        var alarm      = kac.CreateAlarm(AlarmType.Raw, "My New Alarm", connection.SpaceCenter().UT + 10);

        alarm.Notes  = "10 seconds have now passed since the alarm was created.";
        alarm.Action = AlarmAction.MessageOnly;
    }
Exemplo n.º 6
0
 public static void Main()
 {
     var connection = new KRPC.Client.Connection (address: IPAddress.Parse ("10.0.2.2"));
     var vessel = connection.SpaceCenter ().ActiveVessel;
     var root = vessel.Parts.Root;
     var stack = new Stack<KRPC.Client.Tuple<Part,int>> ();
     stack.Push (new KRPC.Client.Tuple<Part,int> (root, 0));
     while (stack.Count > 0) {
         var item = stack.Pop ();
         Part part = item.Item1;
         int depth = item.Item2;
         Console.WriteLine (new String (' ', depth) + part.Title);
         foreach (var child in part.Children)
             stack.Push (new KRPC.Client.Tuple<Part,int> (child, depth + 1));
     }
 }
Exemplo n.º 7
0
    public static void Main()
    {
        var connection = new KRPC.Client.Connection (name: "InfernalRobotics Example", address: IPAddress.Parse ("10.0.2.2"));
        var ir = connection.InfernalRobotics ();

        var group = ir.ServoGroupWithName ("MyGroup");
        if (group == null) {
            Console.WriteLine ("Group not found");
            return;
        }

        foreach (var servo in group.Servos)
            Console.WriteLine (servo.Name + " " + servo.Position);

        group.MoveRight ();
        Thread.Sleep (1000);
        group.Stop ();
    }
Exemplo n.º 8
0
    public static void Main()
    {
        var connection = new KRPC.Client.Connection();
        var vessel     = connection.SpaceCenter().ActiveVessel;
        var root       = vessel.Parts.Root;
        var stack      = new Stack <KRPC.Client.Tuple <Part, int> > ();

        stack.Push(new KRPC.Client.Tuple <Part, int> (root, 0));
        while (stack.Count > 0)
        {
            var  item  = stack.Pop();
            Part part  = item.Item1;
            int  depth = item.Item2;
            Console.WriteLine(new String(' ', depth) + part.Title);
            foreach (var child in part.Children)
            {
                stack.Push(new KRPC.Client.Tuple <Part, int> (child, depth + 1));
            }
        }
    }
Exemplo n.º 9
0
    public static void Main()
    {
        var connection = new KRPC.Client.Connection(name: "InfernalRobotics Example");
        var ir         = connection.InfernalRobotics();

        var group = ir.ServoGroupWithName("MyGroup");

        if (group == null)
        {
            Console.WriteLine("Group not found");
            return;
        }

        foreach (var servo in group.Servos)
        {
            Console.WriteLine(servo.Name + " " + servo.Position);
        }

        group.MoveRight();
        Thread.Sleep(1000);
        group.Stop();
    }
Exemplo n.º 10
0
 public void setConnection(Connection con)
 {
     connection    = con;
     hasConnection = true;
 }
Exemplo n.º 11
0
 public StreamCollection(Connection con)
 {
     connection    = con;
     hasConnection = true;
 }
Exemplo n.º 12
0
        //private KRPC.Client.Connection connection;

        public void setConnection(KRPC.Client.Connection con)
        {
            //this.connection = con;
        }
 private void Poll()
 {
     while (_shouldPoll)
     {
         try
         {
             UpdateFromRPC(_spaceCenter.ActiveVessel);
         }
         catch (Exception e)
         {
             _shouldPoll = false;
             _connection = null;
             _spaceCenter = null;
             Notifications.LastErrorMessage = string.Format("Error on update: {0}", e.Message);
             ConnectedAndViewsVisbilityChanged();
         }
         Thread.Sleep(100);
     }
 }
        public void SetConnectionAndStartPolling(KRPC.Client.Connection connection)
        {
            _connection = connection;
            _spaceCenter = _connection.SpaceCenter();

            _shouldPoll = true;
            _pollingThread = new Thread(Poll);
            _pollingThread.Start();
            ConnectedAndViewsVisbilityChanged();
        }