public static void ApplyRotation(float angle, KRPC.Utils.Tuple<float,float,float> axis, KRPCSpaceCenter.Services.Vessel vessel = null) { Vessel internalVessel = vessel == null ? FlightGlobals.ActiveVessel : vessel.InternalVessel; var axisVector = new Vector3 (axis.Item1, axis.Item2, axis.Item3).normalized; var rotation = internalVessel.transform.rotation * Quaternion.AngleAxis (angle, axisVector); internalVessel.SetRotation (rotation); }
void Update(UInt32 id, KRPC.Schema.KRPC.Response response) { lock (accessLock) { if (!streamData.ContainsKey (id)) throw new ArgumentException ("Stream does not exist"); if (response.HasError) return; //TODO: do something with the error var data = response.ReturnValue; streamData [id] = data; streamValues.Remove (id); } }
/// <summary>Method arguments docs</summary> public void MethodArguments(int one, string two, KRPC.Utils.Tuple<int,float,string> three, Response four, TestDocumentedClass.NestedClass five) { }
// Calls server.Update repeatedly every 50 ms, until predicate is true // or up to a maximum number of iterations, after which point the test fails void UpdateUntil(KRPC.Server.IServer<byte, byte> server, BooleanPredicate predicate, int iterations = 10) { for (int i = 0; i < iterations; i++) { server.Update (); if (predicate ()) return; System.Threading.Thread.Sleep (50); } Assert.Fail (); }
public static void ApplyRotation(float angle, KRPC.Utils.Tuple<float,float,float> axis) { var axisVector = new Vector3 (axis.Item1, axis.Item2, axis.Item3).normalized; var rotation = FlightGlobals.ActiveVessel.transform.rotation * Quaternion.AngleAxis (angle, axisVector); FlightGlobals.ActiveVessel.SetRotation (rotation); }
public static void ClearRotation(KRPC.SpaceCenter.Services.Vessel vessel = null) { Vessel internalVessel = vessel == null ? FlightGlobals.ActiveVessel : vessel.InternalVessel; internalVessel.GoOnRails (); internalVessel.SetRotation (ZeroRotation); }
public static KRPC.Schema.KRPC.Response ProcedureSingleArgReturns (KRPC.Schema.KRPC.Response data) { return Service.ProcedureSingleArgReturns (data); }
public void SetConnectionAndStartPolling(KRPC.Client.Connection connection) { _connection = connection; _spaceCenter = _connection.SpaceCenter(); _shouldPoll = true; _pollingThread = new Thread(Poll); _pollingThread.Start(); ConnectedAndViewsVisbilityChanged(); }
public static void ProcedureSingleArgNoReturn (KRPC.Schema.KRPC.Response data) { Service.ProcedureSingleArgNoReturn (data); }
public static void ProcedureThreeArgsNoReturn (KRPC.Schema.KRPC.Response x, KRPC.Schema.KRPC.Request y, KRPC.Schema.KRPC.Response z) { Service.ProcedureThreeArgsNoReturn (x, y, z); }
public static KRPC.Utils.Tuple<int,bool> EchoTuple (KRPC.Utils.Tuple<int,bool> t) { return Service.EchoTuple (t); }
public static void ProcedureEnumArg (KRPC.Schema.Test.TestEnum x) { Service.ProcedureEnumArg (x); }
private void UpdateLifeSupportPlots(KRPC.Client.Services.SpaceCenter.Resources resources, double MET) { foreach (var lifeSupportName in lifeSupportNames) { LifeSupportPlot.AddToSeriesIfLastXHigherThan(lifeSupportName, MET, resources.Amount(lifeSupportName) / resources.Max(lifeSupportName), 300); } LifeSupportPlot.InvalidatePlot(); }
private void UpdateFuelPlots(KRPC.Client.Services.SpaceCenter.Resources resources, double MET) { foreach (var fuelName in fuelNames) { FuelsPlot.AddToSeries(fuelName, MET, resources.Amount(fuelName) / resources.Max(fuelName)); } FuelsPlot.InvalidatePlot(); }
public void Update(KRPC.Client.Services.SpaceCenter.Resources resources, double MET) { foreach (var name in resources.Names) { ResourceTuple tuple; if (Resources.ContainsKey(name)) { tuple = Resources[name]; } else { tuple = new ResourceTuple() { Name = name }; Resources[name] = tuple; } tuple.Ammount = resources.Amount(name); tuple.Maximum = resources.Max(name); } UpdateFuelPlots(resources, MET); UpdateLifeSupportPlots(resources, MET); OnPropertyChanged("Resources"); OnPropertyChanged("Fuels"); }