Пример #1
0
 public static ChestEvent Serdes(ChestEvent e, AssetMapping mapping, ISerializer s, TextId textSourceId)
 {
     if (s == null)
     {
         throw new ArgumentNullException(nameof(s));
     }
     e ??= new ChestEvent(textSourceId);
     e.PickDifficulty = s.UInt8(nameof(PickDifficulty), e.PickDifficulty);
     e.KeyItemId      = ItemId.SerdesU16(nameof(KeyItemId), e.KeyItemId, AssetType.Item, mapping, s);
     e.UnlockedTextId = s.UInt8(nameof(UnlockedTextId), e.UnlockedTextId);
     e.InitialTextId  = s.UInt8(nameof(InitialTextId), e.InitialTextId);
     e.ChestId        = ChestId.SerdesU16(nameof(ChestId), e.ChestId, mapping, s);
     return(e);
 }
Пример #2
0
 public static ChestEvent Parse(string[] args)
 {
     if (args == null)
     {
         throw new ArgumentNullException(nameof(args));
     }
     return(new ChestEvent(TextId.None)
     {
         ChestId = ChestId.Parse(args[1]),
         PickDifficulty = args.Length > 2 ? byte.Parse(args[2], CultureInfo.InvariantCulture) : (byte)0,
         InitialTextId = args.Length > 3 ? byte.Parse(args[3], CultureInfo.InvariantCulture) : (byte)255,
         UnlockedTextId = args.Length > 4 ? byte.Parse(args[4], CultureInfo.InvariantCulture) : (byte)255,
         KeyItemId = args.Length > 5 ? ItemId.Parse(args[5]) : ItemId.None,
     });
 }
Пример #3
0
    public InventoryChestPane(ChestId id)
    {
        On <InventoryChangedEvent>(e =>
        {
            if (e.Id != new InventoryId(_id))
            {
                return;
            }

            UpdateBackground();
        });

        _id         = id;
        _background = new UiSpriteElement(Base.Picture.OpenChestWithGold);

        var backgroundStack = new FixedPositionStack();

        backgroundStack.Add(_background, 0, 0);
        AttachChild(backgroundStack);

        var slotSpans = new IUiElement[InventoryHeight];

        for (int j = 0; j < InventoryHeight; j++)
        {
            var slotsInRow = new IUiElement[InventoryWidth];
            for (int i = 0; i < InventoryWidth; i++)
            {
                int index = j * InventoryWidth + i;
                slotsInRow[i] = new LogicalInventorySlot(new InventorySlotId(_id, (ItemSlotId)((int)ItemSlotId.Slot0 + index)));
            }
            slotSpans[j] = new HorizontalStack(slotsInRow);
        }

        var slotStack     = new VerticalStack(slotSpans);
        var slotHalfFrame = new ButtonFrame(slotStack)
        {
            Theme = ButtonTheme.InventoryOuterFrame, Padding = -1
        };
        var goldButton = new LogicalInventorySlot(new InventorySlotId(_id, ItemSlotId.Gold));
        var foodButton = new LogicalInventorySlot(new InventorySlotId(_id, ItemSlotId.Rations));

        var takeAllButton =
            new Button(
                (UiElement) new UiTextBuilder(TextId.From(Base.UAlbionString.TakeAll)).Center()
                ).OnClick(() => Raise(new InventoryTakeAllEvent(_id)));

        var header            = new Header(Base.SystemText.Chest_Chest);
        var moneyAndFoodStack = new HorizontalStack(goldButton, takeAllButton, foodButton);

        var stack = new VerticalStack(
            header,
            slotHalfFrame,
            new Spacing(0, 78),
            moneyAndFoodStack
            )
        {
            Greedy = false
        };

        AttachChild(stack);
    }
Пример #4
0
 public InventoryTakeAllEvent(ChestId chestId) => ChestId = chestId;
Пример #5
0
 public SetInventoryChestModeEvent(ChestId chestId, PartyCharacterId member)
 {
     ChestId = chestId;
     Member  = member;
 }