public MoveUnitEvent(EventID eventID, object sender, EventArgs<Actors.Cursor, Pathfinder, float> e)
     : base(eventID, sender, e)
 {
     this.cursor = e.Value;
     this.pathfinder = e.Value2;
     this.moveSpeed = e.Value3;
 }
        /// <summary>
        /// Returns the event category for the given event type
        /// </summary>
        /// <param name="eventType">The EventType whose Category is needed</param>
        /// <returns>The category for the given event type</returns>
        public static EventCategory ResolveEventCategory(EventID eventType)
        {
            EventCategory result = EventCategory.NotSet;
            int eventTypeInt = (int)eventType;
            if (eventTypeInt < 1000)
            {
                result = EventCategory.NotSet;
            }
            else if (eventTypeInt < 2000)
            {
                result = EventCategory.Generic;
            }
            else if (eventTypeInt < 3000)
            {
                result = EventCategory.PageGeneration;
            }
            else if (eventTypeInt < 4000)
            {
                result = EventCategory.MessageQueueing;
            }
            // ...
            else
            {
                result = EventCategory.Reserved;
            }

            return result;
        }
Exemple #3
0
 /// <summary>
 /// Removes all the arguments for the given ID.
 /// </summary>
 public void RemoveArguments(EventID id)
 {
     if (idToArguments.ContainsKey(id))
     {
         idToArguments.Remove(id);
     }
 }
 public UnitCaptureAction(EventID eventID, object sender, EventArgs<Faction, Unit, Tile> e)
     : base(eventID, sender, e)
 {
     this.activeFaction = e.Value;
     this.selectedUnit = e.Value2;
     this.targetTile = e.Value3;
 }
 public UnitAttackAction(EventID eventID, object sender, EventArgs<Faction, Unit, Unit> e)
     : base(eventID, sender, e)
 {
     this.activeFaction = e.Value;
     this.selectedUnit = e.Value2;
     this.targetUnit = e.Value3;
 }
Exemple #6
0
 /// <summary>
 /// Internal version of GetArgumentsForId returning the result
 /// as a list.
 /// </summary>
 private List<CameraArgument> GetArgumentsForIDInternal(EventID id)
 {
     if (!idToArguments.ContainsKey(id))
     {
         idToArguments[id] = new List<CameraArgument>();
     }
     return idToArguments[id];
 }
Exemple #7
0
 /// <summary>
 /// Adds the given argument for the given ID.
 /// </summary>
 public void AddArgument(EventID id, CameraArgument argument)
 {
     if (!idToArguments.ContainsKey(id))
     {
         idToArguments[id] = new List<CameraArgument>();
     }
     idToArguments[id].Add(argument);
 }
Exemple #8
0
 public StoryEvent(
     EventSignature signature,
     EventID id,
     params uint[] parameters)
 {
     this.Signature = signature;
     this.Participants = parameters;
     this.ID = id;
 }
