public ModViewModelAddArgs(ViewModel vm, IHeldItem item, bool isMesh, ItemModRepresentation modRep) { this.vm = vm; this.item = item; this.isMesh = isMesh; this.modRep = modRep; }
internal void ItemModRepresentationDestroyed(ItemModRepresentation rep) { if (!this.modLock && (this.destroyingRep != rep)) { this._itemMods.KillModForRep(rep, this, true); } }
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(); }
internal void ItemModRepresentationDestroyed(ItemModRepresentation rep) { if (this.modLock || this.destroyingRep == rep) { return; } this._itemMods.KillModForRep(rep, this, true); }
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); }
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; }
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); } }
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); } }
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); } }
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); }
protected override void EnableMod(ItemModRepresentation.Reason reason) { }
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); } } } }
protected virtual void InstallToItemModRepresentation(ItemModRepresentation rep) { }
protected virtual void CustomizeItemModRepresentation(ItemModRepresentation rep) { }
internal void BindAsProxy(ItemModRepresentation rep) { this.InstallToItemModRepresentation(rep); }
protected LampModRep(ItemModRepresentation.Caps caps) : this(caps, false) { }
public ModViewModelRemoveArgs(ViewModel vm, IHeldItem item, ItemModRepresentation modRep) { this.vm = vm; this.item = item; this.modRep = modRep; }
protected WeaponModRep(ItemModRepresentation.Caps caps) : this(caps, false) { }
protected WeaponModRep(ItemModRepresentation.Caps caps, bool defaultsOn) : base(caps) { this.defaultsOn = defaultsOn; this._on = defaultsOn; }
protected ItemModRepresentation(ItemModRepresentation.Caps caps) { this.caps = caps; }
protected abstract void DisableMod(ItemModRepresentation.Reason reason);
protected override void BindStateFlags(CharacterStateFlags flags, ItemModRepresentation.Reason reason) { base.BindStateFlags(flags, reason); base.SetOn(flags.lamp, reason); }
protected SilencerModRep(ItemModRepresentation.Caps caps) : this(caps, true) { }
protected virtual void UninstallFromItemModRepresentation(ItemModRepresentation rep) { }
internal void UnBindAsProxy(ItemModRepresentation rep) { this.UninstallFromItemModRepresentation(rep); }
protected LampModRep(ItemModRepresentation.Caps caps, bool defaultOn) : base(caps, defaultOn) { }
protected virtual void BindStateFlags(CharacterStateFlags flags, ItemModRepresentation.Reason reason) { }