ゲームクラスの参照をConfigsクラスに渡す必要があります。Configsのクラスコンストラクターで、プライベートメンバー変数をゲームクラスのインスタンスに設定します。そこからゲームを操作できます。下記参照:
ゲームクラス
public class Game1 : Game
{
Configs configs;
GraphicsDeviceManager _graphics;
SpriteBatch _spriteBatch;
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
// Pass THIS game instance to the Configs class constructor.
configs = new Configs(this);
base.Initialize();
}
protected override void LoadContent()
{
_spriteBatch = new SpriteBatch(GraphicsDevice);
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
base.Draw(gameTime);
}
}
構成クラス
public class Configs
{
// Reference to the main game class.
private Game _game;
public Configs(Game game)
{
// Store the game reference to a local variable.
_game = game;
}
public void SetMouseVisible()
{
// This is a reference to you main game class that was
// passed to the Configs class constructor.
_game.IsMouseVisible = true;
}
}
これは基本的に他の人が述べていることです。ただし、コードを見ずに概念を理解するのに苦労しているようです。したがって、私はそれを提供しました。
お役に立てば幸いです。