Esempio n. 1
0
 public static void UnRegister(EventType0 eventType, ZeroObjEventHandler handler)
 {
     if (EventMap0.ContainsKey(eventType))
     {
         EventMap0[eventType] -= handler;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 触发事件;事件接受0参数
 /// </summary>
 /// <param name="eventType">事件类型</param>
 public static void Send(EventType0 eventType)
 {
     if (EventMap0.ContainsKey(eventType) && EventMap0[eventType] != null)
     {
         try
         {
             EventMap0[eventType]();
         }
         catch (Exception ex)
         {
             Debug.LogError($"An exception occured while event({eventType}) send. {ex}");
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 触发事件;事件接受0参数
 /// </summary>
 /// <param name="eventType">事件类型</param>
 public static void Send(EventType0 eventType)
 {
     if (EventMap0.ContainsKey(eventType) && EventMap0[eventType] != null)
     {
         try
         {
             EventMap0[eventType]();
         }
         catch (Exception ex)
         {
             Debug.LogError("An exception occured while event(" + eventType.ToString() + ") send. " + ex.ToString());
         }
     }
 }
Esempio n. 4
0
    /// <summary>
    /// Record all the ball event.
    /// </summary>
    /// <param name="_event">the type of event</param>
    /// <param name="nr">number of first ball</param>
    /// <param name="nr2">number of second ball</param>
    /// <param name="frame">Frame</param>
    /// <param name="timeoffs">Timeoffset</param>
    public static void record_move_log_event(EventType0 _event, int nr, int nr2, Frame frame, float timeoffs)
    {
        BallEvent be = new BallEvent();

        be._event = _event;

        be.ballnr  = nr;
        be.ballnr2 = nr2;

        Ball ball1 = BM_get_ball_by_nr(nr, frame);
        Ball ball2 = BM_get_ball_by_nr(nr2, frame);

        if (_event == EventType0.BALL_BALL)
        {
            be.pos  = ball1.r;
            be.pos2 = ball2.r;
            be.v    = ball1.v;
            be.v2   = ball2.v;
            be.w    = ball1.w;
            be.w2   = ball2.w;
        }
        else if (_event == EventType0.BALL_WALL)
        {
            be.pos2 = ball2.r;
            be.v2   = ball2.v;
            be.w2   = ball2.w;
        }
        else if (_event == EventType0.BALL_OUT)
        {
            be.pos = ball1.r;
        }

        be.timestep_nr = timestep_nr;
        be.timeoffs    = timeoffs;

        _EventList.Add(be);
    }