Exemple #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((ModId.GetHashCode() * 397) ^ Name.GetHashCode());
     }
 }
Exemple #2
0
        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]);
        }
Exemple #3
0
        public void RemoveModifier(ModId id)
        {
            var mod = eModifiers.FromId(id);

            mod.Remove();
            if (isServer)
            {
                RpcSetModifier(id, mod.Count);
            }
        }
Exemple #4
0
 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);
     }
 }
Exemple #6
0
 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);
 }
Exemple #7
0
        /*
         * ---------
         * Overrides
         * ---------
         */

        public override int GetHashCode() => (ModId != null ? ModId.GetHashCode() : 0);
Exemple #8
0
 public abstract bool Call(ModifierCollection modifiers, ModId id, ref bool newState);
Exemple #9
0
 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;
 }
Exemple #11
0
 public bool IsModifierEnabled(ModId id)
 {
     return(eModifiers.FromId(id).IsEnabled());
 }
Exemple #12
0
 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);
 }
Exemple #17
0
 bool ModifierWillChangeState(ModId id, bool newState)
 {
     return(hooks.CallModifierStateChangedHooks(this, id, newState));
 }