Visualization Homework - First Week Progress

GitHub homepage: https://github.com/ZZhuYYanjiang/UWPTeamWork

Parts uploaded so far:

C# files not uploaded locally:

 

 

 

The first is the idea and logic part made by Zhang Lingfeng in this group:

one. Determine the role of the player and create the Knight class:

Character attributes do not need to be too complicated, divided into three items: health, attack, speed, and an optional skill. It can be set by yourself or randomly generated.

classKnight

    {

publicstring Name = "NewPlayer";

publicint Hp = 1;//HP

publicint Atk = 1;//Attack

publicint Speed ​​= 1;//Speed

publicint Skill = 1;//Skills carried

 

 

}

two. Archive reading

At the beginning, I tried to use .txt to record the role information played by the player, so I have

Save() and Get() are used to archive and read files, but they are very troublesome to use. After asking my classmates, he recommended me to use XML for data processing, so I have:

 

classUsingxml

    {

//initialization

privatevoid creatnew()

        {

 

//Create an XML document

            XmlDataDocument doc = new XmlDataDocument();

 

            XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);//Write the first line of data

            doc.AppendChild(dec);

//Create root node knights

            XmlElement knights = doc.CreateElement("Knights");

            doc.AppendChild(knights);

            XmlElement knight = doc.CreateElement("Knight");

            knights.AppendChild(knight);

 

//Create a child node knightname knighthp under the root node...

            XmlElement knightname1 = doc.CreateElement("Knightname");

            knightname1.InnerText = "Saber";

            knight.AppendChild(knightname1);

 

            XmlElement knighthp1 = doc.CreateElement("KnightHp");

            knighthp1.InnerText = "1";

            knight.AppendChild(knighthp1);

 

            XmlElement knightatk1 = doc.CreateElement("KnightAtk");

            knightatk1.InnerText = "1";

            knight.AppendChild(knightatk1);

 

            XmlElement knightspeed1 = doc.CreateElement("Knightspeed");

            knightspeed1.InnerText = "1";

            knight.AppendChild(knightspeed1);

            doc.Save("Knights.xml");

 

            XmlElement knightskill1 = doc.CreateElement("Knightskill");

            knightskill1.InnerText = "1";

            knight.AppendChild(knightskill1);

//The node is created

            doc.Save("Knights.xml");

        }

 

//Add characters, omitted later

privatevoid append()

        { }

// delete character

privatevoid remove()

        {}

//Read all character information in the current document

privatevoid read()

        {}

//Load character information into the Knight class and create an object

public Knight get(Knight knight)

        {}

 

//interface

publicvoid set(Knight knight)

        {}

}

 

Because the previous attempts were basically pushed back, including character settings, saving, combat and other functions were all redone. This process took a lot of time, but it was the most rewarding part for me.

three. randomly generated map

Determine the total number and distribution of monsters according to the length of the generated map and the end point of the path. It's difficult to generate an interesting map, and more often than not, you will get an inexplicable maze, and it needs to be improved.

classMap

    {

privateint Long = 0;//The total length of the road

privateint[,] Road = newint[2, 10];//Number of branch roads<=10

privateint m = 0;//The mth path leads to the end point

privateint MonsterNum;//Total number of monsters

publicvoid Create()//Randomly generate all private values

    }

 

Four. fighting

The demonstration of the battle is given to other team members, and the function called is:

publicstatic Knight Fightwith(Knight knight, Monster monster)

        {

            }

Huo Xiwen of this group is responsible for skills and specific optimization

(Because of a little problem with the computer, the work is not displayed this time)

Next is the interface design conceived by Zhu Yanjiang of this group:

The basic idea is to use Frame to perform page jumps, battle interfaces, etc.

At present, it is initially a main interface and three sub-interfaces. In the later stage, you may encounter problems such as the smoothness of the screen, which will be solved in the next time. At the same time, the interface will be optimized to make it more immersive.

 

MainPage.xaml

 

MainPage.xaml.cs

 

Page3.xaml

 

Page1.xaml

 

Page3.xaml.cs

 

 

Page2.xaml.cs

 

Page1.xaml.cs

 

Page1.xaml

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324947093&siteId=291194637