Exemple #1
0
        private void SpawnNonEquipmentItemView(int itemId, Transform parent)
        {
            InventoryItemView inventoryItemView  = LocalPlayer.Inventory.InventoryItemViewsCache[itemId][0];
            InventoryItemView inventoryItemView2 = UnityEngine.Object.Instantiate <InventoryItemView>(inventoryItemView);

            inventoryItemView2.transform.localScale = inventoryItemView.transform.lossyScale;
            inventoryItemView2.transform.parent     = parent;
            if (inventoryItemView._modelOffsetTr)
            {
                inventoryItemView2.transform.localPosition = inventoryItemView._modelOffsetTr.localPosition;
            }
            else
            {
                Vector3 position = parent.position;
                position.y += LocalPlayer.Inventory._inventoryGO.transform.InverseTransformPoint(inventoryItemView.transform.position).y;
                inventoryItemView2.transform.position = position;
            }
            inventoryItemView2.transform.rotation = base.transform.parent.rotation * Quaternion.Inverse(inventoryItemView.transform.rotation);
            inventoryItemView2.gameObject.layer   = base.transform.parent.gameObject.layer;
            inventoryItemView2.gameObject.SetActive(true);
            UnityEngine.Object.Destroy(inventoryItemView2.GetComponent <Collider>());
            VirtualCursorSnapNode component = inventoryItemView2.gameObject.GetComponent <VirtualCursorSnapNode>();

            if (component)
            {
                UnityEngine.Object.Destroy(component);
            }
            StoreInformation component2 = inventoryItemView2.gameObject.GetComponent <StoreInformation>();

            if (component2)
            {
                UnityEngine.Object.Destroy(component2);
            }
            UnityEngine.Object.Destroy(inventoryItemView2);
        }
Exemple #2
0
        private void ShowTooltip(InventoryItemView view)
        {
            var tooltip = Find <ItemInformationTooltip>();

            shopItems.SharedModel.DeselectItemView();

            if (view is null ||
                view.RectTransform == tooltip.Target)
            {
                tooltip.Close();
                return;
            }

            if (SharedModel.State.Value == StateType.Buy)
            {
                tooltip.Show(view.RectTransform, view.Model);
            }
            else
            {
                ShowSpeech("SPEECH_SHOP_REGISTER_ITEM_");
                tooltip.Show(
                    view.RectTransform,
                    view.Model,
                    value => !DimmedFuncForSell(value as InventoryItem),
                    L10nManager.Localize("UI_SELL"),
                    _ =>
                    ShowSellPopup(tooltip.itemInformation.Model.item.Value as InventoryItem),
                    _ => inventory.SharedModel.DeselectItemView());
            }
        }
        private void SpawnEquipmentItemView(Transform parent, int itemId)
        {
            InventoryItemView inventoryItemView = LocalPlayer.Inventory.InventoryItemViewsCache[itemId][0];
            GameObject        gameObject        = UnityEngine.Object.Instantiate <GameObject>((!inventoryItemView.ItemCache._throwerProjectilePrefab) ? inventoryItemView._held : inventoryItemView.ItemCache._throwerProjectilePrefab.gameObject);

            parent.gameObject.SetActive(true);
            gameObject.transform.parent        = parent;
            gameObject.transform.localPosition = inventoryItemView._held.transform.localPosition;
            gameObject.transform.localRotation = inventoryItemView._held.transform.localRotation;
            gameObject.layer = base.gameObject.layer;
            gameObject.SetActive(true);
            if (!inventoryItemView.ItemCache._throwerProjectilePrefab)
            {
                foreach (Transform transform in gameObject.transform)
                {
                    if (transform.name == "collide")
                    {
                        UnityEngine.Object.Destroy(transform.gameObject);
                    }
                }
                MonoBehaviour[] components = gameObject.GetComponents <MonoBehaviour>();
                for (int i = 0; i < components.Length; i++)
                {
                    MonoBehaviour obj = components[i];
                    UnityEngine.Object.Destroy(obj);
                }
            }
        }
Exemple #4
0
        public ActionResult UsedInventory()
        {
            var cars = carsRepository.GetAllUsed().Carss.GroupBy(c => c.CarModelId);
            List <InventoryItemView> list = new List <InventoryItemView>();

            foreach (var group in cars)
            {
                var onYear = group.GroupBy(c => c.CarYear);
                foreach (var group2 in onYear)
                {
                    var count      = 0;
                    var stockValue = 0;
                    foreach (var car in group2)
                    {
                        count++;
                    }
                    foreach (var car in group2)
                    {
                        stockValue += car.SalesPrice;
                    }
                    InventoryItemView itemView = new InventoryItemView()
                    {
                        CarModel   = carsRepository.GetCarModel(group.Key).CarModel.CarModelName,
                        CarMake    = carsRepository.GetMake(carsRepository.GetCarModel(group.Key).CarModel.MakeId).Make.MakeName,
                        Count      = count,
                        StockValue = stockValue,
                        Year       = group2.Key
                    };
                    list.Add(itemView);
                }
            }
            return(View(list));
        }
