コード例 #1
0
        private void ChangeColor(LimitedValue value)
        {
            this.Maximum = value.Maximum;
            this.Minimum = value.Minimum;
            this.Value   = value.Current;

            Color color;
            var   percentage = value.Maximum == 0 ? 0.0 : value.Current / (double)value.Maximum;

            // 0.25 以下のとき、「大破」
            if (percentage <= 0.25)
            {
                color = Color.FromRgb(255, 32, 32);
            }

            // 0.5 以下のとき、「中破」
            else if (percentage <= 0.5)
            {
                color = Color.FromRgb(240, 128, 32);
            }

            // 0.75 以下のとき、「小破」
            else if (percentage <= 0.75)
            {
                color = Color.FromRgb(240, 240, 0);
            }

            // 0.75 より大きいとき、「小破未満」
            else
            {
                color = Color.FromRgb(64, 200, 32);
            }

            this.Foreground = new SolidColorBrush(color);
        }
コード例 #2
0
 public Modernizable(LimitedValue masterdata, int upgradedata, int showdata)
 {
     Default   = masterdata.Current;
     Max       = masterdata.Max;
     Upgrated  = upgradedata;
     ShowValue = showdata;
 }
コード例 #3
0
 public Modernizable(LimitedValue masterdata, int upgradedata, int showdata)
 {
     Default = masterdata.Current;
     Max = masterdata.Max;
     Upgrated = upgradedata;
     ShowValue = showdata;
 }
コード例 #4
0
ファイル: FleetView.cs プロジェクト: ForteEscape/BeerViewer
        private void DrawProgress(Graphics g, Rectangle size, LimitedValue HP, int Separates = 4)
        {
            Color color = GetHPColor(HP);

            int width = 0;

            if (HP.Maximum - HP.Minimum > 0)
            {
                width = (HP.Current - HP.Minimum) * size.Width / (HP.Maximum - HP.Minimum);
            }

            using (SolidBrush b = new SolidBrush(Color.FromArgb(0x44, 0x90, 0x90, 0x90)))
                g.FillRectangle(b, size);

            using (SolidBrush b = new SolidBrush(color))
                g.FillRectangle(b, new Rectangle(size.Left, size.Top, width, size.Height));

            using (Pen p = new Pen(frmMain.Instance.BackColor, 1.0f))
            {
                for (var i = 1; i <= (Separates - 1); i++)
                {
                    g.DrawLine(p, size.Left + (size.Width * i / Separates), size.Top, size.Left + (size.Width * i / Separates), size.Top + size.Height / 2 - 1);
                }
            }
        }
コード例 #5
0
        private Color GetHPColor(LimitedValue HP)
        {
            double ratio = 0;

            if (HP.Maximum - HP.Minimum > 0)
            {
                ratio = (double)(HP.Current - HP.Minimum) / (HP.Maximum - HP.Minimum);
            }

            if (ratio <= 0.25)             // 대파
            {
                return(Color.FromArgb(255, 32, 32));
            }
            else if (ratio <= 0.5)             // 중파
            {
                return(Color.FromArgb(240, 128, 32));
            }
            else if (ratio <= 0.75)             // 소파
            {
                return(Color.FromArgb(240, 240, 0));
            }
            else             // 정상
            {
                return(Color.FromArgb(64, 200, 32));
            }
        }
コード例 #6
0
ファイル: QuestTarget.cs プロジェクト: huoyaoyuan/AdmiralRoom
 public QuestTarget(ICounter counter, int questid, QuestPeriod period, int max, int sharedwith = 0, string description = "")
 {
     Counter = counter;
     counter.Increased += Increase;
     QuestId = questid;
     Period = period;
     Progress = new LimitedValue(0, max);
     Description = description;
     sharedwithid = sharedwith;
 }
