public ReferenceFrameSelector( ManagerInterface manager, IntPtr plugin, Callback on_change, string name) : base(manager) { plugin_ = plugin; on_change_ = on_change; name_ = name; frame_type = FrameType.BODY_CENTRED_NON_ROTATING; expanded_ = new Dictionary<CelestialBody, bool>(); foreach (CelestialBody celestial in FlightGlobals.Bodies) { if (!celestial.is_leaf() && !celestial.is_root()) { expanded_.Add(celestial, false); } } selected_celestial_ = FlightGlobals.currentMainBody ?? Planetarium.fetch.Sun; for (CelestialBody celestial = selected_celestial_; celestial.orbit != null; celestial = celestial.orbit.referenceBody) { if (!celestial.is_leaf()) { expanded_[celestial] = true; } } on_change_(FrameParameters()); window_rectangle_.x = UnityEngine.Screen.width / 2; window_rectangle_.y = UnityEngine.Screen.height / 3; }
public ReferenceFrameSelector( ManagerInterface manager, IntPtr plugin, Callback on_change, string name) : base(manager) { plugin_ = plugin; on_change_ = on_change; name_ = name; frame_type = FrameType.BODY_CENTRED_NON_ROTATING; expanded_ = new Dictionary <CelestialBody, bool>(); foreach (CelestialBody celestial in FlightGlobals.Bodies) { if (!celestial.is_leaf() && !celestial.is_root()) { expanded_.Add(celestial, false); } } selected_celestial_ = FlightGlobals.currentMainBody ?? Planetarium.fetch.Sun; for (CelestialBody celestial = selected_celestial_; celestial.orbit != null; celestial = celestial.orbit.referenceBody) { if (!celestial.is_leaf()) { expanded_[celestial] = true; } } on_change_(FrameParameters()); window_rectangle_.x = UnityEngine.Screen.width / 2; window_rectangle_.y = UnityEngine.Screen.height / 3; }
private ManagerInterface TransformToManagerInterface(Data.Entity entityConfig, CodeGenerationModel genModel, EntityClass entityClass) { var data = new ManagerInterface { Name = $"I{entityClass.Name}Manager", Namespace = $"{genModel.BaseNamespace}.Business" }; data.Usings.Add("System"); data.Usings.Add("System.Threading.Tasks"); data.Usings.Add(entityClass.Namespace); if (entityConfig.Operations?.Any(o => o.PagingArgs) == true) { data.Usings.Add("Beef.Entities"); } return(data); }
public WindowRenderer(ManagerInterface manager) { manager_ = manager; manager_.render_windows += RenderWindow; }
private ControllerClass TransformToControllerClass(Data.Entity entityConfig, CodeGenerationModel genModel, EntityClass entityClass, ManagerInterface managerInterface) { var data = new ControllerClass(); data.Name = $"{entityClass.Name}Controller"; data.Namespace = $"{genModel.BaseNamespace}.Api.Controllers"; data.Partial = entityConfig.PartialWebApi; data.PrivateConstructor = entityConfig.PrivateWebApiConstructor; data.WebApiRoutePrefix = entityConfig.WebApiRoutePrefix; data.Usings.Add("Microsoft.AspNetCore.Mvc"); data.Usings.Add("System"); data.Usings.Add("System.Net"); data.Usings.Add("Beef"); data.Usings.Add("Beef.AspNetCore.WebApi"); data.Usings.Add(entityClass.Namespace); data.Usings.Add(managerInterface.Namespace); data.Operations = entityConfig.Operations.Select(o => { var op = CreateOperation <ControllerOperationModel>(o, entityClass); op.WebApiRoute = o.WebApiRoute; if (op.IsGet || op.IsDelete) { op.WebApiRoute = op.WebApiRoute ?? String.Join('/', op.Parameters.Select(o => $"{{{o.Name}}}")); } if (op.IsGetColl) { op.WebApiRoute = op.WebApiRoute ?? ""; op.HasPagingArgs = o.PagingArgs; } if (op.IsUpdate) { op.Parameters.AddRange(entityClass.Properties.Where(o => o.UnqiueKey).Select(o => new OperationParameter { Name = o.Name.ToCamelCase(), Type = o.Type, EntityProperty = o.Name })); op.WebApiRoute = op.WebApiRoute ?? String.Join('/', op.Parameters.Skip(1).Select(o => $"{{{o.Name}}}")); } return(op); }).ToList(); return(data); }