コード例 #1
0
ファイル: GraphicsTestPlugin.cs プロジェクト: mbrachner/XPNet
        /// <summary>
        /// This is a hook that is called when the flight look starts to run,
        /// that is, when the simulator is fully loaded. Only then will <see cref="IXPlaneScenery.LookupObjects(string, float, float)"/>
        /// reasonable results, because the scenery indexes are loaded only after the
        /// plugins are started.  After the work is done the flight loop hook is
        /// disposed because we no longer need it.
        /// </summary>
        private FlightLoopTime SimLoaded(TimeSpan elapsedTimeSinceLastCall, TimeSpan elapsedTimeSinceLastFlightLoop, int counter)
        {
            m_api.Log.Log($"GraphicsTestPlugin: Entered SimLoaded flightloop (just called once)");

            m_api.Log.Log($"GraphicsTestPlugin: Loading objects with path {TUGPATH}");
            var tugs = m_api.Scenery.LookupObjects(TUGPATH, 0, 0);

            foreach (var p in tugs)
            {
                m_api.Log.Log($"GraphicsTestPlugin: Filename: {p}");
            }

            m_testTug          = m_api.Scenery.LoadObject(tugs.First());
            m_testTugInstances = Enumerable.Range(0, 10).Select(_ => m_api.Instance.Create(m_testTug, new string[]
            {
                "sim/graphics/animation/ground_traffic/tire_steer_deg"
            })).ToList();

            m_tireTurning = m_api.Processing.RegisterFlightLoopHook(FlightLoopTime.FromCycles(1), TurnTheWheel);

            m_api.Log.Log($"Loaded and still living, reference is {m_testTug}");
            m_firstFlightLoopHook.Dispose();
            m_firstFlightLoopHook = null;
            m_api.Log.Log($"GraphicsTestPlugin: Leaving SimLoaded flightloop");

            return(FlightLoopTime.Unscheduled);
        }
コード例 #2
0
ファイル: GraphicsTestPlugin.cs プロジェクト: g921002/xpnet
        /// <summary>
        /// This is a hook that is called when the flight look starts to run,
        /// that is, when the simulator is fully loaded. Only then will <see cref="IXPlaneScenery.LookupObjects(string, float, float)"/>
        /// reasonable results, because the scenery indexes are loaded only after the
        /// plugins are started.  After the work is done the flight loop hook is
        /// disposed because we no longer need it.
        /// </summary>
        private FlightLoopTime SimLoaded(TimeSpan elapsedTimeSinceLastCall, TimeSpan elapsedTimeSinceLastFlightLoop, int counter)
        {
            m_api.Log.Log($"GraphicsTestPlugin: Loading objects with path {TUGPATH}");

            var tugs = m_api.Scenery.LookupObjects(TUGPATH, 0, 0);

            foreach (var p in tugs)
            {
                m_api.Log.Log($"GraphicsTestPlugin: Filename: {p}");
            }

            testTug = m_api.Scenery.LoadObject(tugs.First());
            m_api.Log.Log($"GraphicsTestPlugin: Loaded and still living, reference is {testTug}");

            m_flightLoopHook.Dispose();
            m_flightLoopHook = null;

            return(FlightLoopTime.Unscheduled);
        }
コード例 #3
0
 public IXPInstance Create(IXPSceneryObject inSceneryObject, string[] inDataRefs)
 {
     return(inSceneryObject.CreateInstance(inDataRefs));
 }