コード例 #1
1
ファイル: IconsModule.cs プロジェクト: evildude807/kaltar
        public IconsModule(Serial serial, IconInfo info)
            : base(serial)
        {
            //m_Icons = new Hashtable();
            m_Icons = new Dictionary<Type, IconInfo>();

            Add(info);
        }
コード例 #2
0
ファイル: IconsModule.cs プロジェクト: evildude807/kaltar
        public void Add(IconInfo info)
        {
            if (info == null)
                return;

            if (m_Icons.ContainsKey(info.SpellType))
                m_Icons[info.SpellType] = info;

            else
                m_Icons.Add(info.SpellType, info);
        }
コード例 #3
0
ファイル: SpellIconGump.cs プロジェクト: evildude807/kaltar
        public SpellIconGump(IconInfo info)
            : base(((Point3D)info.Location).X, ((Point3D)info.Location).Y)
        {
            m_Info = info;

            Closable = false;
            Disposable = false;
            Dragable = false;
            Resizable = false;

            AddPage(0);
            AddBackground(0, 0, 54, 54, ((Point3D)info.Location).Z);
            AddButton(45, 0, 9008, 9010, 1, GumpButtonType.Reply, 0);
            AddButton(5, 5, m_Info.Icon, m_Info.Icon, 2, GumpButtonType.Reply, 0);
        }
コード例 #4
0
ファイル: IconsModule.cs プロジェクト: evildude807/kaltar
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Icons = new Dictionary<Type, IconInfo>();

            int count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                IconInfo ii = new IconInfo(reader);
                if (ii.SpellType != null)
                    m_Icons.Add(ii.SpellType, ii);
            }
        }
コード例 #5
0
        public override void OnResponse( NetState state, RelayInfo info )
        {
            Mobile from = state.Mobile;
            switch( info.ButtonID )
            {
                //Apply
                case 1:
                {
                    if( !CentralMemory.Running )
                    {
                        from.SendMessage( "There is no Central Memory!  Please page an Admin to assist." );
                        return;
                    }

                    IconInfo ii = new IconInfo( m_Spell, m_Icon, m_X, m_Y, m_Background, m_School );

                    if( !CentralMemory.ContainsModule( from.Serial, typeof( IconsModule ) ) )
                        CentralMemory.AddModule( from.Serial, typeof( IconsModule ) );

                    IconsModule im = new IconsModule( from.Serial );
                    im.Add( ii );

                    CentralMemory.AppendModule( from.Serial, (Module)im, false );

                    from.SendGump( new SpellIconGump( ii ) );
                    break;
                }

                //Move
                case 2:
                {
                    TextRelay xrelay = info.GetTextEntry( 7 );
                    TextRelay yrelay = info.GetTextEntry( 8 );
                    string xstring = ( xrelay == null ? null : xrelay.Text.Trim() );
                    string ystring = ( yrelay == null ? null : yrelay.Text.Trim() );
                    if( xstring == null || xstring.Length == 0 || ystring == null || ystring.Length == 0 )
                    {
                        from.SendMessage( "Please enter a X coordinate in the top box and a Y coordinate in the bottom box" );
                    }
                    else
                    {
                        int x = m_X;
                        int y = m_Y;
                        try
                        {
                            x = Int32.Parse(xstring);
                            y = Int32.Parse(ystring);
                            m_X = x;
                            m_Y = y;
                        }
                        catch
                        {
                            from.SendMessage( "Please enter a X coordinate in the top box and a Y coordinate in the bottom box" );
                        }
                    }
                    if( m_X < 0 )
                    {
                        m_X = 0;
                        from.SendMessage( "You cannot go any farther left" );
                    }
                    if( m_Y < 0 )
                    {
                        m_Y = 0;
                        from.SendMessage( "You cannot go any farther up" );
                    }

                    from.CloseGump( typeof( IconPlacementGump ) );
                    from.SendGump(new IconPlacementGump( m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
                    break;
                }

                //Up
                case 3:
                {
                    MakeI(info);
                    from.CloseGump( typeof( IconPlacementGump ) );
                    if( (m_Y-m_I) < 0 )
                    {
                        m_Y = 0;
                        from.SendMessage( "You cannot go any farther up" );
                        from.SendGump( new IconPlacementGump( m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
                    }
                    else
                    {
                        from.SendGump( new IconPlacementGump( m_Book, from, m_X, (m_Y-m_I), m_I, m_Icon, m_Spell, m_Background, m_School ) );
                    }
                    break;
                }

                //Right
                case 4:
                {
                    MakeI(info);
                    from.CloseGump( typeof( IconPlacementGump ) );
                    from.SendGump( new IconPlacementGump( m_Book, from, (m_X+m_I), m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
                    break;
                }

                //Down
                case 5:
                {
                    MakeI(info);
                    from.CloseGump( typeof( IconPlacementGump ) );
                    from.SendGump( new IconPlacementGump( m_Book, from, m_X, (m_Y+m_I), m_I, m_Icon, m_Spell, m_Background, m_School ) );
                    break;
                }

                //Left
                case 6:
                {
                    MakeI(info);
                    from.CloseGump( typeof( IconPlacementGump ) );
                    if( (m_X-m_I) < 0 )
                    {
                        m_X = 0;
                        from.SendMessage( "You cannot go any farther left" );
                        from.SendGump( new IconPlacementGump( m_Book, from, m_X, m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
                    }
                    else
                    {
                        from.SendGump( new IconPlacementGump( m_Book, from, (m_X-m_I), m_Y, m_I, m_Icon, m_Spell, m_Background, m_School ) );
                    }
                    break;
                }
            }
        }