// Token: 0x06001434 RID: 5172 RVA: 0x0007488C File Offset: 0x00072A8C public void SwitchItemInSlot(global::LoadoutSlotType slot1, global::LoadoutSlotType slot2) { IUnityItem item; bool flag = this.Loadout.TryGetItem(slot1, out item); IUnityItem item2; bool flag2 = this.Loadout.TryGetItem(slot2, out item2); if (flag) { if (flag2) { this.Loadout.SetSlot(slot1, item2); this.Loadout.SetSlot(slot2, item); } else { this.Loadout.SetSlot(slot2, item); this.Loadout.ClearSlot(slot1); } } else if (flag2) { this.Loadout.SetSlot(slot1, item2); this.Loadout.ClearSlot(slot2); } }
// Token: 0x06001F7E RID: 8062 RVA: 0x000971EC File Offset: 0x000953EC public void InitializeAllWeapons(Transform attachPoint) { for (int i = 0; i < this._weapons.Length; i++) { if (this._weapons[i] != null && this._weapons[i].Decorator != null) { UnityEngine.Object.Destroy(this._weapons[i].Decorator.gameObject); } this._weapons[i] = null; } for (int j = 0; j < LoadoutManager.WeaponSlots.Length; j++) { global::LoadoutSlotType slot = LoadoutManager.WeaponSlots[j]; InventoryItem inventoryItem; if (Singleton <LoadoutManager> .Instance.TryGetItemInSlot(slot, out inventoryItem)) { WeaponSlot weaponSlot = new WeaponSlot(slot, inventoryItem.Item, attachPoint, this); this.AddGameLogicToWeapon(weaponSlot); this._weapons[j] = weaponSlot; AmmoDepot.SetMaxAmmoForType(inventoryItem.Item.View.ItemClass, ((UberStrikeItemWeaponView)inventoryItem.Item.View).MaxAmmo); AmmoDepot.SetStartAmmoForType(inventoryItem.Item.View.ItemClass, ((UberStrikeItemWeaponView)inventoryItem.Item.View).StartAmmo); this.SetSlotWeapon(slot, inventoryItem.Item); } else { this.SetSlotWeapon(slot, null); } } GameState.Current.PlayerData.LoadoutWeapons.Value = this.LoadoutWeapons; Singleton <QuickItemController> .Instance.Initialize(); this.Reset(); }
// Token: 0x0600142A RID: 5162 RVA: 0x000741BC File Offset: 0x000723BC private LoadoutManager() { Dictionary <global::LoadoutSlotType, IUnityItem> dictionary = new Dictionary <global::LoadoutSlotType, IUnityItem>(); global::LoadoutSlotType[] array = new global::LoadoutSlotType[] { global::LoadoutSlotType.GearHead, global::LoadoutSlotType.GearGloves, global::LoadoutSlotType.GearUpperBody, global::LoadoutSlotType.GearLowerBody, global::LoadoutSlotType.GearBoots }; int[] array2 = new int[] { 1084, 1086, 1087, 1088, 1089 }; for (int i = 0; i < array.Length; i++) { IUnityItem itemInShop = Singleton <ItemManager> .Instance.GetItemInShop(array2[i]); if (itemInShop != null) { dictionary.Add(array[i], itemInShop); } } this.Loadout = new Loadout(dictionary); }
// Token: 0x06002059 RID: 8281 RVA: 0x0001542B File Offset: 0x0001362B public WeaponSlot(global::LoadoutSlotType slot, IUnityItem item, Transform attachPoint, IWeaponController controller) { this.UnityItem = item; this.View = (item.View as UberStrikeItemWeaponView); this.Slot = slot; this.Initialize(controller, attachPoint); }
// Token: 0x06001441 RID: 5185 RVA: 0x00074C94 File Offset: 0x00072E94 public bool TryGetItemInSlot(global::LoadoutSlotType slot, out InventoryItem item) { item = null; IUnityItem unityItem; return(this.Loadout.TryGetItem(slot, out unityItem) && Singleton <InventoryManager> .Instance.TryGetInventoryItem(unityItem.View.ID, out item)); }
// Token: 0x0600143E RID: 5182 RVA: 0x00074C5C File Offset: 0x00072E5C public IUnityItem GetItemOnSlot(global::LoadoutSlotType loadoutSlotType) { IUnityItem result = null; this.Loadout.TryGetItem(loadoutSlotType, out result); return(result); }
// Token: 0x06001880 RID: 6272 RVA: 0x0008379C File Offset: 0x0008199C public void SetSlot(global::LoadoutSlotType slot, IUnityItem item) { if (item != null && this.CanGoInSlot(slot, item.View.ItemType)) { this._items[slot] = item; switch (slot) { case global::LoadoutSlotType.GearHead: case global::LoadoutSlotType.GearFace: case global::LoadoutSlotType.GearGloves: case global::LoadoutSlotType.GearUpperBody: case global::LoadoutSlotType.GearLowerBody: case global::LoadoutSlotType.GearBoots: case global::LoadoutSlotType.GearHolo: this.OnGearChanged(); break; case global::LoadoutSlotType.WeaponMelee: case global::LoadoutSlotType.WeaponPrimary: case global::LoadoutSlotType.WeaponSecondary: case global::LoadoutSlotType.WeaponTertiary: this.OnWeaponChanged(slot); break; } } }
// Token: 0x0600188B RID: 6283 RVA: 0x00083BD0 File Offset: 0x00081DD0 private void OnItemPrefabUpdated(IUnityItem item) { KeyValuePair <global::LoadoutSlotType, IUnityItem> keyValuePair = this._items.FirstOrDefault((KeyValuePair <global::LoadoutSlotType, IUnityItem> a) => a.Value.View.ID == item.View.ID); if (keyValuePair.Value != null) { global::LoadoutSlotType key = keyValuePair.Key; IUnityItem unityItem; if (this._items.TryGetValue(key, out unityItem) && unityItem == item) { switch (item.View.ItemType) { case UberstrikeItemType.Weapon: this.OnWeaponChanged(key); break; case UberstrikeItemType.Gear: this.CheckAllGear(); break; } } } else { Debug.LogError("OnItemPrefabUpdated failed because slot not found"); } }
// Token: 0x060017F8 RID: 6136 RVA: 0x00081990 File Offset: 0x0007FB90 public void AssignWeapon(global::LoadoutSlotType slot, BaseWeaponDecorator weapon, IUnityItem item) { if (weapon) { BaseWeaponDecorator baseWeaponDecorator; if (this._weapons.TryGetValue(slot, out baseWeaponDecorator) && baseWeaponDecorator) { UnityEngine.Object.Destroy(baseWeaponDecorator.gameObject); } this._weapons[slot] = weapon; weapon.transform.parent = this.Decorator.WeaponAttachPoint; foreach (Transform transform in weapon.gameObject.transform.GetComponentsInChildren <Transform>(true)) { if (transform.gameObject.name == "Head") { transform.gameObject.name = "WeaponHead"; } } LayerUtil.SetLayerRecursively(weapon.gameObject.transform, this.Decorator.gameObject.layer); weapon.transform.localPosition = Vector3.zero; weapon.transform.localRotation = Quaternion.identity; weapon.IsEnabled = (slot == this.CurrentWeaponSlot); weapon.WeaponClass = item.View.ItemClass; } else { this.UnassignWeapon(slot); } }
// Token: 0x06001432 RID: 5170 RVA: 0x00074748 File Offset: 0x00072948 public bool RemoveDuplicateQuickItemClass(UberStrikeItemQuickView view, ref global::LoadoutSlotType lastRemovedSlot) { bool result = false; if (view.ItemType == UberstrikeItemType.QuickUse) { global::LoadoutSlotType[] array = new global::LoadoutSlotType[] { global::LoadoutSlotType.QuickUseItem1, global::LoadoutSlotType.QuickUseItem2, global::LoadoutSlotType.QuickUseItem3 }; foreach (global::LoadoutSlotType loadoutSlotType in array) { InventoryItem inventoryItem; if (this.TryGetItemInSlot(loadoutSlotType, out inventoryItem)) { UberStrikeItemQuickView uberStrikeItemQuickView = inventoryItem.Item as UberStrikeItemQuickView; if (inventoryItem.Item.View.ItemType == UberstrikeItemType.QuickUse && uberStrikeItemQuickView.BehaviourType == view.BehaviourType) { this.ResetSlot(loadoutSlotType); result = true; lastRemovedSlot = loadoutSlotType; } } } } return(result); }
// Token: 0x06001439 RID: 5177 RVA: 0x00074A84 File Offset: 0x00072C84 public void SetLoadoutItem(global::LoadoutSlotType loadoutSlotType, IUnityItem item) { if (item == null) { this.ResetSlot(loadoutSlotType); } else { InventoryItem inventoryItem; if (Singleton <InventoryManager> .Instance.TryGetInventoryItem(item.View.ID, out inventoryItem) && inventoryItem.IsValid) { if (item.View.ItemType == UberstrikeItemType.Weapon) { this.RemoveDuplicateWeaponClass(inventoryItem); } this.Loadout.SetSlot(loadoutSlotType, item); } else if (item.View != null) { BuyPanelGUI buyPanelGUI = PanelManager.Instance.OpenPanel(PanelType.BuyItem) as BuyPanelGUI; if (buyPanelGUI) { buyPanelGUI.SetItem(item, BuyingLocationType.Shop, BuyingRecommendationType.None, false); } } UnityRuntime.StartRoutine(Singleton <PlayerDataManager> .Instance.StartSetLoadout()); this.UpdateArmor(); } }
// Token: 0x06001882 RID: 6274 RVA: 0x000838B8 File Offset: 0x00081AB8 public void ClearSlot(global::LoadoutSlotType slot) { IUnityItem unityItem; if (this._items.TryGetValue(slot, out unityItem)) { this._items.Remove(slot); this.OnGearChanged(); } }
// Token: 0x060013E4 RID: 5092 RVA: 0x00072D80 File Offset: 0x00070F80 public bool EquipItem(IUnityItem item) { global::LoadoutSlotType slotType = global::LoadoutSlotType.None; InventoryItem inventoryItem; if (this.TryGetInventoryItem(item.View.ID, out inventoryItem) && inventoryItem.IsValid && inventoryItem.Item.View.ItemType == UberstrikeItemType.Weapon && GameState.Current.Map != null) { slotType = InventoryManager.FindBestSlotToEquipWeapon(item); } return(this.EquipItemOnSlot(item.View.ID, slotType)); }
// Token: 0x06001F73 RID: 8051 RVA: 0x00014BA6 File Offset: 0x00012DA6 private void SetSlotWeapon(global::LoadoutSlotType slot, IUnityItem weapon) { if (weapon != null) { this._loadoutWeapons[slot] = weapon; } else if (this._loadoutWeapons.ContainsKey(slot)) { this._loadoutWeapons.Remove(slot); } }
// Token: 0x0600143D RID: 5181 RVA: 0x00074C2C File Offset: 0x00072E2C public int GetItemIdOnSlot(global::LoadoutSlotType loadoutSlotType) { int result = 0; IUnityItem unityItem; if (this.Loadout.TryGetItem(loadoutSlotType, out unityItem)) { result = unityItem.View.ID; } return(result); }
// Token: 0x060017FB RID: 6139 RVA: 0x00081AB4 File Offset: 0x0007FCB4 public void UnassignWeapon(global::LoadoutSlotType slot) { this.CurrentWeaponSlot = slot; BaseWeaponDecorator baseWeaponDecorator; if (this._weapons.TryGetValue(slot, out baseWeaponDecorator) && baseWeaponDecorator) { UnityEngine.Object.Destroy(baseWeaponDecorator.gameObject); } this._weapons.Remove(slot); }
// Token: 0x06001533 RID: 5427 RVA: 0x00077AC4 File Offset: 0x00075CC4 public void SetLoadoutItem(global::LoadoutSlotType slot, IUnityItem item) { if (item != null) { IUnityItem unityItem; if (GameState.Current.Avatar.Loadout.TryGetItem(slot, out unityItem) && unityItem != item && !Singleton <InventoryManager> .Instance.Contains(unityItem.View.ID) && unityItem.View.ItemType != UberstrikeItemType.QuickUse) { unityItem.Unload(); } GameState.Current.Avatar.Loadout.SetSlot(slot, item); } }
// Token: 0x06002053 RID: 8275 RVA: 0x0009A8B8 File Offset: 0x00098AB8 public void UpdateWeapons(int currentWeaponSlot, IList <int> weaponItemIds) { if (this.character.Avatar != null) { IUnityItem[] array = new IUnityItem[] { Singleton <ItemManager> .Instance.GetItemInShop((weaponItemIds == null || weaponItemIds.Count <= 0)? 0 : weaponItemIds[0]), Singleton <ItemManager> .Instance.GetItemInShop((weaponItemIds == null || weaponItemIds.Count <= 1)? 0 : weaponItemIds[1]), Singleton <ItemManager> .Instance.GetItemInShop((weaponItemIds == null || weaponItemIds.Count <= 2)? 0 : weaponItemIds[2]), Singleton <ItemManager> .Instance.GetItemInShop((weaponItemIds == null || weaponItemIds.Count <= 3)? 0 : weaponItemIds[3]) }; global::LoadoutSlotType[] array2 = new global::LoadoutSlotType[] { global::LoadoutSlotType.WeaponMelee, global::LoadoutSlotType.WeaponPrimary, global::LoadoutSlotType.WeaponSecondary, global::LoadoutSlotType.WeaponTertiary }; int num = -1; for (int i = 0; i < this.weaponSlots.Length; i++) { if (this.weaponSlots[i] != null && this.weaponSlots[i].Decorator != null) { UnityEngine.Object.Destroy(this.weaponSlots[i].Decorator.gameObject); } if (array[i] != null && this.character.Avatar.Decorator.WeaponAttachPoint) { WeaponSlot weaponSlot = new WeaponSlot(array2[i], array[i], this.character.Avatar.Decorator.WeaponAttachPoint, this); if (weaponSlot.Decorator) { if (num < 0) { num = i; } this.character.Avatar.AssignWeapon(array2[i], weaponSlot.Decorator, weaponSlot.UnityItem); } else { Debug.LogError("WeaponDecorator is NULL!"); } this.weaponSlots[i] = weaponSlot; } else { this.weaponSlots[i] = null; } } if (this.CurrentSlotIndex >= 0 && this.weaponSlots[this.CurrentSlotIndex] != null && this.weaponSlots[this.CurrentSlotIndex].Decorator != null) { this.weaponSlots[this.CurrentSlotIndex].Decorator.IsEnabled = true; } } }
// Token: 0x060017F7 RID: 6135 RVA: 0x00081908 File Offset: 0x0007FB08 private void UpdateWeapon(global::LoadoutSlotType slot) { IUnityItem unityItem; if (this.Loadout.TryGetItem(slot, out unityItem) && this.Decorator && this.Decorator.WeaponAttachPoint) { GameObject gameObject = unityItem.Create(this.Decorator.WeaponAttachPoint.position, this.Decorator.WeaponAttachPoint.rotation); if (gameObject) { this.AssignWeapon(slot, gameObject.GetComponent <BaseWeaponDecorator>(), unityItem); } } }
// Token: 0x06001442 RID: 5186 RVA: 0x00074CD0 File Offset: 0x00072ED0 public bool TryGetSlotForItem(IUnityItem item, out global::LoadoutSlotType slot) { slot = global::LoadoutSlotType.None; foreach (KeyValuePair <global::LoadoutSlotType, IUnityItem> keyValuePair in this.Loadout) { if (keyValuePair.Value == item) { slot = keyValuePair.Key; return(true); } } return(false); }
// Token: 0x060017FC RID: 6140 RVA: 0x00081B00 File Offset: 0x0007FD00 public void ShowWeapon(global::LoadoutSlotType slot) { this.CurrentWeaponSlot = slot; foreach (KeyValuePair <global::LoadoutSlotType, BaseWeaponDecorator> keyValuePair in this._weapons) { if (keyValuePair.Value) { keyValuePair.Value.IsEnabled = (slot == keyValuePair.Key); if (slot == keyValuePair.Key) { this.Decorator.AnimationController.ChangeWeaponType(keyValuePair.Value.WeaponClass); } } } }
// Token: 0x060013E8 RID: 5096 RVA: 0x00073144 File Offset: 0x00071344 private void EquipQuickItemOnSlot(InventoryItem item, global::LoadoutSlotType slotType) { if (slotType < global::LoadoutSlotType.QuickUseItem1 || slotType > global::LoadoutSlotType.QuickUseItem3) { slotType = this.GetNextFreeQuickItemSlot(); } global::LoadoutSlotType loadoutSlotType = slotType; if (slotType != loadoutSlotType && Singleton <LoadoutManager> .Instance.RemoveDuplicateQuickItemClass(item.Item.View as UberStrikeItemQuickView, ref loadoutSlotType)) { Singleton <LoadoutManager> .Instance.SwapLoadoutItems(slotType, loadoutSlotType); } AutoMonoBehaviour <SfxManager> .Instance.PlayInGameAudioClip(GameAudio.EquipItem, 0UL); Singleton <LoadoutManager> .Instance.SetLoadoutItem(slotType, item.Item); }
// Token: 0x06001881 RID: 6273 RVA: 0x00083830 File Offset: 0x00081A30 public bool CanGoInSlot(global::LoadoutSlotType slot, UberstrikeItemType type) { switch (type) { case UberstrikeItemType.Weapon: return(slot >= global::LoadoutSlotType.WeaponMelee && slot <= global::LoadoutSlotType.WeaponTertiary); case UberstrikeItemType.Gear: return(slot >= global::LoadoutSlotType.GearHead && slot <= global::LoadoutSlotType.GearHolo); case UberstrikeItemType.QuickUse: return(slot >= global::LoadoutSlotType.QuickUseItem1 && slot <= global::LoadoutSlotType.QuickUseItem3); case UberstrikeItemType.Functional: return(slot >= global::LoadoutSlotType.FunctionalItem1 && slot <= global::LoadoutSlotType.FunctionalItem3); } Debug.LogError("Item attempted to be equipped into a slot that isn't supported."); return(false); }
// Token: 0x06001F91 RID: 8081 RVA: 0x00097508 File Offset: 0x00095708 private void OnSelectWeapon(GlobalEvents.InputChanged ev, global::LoadoutSlotType slotType) { if (ev.IsDown && !LevelCamera.IsZoomedIn && slotType != this._weapons[this._currentSlotID.Current].Slot && this.GetWeaponCount() > 1) { for (int i = 0; i < this._weapons.Length; i++) { if (this._weapons[i] != null && this._weapons[i].Slot == slotType && this._weapons[i] != this._currentSlot) { if (this._currentSlot != null) { this._currentSlot.InputHandler.Stop(); this._currentSlot = null; } this._currentSlotID.Current = i; GameState.Current.PlayerData.NextActiveWeapon.Value = this._weapons[i]; } } } }
// Token: 0x0600162A RID: 5674 RVA: 0x0007BB88 File Offset: 0x00079D88 private GameObject ElementAtSlot(global::LoadoutSlotType slot) { switch (slot) { case global::LoadoutSlotType.WeaponMelee: return(this.meleeSlot); case global::LoadoutSlotType.WeaponPrimary: return(this.primarySlot); case global::LoadoutSlotType.WeaponSecondary: return(this.secondarySlot); case global::LoadoutSlotType.WeaponTertiary: return(this.tertiarySlot); default: return(null); } }
// Token: 0x06001431 RID: 5169 RVA: 0x00074680 File Offset: 0x00072880 public bool RemoveDuplicateWeaponClass(InventoryItem baseItem, ref global::LoadoutSlotType updatedSlot) { bool result = false; if (baseItem != null && baseItem.Item.View.ItemType == UberstrikeItemType.Weapon) { foreach (global::LoadoutSlotType loadoutSlotType in LoadoutManager.WeaponSlots) { InventoryItem inventoryItem; if (this.TryGetItemInSlot(loadoutSlotType, out inventoryItem) && inventoryItem.Item.View.ItemClass == baseItem.Item.View.ItemClass && inventoryItem.Item.View.ID != baseItem.Item.View.ID) { GameState.Current.Avatar.UnassignWeapon(loadoutSlotType); this.ResetSlot(loadoutSlotType); updatedSlot = loadoutSlotType; result = true; break; } } } return(result); }
// Token: 0x0600142E RID: 5166 RVA: 0x00074308 File Offset: 0x00072508 public void EquipWeapon(global::LoadoutSlotType weaponSlot, IUnityItem itemWeapon) { if (itemWeapon != null) { GameObject gameObject = itemWeapon.Create(Vector3.zero, Quaternion.identity); if (gameObject) { BaseWeaponDecorator component = gameObject.GetComponent <BaseWeaponDecorator>(); component.EnableShootAnimation = false; GameState.Current.Avatar.AssignWeapon(weaponSlot, component, itemWeapon); GameState.Current.Avatar.ShowWeapon(weaponSlot); } else { GameState.Current.Avatar.UnassignWeapon(weaponSlot); } } else { GameState.Current.Avatar.UnassignWeapon(weaponSlot); } }
// Token: 0x060013E5 RID: 5093 RVA: 0x00072DF8 File Offset: 0x00070FF8 public static global::LoadoutSlotType FindBestSlotToEquipWeapon(IUnityItem weapon) { UberstrikeItemClass itemClass = weapon.View.ItemClass; if (itemClass == UberstrikeItemClass.WeaponMelee) { return(global::LoadoutSlotType.WeaponMelee); } global::LoadoutSlotType itemClassSlotType = Singleton <LoadoutManager> .Instance.Loadout.GetItemClassSlotType(itemClass); if (itemClassSlotType != global::LoadoutSlotType.None) { return(itemClassSlotType); } global::LoadoutSlotType firstEmptyWeaponSlot = Singleton <LoadoutManager> .Instance.Loadout.GetFirstEmptyWeaponSlot(); if (firstEmptyWeaponSlot != global::LoadoutSlotType.None) { return(firstEmptyWeaponSlot); } return(global::LoadoutSlotType.WeaponPrimary); }
// Token: 0x060010C2 RID: 4290 RVA: 0x00067124 File Offset: 0x00065324 public static UberstrikeItemClass ItemClassFromSlot(global::LoadoutSlotType slot) { UberstrikeItemClass result = (UberstrikeItemClass)0; switch (slot) { case global::LoadoutSlotType.GearHead: result = UberstrikeItemClass.GearHead; break; case global::LoadoutSlotType.GearFace: result = UberstrikeItemClass.GearFace; break; case global::LoadoutSlotType.GearGloves: result = UberstrikeItemClass.GearGloves; break; case global::LoadoutSlotType.GearUpperBody: result = UberstrikeItemClass.GearUpperBody; break; case global::LoadoutSlotType.GearLowerBody: result = UberstrikeItemClass.GearLowerBody; break; case global::LoadoutSlotType.GearBoots: result = UberstrikeItemClass.GearBoots; break; case global::LoadoutSlotType.GearHolo: result = UberstrikeItemClass.GearHolo; break; } return(result); }
// Token: 0x06001433 RID: 5171 RVA: 0x000747EC File Offset: 0x000729EC public bool RemoveDuplicateFunctionalItemClass(InventoryItem inventoryItem, ref global::LoadoutSlotType lastRemovedSlot) { bool result = false; if (inventoryItem != null && inventoryItem.Item.View.ItemType == UberstrikeItemType.Functional) { global::LoadoutSlotType[] array = new global::LoadoutSlotType[] { global::LoadoutSlotType.FunctionalItem1, global::LoadoutSlotType.FunctionalItem2, global::LoadoutSlotType.FunctionalItem3 }; foreach (global::LoadoutSlotType loadoutSlotType in array) { if (this.HasLoadoutItem(loadoutSlotType) && this.GetItemOnSlot(loadoutSlotType).View.ItemClass == inventoryItem.Item.View.ItemClass) { this.ResetSlot(loadoutSlotType); result = true; lastRemovedSlot = loadoutSlotType; } } } return(result); }