Example #1
0
    /// <summary>
    /// 尝试补足拖拽
    /// </summary>
    private void TrySupplementDrag(Vector2 pDragPosOffset, float pDragTimeOffset)
    {
        if (mEnalbDragSupplement == false)
        {
            return;
        }

        SupplementType tSupplementType         = GetDragSupplementType(pDragPosOffset, pDragTimeOffset);
        int            tMaxDragSupplementIndex = mGridArrangeBase.GetMaxDragSupplementIndex();

        int tDragSupplementIndex = mDragSupplementIndex;

        switch (tSupplementType)
        {
        case SupplementType.Ceil:
            tDragSupplementIndex = Mathf.Min(tMaxDragSupplementIndex, tDragSupplementIndex + 1);
            break;

        case SupplementType.Floor:
            tDragSupplementIndex = Mathf.Max(0, tDragSupplementIndex - 1);
            break;
        }

        mDragSupplementIndex = tDragSupplementIndex;

        Vector2 tTargetPos = mGridArrangeBase.GetDragSupplemnetAnchorPos(mDragSupplementIndex);

        StartScrollToTargetPos(tTargetPos, mDrageSupplementVelocity);
    }
        internal override string FormatType(INdrFormatterInternal context)
        {
            string comment = $"FC_SUPPLEMENT {BaseType}";

            if (SupplementType is NdrBaseStringTypeReference)
            {
                comment = $"{comment} Range({Argument1}, {Argument2})";
            }
            else if (SupplementType is NdrHandleTypeReference)
            {
                comment = $"{comment} Flags: {Argument1:X} ContextID: {Argument2:X})";
            }

            return($"{context.FormatComment(comment)} {SupplementType.FormatType(context)}");
        }
Example #3
0
        public async Task <bool> EditAsync(int id, string name, string description, string brand,
                                           string imageUrl, SupplementType supplementType, decimal price, int quantity, bool inStock)
        {
            var supplement = await this.db.Supplements.Where(a => a.Id == id).FirstOrDefaultAsync();

            if (supplement == null)
            {
                return(false);
            }

            supplement.Name           = name;
            supplement.Description    = description;
            supplement.Brand          = brand;
            supplement.ImageUrl       = imageUrl;
            supplement.SupplementType = supplementType;
            supplement.Price          = price;
            supplement.Quantity       = quantity;
            supplement.inStock        = inStock;

            await this.db.SaveChangesAsync();

            return(true);
        }
 public void AddSupplementType(SupplementType supplementType, double supplementPrice)
 {
     SupplementTypes[supplementType] = supplementPrice;
 }
Example #5
0
        public async Task CreateAsync(string name, string description, string brand, string imageUrl, SupplementType supplementType, decimal price, int quantity)
        {
            var supplement = new Supplement
            {
                Name           = name,
                Description    = description,
                Brand          = brand,
                ImageUrl       = imageUrl,
                SupplementType = supplementType,
                Price          = price,
                Quantity       = quantity
            };

            this.db.Supplements.Add(supplement);
            await this.db.SaveChangesAsync();
        }