2009年7月21日火曜日

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class mainForm : Form
    {
        //ゲームレベルの最高値を表す定数
        private const int MAX_GAME_LEVEL = 15;
        //動物の種類の数を表す定数
        private const int ANIMAL_COUNT = 6;

        private int gamelevel = 1;          //ゲームレベル
        private int score = 0;              //スコア

        private int clickcount = 0;          //クリック回数
        private bool isAnswering = false;   //解答中を示すフラグ

        //規定の背景画像
        private Image defaultbackgroundImage;
        //○と×の画像
        private Image correctImage;
        private Image uncorrectImage;
        //ポイント(点数)として表示する画像からなる配列
        private Image[] pointimageArray = new Image[10];
        //解答歴に表示する画像からなる配列
        private Image[] answerimageArray = new Image[ANIMAL_COUNT];
        //動物の画像を保持しているピクチャボックスからなる配列
        private PictureBox[] showuppictureArray = new PictureBox[ANIMAL_COUNT];
        //正解を示す数値からなる配列
        private int[] answerArray = new int[MAX_GAME_LEVEL];

        public mainForm()
        {
            InitializeComponent();
        }

        private void ResetBackGround()
        {
            this.backgroundPicture.Image = defaultbackgroundImage;
        }
        private void HideAnswerPictures()
        {
            foreach (PictureBox answerbox in this.answerpicturesGroup.Controls)
            {
                answerbox.Visible = false;
            }
        }
        private void DrawImageOnBackGround(Image drawimage, int x, int y)
        {
            Bitmap canvasbitmap = new Bitmap(this.backgroundPicture.Image);
            Graphics.FromImage(canvasbitmap).DrawImage(drawimage, x - this.backgroundPicture.Left, y - this.backgroundPicture.Top);
            this.backgroundPicture.Image = canvasbitmap;
        }
        private void DrawImageOnBackGround(PictureBox drawpicture)
        {
            DrawImageOnBackGround(drawpicture.Image, drawpicture.Left, drawpicture.Top);
        }
        private void DrawImageOnBackGround(Image drawimage, PictureBox locationpicture)
        {
            int x = locationpicture.Left;
            int y = locationpicture.Top;
            DrawImageOnBackGround(drawimage, x, y);

        }

        private void DrawClearBonus(int clearbonus)
        {
            int temp = clearbonus / 10;
            if (temp / 10 > 0)
            {
                DrawImageOnBackGround(pointimageArray[temp / 10], this.clearbonuspoint1Picture);
            }
            if (temp % 10 > 0 || temp / 10 > 0)
            {
                DrawImageOnBackGround(pointimageArray[temp % 10], this.clearbonuspoint2Picture);
            }
            DrawImageOnBackGround(pointimageArray[clearbonus % 10],
                this.clearbonuspoint3Picture);
        }
        private void DrawTimeBonus(int timebonus)
        {
            int temp = timebonus / 10;
            if (temp / 10 > 0)
            {
                DrawImageOnBackGround(pointimageArray[temp / 10], this.timebonuspoint1Picture);
            }
            if ( temp % 10 > 0 || temp / 10 > 0)
            {
                DrawImageOnBackGround(pointimageArray[temp % 10], this.timebonuspoint2Picture);
            }
            DrawImageOnBackGround(pointimageArray[timebonus % 10],this.timebonuspoint3Picture);
        }
        private void QuestionStart()
        {a
            this.levelLabel.Text = gamelevel.ToString();
            ResetBackGround();
        }
        private void pictureBox9_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void プレToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void toolStripSeparator1_Click(object sender, EventArgs e)
        {

        }
    }
}

p.99まで終了。

0 コメント:

コメントを投稿