本文整理匯總了C#中Server.Network.NetState.RemoveGump方法的典型用法代碼示例。如果您正苦於以下問題:C# NetState.RemoveGump方法的具體用法?C# NetState.RemoveGump怎麽用?C# NetState.RemoveGump使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Network.NetState
的用法示例。
在下文中一共展示了NetState.RemoveGump方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DisplayGumpResponse
public static void DisplayGumpResponse( NetState state, PacketReader pvSrc ) {
int serial = pvSrc.ReadInt32();
int typeID = pvSrc.ReadInt32();
int buttonID = pvSrc.ReadInt32();
foreach ( Gump gump in state.Gumps ) {
if ( gump.Serial == serial && gump.TypeID == typeID ) {
int switchCount = pvSrc.ReadInt32();
if ( switchCount < 0 || switchCount > gump.m_Switches ) {
state.WriteConsole( "Invalid gump response, disconnecting..." );
state.Dispose();
return;
}
int[] switches = new int[switchCount];
for ( int j = 0; j < switches.Length; ++j )
switches[j] = pvSrc.ReadInt32();
int textCount = pvSrc.ReadInt32();
if ( textCount < 0 || textCount > gump.m_TextEntries ) {
state.WriteConsole( "Invalid gump response, disconnecting..." );
state.Dispose();
return;
}
TextRelay[] textEntries = new TextRelay[textCount];
for ( int j = 0; j < textEntries.Length; ++j ) {
int entryID = pvSrc.ReadUInt16();
int textLength = pvSrc.ReadUInt16();
if ( textLength > 239 ) {
state.WriteConsole( "Invalid gump response, disconnecting..." );
state.Dispose();
return;
}
string text = pvSrc.ReadUnicodeStringSafe( textLength );
textEntries[j] = new TextRelay( entryID, text );
}
state.RemoveGump( gump );
GumpProfile prof = GumpProfile.Acquire( gump.GetType() );
if ( prof != null ) {
prof.Start();
}
gump.OnResponse( state, new RelayInfo( buttonID, switches, textEntries ) );
if ( prof != null ) {
prof.Finish();
}
return;
}
}
if ( typeID == 461 ) { // Virtue gump
int switchCount = pvSrc.ReadInt32();
if ( buttonID == 1 && switchCount > 0 ) {
Mobile beheld = World.FindMobile( pvSrc.ReadInt32() );
if ( beheld != null ) {
EventSink.InvokeVirtueGumpRequest( new VirtueGumpRequestEventArgs( state.Mobile, beheld ) );
}
} else {
Mobile beheld = World.FindMobile( serial );
if ( beheld != null ) {
EventSink.InvokeVirtueItemRequest( new VirtueItemRequestEventArgs( state.Mobile, beheld, buttonID ) );
}
}
}
}
示例2: DisplayGumpResponse
public static void DisplayGumpResponse(NetState state, PacketReader pvSrc)
{
int serial = pvSrc.ReadInt32();
int typeID = pvSrc.ReadInt32();
int buttonID = pvSrc.ReadInt32();
List<Gump> gumps = state.Gumps;
for (int i = 0; i < gumps.Count; ++i)
{
Gump gump = gumps[i];
if (gump.Serial == serial && gump.TypeID == typeID)
{
int switchCount = pvSrc.ReadInt32();
if (switchCount < 0)
{
Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
state.Dispose();
return;
}
int[] switches = new int[switchCount];
for (int j = 0; j < switches.Length; ++j)
switches[j] = pvSrc.ReadInt32();
int textCount = pvSrc.ReadInt32();
if (textCount < 0)
{
Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
state.Dispose();
return;
}
TextRelay[] textEntries = new TextRelay[textCount];
for (int j = 0; j < textEntries.Length; ++j)
{
int entryID = pvSrc.ReadUInt16();
int textLength = pvSrc.ReadUInt16();
if (textLength > 239)
return;
string text = pvSrc.ReadUnicodeStringSafe(textLength);
textEntries[j] = new TextRelay(entryID, text);
}
state.RemoveGump(i);
if (!CheckResponse(gump, state.Mobile, buttonID))
return;
gump.OnResponse(state, new RelayInfo(buttonID, switches, textEntries));
return;
}
}
if (typeID == 461) // Virtue gump
{
int switchCount = pvSrc.ReadInt32();
if (buttonID == 1 && switchCount > 0)
{
Mobile beheld = World.FindMobile(pvSrc.ReadInt32());
if (beheld != null)
EventSink.InvokeVirtueGumpRequest(new VirtueGumpRequestEventArgs(state.Mobile, beheld));
}
else
{
Mobile beheld = World.FindMobile(serial);
if (beheld != null)
EventSink.InvokeVirtueItemRequest(new VirtueItemRequestEventArgs(state.Mobile, beheld, buttonID));
}
}
}
示例3: DisplayGumpResponse
public static void DisplayGumpResponse( NetState state, PacketReader pvSrc )
{
int serial = pvSrc.ReadInt32();
int typeID = pvSrc.ReadInt32();
int buttonID = pvSrc.ReadInt32();
foreach ( Gump gump in state.Gumps )
{
if ( gump.Serial == serial && gump.TypeID == typeID )
{
int switchCount = pvSrc.ReadInt32();
if ( switchCount < 0 || switchCount > gump.m_Switches )
{
log.InfoFormat("Client: {0}: Invalid gump response, disconnecting...", state);
state.Dispose();
return;
}
int[] switches = new int[switchCount];
for ( int j = 0; j < switches.Length; ++j )
switches[j] = pvSrc.ReadInt32();
int textCount = pvSrc.ReadInt32();
if ( textCount < 0 || textCount > gump.m_TextEntries )
{
log.InfoFormat("Client: {0}: Invalid gump response, disconnecting...", state );
state.Dispose();
return;
}
TextRelay[] textEntries = new TextRelay[textCount];
for ( int j = 0; j < textEntries.Length; ++j )
{
int entryID = pvSrc.ReadUInt16();
int textLength = pvSrc.ReadUInt16();
if ( textLength > 239 )
return;
string text = pvSrc.ReadUnicodeStringSafe( textLength );
textEntries[j] = new TextRelay( entryID, text );
}
state.RemoveGump( gump );
try {
gump.OnResponse( state, new RelayInfo( buttonID, switches, textEntries ) );
} catch (Exception e) {
log.Fatal(String.Format("Exception disarmed in gump response of {0}",
gump), e);
}
return;
}
}
if ( typeID == 461 ) // Virtue gump
{
int switchCount = pvSrc.ReadInt32();
if ( buttonID == 1 && switchCount > 0 )
{
Mobile beheld = World.FindMobile( pvSrc.ReadInt32() );
if ( beheld != null )
EventSink.InvokeVirtueGumpRequest( new VirtueGumpRequestEventArgs( state.Mobile, beheld ) );
}
else
{
Mobile beheld = World.FindMobile( serial );
if ( beheld != null )
EventSink.InvokeVirtueItemRequest( new VirtueItemRequestEventArgs( state.Mobile, beheld, buttonID ) );
}
}
}