Exemple #5
0
 private void Light()
 {
     if (this._fuel < Time.time)
     {
         GameStats.LitWeapon.Invoke();
         LocalPlayer.Inventory.DefaultLight.StashLighter();
         InventoryItemView component = this._inventoryMirror.transform.parent.GetComponent <InventoryItemView>();
         Transform         transform = (!this._weaponFireSpawn) ? base.transform : this._weaponFireSpawn.transform;
         this._weaponFire = (GameObject)UnityEngine.Object.Instantiate(this._weaponFirePrefab, transform.position, transform.rotation);
         this._weaponFire.transform.parent = transform;
         if (!this._weaponFire.activeSelf)
         {
             this._weaponFire.gameObject.SetActive(true);
         }
         this._fireParticleScale = this._weaponFire.GetComponentInChildren <ParticleScaler>();
         this._firelight         = this._weaponFire.GetComponentInChildren <Light>();
         this._fireAudioEmitter  = this._weaponFire.GetComponent <FMOD_StudioEventEmitter>();
         base.GetComponent <Renderer>().sharedMaterial = this._burningMat;
         this._fuel = ((this._state != BurnableCloth.States.PutOutLighting) ? this._burnDuration : this._putOutFuel);
         if (component.ActiveBonus == WeaponStatUpgrade.Types.BurningWeaponExtra)
         {
             this._extraBurn = true;
             this._fuel     *= 3f;
         }
         else
         {
             this._extraBurn = false;
         }
         this._state = BurnableCloth.States.Burning;
         this._player.IsWeaponBurning = true;
         this._attacking       = false;
         component.ActiveBonus = (WeaponStatUpgrade.Types)(-1);
         FMODCommon.PlayOneshot("event:/fire/fire_built_start", transform);
     }
 }
        private void ShowTooltip(InventoryItemView view)
        {
            var tooltip = Find <ItemInformationTooltip>();

            if (view is null ||
                view.RectTransform == tooltip.Target)
            {
                tooltip.Close();

                return;
            }

            tooltip.Show(
                view.RectTransform,
                view.Model,
                value => !view.Model.Dimmed.Value,
                view.Model.EquippedEnabled.Value
                    ? L10nManager.Localize("UI_UNEQUIP")
                    : L10nManager.Localize("UI_EQUIP"),
                _ => Equip(tooltip.itemInformation.Model.item.Value),
                _ =>
            {
                equipSlotGlow.SetActive(false);
                inventory.SharedModel.DeselectItemView();
            });
        }
Exemple #7
0
        public void ApplyUpgradeRecipe(InventoryItemView craftView, Receipe receipe, int amount)
        {
            this._currentIngredientIndex = 0;
            this._recipe          = receipe;
            this._craftView       = craftView;
            this._currentReceiver = null;
            this._receivers       = this._craftView.GetAllComponentsInChildren <UpgradeViewReceiver>();
            Transform parent = craftView.transform.parent;
            Transform child  = craftView.transform.GetChild(0);

            this._downPosition         = this._craftView.transform.position;
            this._downRotation         = this._craftView.transform.rotation;
            child.parent               = this._upPosition;
            craftView.transform.parent = child;
            child.localPosition        = Vector3.zero;
            child.localRotation        = Quaternion.identity;
            this._upRotation           = this._craftView.transform.rotation;
            this._upPositionV          = craftView.transform.position;
            craftView.transform.parent = parent;
            child.parent               = craftView.transform;
            child.SetAsFirstSibling();
            craftView.transform.position = this._downPosition;
            craftView.transform.rotation = this._downRotation;
            this._state                   = UpgradeCog.States.MoveUp;
            this._stateStartTime          = Time.realtimeSinceStartup;
            this._totalUpgrades           = amount;
            this._implantsDone            = 0;
            this._totalIngredientImplants = 0;
            this._craftingCog.enabled     = false;
            this._disableWhenActive.SetActive(false);
            base.enabled = true;
            Scene.HudGui.ShowValidCraftingRecipes(null);
            Scene.HudGui.ShowUpgradesDistribution(this._recipe._productItemID, this._recipe._ingredients[1]._itemID, 1);
        }
Exemple #8
0
        private void SpawnNonEquipment(int itemId, int slotId)
        {
            InventoryItemView inventoryItemView  = LocalPlayer.Inventory.InventoryItemViewsCache[itemId][0];
            InventoryItemView inventoryItemView2 = UnityEngine.Object.Instantiate <InventoryItemView>(inventoryItemView);
            Vector3           zero = Vector3.zero;

            zero.y += inventoryItemView.transform.position.y - LocalPlayer.Inventory._inventoryGO.transform.position.y;
            inventoryItemView2.transform.localScale    = inventoryItemView.transform.lossyScale;
            inventoryItemView2.transform.parent        = this._slots[slotId];
            inventoryItemView2.transform.localPosition = zero;
            inventoryItemView2.transform.localRotation = inventoryItemView.transform.localRotation * Quaternion.Euler(0f, 0f, 90f);
            inventoryItemView2.gameObject.layer        = base.gameObject.layer;
            UnityEngine.Object.DestroyImmediate(inventoryItemView2.GetComponent <Collider>());
            this.CleanUpComponents(inventoryItemView2.transform);
            inventoryItemView2.gameObject.SetActive(true);
            UnityEngine.Object.Destroy(inventoryItemView2.GetComponent <Collider>());
            VirtualCursorSnapNode component = inventoryItemView2.GetComponent <VirtualCursorSnapNode>();

            if (component)
            {
                UnityEngine.Object.Destroy(component);
            }
            StoreInformation component2 = inventoryItemView2.GetComponent <StoreInformation>();

            if (component2)
            {
                UnityEngine.Object.Destroy(component2);
            }
            UnityEngine.Object.Destroy(inventoryItemView2);
        }
Exemple #9
0
        private void PlaceEquipment()
        {
            Item item = null;

            if (!this._billboardRotate)
            {
                InventoryItemView inventoryItemView = LocalPlayer.Inventory.IsRightHandEmpty() ? null : LocalPlayer.Inventory.RightHand;
                if (inventoryItemView != null)
                {
                    item = inventoryItemView.ItemCache;
                }
            }
            else
            {
                item = ItemDatabase.Items[this._currentAddItem];
            }
            if (item != null && this.IsValidItem(item))
            {
                if (LocalPlayer.Inventory.IsRightHandEmpty() || LocalPlayer.Inventory.RightHand._itemId != item._id || LocalPlayer.Inventory.IsSlotLocked(Item.EquipmentSlot.RightHand))
                {
                    if (!LocalPlayer.Inventory.RemoveItem(item._id, 1, false, true))
                    {
                        return;
                    }
                }
                else if (!LocalPlayer.Inventory.ShuffleRemoveRightHandItem())
                {
                    return;
                }
                if (BoltNetwork.isRunning && !this.hellDoorSlot)
                {
                    RackAdd rackAdd = RackAdd.Create(GlobalTargets.OnlyServer);
                    rackAdd.Slot   = base.GetComponentInParent <CoopRack>().GetSlotIndex(this);
                    rackAdd.Rack   = base.GetComponentInParent <BoltEntity>();
                    rackAdd.ItemId = item._id;
                    rackAdd.Send();
                }
                else
                {
                    if (this.hellDoorSlot)
                    {
                        this.Removed = false;
                        this.Added   = true;
                    }
                    this._storedItemId = item._id;
                    this.SpawnItemView();
                }
                Sfx.Play(SfxInfo.SfxTypes.AddItem, base.transform, true);
                this._addIcon.gameObject.SetActive(false);
                if (!this._offsetIcons)
                {
                    this._addIcon.transform.parent.position = base.transform.position;
                }
                else
                {
                    this._takeIcon.transform.parent.position = base.transform.position + this.IconsOffset;
                }
            }
        }
        private void TransferItemView(Transform itemView, Transform parent, int itemId)
        {
            InventoryItemView inventoryItemView = LocalPlayer.Inventory.InventoryItemViewsCache[itemId][0];

            itemView.parent        = parent;
            itemView.localPosition = inventoryItemView._held.transform.localPosition;
            itemView.localRotation = inventoryItemView._held.transform.localRotation;
        }
    private void setupTargetTriggers()
    {
        this.startPositions.Clear();
        this.startRotations.Clear();
        if (this.sourceObjects.Count > 0)
        {
            int i = 0;
            while (i < this.sourceObjects.Count)
            {
                if (this.savingCompatibilityMode)
                {
                    goto IL_F4;
                }
                if (!(this.sourceObjects[i] == null))
                {
                    inventoryItemSpreadTrigger inventoryItemSpreadTrigger = this.sourceObjects[i].gameObject.GetComponent <inventoryItemSpreadTrigger>();
                    if (!inventoryItemSpreadTrigger)
                    {
                        inventoryItemSpreadTrigger = this.sourceObjects[i].gameObject.AddComponent <inventoryItemSpreadTrigger>();
                    }
                    int num = i - 1;
                    if (num > -1)
                    {
                        inventoryItemSpreadTrigger.neighbour1 = this.sourceObjects[num];
                    }
                    int num2 = i + 1;
                    if (num2 < this.sourceObjects.Count)
                    {
                        inventoryItemSpreadTrigger.neighbour2 = this.sourceObjects[num2];
                    }
                    inventoryItemSpreadTrigger.index = i;
                    goto IL_F4;
                }
                Debug.LogError(string.Format("setupTargetTriggers \"{0}.sourceObjects[{1}]\" is null!", base.name, i));
IL_1BF:
                i++;
                continue;
IL_F4:
                if (this.savingCompatibilityMode)
                {
                    InventoryItemView component = this.sourceObjects[i].gameObject.GetComponent <InventoryItemView>();
                    if (component)
                    {
                        component._itemSpreadIndex = i;
                    }
                }
                if (this.offsetRenderersMode)
                {
                    this.startPositions.Add(this.offsetSourceObjects[i].transform.localPosition);
                    this.startRotations.Add(this.offsetSourceObjects[i].transform.localRotation);
                    goto IL_1BF;
                }
                this.startPositions.Add(this.sourceObjects[i].transform.localPosition);
                this.startRotations.Add(this.sourceObjects[i].transform.localRotation);
                goto IL_1BF;
            }
        }
    }
 private void AcceptItem(InventoryItemView item, Vector2Int position)
 {
     item.transform.position = GetSlot(position).transform.position;
     foreach (var slot in GetHoveredSlots(item.Item, position))
     {
         slot.Item     = item.Item;
         slot.ItemView = item;
     }
     GunsInHandsUpdater.UpdateItemsList(AllItems);
 }
