public SlotItem(Vector2 position, Texture texture, EType eType, ESubtype eSubtype) { Position = position; Texture = texture; Subtype = eSubtype; Type = eType; Occupied = false; UpdateRectangePosition(); }
//Constructor public Skill(EType i_type, ESubtype i_subtype, string i_name, float i_power, string i_afinity) { type = i_type; subtype = i_subtype; name = i_name; afinity = i_afinity; skillCount = 0; if (i_type.Equals(EType.AttackSkill)) { if (i_power >= 1 && i_power <= 10) { power = i_power; } subtype = ESubtype.None; } else if (i_type.Equals(EType.SupportSkill)) { power = 0; subtype = i_subtype; } }
bool _HookProc2(TriggerHookContext thc, bool isEdgeMove, ESubtype subtype, HookData.MouseEvent mEvent, POINT pt, byte data, byte dataAnyPart) { var mod = TrigUtil.GetModLR(out var modL, out var modR) | _eatMod; MouseTriggerArgs args = null; g1: if (_d.TryGetValue(_DictKey(subtype, data), out var v)) { if (!isEdgeMove) { thc.UseWndFromPoint(pt); } for (; v != null; v = v.next) { var x = v as MouseTrigger; if ((mod & x.modMask) != x.modMasked) { continue; } switch (x.flags & (TMFlags.LeftMod | TMFlags.RightMod)) { case TMFlags.LeftMod: if (modL != mod) { continue; } break; case TMFlags.RightMod: if (modR != mod) { continue; } break; } if (isEdgeMove && x.screenIndex != TMScreen.Any) { var screen = x.screenIndex == TMScreen.OfActiveWindow ? AScreen.Of(AWnd.Active) : AScreen.Index((int)x.screenIndex); if (!screen.Bounds.Contains(pt)) { continue; } } if (v.DisabledThisOrAll) { continue; } if (args == null) { thc.args = args = new MouseTriggerArgs(x, thc.Window, mod); //may need for scope callbacks too } else { args.Trigger = x; } if (!x.MatchScopeWindowAndFunc(thc)) { continue; } if (x.action == null) { _ResetUp(); } else if (0 != (x.flags & TMFlags.ButtonModUp) && (mod != 0 || subtype == ESubtype.Click)) { _upTrigger = x; _upArgs = args; _upEvent = subtype == ESubtype.Click ? mEvent : 0; _upMod = mod; } else { thc.trigger = x; _ResetUp(); } _eatMod = mod; if (mod != 0) { _SetTempKeybHook(); if (thc.trigger != null) { thc.muteMod = TriggerActionThreads.c_modRelease; } else { ThreadPool.QueueUserWorkItem(_ => AKeys.Internal_.ReleaseModAndDisableModMenu()); } } //AOutput.Write(mEvent, pt, mod); if (isEdgeMove || 0 != (x.flags & TMFlags.ShareEvent)) { return(false); } if (subtype == ESubtype.Click) { _eatUp = mEvent; } return(true); } } if (dataAnyPart != 0) { data = dataAnyPart; dataAnyPart = 0; goto g1; } return(false); }
static int _DictKey(ESubtype subtype, byte data) => (data << 8) | (byte)subtype;
MouseTrigger _Add(Action <MouseTriggerArgs> f, ESubtype subtype, string modKeys, TMFlags flags, byte data, TMScreen screen, string sData) { _triggers.ThrowIfRunning_(); bool noMod = modKeys.NE(); string ps; using (new Util.StringBuilder_(out var b)) { b.Append(subtype.ToString()).Append(' ').Append(sData); b.Append(" + ").Append(noMod ? "none" : (modKeys == "?" ? "any" : modKeys)); if (flags != 0) { b.Append(" (").Append(flags.ToString()).Append(')'); } if (subtype == ESubtype.Edge || subtype == ESubtype.Move) { if (screen == 0) { b.Append(", primary screen"); } else if (screen > 0) { b.Append(", non-primary screen ").Append((int)screen); } else if (screen == TMScreen.Any) { b.Append(", any screen"); } else if (screen == TMScreen.OfActiveWindow) { b.Append(", screen of the active window"); } else { throw new ArgumentException(); } } ps = b.ToString(); //AOutput.Write(ps); } KMod mod = 0, modAny = 0; if (noMod) { if (flags.HasAny(subtype == ESubtype.Click ? TMFlags.LeftMod | TMFlags.RightMod : TMFlags.LeftMod | TMFlags.RightMod | TMFlags.ButtonModUp)) { throw new ArgumentException("Invalid flags."); } } else { if (!AKeys.More.ParseHotkeyTriggerString_(modKeys, out mod, out modAny, out _, true)) { throw new ArgumentException("Invalid modKeys string."); } } var t = new MouseTrigger(_triggers, f, mod, modAny, flags, screen, ps); t.DictAdd(_d, _DictKey(subtype, data)); _lastAdded = t; UsedHookEvents_ |= HooksThread.UsedEvents.Mouse; //just sets the hook switch (subtype) { case ESubtype.Click: UsedHookEvents_ |= HooksThread.UsedEvents.MouseClick; break; case ESubtype.Wheel: UsedHookEvents_ |= HooksThread.UsedEvents.MouseWheel; break; default: UsedHookEvents_ |= HooksThread.UsedEvents.MouseEdgeMove; break; } return(t); }