コード例 #7
0
 protected AerialBase(sortie_battle_old.airbattle api)
 {
     if (api.api_stage1 != null)
     {
         FriendStage1 = new LimitedValue(api.api_stage1.api_f_count - api.api_stage1.api_f_lostcount, api.api_stage1.api_f_count);
         EnemyStage1  = new LimitedValue(api.api_stage1.api_e_count - api.api_stage1.api_e_lostcount, api.api_stage1.api_e_count);
     }
     if (api.api_stage2 != null)
     {
         FriendStage2 = new LimitedValue(api.api_stage2.api_f_count - api.api_stage2.api_f_lostcount, api.api_stage2.api_f_count);
         EnemyStage2  = new LimitedValue(api.api_stage2.api_e_count - api.api_stage2.api_e_lostcount, api.api_stage2.api_e_count);
     }
 }
コード例 #8
0
        private void ChangeColor(LimitedValue value)
        {
            this.Maximum = value.Maximum;
            this.Minimum = value.Minimum;
            this.Value   = value.Current;

            var percentage = value.Current / (double)value.Maximum;
            var color      = percentage > 0.5
                                ? Color.FromRgb((byte)(180 - 140 * ((percentage - 0.5) * 2)), 180, 0)
                                : Color.FromRgb(180, (byte)(40 + 140 * (percentage * 2)), 0);

            this.Foreground = new SolidColorBrush(color);
        }
コード例 #9
0
 public RoomGenerator(int attempts, LimitedValue width, LimitedValue height,
                      int mapWidth, int mapHeight)
 {
     _board         = new GameObject("Board").transform;
     this.attempts  = attempts;
     this.width     = width;
     this.height    = height;
     this.mapWidth  = mapWidth;
     this.mapHeight = mapHeight;
     currentRegion  = -1;
     rooms          = new List <Room>();
     regions        = new int[mapWidth, mapHeight];
 }
コード例 #10
0
        /// <summary>
        /// Calls after new <see cref="LimitedValue"/> given.
        /// </summary>
        /// <param name="value"></param>
        private void ChangeColor(LimitedValue value)
        {
            this.Maximum  = value.Maximum;
            this.Minimum  = value.Minimum;
            this.Value    = value.Current;
            this.Previous = value.Previous < this.Minimum ? this.Minimum : (value.Previous > this.Maximum ? this.Maximum : value.Previous);

            Color color;
            var   percentage = value.Maximum == 0 ? 0.0 : value.Current / (double)value.Maximum;

            // 0.25 以下のとき、「大破」
            if (percentage <= 0.25)
            {
                color = Color.FromRgb(255, 32, 32);
            }

            // 0.5 以下のとき、「中破」
            else if (percentage <= 0.5)
            {
                color = Color.FromRgb(240, 128, 32);
            }

            // 0.75 以下のとき、「小破」
            else if (percentage <= 0.75)
            {
                color = Color.FromRgb(240, 240, 0);
            }

            // 0.75 より大きいとき、「小破未満」
            else if (percentage < 1.0)
            {
                color = Color.FromRgb(64, 200, 32);
            }

            // 1 (100%)
            // else color = Color.FromRgb(40, 160, 240); // Blue one
            // else color = Color.FromRgb(40, 144, 16); // Deep green one
            else
            {
                color = FullColor;
            }

            this.Foreground = new SolidColorBrush(color);
        }
コード例 #11
0
        public static Enums.ShipStatus ShipStatus(this LimitedValue limitedValue)
        {
            var percentage = limitedValue.Percentage();

            if (percentage <= 0.25)
            {
                return(Enums.ShipStatus.SevereDamage);
            }
            else if (percentage <= 0.5)
            {
                return(Enums.ShipStatus.ModerateDamage);
            }
            else if (percentage <= 0.75)
            {
                return(Enums.ShipStatus.MinorDamage);
            }
            else
            {
                return(Enums.ShipStatus.Normal);
            }
        }
コード例 #12
0
ファイル: Calculator.cs プロジェクト: uttm/KanColleViewer
 public static bool IsHeavilyDamage(this LimitedValue hp)
 {
     return((hp.Current / (double)hp.Maximum) <= 0.25);
 }
コード例 #13
0
 public static double Percentage(this LimitedValue limitedValue)
 {
     return(limitedValue.Maximum == 0 ? 0.0 : limitedValue.Current / (double)limitedValue.Maximum);
 }
コード例 #14
0
 /// <summary>大破しているか</summary>
 public static bool IsHeavilyDamage(this LimitedValue hp) => (hp.Current / (decimal)hp.Maximum) <= (decimal)0.25;