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

            mod.Remove();
            if (isServer)
            {
                RpcSetModifier(id, mod.Count);
            }
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 5
0
 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);
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 7
0
        /*
         * ---------
         * Overrides
         * ---------
         */

        public override int GetHashCode() => (ModId != null ? ModId.GetHashCode() : 0);
Ejemplo n.º 8
0
 public abstract bool Call(ModifierCollection modifiers, ModId id, ref bool newState);
Ejemplo n.º 9
0
 public Modifier(ModId id, Func <ModId, bool, bool> stateWillChange)
 {
     this.Id = id;
     this.stateWillChange = stateWillChange;
 }
Ejemplo n.º 10
0
 public ModifierStateChange(Player player, ModId modId, Func <bool> shouldEnd)
     : base(player, 0.25f, shouldEnd)
 {
     this.modId = modId;
 }
Ejemplo n.º 11
0
 public bool IsModifierEnabled(ModId id)
 {
     return(eModifiers.FromId(id).IsEnabled());
 }
Ejemplo n.º 12
0
 void RpcSetModifier(ModId id, uint count)
 {
     eModifiers.FromId(id).Count = count;
 }
Ejemplo n.º 13
0
 public Task Verify(ModId id, IMediator mediator) {
     return _controller.Verify(FindMod(id), mediator);
 }
Ejemplo n.º 14
0
 public Task Uninstall(ModId id, IMediator mediator) {
     return _controller.Uninstall(FindMod(id), mediator);
 }
Ejemplo n.º 15
0
 public Task Launch(ModId id, IMediator mediator) {
     return _controller.Launch(new[] {FindMod(id)}, mediator);
 }
Ejemplo n.º 16
0
 RealVirtualityMod<ArmaGameData> FindMod(ModId id) {
     return _modContainers.SelectMany(x => x.List).First(x => x.Id == id.Id);
 }
Ejemplo n.º 17
0
 bool ModifierWillChangeState(ModId id, bool newState)
 {
     return(hooks.CallModifierStateChangedHooks(this, id, newState));
 }