예제 #1
0
파일: Cloth.cs 프로젝트: KnYaZuK/OOP
 public Cloth(weartype _WearType, material _Material, size _Size, color _Color)
 {
     WearType = _WearType;
     Material = _Material;
     Size     = _Size;
     Color    = _Color;
 }
예제 #2
0
        public string GetName(size animalSize, bool animalEatsMeat)
        {
            if (animalEatsMeat)
            {
                switch (animalSize)
                {
                case size.small:
                    return("SmallCarn");

                case size.medium:
                    return("MediumCarn");

                case size.large:
                    return("LargeCarn");
                }
            }

            switch (animalSize)
            {
            case size.small:
                return("SmallHerb");

            case size.medium:
                return("MediumHerb");

            case size.large:
                return("LargeHerb");
            }
            throw new ArgumentOutOfRangeException();
        }
예제 #3
0
        public Waiter(string text, Font font)
        {
            _text = text;
            _font = font;

            // Determine required size
            size sz = FontManager.ComputeExtentEx(font, text);

            _w = sz.Width + 80;
            _h = sz.Height;
            if (_h < 32)
            {
                _h = 32;
            }
            _h += 32;

            // Now make sure we're within the screen width
            if (_w > Core.ScreenWidth - 32)
            {
                _w = Core.ScreenWidth - 32;
            }
            if (_h > Core.ScreenHeight - 32)
            {
                _h = Core.ScreenHeight - 32;
            }
            _x = Core.ScreenWidth / 2 - _w / 2;
            _y = Core.ScreenHeight / 2 - _h / 2;

            _iy = _y + (_h / 2 - 16);
            _ty = _y + (_h / 2 - sz.Height / 2);
        }
예제 #4
0
        public static void Show(string text, Font font, Bitmap image)
        {
            if (image == null)
            {
                Show(text, font);
                return;
            }

            size sz = FontManager.ComputeExtentEx(font, text);
            var  ov = new Overlay();

            sz.Width += image.Width + 8;
            if (sz.Height < image.Height)
            {
                sz.Height = image.Height;
            }

            ov.Size        = new size(sz.Width + 16, sz.Height + 8);
            ov.Position    = new point(Core.ScreenWidth / 2 - ov.Size.Width / 2, 8);
            ov.Image       = image;
            ov.BackColor   = Colors.Black;
            ov.BorderColor = Colors.White;
            ov.ForeColor   = Colors.White;
            ov.Text        = text;
            ov.Opacity     = 256;
            ov.FadeAfter   = 1.5;
            ov.Font        = font;

            new Thread(() => Core.ScreenOverlay = ov).Start();
        }
예제 #5
0
            public override void Initialize(size videosize, long timebase)
            {
                base.Initialize(videosize, timebase);

                using (var lck = this.Display.Renderer.GetDrawLock())
                {
                    this.vertices = new vertices <vertex>(
                        new vertex[] { new vertex(new Vector3(0, -1, 0)), new vertex(new Vector3(-1, 1, 0)), new vertex(new Vector3(1, 1, 0)) });

                    vertices.define("position", "pos");

                    this.shader = new shader(
                        @"#version 150 core

in vec4 position;
void main()
{
gl_Position = position;
}",
                        @"#version 150 core
precision mediump float;

out vec4 outColor;

void main()
{
    outColor = vec4(1,0,0,1);
}
",
                        this.vertices);
                }
            }
