// Token: 0x06001403 RID: 5123 RVA: 0x00073BD0 File Offset: 0x00071DD0 public bool AddDefaultItem(BaseUberStrikeItemView itemView) { if (itemView != null) { if (itemView.ItemClass == UberstrikeItemClass.FunctionalGeneral) { IUnityItem unityItem; if (this._shopItemsById.TryGetValue(itemView.ID, out unityItem)) { ItemConfigurationUtil.CopyProperties <BaseUberStrikeItemView>(unityItem.View, itemView); } } else if (string.IsNullOrEmpty(itemView.PrefabName)) { Debug.LogWarning("Missing PrefabName for item: " + itemView.Name); } else { Debug.LogError(string.Concat(new string[] { "Missing UnityItem for: '", itemView.Name, "' with PrefabName: '", itemView.PrefabName, "'" })); } } return(false); }
// Token: 0x06001088 RID: 4232 RVA: 0x000663F8 File Offset: 0x000645F8 private void InitializeQuickItem(GameObject quickItemObject, LoadoutSlotType slot, InventoryItem inventoryItem) { int slotIndex = this.GetSlotIndex(slot); QuickItem component = quickItemObject.GetComponent <QuickItem>(); if (component) { component.gameObject.SetActive(true); for (int i = 0; i < component.gameObject.transform.childCount; i++) { component.gameObject.transform.GetChild(i).gameObject.SetActive(false); } component.gameObject.name = inventoryItem.Item.Name; component.transform.parent = GameState.Current.Player.WeaponAttachPoint; if (component.rigidbody) { component.rigidbody.isKinematic = true; } ItemConfigurationUtil.CopyProperties <UberStrikeItemQuickView>(component.Configuration, inventoryItem.Item.View); ItemConfigurationUtil.CopyCustomProperties(inventoryItem.Item.View, component.Configuration); if (component.Configuration.RechargeTime <= 0) { int index = slotIndex; QuickItemBehaviour behaviour = component.Behaviour; behaviour.OnActivated = (Action)Delegate.Combine(behaviour.OnActivated, new Action(delegate() { this.UseConsumableItem(inventoryItem); this.Restriction.DecreaseUse(index); this.NextCooldownFinishTime = Time.time + 0.5f; })); this.Restriction.InitializeSlot(slotIndex, component, inventoryItem.AmountRemaining); } else { component.Behaviour.CurrentAmount = component.Configuration.AmountRemaining; } component.Behaviour.FocusKey = this.GetFocusKey(slot); IGrenadeProjectile grenadeProjectile = component as IGrenadeProjectile; if (grenadeProjectile != null) { grenadeProjectile.OnProjectileEmitted += delegate(IGrenadeProjectile p) { Singleton <ProjectileManager> .Instance.AddProjectile(p, Singleton <WeaponController> .Instance.NextProjectileId()); GameState.Current.Actions.EmitQuickItem(p.Position, p.Velocity, inventoryItem.Item.View.ID, GameState.Current.PlayerData.Player.PlayerId, p.ID); }; } if (this._quickItems[slotIndex]) { UnityEngine.Object.Destroy(this._quickItems[slotIndex].gameObject); } this._quickItems[slotIndex] = component; } else { Debug.LogError("Failed to initialize QuickItem"); } GameData.Instance.OnQuickItemsChanged.Fire(); }
// Token: 0x06000FE1 RID: 4065 RVA: 0x000658C8 File Offset: 0x00063AC8 public static void CopyCustomProperties(BaseUberStrikeItemView src, object dst) { foreach (FieldInfo fieldInfo in ItemConfigurationUtil.GetAllFields(dst.GetType())) { string customPropertyName = ItemConfigurationUtil.GetCustomPropertyName(fieldInfo); if (!string.IsNullOrEmpty(customPropertyName) && src.CustomProperties != null && src.CustomProperties.ContainsKey(customPropertyName)) { object value = ItemConfigurationUtil.Convert(src.CustomProperties[customPropertyName], fieldInfo.FieldType); fieldInfo.SetValue(dst, value); } } }
// Token: 0x06000FE0 RID: 4064 RVA: 0x0006580C File Offset: 0x00063A0C public static void CopyProperties <T>(T config, BaseUberStrikeItemView item) where T : BaseUberStrikeItemView { CloneUtil.CopyAllFields <BaseUberStrikeItemView>(config, item); foreach (FieldInfo fieldInfo in ItemConfigurationUtil.GetAllFields(config.GetType())) { string customPropertyName = ItemConfigurationUtil.GetCustomPropertyName(fieldInfo); if (!string.IsNullOrEmpty(customPropertyName) && item.CustomProperties != null && item.CustomProperties.ContainsKey(customPropertyName)) { fieldInfo.SetValue(config, ItemConfigurationUtil.Convert(item.CustomProperties[customPropertyName], fieldInfo.FieldType)); } } }
// Token: 0x060010D0 RID: 4304 RVA: 0x000672C8 File Offset: 0x000654C8 public GameObject Create(Vector3 position, Quaternion rotation) { if (UnityItemConfiguration.Instance.IsPrefabAvailable(this.View.PrefabName)) { string prefabPath = UnityItemConfiguration.Instance.GetPrefabPath(this.View.PrefabName); Debug.Log(string.Concat(new object[] { "Create Item:", this.View.ID, ", ", this.View.Name, ", ", prefabPath })); UnityEngine.Object @object = Resources.Load <GameObject>(prefabPath); this.Prefab = (GameObject)@object; } else { Debug.Log(string.Concat(new object[] { "Create DEFAULT Item:", this.View.ID, ", ", this.View.Name, ", ", this.View.PrefabName })); this.Prefab = UnityItemConfiguration.Instance.GetDefaultItem(this.View.ItemClass); } if (this.View.ItemType == UberstrikeItemType.QuickUse) { QuickItem component = this.Prefab.GetComponent <QuickItem>(); if (component != null && component.Sfx) { Singleton <QuickItemSfxController> .Instance.RegisterQuickItemEffect(component.Logic, component.Sfx); } } GameObject gameObject = null; if (this.Prefab != null) { if (this.View.ItemClass == UberstrikeItemClass.GearHolo) { HoloGearItem component2 = this.Prefab.GetComponent <HoloGearItem>(); if (component2 && component2.Configuration.Avatar) { gameObject = (UnityEngine.Object.Instantiate(component2.Configuration.Avatar.gameObject) as GameObject); } } else { gameObject = (UnityEngine.Object.Instantiate(this.Prefab, position, rotation) as GameObject); } if (gameObject && this.View.ItemType == UberstrikeItemType.Weapon) { WeaponItem component3 = gameObject.GetComponent <WeaponItem>(); if (component3) { ItemConfigurationUtil.CopyCustomProperties(this.View, component3.Configuration); if (this.View.ItemProperties.ContainsKey(ItemPropertyType.CritDamageBonus)) { component3.Configuration.CriticalStrikeBonus = this.View.ItemProperties[ItemPropertyType.CritDamageBonus]; } else { component3.Configuration.CriticalStrikeBonus = 0; } } } } else { Debug.LogError("Trying to create item prefab, but it was null. Item Name:" + this.View.Name); } this.IsLoaded = true; return(gameObject); }