本文整理汇总了C#中Microsoft.Xna.Framework.GamerServices.SignedInGamer类的典型用法代码示例。如果您正苦于以下问题:C# SignedInGamer类的具体用法?C# SignedInGamer怎么用?C# SignedInGamer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SignedInGamer类属于Microsoft.Xna.Framework.GamerServices命名空间,在下文中一共展示了SignedInGamer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainMenuScreen
public MainMenuScreen(SignedInGamer gamerOne)
{
this.gamerOne = gamerOne;
TransitionOnTime = TimeSpan.FromSeconds(0.5);
TransitionOffTime = TimeSpan.FromSeconds(0.5);
}
示例2: LiveIdentifiedPlayer
/// <summary>
/// Creates a new instance
/// </summary>
/// <param name="signedInGamer">The Xbox Live player SignedInGamer instance</param>
internal LiveIdentifiedPlayer(SignedInGamer signedInGamer)
: base(Application.Input.GetPlayerInput(signedInGamer.PlayerIndex))
{
LiveGamer = signedInGamer;
UniqueId = signedInGamer.Gamertag;
DisplayName = signedInGamer.Gamertag;
}
示例3: HandleInput
public override void HandleInput(InputState input)
{
if (!gamerSelected)
{
for (int i = 0; i < InputState.MaxInputs; i++)
{
if (input.CurrentGamePadStates[i].IsButtonDown(Buttons.Start) == true && input.PreviousGamePadStates[i].IsButtonUp(Buttons.Start) == true ||
input.CurrentKeyboardStates[i].IsKeyDown(Keys.Enter) == true && input.PreviousKeyboardStates[i].IsKeyUp(Keys.Enter) ||
input.CurrentKeyboardStates[i].IsKeyDown(Keys.Space) == true && input.PreviousKeyboardStates[i].IsKeyUp(Keys.Space))
{
gamerOne = Gamer.SignedInGamers[(PlayerIndex)i];
gamerSelected = true;
if (gamerOne == null)
{
if (!Guide.IsVisible)
{
Guide.ShowSignIn(1, false);
}
}
}
}
}
}
示例4: NetworkGameMenu
public NetworkGameMenu(PlayerIndex enteringPlayer)
: base("Start a network game")
{
currentPlayerIndex = enteringPlayer;
currentGamer = SignedInGamer.SignedInGamers[currentPlayerIndex];
// Create our menu entries.
if (currentGamer != null)
{
opt1 = new MenuEntry("Currently signed in");
}
else
{
opt1 = new MenuEntry("Select to sign in");
SignedInGamer.SignedIn += new EventHandler<SignedInEventArgs>(gamerSignIn);
}
MenuEntry opt2 = new MenuEntry("Host local network game");
MenuEntry opt3 = new MenuEntry("Join local newtwork game");
MenuEntry opt4 = new MenuEntry("Go Back");
opt1.Selected += LiveSignIn;
opt2.Selected += HostLocalGame;
opt3.Selected += FindLocalGame;
opt4.Selected += OnCancel;
// Add entries to the menu.
MenuEntries.Add(opt1);
MenuEntries.Add(opt2);
MenuEntries.Add(opt3);
MenuEntries.Add(opt4);
SetMenuEntryText();
}
示例5: LocalNetworkGameMenu
public LocalNetworkGameMenu(PlayerIndex enteringPlayer, NetworkSession nSession)
: base("Local Network Game Lobby")
{
netSession = nSession;
currentPlayerIndex = enteringPlayer;
currentGamer = SignedInGamer.SignedInGamers[currentPlayerIndex];
netSession.GameStarted += new EventHandler<GameStartedEventArgs>(loadNetworkGameScreen);
// Create our menu entries.
gameTypeOption = new MenuEntry("Game Type: " + GameType());
highScoreOption = new MenuEntry("Score to Win: " + WinningScore());
opt2 = new MenuEntry("Host: " + nSession.Host.ToString());
opt3 = new MenuEntry("Ready?");
opt4 = new MenuEntry("Waiting for opponent");
opt5 = new MenuEntry("Go Back");
netSession.GameStarted += new EventHandler<GameStartedEventArgs>(StartGame);
gameTypeOption.Selected += changeGameType;
highScoreOption.Selected += changeWinningScore;
opt3.Selected += setReady;
opt4.Selected += startGame;
opt5.Selected += OnCancel;
// Add entries to the menu.
MenuEntries.Add(gameTypeOption);
MenuEntries.Add(highScoreOption);
MenuEntries.Add(opt2);
MenuEntries.Add(opt3);
MenuEntries.Add(opt4);
MenuEntries.Add(opt5);
SetMenuEntryText();
}
示例6: SignedInEventArgs
public SignedInEventArgs(SignedInGamer gamer)
{
if (gamer == null)
{
throw new ArgumentNullException("gamer");
}
this.gamer = gamer;
}
示例7: CharacterSelectScreen
public CharacterSelectScreen(SignedInGamer gamerOne)
: base("Character Select")
{
this.gamerOne = gamerOne;
TransitionOnTime = TimeSpan.FromSeconds(0.3);
TransitionOffTime = TimeSpan.FromSeconds(0.3);
}
示例8: LocalGamer
internal LocalGamer(SignedInGamer gamer)
{
SignedInGamer = gamer;
SignedInGamer.Tag = this;
reader = new PacketReader();
Writer = new PacketWriter();
InitializeSystemPackets();
}
示例9: LoadGame
/// <summary>
/// This method gets the filenames from the universal storage file LbKTileData.sav
/// </summary>
/// <param name="device"></param>
/// <param name="gamer"></param>
/// <param name="fileNamesOnly"></param>
public static void LoadGame(StorageDevice device, SignedInGamer gamer, bool fileNamesOnly)
{
// Open a storage container.
// name of container is LbK Storage Device
IAsyncResult result =
device.BeginOpenContainer(gamer.Gamertag, null, null);
// Wait for the WaitHandle to become signaled.
result.AsyncWaitHandle.WaitOne();
StorageContainer container = device.EndOpenContainer(result);
// Close the wait handle.
result.AsyncWaitHandle.Close();
string filename = "LbKTileData.sav";
// Check to see whether the save exists.
if (!container.FileExists(filename))
{
// If not, dispose of the container and return.
container.Dispose();
return;
}
// Open the file.
Stream file = container.OpenFile(filename, FileMode.Open);
// Read the data from the file.
XmlSerializer serializer = new XmlSerializer(typeof(SaveGameData));
SaveGameData data = (SaveGameData)serializer.Deserialize(file);
// Close the file.
file.Close();
// Dispose the container.
container.Dispose();
// Report the data to the console.
if (fileNamesOnly)
{
fileNames = data.Names;
}
else
{
position = data.TilePosition;
type = data.TileType;
objectNumber = data.TileObjectNumber;
count = data.TileCount;
fileNames = data.Names;
}
GamePlayScreen.storageDevice = device;
// load up game with respective device
}
示例10: LoadGame
/// <summary>
/// This method loads a serialized data object
/// from the StorageContainer for this game.
/// </summary>
/// <param name="device"></param>
public static void LoadGame(StorageDevice device, SignedInGamer gamer)
{
// Open a storage container.
// name of container is LbK Storage Device
IAsyncResult result =
device.BeginOpenContainer("LbK Storage Device", null, null);
// Wait for the WaitHandle to become signaled.
result.AsyncWaitHandle.WaitOne();
StorageContainer container = device.EndOpenContainer(result);
// Close the wait handle.
result.AsyncWaitHandle.Close();
string filename = "LbKSavedItems.sav";
// Check to see whether the save exists.
if (!container.FileExists(filename))
{
// If not, dispose of the container and return.
container.Dispose();
nothingLoaded = true;
return;
}
// Open the file.
Stream file = container.OpenFile(filename, FileMode.Open);
// Read the data from the file.
XmlSerializer serializer = new XmlSerializer(typeof(SaveGameData));
SaveGameData data = (SaveGameData)serializer.Deserialize(file);
// Close the file.
file.Close();
// Dispose the container.
container.Dispose();
// Report the data to the console.
playerName = data.PlayerName;
level = data.Level;
score = data.PlayerScore;
position = new Vector2(data.playerPosition.X, data.playerPosition.Y);
checkPoint = data.CheckPoint;
GamePlayScreen.storageDevice = device;
// load up game with respective device
}
示例11: Gamer_LoginSuccess
public static void Gamer_LoginSuccess(object sender, SignedInEventArgs e)
{
// set the local gamer to the signedin gamer
gamer = e.Gamer;
// begin asynchronously getting the player's profile. Do this because it may take time to get over the network otherwise.
gamer.BeginGetProfile(endGetProfile, gamer);
// remove the signedin handler
SignedInGamer.SignedIn -= signInHandler;
Console.WriteLine("Gamer: " + gamer.Gamertag + " signed in.");
int maxNumberOfPlayers = 1;
NetworkSession.BeginFind(NetworkSessionType.PlayerMatch, maxNumberOfPlayers, null, endFind, session);
}
示例12: SignIn
public Microsoft.Xna.Framework.GamerServices.Gamer SignIn(string username, string password)
{
using (MonoLive monoLive = new MonoLive())
{
Result result = monoLive.SignIn(username, password);
if (result.ok)
{
SignedInGamer signedInGamer = new SignedInGamer();
signedInGamer.Gamertag = result.Gamer.GamerTag;
signedInGamer.DisplayName = result.Gamer.GamerTag;
return (Microsoft.Xna.Framework.GamerServices.Gamer) signedInGamer;
}
}
return (Microsoft.Xna.Framework.GamerServices.Gamer) null;
}
示例13: client_SignInCompleted
private void client_SignInCompleted(object sender, MonoGame.Framework.MonoLive.SignInCompletedEventArgs e)
{
if (this.SignInCompleted != null && e.Error != null)
{
((IDisposable) e.UserState).Dispose();
MonoLiveClient.SignInCompletedEventHandler completedEventHandler = this.SignInCompleted;
MonoLiveClient monoLiveClient = this;
SignedInGamer signedInGamer = new SignedInGamer();
signedInGamer.Gamertag = e.Result.Gamer.GamerTag;
signedInGamer.DisplayName = e.Result.Gamer.GamerTag;
SignInCompletedEventArgs e1 = new SignInCompletedEventArgs((Microsoft.Xna.Framework.GamerServices.Gamer) signedInGamer);
completedEventHandler((object) monoLiveClient, e1);
}
else
this.SignInCompleted((object) this, (SignInCompletedEventArgs) null);
}
示例14: Update
public override void Update(GameTime gameTime)
{
if (gt == TimeSpan.Zero) gt = gameTime.TotalGameTime;
if ((gameTime.TotalGameTime - gt).TotalSeconds > 10) // close after 10 seconds
{
SignedInGamer sig = new SignedInGamer();
sig.DisplayName = "MonoGamer";
sig.Gamertag = "MonoGamer";
Gamer.SignedInGamers.Add(sig);
this.Enabled = false;
Guide.IsVisible = false;
gt = TimeSpan.Zero;
}
base.Update(gameTime);
}
示例15: Update
public override void Update(GameTime gameTime)
{
if (this.gt == TimeSpan.Zero)
this.gt = this.last = gameTime.TotalGameTime;
if ((gameTime.TotalGameTime - this.last).Milliseconds > 100)
{
this.last = gameTime.TotalGameTime;
this.startalpha += (byte) 21;
}
if ((gameTime.TotalGameTime - this.gt).TotalSeconds > 5.0)
{
string str = WindowsIdentity.GetCurrent().Name;
if (str.Contains("\\"))
{
int startIndex = str.IndexOf("\\") + 1;
str = str.Substring(startIndex, str.Length - startIndex);
}
SignedInGamer signedInGamer = new SignedInGamer();
signedInGamer.DisplayName = str;
signedInGamer.Gamertag = str;
Gamer.SignedInGamers.Add(signedInGamer);
this.Visible = false;
this.Enabled = false;
this.gt = TimeSpan.Zero;
}
base.Update(gameTime);
}