Пример #1
0
        protected override void Paint(
            Graphics graphics,
            Rectangle clipBounds,
            Rectangle cellBounds,
            int rowIndex,
            DataGridViewElementStates cellState,
            object value,
            object formattedValue,
            string errorText,
            DataGridViewCellStyle cellStyle,
            DataGridViewAdvancedBorderStyle advancedBorderStyle,
            DataGridViewPaintParts paintParts)
        {
            // Call the base class method to paint the default cell appearance.
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState,
                       null, null, errorText, cellStyle,
                       advancedBorderStyle, paintParts);


            //境界線の内側に範囲を取得する
            Rectangle borderRect = this.BorderWidths(advancedBorderStyle);
            Rectangle innerRect  = new Rectangle(
                cellBounds.Left + borderRect.Left,
                cellBounds.Top + borderRect.Top,
                cellBounds.Width - borderRect.Right,
                cellBounds.Height - borderRect.Bottom);

            Point middleCenter = new Point();

            middleCenter.X = innerRect.X + innerRect.Width / 2;
            middleCenter.Y = innerRect.Y + innerRect.Height / 2;

            Int32 rebirthCount = (value == null) ? 0 : (Int32)value;

            for (Int32 i = 0; i < REBIRTH_COUNT; ++i)
            {
                bool  isRebirth = (i < rebirthCount);
                Image img       = ResourceUtil.GetPictureRebirth(isRebirth);

                Int32 halfImgWidth  = img.Width / 2;
                Int32 halfImgHeight = img.Height / 2;

                Rectangle imgRect = new Rectangle(
                    middleCenter.X + img.Width * i - halfImgWidth * REBIRTH_COUNT,
                    middleCenter.Y - halfImgHeight,
                    img.Width + 0,
                    img.Height + 0);

                graphics.DrawImage(img, imgRect);
            }
        }
Пример #2
0
        /// <summary>
        /// デッキ情報のモン娘の表示を更新する
        /// </summary>
        /// <param name="deckId">出来ID</param>
        /// <param name="monmusuIndex">デッキ内の順番</param>
        public void UpdateDeckMonmusu(Int32 deckId, Int32 monmusuIndex)
        {
            DeckMonmusuInfo info = mDeckMonmusuInfos[monmusuIndex];

            // 限界突破
            if (info.rebirths != null)
            {
                Int32 rebirthCount = UserDataUtil.GetMonmusuRebirthCount(deckId, monmusuIndex);
                for (Int32 i = 0; i < info.rebirths.Length; ++i)
                {
                    PictureBox pic = info.rebirths[i];
                    if (pic != null)
                    {
                        bool  isRebirth    = (i < rebirthCount);
                        Image rebirthImgOn = ResourceUtil.GetPictureRebirth(isRebirth);
                        pic.Image = rebirthImgOn;
                    }
                }
            }

            // レアリティ
            if (info.rarity != null)
            {
                info.rarity.Text      = UserDataUtil.GetMonmusuRarityName(deckId, monmusuIndex);
                info.rarity.ForeColor = UserDataUtil.GetRarityNameColor(deckId, monmusuIndex);
            }

            // 名前
            if (info.name != null)
            {
                info.name.Text = UserDataUtil.GetMonmusuName(deckId, monmusuIndex);
            }

            // 種族名
            if (info.race != null)
            {
                info.race.Text = UserDataUtil.GetRaceName(deckId, monmusuIndex);
            }

            // 属性
            if (info.element != null)
            {
                Int32 element = UserDataUtil.GetMonmusuElement(deckId, monmusuIndex);
                ResourceUtil.ElementType elementType = (ResourceUtil.ElementType)element;
                info.element.Image = ResourceUtil.GetPictureElement(elementType);
            }

            // レベル
            if (info.level != null)
            {
                info.level.Text = UserDataUtil.GetMonmusuLevel(deckId, monmusuIndex).ToString();
            }

            // HP
            if (info.hpValue != null && info.hpBar != null)
            {
                Int32 hp = UserDataUtil.GetMonmusuHP(deckId, monmusuIndex);
                info.hpValue.Text = hp.ToString();

                Int32 hpMax = UserDataUtil.GetMonmusuHPMax(deckId, monmusuIndex);
                info.hpBar.Minimum = 0;
                info.hpBar.Maximum = hpMax;
                info.hpBar.Value   = hp;
            }

            // テンション
            if (info.tensionValue != null && info.tensionBar != null)
            {
                Int32 tension = UserDataUtil.GetMonmusuTension(deckId, monmusuIndex);
                info.tensionValue.Text  = tension.ToString();
                info.tensionBar.Minimum = 0;
                info.tensionBar.Maximum = 100;
                info.tensionBar.Value   = Math.Min(tension, progressBarDeckMonmusuTension1.Maximum);
            }

            // 満腹度
            if (info.satietyValue != null && info.satietyBar != null)
            {
                String satietyText = UserDataUtil.GetMonmusuSatietyText(deckId, monmusuIndex);
                info.satietyValue.Text = satietyText;

                Int32 satiety    = UserDataUtil.GetMonmusuSatiety(deckId, monmusuIndex);
                Int32 satietyMax = UserDataUtil.GetMonmusuSatietyMax(deckId, monmusuIndex);
                info.satietyBar.Minimum = 0;
                info.satietyBar.Maximum = satietyMax;
                info.satietyBar.Value   = satiety;
            }

            // 好物
            if (info.likeFood != null)
            {
                info.likeFood.Image = UserDataUtil.GetMonmusuLikeFoodPicture(deckId, monmusuIndex);
            }
        }