| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 620 人关注过本帖
标题:[求助]调用GUMP出错
取消只看楼主 加入收藏
注册用户
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-5-15
收藏
 问题点数:0 回复次数:0 
[求助]调用GUMP出错

这个是runuo的,想调用一下travelgategump,老是提示出错

这个是help,用来调用,红色字体是我添加的

using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Menus;
using Server.Menus.Questions;
using Server.Accounting;
using Server.Multis;
using Server.Mobiles;
using System.Collections;

namespace Server.Engines.Help
{
public class ContainedMenu : QuestionMenu
{
private Mobile m_From;

public ContainedMenu( Mobile from ) : base( "You already have an open help request. We will have someone assist you as soon as possible. What would you like to do?", new string[]{ "Leave my old help request like it is.", "Remove my help request from the queue." } )
{
m_From = from;
}

public override void OnCancel( NetState state )
{
m_From.SendLocalizedMessage( 1005306, "", 0x35 ); // Help request unchanged.
}

public override void OnResponse( NetState state, int index )
{
if ( index == 0 )
{
m_From.SendLocalizedMessage( 1005306, "", 0x35 ); // Help request unchanged.
}
else if ( index == 1 )
{
PageEntry entry = PageQueue.GetEntry( m_From );

if ( entry != null && entry.Handler == null )
{
m_From.SendLocalizedMessage( 1005307, "", 0x35 ); // Removed help request.
entry.AddResponse( entry.Sender, "[Canceled]" );
PageQueue.Remove( entry );
}
else
{
m_From.SendLocalizedMessage( 1005306, "", 0x35 ); // Help request unchanged.
}
}
}
}

public class HelpGump : Gump
{
public static void Initialize()
{
EventSink.HelpRequest += new HelpRequestEventHandler( EventSink_HelpRequest );
}

private static void EventSink_HelpRequest( HelpRequestEventArgs e )
{
foreach ( Gump g in e.Mobile.NetState.Gumps )
{
if ( g is HelpGump )
return;
}

if ( !PageQueue.CheckAllowedToPage( e.Mobile ) )
return;

if ( PageQueue.Contains( e.Mobile ) )
e.Mobile.SendMenu( new ContainedMenu( e.Mobile ) );
else
e.Mobile.SendGump( new HelpGump( e.Mobile ) );
}

private static bool IsYoung( Mobile m )
{
if ( m is PlayerMobile )
return ((PlayerMobile)m).Young;

return false;
}

public static bool CheckCombat( Mobile m )
{
for ( int i = 0; i < m.Aggressed.Count; ++i )
{
AggressorInfo info = m.Aggressed[i];

if ( DateTime.Now - info.LastCombatTime < TimeSpan.FromSeconds( 30.0 ) )
return true;
}

return false;
}

public HelpGump( Mobile from ) : base( 0, 0 )
{
from.CloseGump( typeof( HelpGump ) );

bool isYoung = IsYoung( from );

AddBackground( 50, 25, 540, 530, 2600 );

AddPage( 0 );

AddHtmlLocalized( 150, 50, 360, 40, 1001002, false, false ); // <CENTER><U>Ultima Online Help Menu</U></CENTER>
AddButton( 425, 465, 2073, 2072, 0, GumpButtonType.Reply, 0 ); // Close

AddPage( 1 );

if ( isYoung )
{
AddButton( 80, 75, 5540, 5541, 9, GumpButtonType.Reply, 2 );
AddHtml( 110, 75, 450, 58, @"<BODY><BASEFONT COLOR=BLACK><u>新手玩家专用通道.</u> 选择这个选项可传送到哈镇镇.</BODY>", true, true );

AddButton( 80, 140, 5540, 5541, 1, GumpButtonType.Reply, 2 );
AddHtml( 110, 140, 450, 58, @"<u>关于网络创世纪的问题.</u> 选择这个选项,如果你有一个游戏的问题,需要帮助学习使用技巧, 或如果你想搜索uo知识库.", true, true );

AddButton( 80, 205, 5540, 5541, 2, GumpButtonType.Reply, 0 );
AddHtml( 110, 205, 450, 58, @"<u>我的角色被卡在游戏里了.</u> 这个选项只能在以下情况使用,角色会停留在原地2分钟,随后传送到你选择的地方,注意: 每天只能传送2次,以现实中的24个小时计算。", true, true );

AddButton( 80, 270, 5540, 5541, 0, GumpButtonType.Page, 3 );
AddHtml( 110, 270, 450, 58, @"<u>有人在骂我.</u> 有人在不断辱骂你,当你选择这个选项你将看到一个留言本,看到什么构成骚扰,请访问 http://lzuo.vicp.net/gm_9.html.", true, true );

AddButton( 80, 355, 5540, 5541, 0, GumpButtonType.Page, 2 );
AddHtml( 110, 355, 450, 58, @"<u>其它.</u> 如果您所遇到的问题不在游戏类别,我们将给予支援网页(位于http://support.lzuo.vicp.net),请使用此选项。", true, true );
}
else
{
AddButton( 80, 90, 5540, 5541, 1, GumpButtonType.Reply, 2 );
AddHtml( 110, 90, 450, 74, @"<u>关于网络创世纪的问题.</u> 选择这个选项,如果你有一个游戏的问题,需要帮助学习使用技巧, 或如果你想搜索uo知识库.", true, true );

AddButton( 80, 170, 5540, 5541, 2, GumpButtonType.Reply, 0 );
AddHtml( 110, 170, 450, 74, @"<u>我的角色被卡在游戏里了.</u> 这个选项只能在以下情况使用,角色会停留在原地2分钟,随后传送到你选择的地方,注意: 每天只能传送2次,以现实中的24个小时计算。", true, true );

AddButton( 80, 250, 5540, 5541, 0, GumpButtonType.Page, 3 );
AddHtml( 110, 250, 450, 74, @"<u>有人在骂我.</u> 有人在不断辱骂你,当你选择这个选项你将看到一个留言本,看到什么构成骚扰,请访问 http://lzuo.vicp.net/gm_9.html.", true, true );

AddButton( 80, 330, 5540, 5541, 0, GumpButtonType.Page, 2 );
AddHtml( 110, 330, 450, 74, @"<u>其它.</u> 如果您所遇到的问题不在游戏类别,我们将给予支援网页(位于http://support.lzuo.vicp.net),请使用此选项。", true, true );
AddButton( 80, 405, 5540, 5541, 10, GumpButtonType.Page, 0 );
AddHtml( 110, 405, 450, 58, @"<u>我要使用旅游系统.</u> 免费才是硬道理", true, true );

}

....................
case 9: // Young player transport
{
if ( IsYoung( from ) )
{
if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) )
{
from.SendLocalizedMessage( 1041530, "", 0x35 ); // You'll need a better jailbreak plan then that!
}
else if ( from.Region.IsPartOf( "Haven Island" ) )
{
from.SendLocalizedMessage( 1041529 ); // You're already in Haven
}
else
{
from.MoveToWorld( new Point3D( 3618, 2587, 0 ), Map.Trammel );
}
}

break;
}
case 10: //travelgate
{
from.SendMessage( "测试中" );
//from.SendGump( new TravelGateGump( from, this ) );
//from.SendUseGate( from );
break;
}
}