Exemple #13
0
        public void SubscribeItemOnClick(InventoryItemView view)
        {
            if (view != null &&
                view == SelectedItemView.Value)
            {
                DeselectItemView();
                return;
            }

            SelectItemView(view);
        }
 private void SubscribeInventorySelectedItem(InventoryItemView view)
 {
     // Fix me. 이미 장착한 아이템일 경우 장착 버튼 비활성화 필요.
     // 현재는 왼쪽 부분인 인벤토리와 아이템 정보 부분만 뷰모델을 적용했는데, 오른쪽 까지 뷰모델이 확장되면 가능.
     if (view is null ||
         view.Model is null ||
         view.Model.Dimmed.Value ||
         !(view.Model.ItemBase.Value is ItemUsable))
     {
         HideGlowEquipSlot();
     }
Exemple #15
0
        private void SpawnNonEquipmentItemView()
        {
            InventoryItemView inventoryItemView  = LocalPlayer.Inventory.InventoryItemViewsCache[this._storedItemId][0];
            InventoryItemView inventoryItemView2 = UnityEngine.Object.Instantiate <InventoryItemView>(inventoryItemView);
            Vector3           position           = base.transform.position;
            Quaternion        rotation           = base.transform.rotation;
            Item          item = ItemDatabase.ItemById(this._storedItemId);
            RackPlacement placementOverride = this.GetPlacementOverride(item);

            if (placementOverride != null)
            {
                Vector3    zero     = Vector3.zero;
                Quaternion identity = Quaternion.identity;
                Vector3    one      = Vector3.one;
                placementOverride.ApplyTo(ref zero, ref identity, ref one);
                inventoryItemView2.transform.localScale     = one;
                inventoryItemView2.transform.parent         = base.transform;
                inventoryItemView2.transform.localPosition  = zero;
                inventoryItemView2.transform.localRotation  = identity;
                inventoryItemView2.transform.localPosition += WeaponRackSlot.GetJitterVector3(this._jitterPosition);
                inventoryItemView2.transform.localRotation  = Quaternion.Euler(WeaponRackSlot.GetJitterVector3(this._jitterRotation)) * inventoryItemView2.transform.localRotation;
            }
            else
            {
                Vector3 position2 = position;
                position2.y += inventoryItemView.transform.position.y - LocalPlayer.Inventory._inventoryGO.transform.position.y;
                inventoryItemView2.transform.localScale = inventoryItemView.transform.lossyScale;
                inventoryItemView2.transform.parent     = base.transform;
                inventoryItemView2.transform.position   = position2;
                inventoryItemView2.transform.rotation   = inventoryItemView.transform.rotation;
            }
            inventoryItemView2.gameObject.layer = base.gameObject.layer;
            inventoryItemView2.gameObject.SetActive(true);
            this._storedItemGO = inventoryItemView2.gameObject;
            UnityEngine.Object.Destroy(inventoryItemView2.GetComponent <Collider>());
            UnityEngine.Object.Destroy(inventoryItemView2);
            VirtualCursorSnapNode component = this._storedItemGO.GetComponent <VirtualCursorSnapNode>();

            if (component)
            {
                UnityEngine.Object.Destroy(component);
            }
            StoreInformation component2 = this._storedItemGO.GetComponent <StoreInformation>();

            if (component2)
            {
                UnityEngine.Object.Destroy(component2);
            }
            if (this.OnItemAdded != null)
            {
                this.OnItemAdded.Invoke(this._storedItemId);
            }
        }
Exemple #16
0
        private void viewStockBtn_Click(object sender, EventArgs e)
        {
            if (itemsTable.RowCount == 0)
            {
                return;
            }

            using (var inventoryView = new InventoryItemView())
            {
                inventoryView.SetItemId(selectedBarcode);
                inventoryView.ShowDialog();
            }
        }
Exemple #17
0
 private void Start()
 {
     this._lambdaMultiView = new GameObject("LambdaMultiview").AddComponent <InventoryItemView>();
     this._lambdaMultiView.transform.parent        = base.transform;
     this._lambdaMultiView.transform.localPosition = new Vector3(-2.5f, 2.5f, 2.5f);
     this._lambdaMultiView._isCraft        = true;
     this._lambdaMultiView._allowMultiView = true;
     if (!LevelSerializer.IsDeserializing)
     {
         this.IngredientCleanUp();
     }
     base.enabled = false;
 }
Exemple #18
0
        public void OnDeserialized()
        {
            InventoryItemView inventoryItemView = this._inventoryMirror.transform.parent.parent.GetComponent <InventoryItemView>() ?? this._inventoryMirror.transform.parent.GetComponent <InventoryItemView>();

            if (inventoryItemView)
            {
                WeaponStatUpgrade.Types activeBonus = inventoryItemView.ActiveBonus;
                if (activeBonus == WeaponStatUpgrade.Types.BurningWeapon || activeBonus == WeaponStatUpgrade.Types.BurningWeaponExtra)
                {
                    this.EnableBurnableCloth();
                }
            }
        }
Exemple #19
0
        public void SelectItemView(InventoryItemView view)
        {
            if (view is null ||
                view.Model is null)
            {
                return;
            }

            DeselectItemView();

            view.Model.Selected.Value = true;
            SelectedItemView.Value    = view;
            SetGlowedAll(false);
        }
        private IEnumerator ToggleManifest()
        {
            LocalPlayer.Inventory.MemorizeItem(Item.EquipmentSlot.RightHand);
            InventoryItemView iiv = LocalPlayer.Inventory.EquipmentSlotsPrevious[0];

            LocalPlayer.Inventory.Equip(this._itemId, false);
            LocalPlayer.Inventory.EquipmentSlotsPrevious[0] = iiv;
            yield return(YieldPresets.WaitThreeSeconds);

            if (LocalPlayer.Inventory.HasInSlot(Item.EquipmentSlot.RightHand, this._itemId))
            {
                LocalPlayer.Inventory.EquipPreviousWeapon(true);
            }
            yield break;
        }
Exemple #21
0
        protected override bool MainEffect()
        {
            bool flag = LocalPlayer.Stats.CheckItem(Item.EquipmentSlot.RightHand);

            if (flag)
            {
                LocalPlayer.Inventory.MemorizeItem(Item.EquipmentSlot.RightHand);
            }
            InventoryItemView inventoryItemView = LocalPlayer.Inventory.EquipmentSlotsPrevious[0];

            LocalPlayer.Inventory.Equip(this._itemId, true);
            LocalPlayer.Inventory.EquipmentSlotsPrevious[0] = inventoryItemView;
            FMOD_StudioSystem.instance.PlayOneShot("event:/music/toy_pickup", LocalPlayer.Transform.position, null);
            return(true);
        }
Exemple #22
0
 private void setupTargetTriggers()
 {
     this.startPositions.Clear();
     this.startRotations.Clear();
     if (this.sourceObjects.Count > 0)
     {
         for (int i = 0; i < this.sourceObjects.Count; i++)
         {
             if (!this.savingCompatibilityMode)
             {
                 inventoryItemSpreadTrigger inventoryItemSpreadTrigger = this.sourceObjects[i].gameObject.GetComponent <inventoryItemSpreadTrigger>();
                 if (!inventoryItemSpreadTrigger)
                 {
                     inventoryItemSpreadTrigger = this.sourceObjects[i].gameObject.AddComponent <inventoryItemSpreadTrigger>();
                 }
                 int num = i - 1;
                 if (num > -1)
                 {
                     inventoryItemSpreadTrigger.neighbour1 = this.sourceObjects[num];
                 }
                 int num2 = i + 1;
                 if (num2 < this.sourceObjects.Count)
                 {
                     inventoryItemSpreadTrigger.neighbour2 = this.sourceObjects[num2];
                 }
                 inventoryItemSpreadTrigger.index = i;
             }
             if (this.savingCompatibilityMode)
             {
                 InventoryItemView component = this.sourceObjects[i].gameObject.GetComponent <InventoryItemView>();
                 if (component)
                 {
                     component._itemSpreadIndex = i;
                 }
             }
             if (this.offsetRenderersMode)
             {
                 this.startPositions.Add(this.offsetSourceObjects[i].transform.localPosition);
                 this.startRotations.Add(this.offsetSourceObjects[i].transform.localRotation);
             }
             else
             {
                 this.startPositions.Add(this.sourceObjects[i].transform.localPosition);
                 this.startRotations.Add(this.sourceObjects[i].transform.localRotation);
             }
         }
     }
 }
Exemple #23
0
 private void TransferItemView(Transform itemView, Transform parent, int itemId)
 {
     itemView.parent = parent;
     if (LocalPlayer.Inventory)
     {
         InventoryItemView inventoryItemView = LocalPlayer.Inventory.InventoryItemViewsCache[itemId][0];
         FakeParent        component         = inventoryItemView._held.GetComponent <FakeParent>();
         itemView.transform.localPosition = ((!component) ? inventoryItemView._held.transform.localPosition : component.RealLocalPosition);
         itemView.transform.localRotation = ((!component) ? inventoryItemView._held.transform.localRotation : component.RealLocalRotation);
     }
     else
     {
         itemView.localPosition = Vector3.zero;
         itemView.localRotation = Quaternion.identity;
     }
 }
        public void SetupCOTF()
        {
            instance = this;

            customWeapons.Clear();
            originalPlaneAxe      = this._itemViews[64];
            originalPlaneAxeModel = this._itemViews[64]._heldWeaponInfo.transform.parent.GetChild(2).gameObject;
            originalRotation      = originalPlaneAxeModel.transform.localRotation;
            OriginalOffset        = originalPlaneAxeModel.transform.localPosition;
            originalParent        = originalPlaneAxeModel.transform.parent;
            OriginalTreeDmg       = this._itemViews[64]._heldWeaponInfo.treeDamage;
            originalMesh          = originalPlaneAxeModel.GetComponent <MeshFilter>().mesh;
            noMesh = new Mesh();

            CreateCustomWeapons();
            SetupComplete = true;
        }
Exemple #25
0
 private void SpawnEquipmentItemView(Transform parent, int itemId)
 {
     if (LocalPlayer.Inventory)
     {
         Reparent.Locked = true;
         InventoryItemView inventoryItemView = LocalPlayer.Inventory.InventoryItemViewsCache[itemId][0];
         GameObject        gameObject        = UnityEngine.Object.Instantiate <GameObject>((!inventoryItemView.ItemCache._throwerProjectilePrefab) ? inventoryItemView._held : inventoryItemView.ItemCache._throwerProjectilePrefab.gameObject);
         FakeParent        component         = inventoryItemView._held.GetComponent <FakeParent>();
         parent.gameObject.SetActive(true);
         gameObject.transform.parent        = parent;
         gameObject.transform.localPosition = ((!component) ? inventoryItemView._held.transform.localPosition : component.RealLocalPosition);
         gameObject.transform.localRotation = ((!component) ? inventoryItemView._held.transform.localRotation : component.RealLocalRotation);
         gameObject.layer = base.gameObject.layer;
         gameObject.SetActive(true);
         if (!inventoryItemView.ItemCache._throwerProjectilePrefab)
         {
             IEnumerator enumerator = gameObject.transform.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     object    obj       = enumerator.Current;
                     Transform transform = (Transform)obj;
                     if (transform.name.Contains("collide") || transform.GetComponent <weaponInfo>())
                     {
                         UnityEngine.Object.Destroy(transform.gameObject);
                     }
                 }
             }
             finally
             {
                 IDisposable disposable;
                 if ((disposable = (enumerator as IDisposable)) != null)
                 {
                     disposable.Dispose();
                 }
             }
             foreach (MonoBehaviour obj2 in gameObject.GetComponents <MonoBehaviour>())
             {
                 UnityEngine.Object.Destroy(obj2);
             }
         }
         Reparent.Locked = false;
     }
 }
    private bool TryFindItemView(InventoryItemModel item, out int index, out InventoryItemView inventory_item_view)
    {
        for (int i = 0; i < _inventory_item_views.Count; i++)
        {
            if (!_inventory_item_views[i].IsMatch(item))
            {
                continue;
            }

            index = i;
            inventory_item_view = _inventory_item_views[i];
            return(true);
        }

        index = -1;
        inventory_item_view = null;
        return(false);
    }
