当前位置: 首页>>代码示例>>C#>>正文


C# Item.GetLiftSound方法代码示例

本文整理汇总了C#中Server.Item.GetLiftSound方法的典型用法代码示例。如果您正苦于以下问题:C# Item.GetLiftSound方法的具体用法?C# Item.GetLiftSound怎么用?C# Item.GetLiftSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Item的用法示例。


在下文中一共展示了Item.GetLiftSound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EquipTarget

        private void EquipTarget(Item i)
        {
            if (i == null || i.Deleted)
                return;

            if (m_Commander.CustomGuilds[m_Soldier.Government].ActiveTitle)
            {
                if (m_Commander.TitlePrefix != null && m_Commander.TitlePrefix != "")
                    m_Soldier.Say("Yes, " + m_Commander.TitlePrefix + ".");
            }

            if (i.Layer != Layer.Invalid && i.Layer != Layer.Mount && i.Layer != Layer.ShopBuy && i.Layer != Layer.ShopResale && i.Layer != Layer.ShopSell)
            {
                m_NewEquip = i;
                if (m_NewEquip.Layer == Layer.FirstValid && m_NewEquip is BaseWeapon)
                {
                    if (m_Soldier.FindItemOnLayer(Layer.TwoHanded) is BaseWeapon)
                        m_CurrentEquip = m_Soldier.FindItemOnLayer(Layer.TwoHanded);
                    else
                        m_CurrentEquip = m_Soldier.FindItemOnLayer(Layer.OneHanded);
                }
                else
                    m_CurrentEquip = m_Soldier.FindItemOnLayer(i.Layer);

                if (m_CurrentEquip != null && !m_CurrentEquip.Deleted)
                {
                    if (m_NewEquip.Layer == Layer.TwoHanded)
                    {
                        Item oneHanded = m_Soldier.FindItemOnLayer(Layer.OneHanded);
                        if (oneHanded == null)
                            oneHanded = m_Soldier.FindItemOnLayer(Layer.FirstValid);

                        if (oneHanded != null)
                        {
                            if (m_Commander.InRange(m_Soldier.Location, 3))
                            {
                                m_Commander.AddToBackpack(oneHanded);
                                //m_Soldier.Say("Here is the " + oneHanded.Name.ToString() + ".");
                                m_Commander.PlaySound(oneHanded.GetDropSound());
                            }
                            else
                            {
                                oneHanded.DropToWorld(m_Soldier, m_Soldier.Location);
                                m_Soldier.PlaySound(oneHanded.GetDropSound());
                            }
                        }
                    }

                    if (m_Commander.InRange(m_Soldier.Location, 3))
                    {
                        m_Commander.AddToBackpack(m_CurrentEquip);
                        //m_Soldier.Say("Here is the " + m_CurrentEquip.Name.ToString() + ".");
                        m_Commander.PlaySound(m_CurrentEquip.GetDropSound());
                    }
                    else
                    {
                        m_CurrentEquip.DropToWorld(m_Soldier, m_Soldier.Location);
                        m_Soldier.PlaySound(m_CurrentEquip.GetDropSound());
                    }
                }
                m_Soldier.EquipItem(m_NewEquip);
                m_Soldier.Emote("*changes equipment*");
                if (m_NewEquip is BaseMeleeWeapon)
                    m_Soldier.AI = AIType.AI_Melee;
                else if (m_NewEquip is BaseRanged)
                    m_Soldier.AI = AIType.AI_Archer;
                m_Soldier.PlaySound(m_NewEquip.GetLiftSound(m_Soldier));
            }
            else
                m_Soldier.Say("I can't equip that.");
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:71,代码来源:Soldier.cs

示例2: Lift


//.........这里部分代码省略.........
                        else
                        {
                            item.SetLastMoved();

                            if ( amount == 0 )
                                amount = 1;

                            if ( amount > item.Amount )
                                amount = item.Amount;

                            int oldAmount = item.Amount;
                            item.Amount = amount;

                            if ( amount < oldAmount )
                                item.Dupe( oldAmount - amount );

                            Map map = from.Map;

                            if ( Mobile.DragEffects && map != null && (root == null || root is Item))
                            {
                                IPooledEnumerable eable = map.GetClientsInRange( from.Location );
                                Packet p = null;

                                foreach ( NetState ns in eable )
                                {
                                    if ( ns.Mobile != from && ns.Mobile.CanSee( from ) )
                                    {
                                        if ( p == null )
                                        {
                                            IEntity src;

                                            if ( root == null )
                                                src = new Entity( Serial.Zero, item.Location, map );
                                            else
                                                src = new Entity( ((Item)root).Serial, ((Item)root).Location, map );

                                            p = new DragEffect( src, from, item.ItemID, item.Hue, amount );
                                        }

                                        ns.Send( p );
                                    }
                                }

                                eable.Free();
                            }

                            Point3D fixLoc = item.Location;
                            Map fixMap = item.Map;
                            bool shouldFix = ( item.Parent == null );

                            item.RecordBounce();
                            item.OnItemLifted( from, item );
                            item.Internalize();

                            from.Holding = item;

                            int liftSound = item.GetLiftSound( from );

                            if ( liftSound != -1 )
                                from.Send( new PlaySound( liftSound, from ) );

                            from.NextActionTime = Core.Now + TimeSpan.FromSeconds( 0.5 );

                            if ( fixMap != null && shouldFix )
                                fixMap.FixColumn( fixLoc.m_X, fixLoc.m_Y );

                            reject = LRReason.Inspecific;
                            rejected = false;
                        }
                    }
                }
                else
                {
                    reject = LRReason.Inspecific;
                }
            }
            else
            {
                SendActionMessage();
                reject = LRReason.Inspecific;
            }

            if ( rejected && state != null )
            {
                state.Send( new LiftRej( reject ) );

                if( item.Parent is Item ) {
                    if ( state.IsPost6017 )
                        state.Send( new ContainerContentUpdate6017( item ) );
                    else
                        state.Send( new ContainerContentUpdate( item ) );
                } else if( item.Parent is Mobile )
                    state.Send( new EquipUpdate( item ) );
                else
                    item.SendInfoTo( state );

                if ( ObjectPropertyList.Enabled && item.Parent != null )
                    state.Send( item.OPLPacket );
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:101,代码来源:Mobile.cs


注:本文中的Server.Item.GetLiftSound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。