当前位置: 首页>>代码示例>>C#>>正文


C# IntPtr.IsKspStockSystem方法代码示例

本文整理汇总了C#中IntPtr.IsKspStockSystem方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.IsKspStockSystem方法的具体用法?C# IntPtr.IsKspStockSystem怎么用?C# IntPtr.IsKspStockSystem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IntPtr的用法示例。


在下文中一共展示了IntPtr.IsKspStockSystem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResetPlugin


//.........这里部分代码省略.........
       vx                      : initial_state.GetValue("vx"),
       vy                      : initial_state.GetValue("vy"),
       vz                      : initial_state.GetValue("vz"));
     };
     insert_body(Planetarium.fetch.Sun);
     ApplyToBodyTree(insert_body);
     plugin_.EndInitialization();
     plugin_.AdvanceTime(Planetarium.GetUniversalTime(),
                 Planetarium.InverseRotAngle);
       } catch (Exception e) {
     Log.Fatal("Exception while reading initial state: " + e.ToString());
       }
     } else {
       plugin_source_ = PluginSource.ORBITAL_ELEMENTS;
       // We create the plugin at time 0, rather than
       // |Planetarium.GetUniversalTime()|, in order to get a deterministic
       // initial state.
       for(;;) {
     plugin_ = Interface.NewPlugin("0 s", "0 s",
                           Planetarium.InverseRotAngle);
     BodyProcessor insert_body = body => {
       Log.Info("Inserting " + body.name + "...");
       ConfigNode gravity_model = null;
       if (name_to_gravity_model?.TryGetValue(body.name,
                                      out gravity_model) == true) {
     Log.Info("using custom gravity model");
       }
       Orbit orbit = unmodified_orbits_.GetValueOrNull(body);
       var body_parameters = new BodyParameters{
       name = body.name,
       gravitational_parameter =
       (gravity_model?.GetValue("gravitational_parameter")).
           GetValueOrDefault(body.gravParameter + " m^3/s^2"),
       // J2000, because that's when we start non-config games.  We
       // should really parse real-life dates from strings.
       // The origin of rotation in KSP is the x of Barycentric, rather
       // than the y axis as is the case for Earth, so the right
       // ascension is -90 deg.
       reference_instant    = double.Parse(
       (gravity_model?.GetValue("reference_instant")).
           GetValueOrDefault("2451545.0")),
       mean_radius          =
       (gravity_model?.GetValue("mean_radius")).
           GetValueOrDefault(body.Radius + " m"),
       axis_right_ascension =
       (gravity_model?.GetValue("axis_right_ascension")).
           GetValueOrDefault("-90 deg"),
       axis_declination     =
       (gravity_model?.GetValue("axis_declination")).
           GetValueOrDefault("90 deg"),
       reference_angle      =
       (gravity_model?.GetValue("reference_angle")).
           GetValueOrDefault(body.initialRotation.ToString() +
                             " deg"),
       angular_frequency    =
       (gravity_model?.GetValue("angular_frequency")).
           GetValueOrDefault(body.angularV.ToString() + " rad/s"),
       j2                   = gravity_model?.GetValue("j2"),
       reference_radius     =
       gravity_model?.GetValue("reference_radius")};
       plugin_.InsertCelestialJacobiKeplerian(
       celestial_index             : body.flightGlobalsIndex,
       parent_index                :
       orbit?.referenceBody.flightGlobalsIndex,
       body_parameters             : body_parameters,
       keplerian_elements          : orbit?.Elements());
     };
     insert_body(Planetarium.fetch.Sun);
     ApplyToBodyTree(insert_body);
     plugin_.EndInitialization();
     if (plugin_.IsKspStockSystem()) {
       Interface.DeletePlugin(ref plugin_);
       Fix631();
     } else {
       break;
     }
       }
     }
     plotting_frame_selector_.reset(
     new ReferenceFrameSelector(this,
                        plugin_,
                        UpdateRenderingFrame,
                        "Plotting frame"));
     flight_planner_.reset(new FlightPlanner(this, plugin_));
     VesselProcessor insert_vessel = vessel => {
       Log.Info("Inserting " + vessel.name + "...");
       bool inserted =
       plugin_.InsertOrKeepVessel(
       vessel.id.ToString(),
       vessel.orbit.referenceBody.flightGlobalsIndex);
       if (!inserted) {
     Log.Fatal("Plugin initialization: vessel not inserted");
       } else {
     plugin_.SetVesselStateOffset(vessel.id.ToString(),
                          new QP{q = (XYZ)vessel.orbit.pos,
                                 p = (XYZ)vessel.orbit.vel});
       }
     };
     ApplyToVesselsOnRailsOrInInertialPhysicsBubbleInSpace(insert_vessel);
 }
开发者ID:pleroy,项目名称:Principia,代码行数:101,代码来源:ksp_plugin_adapter.cs


注:本文中的IntPtr.IsKspStockSystem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。