Exemple #27
0
 public void ApplyUpgradeRecipe(InventoryItemView craftView, Receipe receipe, int amount)
 {
     this._currentIngredientIndex = 0;
     this._recipe                  = receipe;
     this._craftView               = craftView;
     this._currentReceiver         = null;
     this._upPositionV             = craftView.transform.position + this._upPosition.parent.TransformDirection(new Vector3(0.5f, -1.05f, 0f));
     this._upRotation              = craftView.transform.rotation * Quaternion.Euler(30f, 0f, 0f);
     this._receivers               = this._craftView.GetAllComponentsInChildren <UpgradeViewReceiver>();
     this._downPosition            = this._craftView.transform.position;
     this._downRotation            = this._craftView.transform.rotation;
     this._state                   = UpgradeCog.States.MoveUp;
     this._totalUpgrades           = amount;
     this._implantsDone            = 0;
     this._totalIngredientImplants = 0;
     this._craftingCog.enabled     = false;
     base.enabled                  = true;
     Scene.HudGui.ShowValidCraftingRecipes(null);
     Scene.HudGui.ShowUpgradesDistribution(this._recipe._productItemID, this._recipe._ingredients[1]._itemID, 1);
 }
Exemple #28
0
    public void Open(List <InventoryItem> items)
    {
        float aux = AngleRange / Mathf.Max((float)(items.Count - 1), 3);


        for (int i = 0; i < items.Count; i++)
        {
            GameObject item = Instantiate(itemViewPrefab, container.transform);
            views.Add(item);
            item.transform.localPosition = Vector3.zero;

            InventoryItemView iv = item.GetComponent <InventoryItemView>();


            iv.ShowItem(items[i]);

            Vector2 dir = (Vector2)(Quaternion.Euler(0, 0, Mathf.Repeat(startAngle + (aux * i), 360)) * Vector2.right);

            StartCoroutine(LerpFromTo(item.transform.position, container.transform.position + new Vector3(dir.x, dir.y, 0).normalized *separationDistance, item.transform, 0.5f));
        }
    }
