public override int GetHashCode() { unchecked { return((ModId.GetHashCode() * 397) ^ Name.GetHashCode()); } }
public Modifier FromId(ModId id) { int index = (int)id; if (index < 0 || index > modifiers.Length) { throw new ArgumentOutOfRangeException("id", "Not a valid modifier ID"); } return(modifiers[index]); }
public void RemoveModifier(ModId id) { var mod = eModifiers.FromId(id); mod.Remove(); if (isServer) { RpcSetModifier(id, mod.Count); } }
public override int GetHashCode() { unchecked { var hashCode = (int)State; hashCode = (hashCode * 397) ^ (ModId != null ? ModId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CanSuspend.GetHashCode(); hashCode = (hashCode * 397) ^ CanUnload.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = (ModId != null ? ModId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ModName != null ? ModName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ModAuthor != null ? ModAuthor.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ModVersion != null ? ModVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ModDescription != null ? ModDescription.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ModDll != null ? ModDll.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ModDependencies != null ? ModDependencies.GetHashCode() : 0); return(hashCode); } }
public bool CallModifierStateChangedHooks(ModifierCollection modifiers, ModId id, bool newState) { foreach (var hook in modifierStateChangedHooks) { if (!hook.IsEnabled) { continue; } if (!hook.Call(modifiers, id, ref newState)) { break; } } return(newState); }
/* * --------- * Overrides * --------- */ public override int GetHashCode() => (ModId != null ? ModId.GetHashCode() : 0);
public abstract bool Call(ModifierCollection modifiers, ModId id, ref bool newState);
public Modifier(ModId id, Func <ModId, bool, bool> stateWillChange) { this.Id = id; this.stateWillChange = stateWillChange; }
public ModifierStateChange(Player player, ModId modId, Func <bool> shouldEnd) : base(player, 0.25f, shouldEnd) { this.modId = modId; }
public bool IsModifierEnabled(ModId id) { return(eModifiers.FromId(id).IsEnabled()); }
void RpcSetModifier(ModId id, uint count) { eModifiers.FromId(id).Count = count; }
public Task Verify(ModId id, IMediator mediator) { return _controller.Verify(FindMod(id), mediator); }
public Task Uninstall(ModId id, IMediator mediator) { return _controller.Uninstall(FindMod(id), mediator); }
public Task Launch(ModId id, IMediator mediator) { return _controller.Launch(new[] {FindMod(id)}, mediator); }
RealVirtualityMod<ArmaGameData> FindMod(ModId id) { return _modContainers.SelectMany(x => x.List).First(x => x.Id == id.Id); }
bool ModifierWillChangeState(ModId id, bool newState) { return(hooks.CallModifierStateChangedHooks(this, id, newState)); }