/// <summary> /// Creates Candle events via all parameters. /// </summary> /// <param name="symbol"></param> /// <param name="time"></param> /// <param name="sequence"></param> /// <param name="count"></param> /// <param name="open"></param> /// <param name="high"></param> /// <param name="low"></param> /// <param name="close"></param> /// <param name="volume"></param> /// <param name="vwap"></param> /// <param name="bidVolume"></param> /// <param name="askVolume"></param> /// <param name="index"></param> /// <param name="openInterest"></param> /// <param name="impVolatility"></param> /// <param name="eventFlags"></param> internal PlayedCandle(string symbol, long time, int sequence, double count, double open, double high, double low, double close, double volume, double vwap, double bidVolume, double askVolume, long index, long openInterest, double impVolatility, EventFlag eventFlags) { EventSymbol = CandleSymbol.ValueOf(symbol); EventFlags = eventFlags; TimeStamp = time; Time = Tools.UnixTimeToDate(time); Sequence = sequence; Count = count; Open = open; High = high; Low = low; Close = close; Volume = volume; VWAP = vwap; BidVolume = bidVolume; AskVolume = askVolume; DateTime = Tools.UnixTimeToDate(time); Index = index; ImpVolatility = impVolatility; OpenInterest = openInterest; Params = new EventParams(EventFlags, ((ulong)time << 32) + (uint)sequence, 0); Data = new DxTestCandle(eventFlags, index, time, sequence, count, open, high, low, close, volume, vwap, bidVolume, askVolume, (int)openInterest, impVolatility); }
internal unsafe PlayedOrder(string symbol, EventFlag event_flags, long index, long time, int time_nanos, int sequence, double price, int size, int count, Scope scope, Side side, char exchange_code, IndexedEventSource source, string mm) { this.EventSymbol = symbol; this.EventFlags = event_flags; this.Index = index; this.Time = Tools.UnixTimeToDate(time); this.TimeNanoPart = time_nanos; this.Sequence = sequence; this.Price = price; this.Size = size; this.Count = count; this.Scope = scope; this.Side = side; this.ExchangeCode = exchange_code; this.Source = source; fixed(char *pMarketMaker = mm.ToCharArray()) { this.MarketMaker = new string(pMarketMaker); } marketMakerCharArray = mm.ToCharArray(); IntPtr marketMakerCharsPtr = Marshal.UnsafeAddrOfPinnedArrayElement(marketMakerCharArray, 0); Params = new EventParams(EventFlags, (ulong)Index, 0); Data = new DxTestOrder(event_flags, index, time, time_nanos, sequence, price, size, count, scope, side, exchange_code, source, marketMakerCharsPtr); }
internal IntPtr mm_or_ss; // String internal DxTestOrder(EventFlag event_flags, long index, long time, int time_nanos, int sequence, double price, int size, int count, Scope scope, Side side, char exchange_code, IndexedEventSource source, IntPtr mm_or_ss) { this.event_flags = event_flags; this.index = index; this.time = time; this.time_nanos = time_nanos; this.sequence = sequence; this.price = price; this.size = size; this.count = count; this.scope = scope; this.side = side; this.exchange_code = exchange_code; fixed(char *pSource = this.source) { var length = Math.Min(4, source.Name.Length); Marshal.Copy(source.Name.ToCharArray(), 0, (IntPtr)pSource, length); pSource[length] = (char)0; } this.mm_or_ss = mm_or_ss; }
public TransmitClientEvent(uint objectId, uint eventId, uint dwData, uint groupId, EventFlag flags) { this.objectId = objectId; this.eventId = eventId; this.dwData = dwData; this.groupId = groupId; this.flags = flags; }
public virtual void TestClassRegistrationEvents() { var eventFlag = new EventFlag (); var registry = EventRegistryFactory.ForObjectContainer(Db()); registry.ClassRegistered += new _IEventListener4_23(eventFlag).OnEvent; Store(new Data()); Assert.IsTrue(eventFlag.eventOccurred); }
void ICmpInitializable.OnShutdown(Component.ShutdownContext context) { switch (context) { case ShutdownContext.Deactivate: this.receivedEvents |= EventFlag.Deactivate; break; case ShutdownContext.RemovingFromGameObject: this.receivedEvents |= EventFlag.RemovingFromGameObject; break; case ShutdownContext.Saving: this.receivedEvents |= EventFlag.Saving; break; } }
public void SetTerminalAction(EventFlag flag, UnityAction <T> action) { if (_terminalAction != null) { Remove(flag, _terminalAction); } _terminalAction = new Modifier <T>(action, 999999999); Add(flag, _terminalAction); }
public bool UnsetFlagCompletion(EventFlag flag) { if (!completedFlags_.Remove(flag)) { Debug.LogWarning("Unsetting Flag " + flag + " eventhough it doesn't exist."); return(false); } return(true); }
public virtual void TestClassRegistrationEvents() { var eventFlag = new EventFlag (); var registry = EventRegistryFactory.ForObjectContainer(Db()); registry.ClassRegistered += new _IEventListener4_23(eventFlag).OnEvent; Store(new Data()); Assert.IsTrue(eventFlag.eventOccurred); }
void ICmpInitializable.OnInit(Component.InitContext context) { switch (context) { case InitContext.Activate: this.receivedEvents |= EventFlag.Activate; break; case InitContext.AddToGameObject: this.receivedEvents |= EventFlag.AddToGameObject; break; case InitContext.Loaded: this.receivedEvents |= EventFlag.Loaded; break; case InitContext.Saved: this.receivedEvents |= EventFlag.Saved; break; } }
void ICmpInitializable.OnShutdown(Component.ShutdownContext context) { switch (context) { case ShutdownContext.Deactivate: this.receivedEvents |= EventFlag.Deactivate; break; case ShutdownContext.RemovingFromGameObject: this.receivedEvents |= EventFlag.RemovingFromGameObject; break; case ShutdownContext.Saving: this.receivedEvents |= EventFlag.Saving; break; } }
public bool SetFlagCompletion(EventFlag flag) { if (completedFlags_.Contains(flag)) { Debug.LogWarning("Flipping Flag " + flag + " eventhough it's already flipped."); return(false); } completedFlags_.Add(flag); flagCompletedEvent.Invoke(flag); return(true); }
void ICmpInitializable.OnInit(Component.InitContext context) { switch (context) { case InitContext.Activate: this.receivedEvents |= EventFlag.Activate; break; case InitContext.AddToGameObject: this.receivedEvents |= EventFlag.AddToGameObject; break; case InitContext.Loaded: this.receivedEvents |= EventFlag.Loaded; break; case InitContext.Saved: this.receivedEvents |= EventFlag.Saved; break; } }
internal DxTestGreeks(EventFlag event_flags, long index, long time, double price, double volatility, double delta, double gamma, double theta, double rho, double vega) { this.event_flags = event_flags; this.index = index; this.time = time; this.price = price; this.volatility = volatility; this.delta = delta; this.gamma = gamma; this.theta = theta; this.rho = rho; this.vega = vega; }
public void GenerateFlags() { int flags = FlagCount(); if (flags < _FLAG_MAX_AMOUNT) { for (int i = flags; i < _FLAG_MAX_AMOUNT; i++) { Point pos = default(Point); if (!GetRandomMapPosition(ref pos)) { continue; } EventFlag pRole = new EventFlag(FlagPacket((ushort)pos.X, (ushort)pos.Y), m_pMap); m_pMap.AddNpc(pRole); } } }
public virtual bool Validate(Mobile from) { if (Parent == null) { from.SayTo(from, 1010095); // This must be on your person to use. return(false); } else if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null)) { } else if (!BaseMount.CheckMountAllowed(from, true)) { } else if (from.Mounted) { from.SendLocalizedMessage(1005583); // Please dismount first. } else if (from.IsBodyMod && !from.Body.IsHuman) { from.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } else if (from.HasTrade) { from.SendLocalizedMessage(1042317, "", 0x41); // You may not ride at this time } else if ((from.Followers + FollowerSlots) > from.FollowersMax) { from.SendLocalizedMessage(1049679); // You have too many followers to summon your mount. } else if (!Multis.DesignContext.Check(from)) { } else if (EventFlag.ExistsOn(from)) { from.SendLocalizedMessage(1061632); // EventFlag Add by XLX. } else { return(true); } return(false); }
internal PlayedGreeks(string symbol, EventFlag event_flags, long index, long time, double price, double volatility, double delta, double gamma, double theta, double rho, double vega) { EventSymbol = symbol; EventFlags = event_flags; Delta = delta; Gamma = gamma; Price = price; Rho = rho; Theta = theta; Time = Tools.UnixTimeToDate(time); Vega = vega; Volatility = volatility; Index = index; Params = new EventParams(EventFlags, ((ulong)time << 32), 0); Data = new DxTestGreeks(event_flags, index, time, price, volatility, delta, gamma, theta, rho, vega); }
internal DxTestCandle(EventFlag event_flags, long index, long time, int sequence, double count, double open, double high, double low, double close, double volume, double vwap, double bid_volume, double ask_volume, int open_interest, double imp_volatility) { this.event_flags = event_flags; this.index = index; this.time = time; this.sequence = sequence; this.count = count; this.open = open; this.high = high; this.low = low; this.close = close; this.volume = volume; this.vwap = vwap; this.bid_volume = bid_volume; this.ask_volume = ask_volume; this.open_interest = open_interest; this.imp_volatility = imp_volatility; }
public static AbilityModHandler Generate(EventFlag flag, UnityAction <AbilityInstance> mod, int priority = 0) { AbilityModHandler newMod = new AbilityModHandler(flag, new Modifier <AbilityInstance>(mod, priority)); return(newMod); }
public bool HasReceived(EventFlag eventFlag) { return this.receivedEvents.HasFlag(eventFlag); }
List<EventFlag> GetFlags(String file) { List<EventFlag> FlagList = new List<EventFlag>(); ArrayList elemType = new ArrayList(); ArrayList elemText = new ArrayList(); GetTextForFlags(file, out elemType, out elemText); EventFlag flag = null; GameEvent g_event = null; for (int i = 0; i < elemType.Count; ++i) { if((string)elemType[i] == "flag") { if (flag != null) FlagList.Add(flag); flag = new EventFlag(); flag.Corners = GetCorners((string)elemText[i]); } else if ((string)elemType[i] == "event") { g_event = new GameEvent(); if ((string)elemText[i] == "PUT_ENEMY") { g_event.EventType = GameEvent.GameEventType.PUT_ENEMY; EnemySpawn spawn = new EnemySpawn(); spawn.Position = GetVector3At((string)elemText[i + 1]); string model = (string)elemText[i + 2]; string scale = (string)elemText[i + 3]; spawn.EnemyStats.Add("Model", model); spawn.EnemyStats.Add("Scale", scale); g_event.SpawnPoint = spawn; } flag.Events.Add(g_event); } } if (flag != null) FlagList.Add(flag); return FlagList; }
BuffModHandler(EventFlag flag, Modifier <BuffInstance> mod) { _flag = flag; _mod = mod; }
void ICmpAttachmentListener.OnAddToGameObject() { this.receivedEvents |= EventFlag.AddToGameObject; }
public static DamageModHandler Generate(EventFlag flag, UnityAction <DamageInstance> mod, int priority = 0) { DamageModHandler newMod = new DamageModHandler(flag, new Modifier <DamageInstance>(mod, priority)); return(newMod); }
private void AddNewFlag() { Vector3 mousePos = GetCursorPos(); EventFlag flag = new EventFlag( new Vector2(mousePos.X + 10, mousePos.Z + 10), // top left new Vector2(mousePos.X + 10, mousePos.Z - 10), // top right new Vector2(mousePos.X - 10, mousePos.Z + 10), // bot left new Vector2(mousePos.X - 10, mousePos.Z - 10));// bot right parentGame.myLevel.FlagsList.Add(flag); }
void ICmpSerializeListener.OnLoaded() { this.receivedEvents |= EventFlag.Loaded; }
void ICmpSerializeListener.OnSaving() { this.receivedEvents |= EventFlag.Saving; }
// Update the Array of hwnd requesting notifications // eFlag - Add or Remove // hwnd // raiseEvents - function to call to create a raw element // aEvtIdProp - Array of Tupples WinEvent and Automation properties // cProps - Number of valid props in the array private static void BuildEventsList (EventFlag eFlag, IntPtr hwnd, ProxyRaiseEvents raiseEvents, EvtIdProperty[] aEvtIdProp, int cProps) { // All operations in the list of events and windows handle must be atomic lock (_ahp) { for (int i = 0; i < cProps; i++) { EvtIdProperty evtIdProp = aEvtIdProp[i]; // Map a property into a WinEventHookProperty int evt = Array.BinarySearch (_eventIdToIndex, evtIdProp._evtId); // add the window to the list if (evt >= 0) { EventHookParams hookParams = null; uint processId; if (hwnd == IntPtr.Zero) { // if its a global event use this well known key to the hash processId = _globalEventKey; } else { if (Misc.GetWindowThreadProcessId(hwnd, out processId) == 0) { processId = _globalEventKey; } } // If never seens this EventId before. Create the notification object if (_ahp[evt] == null) { // create the hash table the key is the process id _ahp[evt] = new Hashtable(10); } // Find the EventHookParams. // _ahp is an array of Hashtables where each Hashtable corrasponds to one event. // Get the correct Hashtable using the index evt. Then lookup the EventHookParams // in the hash table, using the process id. hookParams = (EventHookParams)_ahp[evt][processId]; // If there is not an entry for the event for the specified process then create one. if (hookParams == null) { hookParams = new EventHookParams(); hookParams._process = processId; _ahp[evt].Add(processId, hookParams); } ArrayList eventCreateParams = hookParams._alHwnd; if (eFlag == EventFlag.Add) { if (eventCreateParams == null) { // empty array, create the hwnd arraylist hookParams._evtId = evtIdProp._evtId; eventCreateParams = hookParams._alHwnd = new ArrayList (16); } // Check if the event for that window already exist. // Discard it as no dups are allowed for (int index = eventCreateParams.Count - 1; index >= 0; index--) { EventCreateParams ecp = (EventCreateParams)eventCreateParams[index]; // Code below will discard duplicates: // Proxy cannot subscribe same hwnd to the same event more than once // However proxy can be globaly registered to be always notified of some event, in order to // do this proxy will send IntPtr.Zero as hwnd. Please notice that a given Proxy can be globaly registered // to some EVENT_XXX only once. This will be ensured via delegate comparison. if ( (hwnd == IntPtr.Zero || ecp._hwnd == hwnd) && ecp._idProp == evtIdProp._idProp && ecp._raiseEventFromRawElement == raiseEvents) { return; } } // Set the WinEventHook if first time around if (eventCreateParams.Count == 0) { _callbackQueue.PostSyncWorkItem (new QueueItem.WinEventItem (ref hookParams, _startDelegate)); } // add the event into the list // Called after the Post does not matter because of the lock eventCreateParams.Add (new EventCreateParams (hwnd, evtIdProp._idProp, raiseEvents)); } else { if ( eventCreateParams == null ) return; // Remove a notification // Go through the list of window to find the one for (int index = eventCreateParams.Count - 1; index >= 0; index--) { EventCreateParams ecp = (EventCreateParams)eventCreateParams[index]; // Detect if caller should be removed from notification list bool remove = false; if (raiseEvents == null) { // Not a global wide events remove = (ecp._hwnd == hwnd && ecp._idProp == evtIdProp._idProp); } else { // Global events Debug.Assert (hwnd == IntPtr.Zero, @"BuildEventsList: event is global but hwnd is not null"); remove = (ecp._hwnd == hwnd && ecp._raiseEventFromRawElement == raiseEvents); } if (remove) { eventCreateParams.RemoveAt (index); // if empty then stop listening for this event arg if (eventCreateParams.Count == 0) { _callbackQueue.PostSyncWorkItem (new QueueItem.WinEventItem (ref hookParams, _stopDelegate)); _ahp[evt].Remove(processId); } break; } } } } } } }
void ICmpAttachmentListener.OnRemoveFromGameObject() { this.receivedEvents |= EventFlag.RemovingFromGameObject; }
public void TransmitClientEvent(uint objectId, Enum eventId, uint dwData, Enum groupId, EventFlag flags) { CheckHresult(InvokeOverSocket(new MethodCall.TransmitClientEvent(objectId, Convert.ToUInt32(eventId), dwData, Convert.ToUInt32(groupId), flags)).Hresult); }
public static BuffModHandler Generate(EventFlag flag, UnityAction <BuffInstance> mod, int priority = 0) { BuffModHandler newMod = new BuffModHandler(flag, new Modifier <BuffInstance>(mod, priority)); return(newMod); }
internal static extern HRESULT TransmitClientEvent(HANDLE hSimConnect, DWORD ObjectID, DWORD EventID, DWORD dwData, DWORD GroupID, EventFlag Flags);
public void Reset() { this.receivedEvents = EventFlag.None; }
public void Reset() { this.receivedEvents = EventFlag.None; }
public _IEventListener4_23(EventFlag eventFlag) { this.eventFlag = eventFlag; }
public bool HasReceived(EventFlag eventFlag) { return(this.receivedEvents.HasFlag(eventFlag)); }
AbilityModHandler(EventFlag flag, Modifier <AbilityInstance> mod) { _flag = flag; _mod = mod; }
void ICmpInitializable.OnDeactivate() { this.receivedEvents |= EventFlag.Deactivate; }
// Update the Array of hwnd requesting notifications // eFlag - Add or Remove // hwnd // raiseEvents - function to call to create a raw element // aEvtIdProp - Array of Tupples WinEvent and Automation properties // cProps - Number of valid props in the array private static void BuildEventsList(EventFlag eFlag, IntPtr hwnd, ProxyRaiseEvents raiseEvents, EvtIdProperty[] aEvtIdProp, int cProps) { // All operations in the list of events and windows handle must be atomic lock (_ahp) { for (int i = 0; i < cProps; i++) { EvtIdProperty evtIdProp = aEvtIdProp[i]; // Map a property into a WinEventHookProperty int evt = Array.BinarySearch(_eventIdToIndex, evtIdProp._evtId); // add the window to the list if (evt >= 0) { EventHookParams hookParams = null; uint processId; if (hwnd == IntPtr.Zero) { // if its a global event use this well known key to the hash processId = _globalEventKey; } else { if (Misc.GetWindowThreadProcessId(hwnd, out processId) == 0) { processId = _globalEventKey; } } // If never seens this EventId before. Create the notification object if (_ahp[evt] == null) { // create the hash table the key is the process id _ahp[evt] = new Hashtable(10); } // Find the EventHookParams. // _ahp is an array of Hashtables where each Hashtable corrasponds to one event. // Get the correct Hashtable using the index evt. Then lookup the EventHookParams // in the hash table, using the process id. hookParams = (EventHookParams)_ahp[evt][processId]; // If there is not an entry for the event for the specified process then create one. if (hookParams == null) { hookParams = new EventHookParams(); hookParams._process = processId; _ahp[evt].Add(processId, hookParams); } ArrayList eventCreateParams = hookParams._alHwnd; if (eFlag == EventFlag.Add) { if (eventCreateParams == null) { // empty array, create the hwnd arraylist hookParams._evtId = evtIdProp._evtId; eventCreateParams = hookParams._alHwnd = new ArrayList(16); } // Check if the event for that window already exist. // Discard it as no dups are allowed for (int index = eventCreateParams.Count - 1; index >= 0; index--) { EventCreateParams ecp = (EventCreateParams)eventCreateParams[index]; // Code below will discard duplicates: // Proxy cannot subscribe same hwnd to the same event more than once // However proxy can be globaly registered to be always notified of some event, in order to // do this proxy will send IntPtr.Zero as hwnd. Please notice that a given Proxy can be globaly registered // to some EVENT_XXX only once. This will be ensured via delegate comparison. if ((hwnd == IntPtr.Zero || ecp._hwnd == hwnd) && ecp._idProp == evtIdProp._idProp && ecp._raiseEventFromRawElement == raiseEvents) { return; } } // Set the WinEventHook if first time around if (eventCreateParams.Count == 0) { _callbackQueue.PostSyncWorkItem(new QueueItem.WinEventItem(ref hookParams, _startDelegate)); } // add the event into the list // Called after the Post does not matter because of the lock eventCreateParams.Add(new EventCreateParams(hwnd, evtIdProp._idProp, raiseEvents)); } else { if (eventCreateParams == null) { return; } // Remove a notification // Go through the list of window to find the one for (int index = eventCreateParams.Count - 1; index >= 0; index--) { EventCreateParams ecp = (EventCreateParams)eventCreateParams[index]; // Detect if caller should be removed from notification list bool remove = false; if (raiseEvents == null) { // Not a global wide events remove = (ecp._hwnd == hwnd && ecp._idProp == evtIdProp._idProp); } else { // Global events Debug.Assert(hwnd == IntPtr.Zero, @"BuildEventsList: event is global but hwnd is not null"); remove = (ecp._hwnd == hwnd && ecp._raiseEventFromRawElement == raiseEvents); } if (remove) { eventCreateParams.RemoveAt(index); // if empty then stop listening for this event arg if (eventCreateParams.Count == 0) { _callbackQueue.PostSyncWorkItem(new QueueItem.WinEventItem(ref hookParams, _stopDelegate)); _ahp[evt].Remove(processId); } break; } } } } } } }
void GetNearestFlagCorner() { Vector2 cursor2Dpos = GetCursor2D(); float dist = 5; float lastDistance = 100; int cornerIndex = 0; foreach (EventFlag flag in parentGame.myLevel.FlagsList) { cornerIndex = 0; foreach (Vector2 corner in flag.Corners) { float thisDistance = Vector2.Distance(cursor2Dpos, corner); if (thisDistance <= dist && thisDistance < lastDistance) { lastDistance = thisDistance; activeFlag = flag; activeCornerIndex = cornerIndex; activeCorner = corner; brush = BrushState.FlagSelected; } cornerIndex += 1; } } }