예제 #1
0
        public static void ModifyCombinationSlotEquipment(
            TableSheets tableSheets,
            EquipmentItemRecipeSheet.Row row,
            CombinationPanel panel,
            Address slotAddress,
            int?subRecipeId
            )
        {
            // When the layer is covered, additionally set the block height to prevent state updates until the actual state comes in.
            var blockIndex         = Game.Game.instance.Agent.BlockIndex + 100;
            var requiredBlockIndex = row.RequiredBlockIndex + blockIndex;

            if (subRecipeId.HasValue)
            {
                var subRow =
                    tableSheets.EquipmentItemSubRecipeSheet.Values.First(r => r.Id == subRecipeId);
                requiredBlockIndex += subRow.RequiredBlockIndex;
            }

            var equipRow =
                tableSheets.EquipmentItemSheet.Values.First(i => i.Id == row.ResultEquipmentId);
            var equipment = ItemFactory.CreateItemUsable(equipRow, Guid.Empty, requiredBlockIndex);
            var materials = new Dictionary <Material, int>();

            foreach (var(material, count) in panel.materialPanel.MaterialList)
            {
                materials[material] = count;
            }

            var result = new CombinationConsumable.ResultModel
            {
                // id: When applying the local layer for the first time, if the id is the default, the notification is not applied.
                id          = Guid.NewGuid(),
                actionPoint = panel.CostAP,
                gold        = panel.CostNCG,
                materials   = materials,
                itemUsable  = equipment,
                recipeId    = row.Id,
                subRecipeId = subRecipeId,
                itemType    = ItemType.Equipment,
            };
            var modifier  = new CombinationSlotBlockIndexAndResultModifier(result, blockIndex, requiredBlockIndex);
            var slotState = States.Instance.CombinationSlotStates[slotAddress];

            LocalLayer.Instance.Set(slotState.address, modifier);
            States.Instance.CombinationSlotStates[slotAddress] = modifier.Modify(slotState);
            CombinationSlotStateSubject.OnNext(slotState);
        }
예제 #2
0
        private void ActionCombinationEquipment(CombinationPanel combinationPanel)
        {
            var cellview    = combinationPanel.recipeCellView;
            var model       = cellview.EquipmentRowData;
            var subRecipeId = (combinationPanel is ElementalCombinationPanel elementalPanel)
                ? elementalPanel.SelectedSubRecipeId
                : (int?)null;

            UpdateCurrentAvatarState(combinationPanel, combinationPanel.materialPanel.MaterialList);
            CreateCombinationEquipmentAction(
                model.Id,
                subRecipeId,
                selectedIndex,
                model,
                combinationPanel
                );
            combineEquipmentCategoryButton.HasNotification.Value = HasNotification;
        }
예제 #3
0
        public static void ModifyCombinationSlotEquipment(
            TableSheets tableSheets,
            EquipmentItemRecipeSheet.Row row,
            CombinationPanel panel,
            int slotIndex,
            int?subRecipeId
            )
        {
            var slotAddress = States.Instance.CurrentAvatarState.address.Derive(
                string.Format(
                    CultureInfo.InvariantCulture,
                    CombinationSlotState.DeriveFormat,
                    slotIndex
                    )
                );

            ModifyCombinationSlotEquipment(tableSheets, row, panel, slotAddress, subRecipeId);
        }