C#代写:CAB201 Yahtzee Part A

Introduction

这次需要代写的是Yahtzee,也就是快艇骰子。语言是C#,从零开始写,包括界面设计以及游戏逻辑。整个作业长达6周,每周会出一个新的需求,工作量不小。
Part A是需要完成游戏的基本UI布局,包括button, label, checkbox等,并且需要按照需求修改样式。

The Task

You are to implement a prototype of a computerised version of Yahtzee. You are required to

  1. Use Windows Forms, rather than other GUI technologies such as WPF, XNA, web-pages, game engines, etc. (If you don’t know what some of these acronyms mean, that’s fine. Just ignore them.)
  2. Develop the game which will play the game according to the specified rules which will be explained in a later update of this assignment.
  3. Produce a GUI layout which will be described in this and subsequent specification releases.

The Objective of Part A

This objective of part A of the assignment is to begin the implementation of the GUI form which will look like the following screenshot.
Your form’s BackColor is your choice. The screenshot used “Dodger Blue” which is one of many colours available on the Web Tab of BackColor Property.
This specification will include some specific Property requirements for the different labels, buttons and checkboxes that are on the form.

Project folder

Open the Solution file Yahtzee Game.sln and then open Form1.cs
You will see that the form contains a SplitContainer which has divided the form into two Panels: one on the left, for the labels, buttons and checkboxes in previous screenshot; and one on the right for some other controls which will be introduced in a later specification.
You can’t really see the SplitContainer, just its two panels. The SplitContainer is docked in its parent container, so that its panels occupy the whole of the form, i.e. its Dock property = Fill. (This is the default behaviour when you add a SplitContainer to a form, so you shouldn’t have to do anything. But if you accidentally change this property, your form will look a mess.) This control is complete. Its position on the form is correct. Do not move it.
If you execute the project the following form is displayed, though not in the size shown below.

The GUI controls

The main form of the game is shown below entirely within Panel 1. The top part of the panel has labels for five dice and a button to click to roll the dice. Below that are five checkboxes, one for each die to stop the die from being rolled, with a label that explains this. Next is a label (the message label) which tells the player what they are to do next. The possible messages that can appear on this label for the basic game play include: “Roll 1”, “Roll 2 or choose a combination to score”, “Roll 3 or choose a combination to score”, “Choose a combination to score”, “Your turn has ended - click OK”. The OK button will appear below the message label at the appropriate time.
The rest of the panel shows the information for the Player. It shows the player’s name (Player label) and the score label for any combination that the player has attempted. Any combinations not attempted will be blank. There are 13 buttons, one for each combination. There are also some sub-total and total values, including a Grand Total that will be shown when the game has finished.

Start to Develop the GUI

The following describes some essential features of some controls. Any control not explicitly mentioned should be placed on the form as per the screenshot. Choose sensible names if none are stated. Also the Font size is the default unless otherwise stated.

Dice Labels

Place the five (5) labels which will hold the separate die face values after a roll onto the form. The dice labels need to have their AutoSize property set to false, before deleting the default text. The BackColor needs to be set to a colour which will make the label visible, in the screenshot, White from the Web Tab was selected. The Width and Height of Size should be the same so the label shape is square, 40 was used. Though it will show no result for the moment, the TextAlign Property should be set to Middle Center
Name these labels, die1, die 2, etc.

Various Labels

The message label font size is 15 and has ForeColor which will make the text visible against the background colour. This label will initially display “Roll 1”.
The Player label has a font size of 25 and the two “Section” labels have a font size of 20.
Until multiple players are introduced in a later specification, the Player label will not be updated with a player’s name.

Combination Controls

Place the thirteen (13) buttons onto the form one after another so their default names (Name) are button1, button2… button13. Change AutoSize to true this will ensure that the buttons retain the same general appearance though some will be wider than others.
Align the right hand edge of the buttons in each column after having changing the Text of each.
The thirteen (13) score labels for each button should be added to the form one after the other with their default names (Name) set to scoreLabel1, scoreLabel2, etc. (Ignore this advice at your own peril!)
Set the AutoSize to false, before deleting the default text. Set TextAlign to Middle Center. Choose a suitable Size for the score labels, 30 by 23 was used for the screenshot. Name the remaining five (5) score labels appropriately.
The Grand Total label font size was 25.
Compile your form as you may have to adjust the size and position of various controls to arrive at a form which looks reasonable. Show your form to tutors or other students for feedback on the form’s overall appearance.