Beispiel #1
0
 public ModViewModelAddArgs(ViewModel vm, IHeldItem item, bool isMesh, ItemModRepresentation modRep)
 {
     this.vm     = vm;
     this.item   = item;
     this.isMesh = isMesh;
     this.modRep = modRep;
 }
Beispiel #2
0
 internal void ItemModRepresentationDestroyed(ItemModRepresentation rep)
 {
     if (!this.modLock && (this.destroyingRep != rep))
     {
         this._itemMods.KillModForRep(rep, this, true);
     }
 }
Beispiel #3
0
        public bool KillModForRep(ItemModRepresentation modRep, ItemRepresentation owner, bool fromCallback)
        {
            switch (modRep.modSlot)
            {
            case 0:
            {
                return(ItemRepresentation.ItemModPairArray.KillModForRep(ref this.a, modRep, owner, fromCallback));
            }

            case 1:
            {
                return(ItemRepresentation.ItemModPairArray.KillModForRep(ref this.b, modRep, owner, fromCallback));
            }

            case 2:
            {
                return(ItemRepresentation.ItemModPairArray.KillModForRep(ref this.c, modRep, owner, fromCallback));
            }

            case 3:
            {
                return(ItemRepresentation.ItemModPairArray.KillModForRep(ref this.d, modRep, owner, fromCallback));
            }

            case 4:
            {
                return(ItemRepresentation.ItemModPairArray.KillModForRep(ref this.e, modRep, owner, fromCallback));
            }
            }
            throw new IndexOutOfRangeException();
        }
 public ModViewModelAddArgs(ViewModel vm, IHeldItem item, bool isMesh, ItemModRepresentation modRep)
 {
     this.vm = vm;
     this.item = item;
     this.isMesh = isMesh;
     this.modRep = modRep;
 }
Beispiel #5
0
 internal void ItemModRepresentationDestroyed(ItemModRepresentation rep)
 {
     if (this.modLock || this.destroyingRep == rep)
     {
         return;
     }
     this._itemMods.KillModForRep(rep, this, true);
 }
Beispiel #6
0
 private static bool KillModForRep(ref ItemRepresentation.ItemModPair pair, ItemModRepresentation modRep, ItemRepresentation owner, bool fromCallback)
 {
     if (pair.representation != modRep)
     {
         return(true);
     }
     owner.KillModRep(ref pair.representation, fromCallback);
     return(true);
 }
 protected override void InstallToItemModRepresentation(ItemModRepresentation modRep)
 {
     base.InstallToItemModRepresentation(modRep);
     if (this.attachObjectRep != null)
     {
         GameObject gameObject = modRep.itemRep.muzzle.InstantiateAsChild(this.attachObjectRep, false);
         gameObject.name = this.attachObjectRep.name;
         ((WeaponModRep)modRep).SetAttached(gameObject, false);
     }
 }
    protected override void UninstallFromItemModRepresentation(ItemModRepresentation rep)
    {
        WeaponModRep rep2     = (WeaponModRep)rep;
        GameObject   attached = rep2.attached;

        if (attached != null)
        {
            rep2.SetAttached(null, false);
            Object.Destroy(attached);
        }
        base.UninstallFromItemModRepresentation(rep);
    }
    protected override void UninstallFromItemModRepresentation(ItemModRepresentation rep)
    {
        WeaponModRep weaponModRep = (WeaponModRep)rep;
        GameObject   gameObject   = weaponModRep.attached;

        if (gameObject)
        {
            weaponModRep.SetAttached(null, false);
            UnityEngine.Object.Destroy(gameObject);
        }
        base.UninstallFromItemModRepresentation(rep);
    }
Beispiel #10
0
 private void KillModRep(ref ItemModRepresentation rep, bool fromCallback)
 {
     if (!fromCallback && (rep != null))
     {
         ItemModRepresentation destroyingRep = this.destroyingRep;
         try
         {
             this.destroyingRep = rep;
             UnityEngine.Object.Destroy(rep);
         }
         finally
         {
             this.destroyingRep = destroyingRep;
         }
     }
     rep = null;
 }
Beispiel #11
0
 protected override void EnableMod(ItemModRepresentation.Reason reason)
 {
     Light light = null;
     Light[] lightArray = this.lights;
     for (int i = 0; i < (int)lightArray.Length; i++)
     {
         Light light1 = lightArray[i];
         if (light1)
         {
             light1.enabled = true;
             light = light1;
         }
     }
     if (reason == ItemModRepresentation.Reason.Explicit)
     {
         this.PlaySound(light, base.modDataBlock.onSound);
     }
 }
Beispiel #12
0
 protected override void DisableMod(ItemModRepresentation.Reason reason)
 {
     LaserBeam laserBeam = null;
     LaserBeam[] laserBeamArray = this.beams;
     for (int i = 0; i < (int)laserBeamArray.Length; i++)
     {
         LaserBeam laserBeam1 = laserBeamArray[i];
         if (laserBeam1)
         {
             laserBeam = laserBeam1;
             laserBeam1.enabled = false;
         }
     }
     if (reason == ItemModRepresentation.Reason.Explicit)
     {
         this.PlaySound(laserBeam, base.modDataBlock.offSound);
     }
 }