Exemple #29
0
    public void AddItem(CommonDefine.GoodType goodType, int num = 0)
    {
        if (num > 0)
        {
            for (int i = 0; i < cells.Length; i++)
            {
                if (cells[i].transform.childCount > 0)
                {
                    InventoryItemView inventoryItem = cells[i].GetComponentInChildren <InventoryItemView>();
                    if (inventoryItem.m_goodType == goodType)
                    {
                        m_isFind = true;
                        inventoryItem.AddCount(num);
                        break;
                    }
                }
                else
                {
                    m_isFind = false;
                }
            }

            if (!m_isFind)
            {
                for (int j = 0; j < cells.Length; j++)
                {
                    if (cells[j].transform.childCount == 0)
                    {
                        GameObject go = NGUITools.AddChild(cells[j], (GameObject)ResMgr.Instance.LoadAssetFromResource("Prefabs/UI/Inventory/InventoryItem"));
                        go.GetComponent <UISprite>().spriteName = CommonDefine.GoodNameDic[goodType];
                        go.transform.localPosition = Vector3.zero;
                        InventoryItemView dragObjTemp = go.GetComponentInChildren <InventoryItemView>();
                        dragObjTemp.m_goodType = goodType;
                        dragObjTemp.AddCount(num);
                        break;
                    }
                }
            }
        }
    }
Exemple #30
0
 private void SetItemAsQuickSlot(int slotNum)
 {
     try
     {
         for (int i = 0; i < LocalPlayer.Inventory.QuickSelectItemIds.Length; i++)
         {
             if (LocalPlayer.Inventory.QuickSelectItemIds[i] == this._combiningItemId && i != slotNum)
             {
                 LocalPlayer.Inventory.QuickSelectItemIds[i] = -1;
                 this._hiddenInventoryItemView[i]            = false;
             }
         }
         if (LocalPlayer.Inventory.QuickSelectItemIds[slotNum] != this._combiningItemId)
         {
             if (this._hiddenInventoryItemView[slotNum] && LocalPlayer.Inventory.QuickSelectItemIds[slotNum] > 0)
             {
                 LocalPlayer.Inventory.InventoryItemViewsCache[LocalPlayer.Inventory.QuickSelectItemIds[slotNum]][0].gameObject.SetActive(true);
             }
             LocalPlayer.Inventory.QuickSelectItemIds[slotNum] = this._combiningItemId;
             LocalPlayer.Inventory.AddItem(this._combiningItemId, 1, true, true, this._combiningItemProperties);
             InventoryItemView lastActiveView = LocalPlayer.Inventory.GetLastActiveView(this._combiningItemId);
             LocalPlayer.Inventory.BubbleDownInventoryView(lastActiveView);
             lastActiveView.gameObject.SetActive(false);
             this._hiddenInventoryItemView[slotNum] = true;
             this._combiningItemId = 0;
             Scene.HudGui.ShowQuickSelectCombineInfo();
         }
         LocalPlayer.Sfx.PlayTwinkle();
     }
     finally
     {
         this._startingCombine = false;
         this._isCombining     = true;
         this.StopCombining();
     }
     foreach (QuickSelectViews quickSelectViews2 in LocalPlayer.QuickSelectViews)
     {
         quickSelectViews2.ShowLocalPlayerViews();
     }
 }