if ( type != (PageType)(-1) && PageQueue.CheckAllowedToPage( from ) )
from.SendGump( new PagePromptGump( from, type ) );
}
}
}


这个是老外写的,被调用

using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;

namespace Server.Items
{
public class TravelGate : Item
{
[Constructable]
public TravelGate() : base( 0xF6C )
{
Movable = false;
//Light = LightType.Circle300;
//Hue = 322;
//Weight = 3;
Name = "旅行月门";
Light = LightType.Circle300;
}

public TravelGate( Serial serial ) : base( serial )
{
}

public override void OnDoubleClick( Mobile from )
{
if ( !from.Player )
return;

if ( from.InRange( GetWorldLocation(), 1 ) )
UseGate( from );
else
from.SendLocalizedMessage( 500446 ); // That is too far away.
}

public override bool OnMoveOver( Mobile m )
{
return !m.Player || UseGate( m );
}

public bool UseGate( Mobile m )
{
if ( m.Criminal )
{
m.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
return false;
}
else if ( Server.Spells.SpellHelper.CheckCombat( m ) )
{
m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
return false;
}
else if ( m.Spell != null )
{
m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
return false;
}
else
{
m.CloseGump( typeof( TravelGateGump ) );
m.SendGump( new TravelGateGump( m, this ) );

Effects.PlaySound( m.Location, m.Map, 0x20E );
return true;
}
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
}

........

看下怎么样可以调用下面这个,我用from.SendGump( new TravelGateGump( from, this ) )和from.SendUseGate( from )来调用travelgategump总是出错。

[此贴子已经被作者于2007-5-15 10:28:24编辑过]

搜索更多相关主题的帖子: using GUMP Server Mobile Menus 
2007-05-15 10:27
快速回复:[求助]调用GUMP出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028566 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved