本文整理汇总了C#中Server.Accounting.Account类的典型用法代码示例。如果您正苦于以下问题:C# Account类的具体用法?C# Account怎么用?C# Account使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Account类属于Server.Accounting命名空间,在下文中一共展示了Account类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
private static void Load()
{
string filePath = Path.Combine( "Saves/Accounts", "accounts.xml" );
if ( !File.Exists( filePath ) )
return;
XmlDocument doc = new XmlDocument();
doc.Load( filePath );
XmlElement root = doc["accounts"];
foreach ( XmlElement accountXmlElement in root.GetElementsByTagName( "account" ) )
{
try
{
Account acct = new Account( accountXmlElement );
Accounts.AddAccount( acct );
}
catch
{
Console.WriteLine( "Warning: Account instance load failed" );
}
}
}
示例2: Initialize
public static void Initialize()
{
if ( Accounts.Count == 0 && !Core.Service )
{
Console.WriteLine( "This server has no accounts." );
Console.Write( "Do you want to create the owner account now? (y/n)" );
if( Console.ReadKey( true ).Key == ConsoleKey.Y )
{
Console.WriteLine();
Console.Write( "Username: " );
string username = Console.ReadLine();
Console.Write( "Password: " );
string password = Console.ReadLine();
Account a = new Account( username, password );
a.AccessLevel = AccessLevel.Owner;
Console.WriteLine( "Account created." );
}
else
{
Console.WriteLine();
Console.WriteLine( "Account not created." );
}
}
}
示例3: DonationHuePickerGump
public DonationHuePickerGump(Mobile m, int[] hues, GetHueMethod gethuemethod, SetHueMethod sethuemethod, string caption)
: base(20, 20)
{
if (m == null || m.Account == null || hues == null || hues.Length <= 0 || gethuemethod == null || sethuemethod == null || caption == null)
return;
m_Account = (Account)m.Account;
m_Hues = hues;
m_GetHueMethod = gethuemethod;
m_SetHueMethod = sethuemethod;
m_Caption = caption;
int cushue = m_GetHueMethod(m_Account);
AddPage(0);
AddBackground(0, 0, 200, 120 + m_Hues.Length * 30, 2600);
AddLabel(50, 30, 2401, m_Caption);
int c = 0;
foreach (int hue in m_Hues)
{
AddRadio(30, 50 + c * 30, 9727, 9730, (cushue == hue), c);
AddLabel(65, 55 + c * 30, (hue == 0) ? 2401 : (hue == 1177) ? 52 : hue - 1, (hue == 0) ? "Regular Hue" : (hue == 1177) ? "Blaze Hue" : "*****");
c++;
}
AddButton(30, 60 + c * 30, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddLabel(65, 60 + c * 30, 2401, "Apply");
}
示例4: Load
public static void Load()
{
m_Accounts = new Dictionary<string, IAccount>( 32, StringComparer.OrdinalIgnoreCase );
string filePath = Path.Combine( "Saves/Accounts", "accounts.xml" );
if ( !File.Exists( filePath ) )
return;
XmlDocument doc = new XmlDocument();
doc.Load( filePath );
XmlElement root = doc["accounts"];
foreach ( XmlElement account in root.GetElementsByTagName( "account" ) )
{
try
{
Account acct = new Account( account );
}
catch
{
Console.WriteLine( "Warning: Account instance load failed" );
}
}
}
示例5: CreateAccount
public static Account CreateAccount( string username, string password, string linkedEmail = null )
{
Account account = new Account( username, password, linkedEmail );
if ( m_Accounts.Count == 0 )
account.AccessLevel = AccessLevel.Owner;
return AddAccount( account );
}
示例6: AddAccount
public static Account AddAccount( string user, string pass )
{
Account a = new Account( user, pass );
if ( m_Accounts.Count == 0 )
a.AccessLevel = AccessLevel.Administrator;
m_Accounts[a.Username] = a;
return a;
}
示例7: GetProgress
protected virtual int GetProgress(ConquestState state, Account account)
{
if (state.User == null)
return 0;
if (account == null || DateTime.UtcNow - account.Created < AccountAge)
{
return 0;
}
return 1;
}
示例8: CreateMobile
private static Mobile CreateMobile( Account a )
{
if ( a.Count >= a.Limit )
return null;
for ( int i = 0; i < a.Length; ++i )
{
if ( a[i] == null )
return (a[i] = new PlayerMobile());
}
return null;
}
示例9: GetAccountInfo
public static void GetAccountInfo(Account a, out AccessLevel accessLevel, out bool online)
{
accessLevel = a.AccessLevel;
online = false;
for (int j = 0; j < 5; ++j)
{
Mobile check = a[j];
if (check == null)
continue;
if (check.AccessLevel > accessLevel)
accessLevel = check.AccessLevel;
if (check.NetState != null)
online = true;
}
}
示例10: Deserialize
public void Deserialize( GenericReader reader )
{
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Account = Accounts.GetAccount( reader.ReadString() );
m_HorseHue = reader.ReadInt();
m_SandalHue = reader.ReadInt();
m_BandanaHue = reader.ReadInt();
m_RobeHue = reader.ReadInt();
for ( int i = 0; i < 9; i++ )
reader.ReadInt();
break;
}
}
}
示例11: DonationSettingsGump
public DonationSettingsGump( Mobile m ) : base( 20, 20 )
{
if ( !(m is PlayerMobile ) || m == null || m.Account == null )
return;
m_Account = (Account)m.Account;
AddPage( 0 );
AddBackground( 0, 0, 300, 250, 2600 );
AddLabel( 60, 30, 2401, "Donation Settings" );
int errors = 0;
TryButton( 30, 50, m, 90, 1, ref errors );
AddLabel( 65, 50, 2401, "Set Horse Hue" );
TryButton( 30, 70, m, 30, 2, ref errors );
AddLabel( 65, 70, 2401, "Set Sandal Hue" );
TryButton( 30, 90, m, 30, 3, ref errors );
AddLabel( 65, 90, 2401, "Set Bandana Hue" );
TryButton( 30, 110, m, 180, 4, ref errors );
AddLabel( 65, 110, 2401, "Set Robe Hue" );
TimeSpan timeleft = ((PlayerMobile)m).DonationTimeLeft;
if ( timeleft == TimeSpan.MaxValue )
AddLabel( 30, 140, 2401, "You have a permanent membership" );
else
{
if ( timeleft > TimeSpan.FromSeconds( 0.0 ) )
AddLabel( 30, 140, 2401, String.Format( "Your membership expires in {0} days", (int)timeleft.TotalDays ) );
if ( errors > 0 )
AddLabel( 30, 160, 37, "* required membership length" );
AddLabel( 30, 180, 2401, "Type [donate to donate" );
}
}
示例12: InitJail
/// <summary>
/// Initializes a jailing action by sending the JailReasonGump
/// </summary>
/// <param name="from">The GM performing the jailing</param>
/// <param name="offender">The account being jailed</param>
/// <returns>True if the jailing can proceed</returns>
public static bool InitJail(Mobile from, Account offender)
{
if (CanBeJailed(offender))
{
from.SendGump(new JailReasonGump(offender));
return true;
}
JailEntry jail = GetCurrentJail(offender);
if (jail == null)
{
from.SendMessage("You can't jail that account because it's either already jailed or a staff account.");
}
else
{
from.SendMessage("That account has already been jailed. Please review the existing jail record.");
from.SendGump(new JailViewGump(from, jail, null));
}
return false;
}
示例13: GetOnlineMobile
/// <summary>
/// Gets the online mobile for a given account.
/// This method will not return any staff mobiles.
/// </summary>
/// <param name="account">The account object</param>
/// <returns>A mobile if one is online, null otherwise</returns>
public static Mobile GetOnlineMobile(Account account)
{
if (account == null)
{
return null;
}
for (int i = 0; i < account.Length; i++)
{
Mobile m = account[i];
if (m != null && m.NetState != null && m.AccessLevel == AccessLevel.Player)
{
return m;
}
}
return null;
}
示例14: GetCurrentJail
/// <summary>
/// Gets the current jail record for a given account
/// </summary>
/// <param name="acc">The account being examined</param>
/// <returns>A JailEntry if one is matching, null otherwise</returns>
private static JailEntry GetCurrentJail(Account acc)
{
if (acc == null)
{
return null;
}
return m_Jailings.FirstOrDefault(jail => jail.Account == acc && jail.FullJail);
}
示例15: SearchHistory
/// <summary>
/// Searches the jail history for references of an account
/// </summary>
/// <param name="account">The account to search for</param>
/// <returns>An ArrayList of JailEntry objects</returns>
public static List<JailEntry> SearchHistory(Account account)
{
List<JailEntry> history = GetHistory();
history.AddRange(m_ExpiredJailings);
history.AddRange(m_Jailings);
return history.Where(jail => jail.Account != null && jail.Account == account).ToList();
}