示例#1
0
        public static void ModifyCombinationSlotConsumable(
            TableSheets tableSheets,
            ICombinationPanel panel,
            ConsumableItemRecipeSheet.Row recipeRow,
            int slotIndex
            )
        {
            var slotAddress = States.Instance.CurrentAvatarState.address.Derive(
                string.Format(
                    CultureInfo.InvariantCulture,
                    CombinationSlotState.DeriveFormat,
                    slotIndex
                    )
                );

            ModifyCombinationSlotConsumable(tableSheets, panel, recipeRow, slotAddress);
        }
示例#2
0
        public static void ModifyCombinationSlotConsumable(
            TableSheets tableSheets,
            ICombinationPanel panel,
            ConsumableItemRecipeSheet.Row recipeRow,
            Address slotAddress
            )
        {
            // 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 = blockIndex + recipeRow.RequiredBlockIndex;
            var consumableRow      = tableSheets.ConsumableItemSheet.Values.First(i =>
                                                                                  i.Id == recipeRow.ResultConsumableItemId);
            var consumable = ItemFactory.CreateItemUsable(
                consumableRow,
                Guid.Empty,
                requiredBlockIndex);
            var materials = new Dictionary <Material, int>();

            foreach (var materialInfo in recipeRow.Materials)
            {
                var materialRow = tableSheets.MaterialItemSheet.Values.First(r => r.Id == materialInfo.Id);
                var material    = ItemFactory.CreateMaterial(materialRow);
                materials[material] = materialInfo.Count;
            }

            var result = new CombinationConsumable.ResultModel
            {
                actionPoint = panel.CostAP,
                gold        = panel.CostNCG,
                materials   = materials,
                itemUsable  = consumable,
                recipeId    = recipeRow.Id,
                itemType    = ItemType.Consumable,
            };
            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);
        }
示例#3
0
 private static void UpdateCurrentAvatarState(
     ICombinationPanel combinationPanel,
     IEnumerable <(Material material, int count)> materialInfoList)