Beispiel #13
0
 protected override void EnableMod(ItemModRepresentation.Reason reason)
 {
     LaserBeam laserBeam = null;
     LaserBeam[] laserBeamArray = this.beams;
     for (int i = 0; i < (int)laserBeamArray.Length; i++)
     {
         LaserBeam laserBeam1 = laserBeamArray[i];
         if (laserBeam1)
         {
             laserBeam = laserBeam1;
             laserBeam1.enabled = (this.is_vm ? true : LaserModRep.allow_3rd_lasers);
         }
     }
     if (reason == ItemModRepresentation.Reason.Explicit)
     {
         this.PlaySound(laserBeam, base.modDataBlock.onSound);
     }
 }
Beispiel #14
0
 internal bool AddModRepresentationComponent(GameObject gameObject, out ItemModRepresentation rep)
 {
     ItemModDataBlock.g.TypePair typePair;
     if (this.hasModRepresentation)
     {
         if (!ItemModDataBlock.g.cachedTypeLookup.TryGetValue(base.name, out typePair) || typePair.typeString != this.modRepresentationTypeName)
         {
             typePair = new ItemModDataBlock.g.TypePair()
             {
                 typeString = this.modRepresentationTypeName,
                 type       = Types.GetType(typePair.typeString, "Assembly-CSharp")
             };
             if (typePair.type == null)
             {
                 Debug.LogError(string.Format("modRepresentationTypeName:{0} resolves to no type", typePair.typeString), this);
             }
             else if (!this.minimumModRepresentationType.IsAssignableFrom(typePair.type))
             {
                 Debug.LogError(string.Format("modRepresentationTypeName:{0} resolved to {1} but {1} is not a {2}", typePair.typeString, typePair.type, this.minimumModRepresentationType), this);
                 typePair.type = null;
             }
             ItemModDataBlock.g.cachedTypeLookup[base.name] = typePair;
         }
         if (typePair.type != null)
         {
             rep = (ItemModRepresentation)gameObject.AddComponent(typePair.type);
             if (rep)
             {
                 this.CustomizeItemModRepresentation(rep);
                 if (rep)
                 {
                     return(true);
                 }
             }
         }
     }
     rep = null;
     return(false);
 }
Beispiel #15
0
 protected override void EnableMod(ItemModRepresentation.Reason reason)
 {
 }
Beispiel #16
0
 protected void SetOn(bool on, ItemModRepresentation.Reason reason)
 {
     if (this._on != on)
     {
         this._on = on;
         if (this._attached)
         {
             if (!on)
             {
                 this.DisableMod(reason);
             }
             else
             {
                 this.EnableMod(reason);
             }
         }
     }
 }
Beispiel #17
0
 protected virtual void InstallToItemModRepresentation(ItemModRepresentation rep)
 {
 }
Beispiel #18
0
 protected virtual void CustomizeItemModRepresentation(ItemModRepresentation rep)
 {
 }
Beispiel #19
0
 internal void BindAsProxy(ItemModRepresentation rep)
 {
     this.InstallToItemModRepresentation(rep);
 }
Beispiel #20
0
 protected LampModRep(ItemModRepresentation.Caps caps)
     : this(caps, false)
 {
 }
Beispiel #21
0
 public ModViewModelRemoveArgs(ViewModel vm, IHeldItem item, ItemModRepresentation modRep)
 {
     this.vm     = vm;
     this.item   = item;
     this.modRep = modRep;
 }
Beispiel #22
0
 protected WeaponModRep(ItemModRepresentation.Caps caps)
     : this(caps, false)
 {
 }
Beispiel #23
0
 protected WeaponModRep(ItemModRepresentation.Caps caps, bool defaultsOn)
     : base(caps)
 {
     this.defaultsOn = defaultsOn;
     this._on = defaultsOn;
 }
 protected ItemModRepresentation(ItemModRepresentation.Caps caps)
 {
     this.caps = caps;
 }
Beispiel #25
0
 protected abstract void DisableMod(ItemModRepresentation.Reason reason);
Beispiel #26
0
 protected override void BindStateFlags(CharacterStateFlags flags, ItemModRepresentation.Reason reason)
 {
     base.BindStateFlags(flags, reason);
     base.SetOn(flags.lamp, reason);
 }
Beispiel #27
0
 protected SilencerModRep(ItemModRepresentation.Caps caps)
     : this(caps, true)
 {
 }
Beispiel #28
0
 protected virtual void UninstallFromItemModRepresentation(ItemModRepresentation rep)
 {
 }
Beispiel #29
0
 internal void UnBindAsProxy(ItemModRepresentation rep)
 {
     this.UninstallFromItemModRepresentation(rep);
 }
Beispiel #30
0
 protected LampModRep(ItemModRepresentation.Caps caps, bool defaultOn)
     : base(caps, defaultOn)
 {
 }
 public ModViewModelRemoveArgs(ViewModel vm, IHeldItem item, ItemModRepresentation modRep)
 {
     this.vm = vm;
     this.item = item;
     this.modRep = modRep;
 }
 protected virtual void BindStateFlags(CharacterStateFlags flags, ItemModRepresentation.Reason reason)
 {
 }