Esempio n. 1
0
        public static IClassBuilder AddSize(this IClassBuilder builder, ComponentSize size, bool when = true)
        {
            if (!when)
            {
                return(builder);
            }

            return(builder
                   .Add(ClassNames.InputComponent)
                   .Add(size switch
            {
                ComponentSize.Tiny => ClassNames.SizeTiny,
                ComponentSize.Small => ClassNames.SizeSmall,
                ComponentSize.Medium => ClassNames.SizeMedium,
                ComponentSize.Large => ClassNames.SizeLarge,
                ComponentSize.Big => ClassNames.SizeBig,
                ComponentSize.Huge => ClassNames.SizeHuge,
                ComponentSize.Massive => ClassNames.SizeMassive,
                _ => throw new ArgumentOutOfRangeException(nameof(size))
            }));
Esempio n. 2
0
        public CatalogueComponents createComponents(int height, int width, int depth, ComponentColor color, bool ifCup, string typeObj)
        {
            conn = new MySqlConnection(MyConString);
            conn.Open();

            // 0 = code, 1 = in stock, 2 = price
            string price = DbUtils.BigMoney(conn, "CustPrice", typeObj, height.ToString(), depth.ToString(), width.ToString(), EnumParse.parseColorEnumToStr(color))[0];

            conn.Close();
            conn.Open();
            string code = DbUtils.BigMoney(conn, "Code", typeObj, height.ToString(), depth.ToString(), width.ToString(), EnumParse.parseColorEnumToStr(color))[0];

            conn.Close();
            conn.Open();
            bool inStock = int.Parse(DbUtils.BigMoney(conn, "Instock", typeObj, height.ToString(), depth.ToString(), width.ToString(), EnumParse.parseColorEnumToStr(color))[0]) > 0;

            ComponentSize size = new ComponentSize(height, width, depth);

            conn.Close();

            return(new Door(double.Parse(price), typeof(Door).ToString().Split('.')[1], code, size, inStock, color, ifCup));
        }
Esempio n. 3
0
        public CatalogueComponents createComponents(int height, int width, int depth, CrossBarType crossType, string typeObj)
        {
            conn = new MySqlConnection(MyConString);
            conn.Open();

            // 0 = code, 1 = in stock, 2 = price
            typeObj = typeObj + " " + EnumParse.parseTypeEnumToStr(crossType);
            string price = DbUtils.BigMoney(conn, "CustPrice", typeObj, height.ToString(), depth.ToString(), width.ToString(), "")[0];

            conn.Close();
            conn.Open();
            string code = DbUtils.BigMoney(conn, "Code", typeObj, height.ToString(), depth.ToString(), width.ToString(), "")[0];

            conn.Close();
            conn.Open();
            bool inStock = int.Parse(DbUtils.BigMoney(conn, "Instock", typeObj, height.ToString(), depth.ToString(), width.ToString(), "")[0]) > 0;

            ComponentSize size = new ComponentSize(height, width, depth);

            conn.Close();

            return(new CrossBar(double.Parse(price), typeof(CrossBar).ToString().Split('.')[1], code, size, inStock, crossType));
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="size">
 /// /// Size of the space.(Required) <para>
 /// You can specify one of the following values: xs, sm, md, lg, xl, or xxl.
 /// The size increases in the order of listing. The default value is md.</para>
 /// </param>
 public SpacerComponent(ComponentSize size)
 {
     Size = size;
 }
Esempio n. 5
0
    static void UpdateTexture(ref Texture2D RamTexture, UnityEvent_Texture Event, byte[] Ram, ComponentSize Size, int Width = 256)
    {
        var DataLength = Ram.Length / (int)Size;
        var Height     = DataLength / Width;

        if (!Mathf.IsPowerOfTwo(Height))
        {
            Height = Mathf.NextPowerOfTwo(Height);
        }

        if (RamTexture == null || RamTexture.width != Width || RamTexture.height != Height)
        {
            RamTexture = null;
        }
        if (RamTexture == null)
        {
            var Format = Size == ComponentSize.Eight ? TextureFormat.R8 : TextureFormat.RG16;
            RamTexture            = new Texture2D(Width, Height, Format, false);
            RamTexture.filterMode = FilterMode.Point;
            RamTexture.wrapMode   = TextureWrapMode.Clamp;
        }

        var PixelData = GetTextureSizedBytes(RamTexture, Ram);

        RamTexture.LoadRawTextureData(PixelData);

        RamTexture.Apply();
        Event.Invoke(RamTexture);
    }