コード例 #1
0
ファイル: EventFactory.cs プロジェクト: youarebritish/FoxKit
        /// <summary>
        /// Create a RouteEvent.
        /// </summary>
        /// <param name="data">Parameters of the RouteEvent to construct.</param>
        /// <param name="getEventTypeHash">Function to get the StrCode32 hash of a RouteEvent's type.</param>
        /// <returns>The constructed RouteEvent.</returns>
        private static FoxLib.Tpp.RouteSet.RouteEvent Create(RouteEvent data, GetNodeEventTypeHashDelegate getNodeTypeHash, GetEdgeEventTypeHashDelegate getEdgeTypeHash)
        {
            // TODO: Refactor this to not use type checking.
            uint eventTypeHash = uint.MaxValue;

            if (data is RouteNodeEvent)
            {
                eventTypeHash = getNodeTypeHash((data as RouteNodeEvent));
            }
            else if (data is RouteEdgeEvent)
            {
                eventTypeHash = getEdgeTypeHash((data as RouteEdgeEvent));
            }
            else
            {
                Assert.IsTrue(false, "Unrecognized RouteEvent type.");
            }

            return(new FoxLib.Tpp.RouteSet.RouteEvent(
                       eventTypeHash,
                       data.Params[0],
                       data.Params[1],
                       data.Params[2],
                       data.Params[3],
                       data.Params[4],
                       data.Params[5],
                       data.Params[6],
                       data.Params[7],
                       data.Params[8],
                       data.Params[9],
                       data.Snippet
                       ));
        }
コード例 #2
0
ファイル: EventFactory.cs プロジェクト: youarebritish/FoxKit
 /// <summary>
 /// Create a function to create RouteEvents.
 /// </summary>
 /// <param name="getEventTypeHash">Function to get the StrCode32 hash of a RouteEvent's type.</param>
 /// <returns>Function to construct RouteEvents.</returns>
 public static CreateEventDelegate CreateFactory(GetNodeEventTypeHashDelegate getNodeTypeHash, GetEdgeEventTypeHashDelegate getEdgeTypeHash)
 {
     return((data) => Create(data, getNodeTypeHash, getEdgeTypeHash));
 }