Exemple #9
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (EventID?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (EventDesc?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (EventTime?.GetHashCode() ?? 0);
            return(hashCode);
        }
Exemple #10
0
 public EventTrigger(EventID eventType, Vector2 pos, int width, int height)
 {
     this.eventType = eventType;
     nextLevel      = string.Empty;
     Position       = pos;
     Width          = width;
     Height         = height;
     bounds         = new Rectangle(pos.ToPoint(), new Point(Width, Height));
 }
Exemple #11
0
 /// <summary>
 /// 移除监听
 /// </summary>
 public static void RemoveEventListener(EventID eventType, CallBack callback)
 {
     if (m_eventTable.ContainsKey(eventType))
     {
         EventRemoving(eventType, callback);
         m_eventTable[eventType] = (CallBack)m_eventTable[eventType] - callback;
         EventRemoved(eventType);
     }
 }
Exemple #12
0
        public string[] ToStringArray()
        {
            List <string> result = new List <string>();

            result.Add(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
            result.Add(EventID.ToString());
            result.Add(Provider);
            result.Add(Data);
            return(result.ToArray());
        }
Exemple #13
0
        public EventHandler FindHandler(EventID eventID, Order order)
        {
            var orderDict = _eventDict[order];

            if (orderDict.ContainsKey(eventID))
            {
                return(orderDict[eventID]);
            }
            return(null);
        }
Exemple #14
0
 /// <summary>
 /// Private constructor, as TryGetEventStub should be used instead. 
 /// </summary>
 private EventStub(EventSignature mainSignature, List<EventSignature> signatures, EventID id)
 {
     this.MainSignature = this.Signature = mainSignature;
     this.allSignatures = signatures;
     AnalyzeSignatures(this.allSignatures);
     this.name = mainSignature.Name;
     this.name = Regex.Replace(this.name, "([a-z])([A-Z])", "$1 $2");
     this.name = Regex.Replace(this.name, "(\\(.*\\))", "");
     this.ID = id;
 }
        /// <summary>
        /// will activate handler in next frame
        /// </summary>
        public void FireEvent(EventID eventID, long senderID, long receiverID, object data)
        {
            if (senderID == -1 || receiverID == -1)
            {
                return;
            }
            var eventObj = new CommonEvent(eventID, senderID, receiverID, data);

            _cachedEvents.Add(eventObj);
        }
Exemple #16
0
 public StoryEvent(StoryEvent other)
 {
     this.Signature = new EventSignature(other.Signature);
     this.Participants = new uint[other.Participants.Length];
     Array.Copy(
         other.Participants, 
         this.Participants, 
         other.Participants.Length);
     this.ID = other.ID;
 }
 public void AddEvent(EventID id, string key, Action <string> action)
 {
     if (actions[id].ContainsKey(key))
     {
         actions[id][key] += action;
     }
     else
     {
         actions[id][key] = action;
     }
 }
Exemple #18
0
 public void addMouseListener(EventID evtID, Action cb)
 {
     if (EventID.MOUSEDOWN_EVENT == evtID)
     {
         m_onMouseDown += cb;
     }
     else if (EventID.MOUSEUP_EVENT == evtID)
     {
         m_onMouseUp += cb;
     }
 }
Exemple #19
0
 public void addKeyListener(EventID evtID, Action <KeyCode> cb)
 {
     if (EventID.KEYUP_EVENT == evtID)
     {
         m_onKeyUp += cb;
     }
     else if (EventID.KEYDOWN_EVENT == evtID)
     {
         m_onKeyDown += cb;
     }
 }
Exemple #20
0
        public static UserActionRec Create(string sign, int nameRes, EventID Event, HotKey hotKey, bool withoutShift)
        {
            UserActionRec result = new UserActionRec();

            result.Sign         = sign;
            result.NameRes      = nameRes;
            result.Event        = Event;
            result.HotKey       = hotKey;
            result.WithoutShift = withoutShift;
            return(result);
        }
Exemple #21
0
    public static void AddListener <T, U>(EventID eventId, EventFun2 <T, U> listener)
    {
        BaseEvents baseEvents = null;

        if (!Instance.eventDictionary.TryGetValue(eventId, out baseEvents))
        {
            baseEvents = new GenericEvents2 <T, U>();
            Instance.eventDictionary.Add(eventId, baseEvents);
        }
        ((GenericEvents2 <T, U>)baseEvents).eventList.Add(listener);
    }
Exemple #22
0
 //Call all the Functions in the Action Once.
 public void DispatchEvent(EventID a_EventID, object a_Param = null)
 {
     if (m_Events.ContainsKey(a_EventID))
     {
         m_Events[a_EventID](a_Param);
     }
     else
     {
         Debug.LogWarning("The thread you are Dispatching doesnt exist. Mathf");
     }
 }
Exemple #23
0
 //Remove a Function (Value) into a Action (Key).
 public void UnregisterEvent(EventID a_EventID, Action <object> a_CallBack)
 {
     if (m_Events.ContainsKey(a_EventID))
     {
         m_Events[a_EventID] -= a_CallBack;
     }
     else
     {
         Debug.LogWarning("The Event you are Unregistering doesnt exist. Mathf");
     }
 }
Exemple #24
0
 //Add a Function (Value) into a Action (Key).
 //Action<object> is a way of saying that the function added to the Action may take ANY parameter. Works Like <T> but less overkill.
 public void RegisterEvent(EventID a_EventID, Action <object> a_CallBack)
 {
     if (m_Events.ContainsKey(a_EventID))
     {
         m_Events[a_EventID] += a_CallBack;
     }
     else
     {
         m_Events.Add(a_EventID, a_CallBack);
     }
 }
Exemple #25
0
 private void OnMouseDown()
 {
     _rawImage = GameObject.Find("RawImage");
     _leaderboardTransition = GameObject.Find("Leaderboard Panel").GetComponent <Animator>();
     if (_rawImage == null && _leaderboardTransition.GetBool("isLeaderboardOn") == false)
     {
         EventID eventID = new EventID(this.gameObject.name);
         StartCoroutine(_gameNetwork.GetEventMetaData("https://harryspotter.eu.ngrok.io/getEventMetadata", eventID.Serialize().ToString(), GetEventMetaData));
         Debug.Log(this.gameObject.name);
     }
 }
        public static MainControlRec Create(int nameRes, string imageFile, EventID _event, ExtRect rt)
        {
            MainControlRec result = new MainControlRec();

            result.NameRes   = nameRes;
            result.ImageFile = imageFile;
            result.Event     = _event;
            result.R         = rt;
            result.Button    = null;
            return(result);
        }
 public void RemoveListener(EventID eventID, Action <object> callback)
 {
     if (_listeners.ContainsKey(eventID))
     {
         _listeners[eventID] -= callback;
     }
     else
     {
         Debug.LogWarning("not found key");
     }
 }
 public void UpdateEvent(IList <string> eventList)
 {
     if (EventID.InvokeRequired)
     {
         EventID.Invoke(new SetTextCallback(UpdateEvent), eventList);
     }
     else
     {
         EventID.DataSource = eventList.ToList();
     }
 }
Exemple #29
0
 public StoryEvent(
     EventSignature signature,
     EventID id,
     params SmartObject[] parameters)
 {
     this.Signature = signature;
     this.Participants = new uint[parameters.Length];
     for (int i = 0; i < parameters.Length; i++)
         this.Participants[i] = parameters[i].Id;
     this.ID = id;
 }
 public void DispatchEvent(EventID i_ID, object i_Param = null)
 {
     if (m_EventDict.ContainsKey(i_ID))
     {
         m_EventDict[i_ID](i_Param);
     }
     else
     {
         Debug.LogError("The event you are dispatching dosent exist");
     }
 }
 public void RegisterEvent(EventID i_ID, Action <object> i_Callback)
 {
     if (m_EventDict.ContainsKey(i_ID))
     {
         m_EventDict[i_ID] += i_Callback;
     }
     else
     {
         m_EventDict.Add(i_ID, i_Callback);
     }
 }
Exemple #32
0
 public IDictionary <string, string> ToDictionary()
 {
     return(new Dictionary <string, string>()
     {
         { nameof(EventID), EventID.ToString() },
         { nameof(EventType), EventType },
         { nameof(UserID), UserID },
         { nameof(SourceIPAddress), SourceIPAddress },
         { nameof(DataTimeStamp), DataTimeStamp.ToString() }
     });
 }
Exemple #33
0
 public void UnregisterEvent(EventID id, Action <object> callback)
 {
     if (_eventDict.ContainsKey(id))
     {
         _eventDict[id] -= callback;
     }
     else
     {
         Debug.LogError("The event you are unregistering doesn't exist.");
     }
 }
Exemple #34
0
 public void RegisterEvent(EventID id, Action <object> callback)
 {
     if (_eventDict.ContainsKey(id))
     {
         _eventDict[id] += callback;
     }
     else
     {
         _eventDict.Add(id, callback);
     }
 }
        public PanCameraToGameObjectEvent(EventID eventID, object sender, EventArgs<CameraHandler, GameObject, float> e)
            : base(eventID, sender, e)
        {
            this.cameraHandler = e.Value;
            this.targetGameObject = e.Value2;
            this.panDuration = e.Value3;
            this.origin = cameraHandler.CameraPositionWithinBounds;

            if (targetGameObject != null)
                this.destination = targetGameObject.transform.position;
        }
Exemple #36
0
 public void DispatchEvent(EventID id, object param = null)
 {
     if (_eventDict.ContainsKey(id))
     {
         _eventDict[id](param);
     }
     else
     {
         Debug.LogError("The event you are dispatching doesn't exist.");
     }
 }
    //注册与注销处理
    private static void Resister(EventID id, Delegate cb)
    {
        EventCBDelegate dlg;

        if (!sm_events.TryGetValue(id, out dlg))
        {
            dlg = new EventCBDelegate(id);
            sm_events.Add(id, dlg);
        }
        dlg.Add(cb);
    }
Exemple #38
0
 public static void RegisterEvent(EventID eventID, Action <byte[]> action)
 {
     if (action_bytes.ContainsKey(eventID))
     {
         action_bytes[eventID] += action;
     }
     else
     {
         action_bytes[eventID] = action;
     }
 }
Exemple #39
0
 public static void RegisterEvent(EventID eventID, Action <uint> action)
 {
     if (action_int.ContainsKey(eventID))
     {
         action_int[eventID] += action;
     }
     else
     {
         action_int[eventID] = action;
     }
 }
Exemple #40
0
 public static void RegisterEvent(EventID eventID, Action <uint, IPEndPoint> action)
 {
     if (action_bytes.ContainsKey(eventID))
     {
         action_uint_ipEndPoint[eventID] += action;
     }
     else
     {
         action_uint_ipEndPoint[eventID] = action;
     }
 }
 public void UnregisterEvent(EventID i_ID, Action <object> i_Callback)
 {
     if (m_EventDict.ContainsKey(i_ID))
     {
         m_EventDict[i_ID] -= i_Callback;
     }
     else
     {
         Debug.LogError("The event you are unregistering dosent exist");
     }
 }
 public EventParamTimer(EventID id, EventParam eParam, int millisecond, bool repeat = false)
 {
     if (millisecond > 86400000)
     {
         throw new Exception("The milliSecond range over(1~86,400,000)");
     }
     eventID    = id;
     eventParam = eParam;
     delayms    = millisecond;
     repeatFlag = repeat;
     SetNextTickCount();
 }
        public static void Log(EventID eventID, string message)
        {
            // ...
            ILog logger = log4net.LogManager.GetLogger("DecoupledLogger");

            CustomLogLevel level = GetLevelForEventID(eventID);
            switch (level)
            {
                // ...
                case CustomLogLevel.Info: logger.Info(message); break;
                case CustomLogLevel.Error: logger.Error(message); break;
                // ...
            }
        }
        private void SetMenuText(EventID eventID)
        {
            string menuString = "CONFIRM UNAVAILABLE ACTION?";

            switch (eventID)
            {
                case EventID.UnitCapture:
                    menuString = "CONFIRM CAPTURE ACTION?";
                    break;
                case EventID.UnitAttack:
                    menuString = "CONFIRM ATTACK ACTION?";
                    break;
                case EventID.UnitWait:
                default:
                    menuString = "CONFIRM WAIT ACTION?";
                    break;
            }

            SetText(MenuText, menuString);
        }
        public static void Log(string message, EventLogEntryType eventType, EventID eventID)
        {
            const string applicationName = "CIWaterNetService";
            // Create an instance of EventLog
            EventLog eventLog = new EventLog();

            // Check if the event source exists. If not create it.
            if (!System.Diagnostics.EventLog.SourceExists(applicationName))
            {
                EventLog.CreateEventSource(applicationName, "Application");
            }

            // Set the source name for writing log entries.
            eventLog.Source = applicationName;

            // Write an entry to the event log.
            eventLog.WriteEntry(message, eventType,  (int)eventID);

            // Close the Event Log
            eventLog.Close();
        }
Exemple #46
0
 public UnitAction(EventID eventID, object sender, EventArgs e)
     : base(eventID, sender, e)
 {
 }
Exemple #47
0
        public void removeMouseListener(EventID evtID, Action cb)
        {

        }
 public EnableCursorEvent(EventID eventID, object sender, EventArgs<InputHandler> e)
     : base(eventID, sender, e)
 {
     this.inputHandler = e.Value;
 }
 public ShowWindowEvent(EventID eventID, object sender, EventArgs<Window> e)
     : base(eventID, sender, e)
 {
     this.window = e.Value;
 }
 public ChangeActiveFactionEvent(EventID eventID, object sender, EventArgs<TurnHandler> e)
     : base(eventID, sender, e)
 {
     this.turnHandler = e.Value;
 }
 /// <summary>
 /// Adds a termination dependency, so that toTerminate temrinates as soon as dependentOn does.
 /// </summary>
 public void AddTerminationDependency(EventID dependentOn, EventID toTerminate)
 {
     dependencies[toTerminate].Add(dependentOn);
 }
 public ShowMovementAreaEvent(EventID eventID, object sender, EventArgs<Pathfinder, Actors.Cursor> e)
     : base(eventID, sender, e)
 {
     this.pathfinder = e.Value;
     this.cursor = e.Value2;
 }
 public SelectUnitEvent(EventID eventID, object sender, EventArgs<Actors.Cursor> e)
     : base(eventID, sender, e)
 {
     this.cursor = e.Value;
 }
 public DeactivateUnitEvent(EventID eventID, object sender, EventArgs<Actors.Cursor, Faction> e)
     : base(eventID, sender, e)
 {
     this.cursor = e.Value;
     this.faction = e.Value2;
 }
Exemple #55
0
 public void addKeyListener(EventID evtID, Action<KeyCode> cb)
 {
     if (EventID.KEYUP_EVENT == evtID)
     {
         m_onKeyUp += cb;
     }
     else if (EventID.KEYDOWN_EVENT == evtID)
     {
         m_onKeyDown += cb;
     }
 }
Exemple #56
0
        public void removeKeyListener(EventID evtID, Action<KeyCode> cb)
        {

        }
Exemple #57
0
        public void removeAxisListener(EventID evtID, Action cb)
        {

        }
Exemple #58
0
 public void addMouseListener(EventID evtID, Action cb)
 {
     if (EventID.MOUSEDOWN_EVENT == evtID)
     {
         m_onMouseDown += cb;
     }
     else if (EventID.MOUSEUP_EVENT == evtID)
     {
         m_onMouseUp += cb;
     }
 }
Exemple #59
0
 public void addAxisListener(EventID evtID, Action cb)
 {
     m_onAxisDown += cb;
 }
 public PanCameraToSelectedUnitObjectEvent(EventID eventID, object sender, EventArgs<CameraHandler, Actors.Cursor, float> e)
     : base(eventID, sender, e)
 {
     this.cameraHandler = e.Value;
     this.cursor = e.Value2;
     this.panDuration = e.Value3;
     this.origin = cameraHandler.CameraPositionWithinBounds;
 }