ClassGameManage.cs
(开头部分) 16KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace Sokoban
{
class ClassGameManage
{
private ClassBoy _boy = new ClassBoy(); //箱子
private List<ClassBackground> _backgroundList; //空地集合
private List<ClassBox> _boxList; //箱子集合
private List<ClassWall> _wallList; //墙集合
private List<ClassHole> _holeList; //坑集合
private Graphics _graphics; //画板
private string[,] _layout;
public ClassGameManage(Graphics graphics, string[,] layout)
{
_graphics = graphics;
_layout = layout;
}
public int Gamestart()
{
//初始化
_boy = new ClassBoy();
_backgroundList = new List<ClassBackground>();
_boxList = new List<ClassBox>();
_wallList = new List<ClassWall>();
_holeList = new List<ClassHole>();
//获取关卡布局集合
GameLayout();
//创建布局画板
creatGraphics();
return _boxList.Count;
}
public void GameLayout()
{
for (int y = 0; y < 18; y++) //纵向
{
for (int x = 0; x < 20; x++) //横向
{
string temp = _layout[y,x].Trim(); //从数组中读取每个布局节点
switch (temp)
{
case "n": //空地
ClassBackground background = new ClassBackground();
background.X = x;
background.Y = y;
_backgroundList.Add(background);
break;
case "b": //箱子
ClassBox box = new ClassBox();
box.X = x;
box.Y = y;
_boxList.Add(box);
后面还有 426 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。