Exemple #31
0
 public void ShowItemInfoView(InventoryItemView itemView, Vector3 viewportPos, bool isCraft)
 {
     if (this._inventoryItemInfoView._itemId == itemView._itemId && this._inventoryItemInfoView.IsCraft == isCraft)
     {
         this._inventoryItemInfoView.ViewCounter++;
     }
     else if (!isCraft)
     {
         if (this._inventoryItemsInfoCache.ContainsKey(itemView._itemId))
         {
             this._inventoryItemInfoView.ViewCounter = 1;
             this._inventoryItemInfoView._itemId = itemView._itemId;
             this._inventoryItemInfoView.IsCraft = false;
             if (viewportPos.y > 0.6f)
             {
                 viewportPos.y -= 0.1f;
             }
             else
             {
                 viewportPos.y += 0.1f;
             }
             if (viewportPos.x > 0.7f)
             {
                 viewportPos.x -= 0.075f;
             }
             else if (viewportPos.x < 0.3f)
             {
                 viewportPos.x += 0.075f;
             }
             viewportPos.z = 2f;
             Vector3 position = this.GuiCamC.ViewportToWorldPoint(viewportPos);
             this._inventoryItemInfoView._root.transform.position = position;
             HudGui.InventoryItemInfo inventoryItemInfo = this._inventoryItemsInfoCache[itemView._itemId];
             this._inventoryItemInfoView._icon.mainTexture = inventoryItemInfo._icon;
             if (itemView is DecayingInventoryItemView)
             {
                 this._inventoryItemInfoView._title.text = string.Format("{0} {1}", ((DecayingInventoryItemView)itemView)._state, inventoryItemInfo._titleText);
             }
             else
             {
                 this._inventoryItemInfoView._title.text = inventoryItemInfo._titleText;
             }
             this._inventoryItemInfoView._effect.text = inventoryItemInfo._effectText;
             this._inventoryItemInfoView._description.text = inventoryItemInfo._descriptionText;
             this._inventoryItemInfoView._effect.gameObject.SetActive(true);
             this._inventoryItemInfoView._description.gameObject.SetActive(true);
             switch (inventoryItemInfo._amountDisplay)
             {
             case HudGui.InventoryItemInfo.AmountDisplay.none:
                 this._inventoryItemInfoView._amountText._label.enabled = false;
                 break;
             case HudGui.InventoryItemInfo.AmountDisplay.Amount:
                 this._inventoryItemInfoView._amountText._label.enabled = true;
                 this._inventoryItemInfoView._amountText._itemId = itemView._itemId;
                 break;
             case HudGui.InventoryItemInfo.AmountDisplay.Pedometer:
                 this._inventoryItemInfoView._amountText._label.enabled = false;
                 this._inventoryItemInfoView._description.text = inventoryItemInfo._descriptionText.Replace("%", LocalPlayer.FpHeadBob.Steps.ToString());
                 break;
             case HudGui.InventoryItemInfo.AmountDisplay.Battery:
                 this._inventoryItemInfoView._amountText._label.enabled = false;
                 this._inventoryItemInfoView._description.text = inventoryItemInfo._descriptionText.Replace("%", Mathf.FloorToInt(LocalPlayer.Stats.BatteryCharge) + "%");
                 break;
             case HudGui.InventoryItemInfo.AmountDisplay.Air:
                 this._inventoryItemInfoView._amountText._label.enabled = false;
                 this._inventoryItemInfoView._description.text = inventoryItemInfo._descriptionText.Replace("%", Mathf.FloorToInt(LocalPlayer.Stats.AirBreathing.CurrentRebreatherAir) + "s");
                 if (LocalPlayer.Inventory.HasInSlot(Item.EquipmentSlot.Chest, inventoryItemInfo._itemId))
                 {
                     UILabel expr_376 = this._inventoryItemInfoView._description;
                     expr_376.text += " (Equiped)";
                 }
                 break;
             case HudGui.InventoryItemInfo.AmountDisplay.WaterFill:
             {
                 this._inventoryItemInfoView._amountText._label.enabled = false;
                 WeaponStatUpgrade.Types activeBonus = itemView.ActiveBonus;
                 string newValue;
                 if (activeBonus != WeaponStatUpgrade.Types.DirtyWater)
                 {
                     if (activeBonus != WeaponStatUpgrade.Types.CleanWater)
                     {
                         newValue = "empty";
                     }
                     else
                     {
                         newValue = "clean water (" + string.Format("{0:P0}", itemView._activeBonusValue / 2f) + ")";
                     }
                 }
                 else
                 {
                     newValue = "polluted water (" + string.Format("{0:P0}", itemView._activeBonusValue / 2f) + ")";
                 }
                 this._inventoryItemInfoView._description.text = inventoryItemInfo._descriptionText.Replace("%", newValue);
                 break;
             }
             }
             this._inventoryItemInfoView._weight.enabled = false;
             if (this._inventoryItemInfoView._upgradeCounterGrid)
             {
                 if (itemView.ItemCache.MatchType(Item.Types.Equipment))
                 {
                     this._inventoryItemInfoView._upgradeCounterGrid.gameObject.SetActive(true);
                     for (int i = 0; i < this._inventoryItemInfoView._upgradeCounterViews.Count; i++)
                     {
                         HudGui.UpgradeCounterView upgradeCounterView = this._inventoryItemInfoView._upgradeCounterViews[i];
                         int amountOfUpgrades = LocalPlayer.Inventory.GetAmountOfUpgrades(itemView._itemId, upgradeCounterView._itemId);
                         if (amountOfUpgrades > 0)
                         {
                             upgradeCounterView._root.SetActive(true);
                             upgradeCounterView._label.text = amountOfUpgrades.ToString();
                         }
                         else
                         {
                             upgradeCounterView._root.SetActive(false);
                         }
                     }
                     this._inventoryItemInfoView._upgradeCounterGrid.Reposition();
                 }
                 else
                 {
                     this._inventoryItemInfoView._upgradeCounterGrid.gameObject.SetActive(false);
                 }
             }
             if (this._inventoryItemInfoView._upgradeBonusGrid)
             {
                 if (itemView.ItemCache.MatchType(Item.Types.Equipment) && itemView._heldWeaponInfo)
                 {
                     this._inventoryItemInfoView._effect.gameObject.SetActive(false);
                     this._inventoryItemInfoView._description.gameObject.SetActive(false);
                     this._inventoryItemInfoView._upgradeBonusGrid.gameObject.SetActive(true);
                     this._inventoryItemInfoView._speedBonusView._root.SetActive(true);
                     float fillAmount = itemView._heldWeaponInfo.weaponSpeed / 12f;
                     this._inventoryItemInfoView._speedBonusView._amount.fillAmount = fillAmount;
                     this._inventoryItemInfoView._damageBonusView._root.SetActive(true);
                     float fillAmount2 = itemView._heldWeaponInfo.weaponDamage / 12f;
                     this._inventoryItemInfoView._damageBonusView._amount.fillAmount = fillAmount2;
                     this._inventoryItemInfoView._blockView._root.SetActive(true);
                     float fillAmount3 = 1f - itemView._heldWeaponInfo.blockDamagePercent / 1f;
                     this._inventoryItemInfoView._blockView._amount.fillAmount = fillAmount3;
                     this._inventoryItemInfoView._upgradeBonusGrid.Reposition();
                 }
                 else
                 {
                     this._inventoryItemInfoView._upgradeBonusGrid.gameObject.SetActive(false);
                 }
             }
             for (int j = 0; j < this._inventoryItemInfoView._usableUpgradeViews.Count; j++)
             {
                 HudGui.UsableUpgradeView usableUpgradeView = this._inventoryItemInfoView._usableUpgradeViews[j];
                 if (usableUpgradeView._stat == itemView.ActiveBonus != usableUpgradeView._root.activeSelf)
                 {
                     usableUpgradeView._root.SetActive(!usableUpgradeView._root.activeSelf);
                 }
             }
             if (inventoryItemInfo._leftClick == HudGui.InventoryItemInfo.LeftClickCommands.none)
             {
                 this._inventoryItemInfoView._leftClickIcon.enabled = false;
                 this._inventoryItemInfoView._leftClickText.enabled = false;
             }
             else
             {
                 this._inventoryItemInfoView._leftClickIcon.enabled = true;
                 this._inventoryItemInfoView._leftClickText.enabled = true;
                 if (itemView.ItemCache._edibleCondition != (WeaponStatUpgrade.Types)(-1) && (itemView.ActiveBonus == WeaponStatUpgrade.Types.CleanWater || itemView._activeBonus == WeaponStatUpgrade.Types.DirtyWater))
                 {
                     this._inventoryItemInfoView._leftClickText.text = "Drink";
                 }
                 else
                 {
                     this._inventoryItemInfoView._leftClickText.text = inventoryItemInfo._leftClick.ToString();
                 }
             }
             if (LocalPlayer.Inventory.CurrentStorage == LocalPlayer.Inventory._craftingCog)
             {
                 if (itemView._canDropFromInventory)
                 {
                     this._inventoryItemInfoView._rightClickIcon.enabled = true;
                     this._inventoryItemInfoView._rightClickText.enabled = true;
                     this._inventoryItemInfoView._rightClickText.text = "Drop";
                 }
                 else if (inventoryItemInfo._rightClick == HudGui.InventoryItemInfo.RightClickCommands.none)
                 {
                     this._inventoryItemInfoView._rightClickIcon.enabled = false;
                     this._inventoryItemInfoView._rightClickText.enabled = false;
                 }
                 else
                 {
                     this._inventoryItemInfoView._rightClickIcon.enabled = true;
                     this._inventoryItemInfoView._rightClickText.enabled = true;
                     this._inventoryItemInfoView._rightClickText.text = inventoryItemInfo._rightClick.ToString();
                 }
             }
             else if (itemView.CanBeStored)
             {
                 this._inventoryItemInfoView._rightClickIcon.enabled = true;
                 this._inventoryItemInfoView._rightClickText.enabled = true;
                 this._inventoryItemInfoView._rightClickText.text = "Store";
             }
             else
             {
                 this._inventoryItemInfoView._rightClickIcon.enabled = false;
                 this._inventoryItemInfoView._rightClickText.enabled = false;
             }
             this._inventoryItemInfoView._root.SetActive(true);
         }
         else
         {
             UnityEngine.Debug.LogWarning("Missing Inventory Item Info data in HUDGui for " + itemView.ItemCache._name);
         }
     }
     else
     {
         if (!this.ClickToRemoveInfo.activeSelf)
         {
             this._inventoryItemInfoView.ViewCounter = 1;
             this._inventoryItemInfoView._itemId = itemView._itemId;
             this._inventoryItemInfoView.IsCraft = true;
             this.ClickToRemoveInfo.SetActive(true);
         }
         if (this.ClickToEquipInfo.activeSelf != itemView._canEquipFromCraft)
         {
             this.ClickToEquipInfo.SetActive(itemView._canEquipFromCraft);
         }
     }
 }