예제 #6
0
        //ADD
        public ActionResult Add(string size, int cat)
        {
            try
            {
                int assignedID = 0;
                using (linqDBContext db = new linqDBContext())
                {
                    size lt = new size();
                    lt.mainCatID = cat;
                    lt.size1     = size;
                    db.sizes.Add(lt);
                    db.SaveChanges();
                    assignedID = lt.id;
                }

                return(Json(new JsonResult()
                {
                    Data = assignedID
                }, JsonRequestBehavior.AllowGet));
            }
            catch (ApplicationException m)
            {
                return(Json(new { status = "error", Data = m.Message }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception x)
            {
                return(Json(new { status = "error", Data = x.Message }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #7
0
        public Race(string name, int str, int dex, int con, int intel, int wis, int cha, int baseSpeed, size size, bool common, bool dwarf, bool elf, bool giant, bool gnome, bool goblin, bool halfling, bool orc, bool abyssal, bool celestial, bool draconic, bool deepSpeech, bool infernal, bool primordial, bool sylvan, bool undercommon)
        {
            Languages   = new bool[16];
            AbiBonus    = new int[6];
            Subraces    = new List <string>();
            Name        = name;
            Size        = size;
            BaseSpeed   = baseSpeed;
            AbiBonus[0] = str;
            AbiBonus[1] = dex;
            AbiBonus[2] = con;
            AbiBonus[3] = intel;
            AbiBonus[4] = wis;
            AbiBonus[5] = cha;

            Languages[0]  = common;
            Languages[1]  = dwarf;
            Languages[2]  = elf;
            Languages[3]  = giant;
            Languages[4]  = gnome;
            Languages[5]  = goblin;
            Languages[6]  = halfling;
            Languages[7]  = orc;
            Languages[8]  = abyssal;
            Languages[9]  = celestial;
            Languages[10] = draconic;
            Languages[11] = deepSpeech;
            Languages[12] = infernal;
            Languages[13] = primordial;
            Languages[14] = sylvan;
            Languages[15] = undercommon;
        }
예제 #8
0
        static void Main(string[] args)
        {
            var bgWorker = new BackgroundWorker();

            bgWorker.WorkerReportsProgress = true;

            bgWorker.DoWork += (sender, e) =>
            {
                lacie BackupDrive = new lacie();
                BackupDrive.findLacie();

                xml xmlFile = new xml();
                xmlFile.ProcessXML();

                size BackupSize = new size();
                BackupSize.GetSize(xmlFile.Path);

                int SizeofBackup = (int)(((BackupSize.BackupSize) / 1024f) / 1024f) / 1024;
                Console.WriteLine("Drive Letter: " + BackupDrive.Drive);
                Console.WriteLine("Volume Name: " + BackupDrive.VolumeLabel);
                Console.WriteLine("Free Space: " + Convert.ToString(BackupDrive.AvailableSize) + "G");
                Console.WriteLine("Size of Lacie: " + Convert.ToString(BackupDrive.TotalSize) + "G");
                Console.WriteLine("Backup Size: " + Convert.ToString(SizeofBackup + "G"));
                Console.WriteLine("Backing up " + BackupSize.FileCount + " files found in " + BackupSize.FolderCount + " folders.");
                Console.ReadKey(true);
            };

            bgWorker.RunWorkerCompleted += (sender, e) => Console.WriteLine("completed...");
            bgWorker.ProgressChanged    += (sender, e) => Console.WriteLine("progressing...");


            bgWorker.RunWorkerAsync();
        }
예제 #9
0
    protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        try
        {
            //Lấy data
            size obj = (size)e.Item.DataItem;
            if (obj == null)
            {
                return;
            }
            //Set ID (unique id)

            HtmlInputCheckBox cbxSelect = e.Item.FindControl("cbxcheck") as HtmlInputCheckBox;
            if (cbxSelect != null)
            {
                uID = obj.ID;
                cbxSelect.Attributes.Add("uid", obj.ID.ToString());
            }
            //set image
            ImageButton btnDelete = e.Item.FindControl("btnDelete") as ImageButton;
            if (btnDelete != null)
            {
                btnDelete.ImageUrl = "~/Images/delete.gif";
            }
        }
        catch (Exception ex)
        {
            Global.WriteLogError("rptData_ItemDataBound : " + ex);
        }
    }
예제 #10
0
        public ProgressWaiter(string text, Font font, long minimum, long maxmimum, long value, bool largeSize = false)
        {
            _text = text;
            _font = font;

            _min   = minimum;
            _max   = maxmimum;
            _value = value;

            // Determine required size
            size sz = FontManager.ComputeExtentEx(font, text);

            _w  = sz.Width + 32;
            _h  = sz.Height;
            _h += 64;

            // Add Progressbar Height
            _large = largeSize;
            _h    += (largeSize) ? 22 : 15;

            // Now make sure we're within the screen width
            if (_w > Core.Screen.Width - 32)
            {
                _w = Core.Screen.Width - 32;
            }
            if (_h > Core.Screen.Height - 32)
            {
                _h = Core.Screen.Height - 32;
            }
            _x = Core.Screen.Width / 2 - _w / 2;
            _y = Core.Screen.Height / 2 - _h / 2;

            //_iy = y + (h / 2 - 16);
            //_ty = y + (h / 2 - sz.Height / 2);
        }
예제 #11
0
    private void IniUpdate(int ID)
    {
        Data objdata = new Data(Global.ConnectionSql);

        try
        {
            size obj = new size();
            obj.DataObject = objdata;

            if (obj.GetByID(ID))
            {
                txtType.Text   = obj.Width;
                txtValue.Text  = obj.Height;
                Handle         = HandleValue.Edit;
                lblHandle.Text = "Sửa kích thước";
                mdPopup.Show();
            }
        }
        catch (Exception ex)
        {
            Global.WriteLogError("IniUpdate() " + ex);
        }
        finally
        {
            objdata.DeConnect();
        }
    }
예제 #12
0
    static void Main(string[] args)
    {
        size BackupSize = new size();

        BackupSize.GetSize("path");
        BackupSize.ProgressEvent += new ProgressEventHandler(BackupSize_ProgressEvent);
        Console.ReadLine();
    }
예제 #13
0
        public ActionResult DeleteConfirmed(long id)
        {
            size size = db.sizes.Find(id);

            db.sizes.Remove(size);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #14
0
        public static void SetBackground(this Control control, Bitmap bitmap)
        {
            /*Parametri accettati dalla procedura:
             * control = il form o controllo da renderizzare
             * bitmap = la PNG da utilizzare come sfondo*/

            // Imposta le dimensioni del controllo come quelle della bitmap
            control.Width  = bitmap.Width;
            control.Height = bitmap.Height;

            if (bitmap.PixelFormat != PixelFormat.Format32bppArgb)
            {
                throw new ApplicationException("L'immagine deve essere in formato a 32 bpp con canale alpha");
            }

            IntPtr hBitmap   = IntPtr.Zero;
            IntPtr oldBitmap = IntPtr.Zero;

            IntPtr screenDc = GetDC(IntPtr.Zero);
            IntPtr memDc    = CreateCompatibleDC(screenDc);

            try
            {
                hBitmap   = bitmap.GetHbitmap(Color.FromArgb(0));
                oldBitmap = SelectObject(memDc, hBitmap);

                size  size        = new size(bitmap.Width, bitmap.Height);
                point pointSource = new point(control.Left, control.Top);
                point topPos      = new point(0, 0);

                BLENDFUNCTION blend = new BLENDFUNCTION();
                blend.BlendOp             = 0;
                blend.BlendFlags          = 0;
                blend.SourceConstantAlpha = byte.MaxValue;
                blend.AlphaFormat         = 1;

                UpdateLayeredWindow(control.Handle, screenDc, ref topPos, ref size,
                                    memDc, ref pointSource, 0, ref blend, 2);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ReleaseDC(IntPtr.Zero, screenDc);

                if (hBitmap != IntPtr.Zero)
                {
                    SelectObject(memDc, oldBitmap);
                    DeleteObject(hBitmap);
                }

                DeleteDC(memDc);
            }
        }
예제 #15
0
 private void Ctl_SizeChanged(object sender, EventArgs e)
 {
     _layer?.StopRenderingScene();
     this.viewsize = new size(Convert.ToInt32(window.ActualWidth), Convert.ToInt32(window.ActualHeight));
     _layer?.rec.Arrange(new Rect(0, 0, this.window.ActualWidth, this.window.ActualHeight));
     _layer?.rec.UpdateLayout();
     _layer?.BeginRenderingScene();
     //     this._layer?.rec.Arrange(new Rect(0, 0, this.window.ActualWidth, this.window.ActualHeight));
     //this.viewsize = this.ctl.ClientSize;
 }
        public bool ConDishesSizeMediumLarge(Dish d) //(condition for the delegate)checks if the size is large
        {
            size s = (size)3;                        //large

            if (d.dishSize == s)
            {
                return(true);
            }
            return(false);
        }
        public bool ConDishesSizeMedium(Dish d) //(condition for the delegate)checks if the size is medium
        {
            size s = (size)2;                   //medium

            if (d.dishSize == s)
            {
                return(true);
            }
            return(false);
        }
        public bool ConDishesSizeSmall(Dish d) //(condition for the delegate)checks if the size is small
        {
            size s = (size)1;                  //small

            if (d.dishSize == s)
            {
                return(true);
            }
            return(false);
        }
예제 #19
0
 public ActionResult Edit([Bind(Include = "id,size_name")] size size)
 {
     if (ModelState.IsValid)
     {
         db.Entry(size).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(size));
 }
예제 #20
0
 public void get_image_size(string src, string baseurl, out size sz)
 {
     sz = new size();
     make_url(src, baseurl, out var url);
     if (_images.TryGetValue(url, out var img) && img is Texture tex)
     {
         sz.width  = tex.width;
         sz.height = tex.height;
     }
 }
예제 #21
0
파일: Listbox.cs 프로젝트: valoni/Tinkr
 public Listbox(string name, Font font, int x, int y, int width, int height, bool displayCheckboxes, bool displayImages, size imageSize) :
     base(name, x, y, width, height)
 {
     _font           = font;
     _showCheckboxes = displayCheckboxes;
     _showImages     = displayImages;
     _imgSize        = imageSize;
     DefaultColors();
     _recalc = true;
 }
예제 #22
0
 //constructor
 public Dish(int dishnumber, string dishname, size dishsize, float dishprice, int rate, hechsher hechsherr, int calories)
 {
     dishNumber = dishnumber;
     dishName   = dishname;
     dishSize   = dishsize;
     dishPrice  = dishprice;
     Hechsher   = hechsherr;
     Calories   = calories;
     Rate       = rate;
 }
예제 #23
0
        protected override void GetImageSize(string imageUrl, ref size size)
        {
            var imageHolder = GetCacheImage(imageUrl);

            if (imageHolder != null)
            {
                size.width  = (int)imageHolder.Size.Width;
                size.height = (int)imageHolder.Size.Height;
            }
        }
예제 #24
0
        protected override void GetImageSize(string image, ref size size)
        {
            var bmp = LoadImage(image);

            if (bmp != null)
            {
                size.width  = bmp.PixelWidth;
                size.height = bmp.PixelHeight;
            }
        }
예제 #25
0
 public void get_image_size(string src, string baseurl, out size sz)
 {
     sz = new size();
     make_url(src, baseurl, out var url);
     if (_images.TryGetValue(url, out var img) && img is GameObject bmp)
     {
         //sz.width = bmp.Width;
         //sz.height = bmp.Height;
     }
 }
예제 #26
0
 public void get_image_size(string src, string baseurl, Dictionary <string, string> attrs, out size sz)
 {
     sz = new size();
     make_url(src, baseurl, out var url);
     if (_images.TryGetValue(url, out var img) && img is Bitmap bmp)
     {
         sz.width  = bmp.Width;
         sz.height = bmp.Height;
     }
 }
예제 #27
0
        public ActionResult Create([Bind(Include = "id,size_name")] size size)
        {
            if (ModelState.IsValid)
            {
                db.sizes.Add(size);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(size));
        }
예제 #28
0
    private void SetNewSizeObjects(size newSize)
    {
        // Add immunity timer if this change was a growth.
        if (currentSpriteSize < newSize)
        {
            SetImmunityTimer(statsMap[newSize].immunityTime);
        }

        SetColliderActive(currentSpriteSize, false);
        currentSpriteSize = newSize;
        SetColliderActive(currentSpriteSize, true);
    }
예제 #29
0
    static void Main(string[] args)
    {
        size BackupSize = new size();

        BackupSize.GetSize("path");
        BackupSize.ProgressEvent += new ProgressEventHandler(BackupSize_ProgressEvent);
        // BackupSize.BackupSize will not be accurate until the thread is finished.
        // You may want to take that into consideration
        int SizeofBackup = (int)(((BackupSize.BackupSize) / 1024f) / 1024f) / 1024;

        Console.ReadLine();
    }
예제 #30
0
        public void get_asset_size(string src, string baseurl, Dictionary <string, string> attributes, out size sz)
        {
            var provider = AssetManager.Find();

            sz = new size();
            make_url(src, baseurl, out var url);
            var key = provider.MakeKey(url, attributes);

            if (_assets.TryGetValue(url, out var asset) && asset is Bitmap bmp)
            {
                sz.width  = bmp.Width;
                sz.height = bmp.Height;
            }
        }
			this._gameBoard = new GameBoard(size, state);
예제 #32
0
        size TrueSize(IBitmapCore hdp)
        {
            CrotateStageOperationParameters pm = (CrotateStageOperationParameters)Parameters;

            int trueWidth = hdp.Width, trueHeight = hdp.Height;

            double w1, h1;

            w1 = pm.CropWidth * hdp.Width;
            h1 = pm.CropHeight * hdp.Height;

            double asp_rat;

            if (pm.AspectRatioCustom)
                asp_rat = pm.AspectRatio;
            else
                asp_rat = pm.PresetAspectRatioValues[pm.AspectRatioPreset];

            switch (pm.Mode)
            {
            case Mode.Disproportional:
                trueWidth = (int)w1;
                trueHeight = (int)h1;
                break;
            case Mode.ProportionalWidthFixed:
                trueWidth = (int)w1;
                trueHeight = (int)(w1 / asp_rat);
                break;
            case Mode.ProportionalHeightFixed:
                trueWidth = (int)(h1 * asp_rat);
                trueHeight = (int)h1;
                break;
            }

            size res = new size();
            res.width = trueWidth; res.height = trueHeight;
            return res;
        }
예제 #33
0
 public static void Unlock()
 {
     xrState = size.mutate;
     yrState = size.mutate;
     vState = moving.straight;
     hState = moving.straight;
 }
예제 #34
0
 public static void LockRadius(float x, float y)
 {
     // lerp to x and y radii
     xrState = size.target;
     yrState = size.target;
     yRadiusTarget = y;
     xRadiusTarget = x;
 }
예제 #35
0
 public static void LockRadius(float radius)
 {
     // lerp to circular shape
     xrState = size.target;
     yrState = size.target;
     yRadiusTarget = radius;
     xRadiusTarget = radius;
 }
예제 #36
0
 public static void LockRadius()
 {
     // prevent size changes
     xrState = size.locked;
     yrState = size.locked;
 }