所以我有一个扫雷游戏旧代码,我试图将它添加到C#移动版本。这听起来很愚蠢,但我从未使用过,但由于某种原因,它不会让我实例化我的Game类。任何帮助?建筑类
主要是Game mineSweeper = new Game;
加下划线。
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace App3
{
[Activity(Label = "App3", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
GridLayout gl = (GridLayout)FindViewById(Resource.Id.MineField);
// Set our view from the "main" layout resource
Button[] cells = new Button[100];
Game mineSweeper = new Game;
var i = 0;
foreach (Button b in cells)
{
cells[i] = new Button(this);
cells[i].Click += new EventHandler(button_Click);
gl.AddView(cells[i]);
i++;
}
}
private void addButtions()
{
}
protected void button_Click(object sender, EventArgs e)
{
Button button = sender as Button;
// identify which button was clicked and perform necessary actions
button.Text = ("!");
button.Enabled = false;
}
}
}
你的游戏课在哪里? – 2015-04-06 00:39:23
'游戏扫雷=新游戏();' – Alex 2015-04-06 00:40:11
你刚刚在评论中输入的内容......这是_not_什么在你的代码(缺少括号)。错字? – 2015-04-06 00:42:06