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


C# Decal.IsYouGive方法代码示例

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


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

示例1: _decalEventsProxy_ChatBoxMessage

        private void _decalEventsProxy_ChatBoxMessage(object sender, Decal.Adapter.ChatTextInterceptEventArgs e)
        {
            if (this._giveItemPending.WaitOne(0))
            {
                // Ex: You give Kreap Invitation Ithaenc Cathedral.
                // Ex: You give Kreap Velvet Baggy Pants.
                //         WorldObject Name will = Baggy Pants
                // Ex: You give Vassari 4 Quills of Infliction
                // Ex: You give Rockdown Guy 50 Silver Peas.
                if (e.IsYouGive())
                {
                    var worldObj = this._pendingGiveItemCapturedWorldObject;

                    var textMinusPrefix = e.Text.Substring(9);

                    var itemNameStartIndex = textMinusPrefix.IndexOf(worldObj.Name);

                    var targetName = textMinusPrefix.Substring(0, itemNameStartIndex).Trim();

                    // If the item we are giving has a material, it's going to be in the text and we need to trim it out
                    var materialValue = worldObj.Values(LongValueKey.Material);
                    if (materialValue > 0)
                    {
                        string materialName;
                        if(Mag.Shared.Constants.Dictionaries.MaterialInfo.TryGetValue(materialValue, out materialName))
                        {
                            targetName = targetName.Substring(0, targetName.Length - (materialName.Length + 1));
                        }
                    }

                    var stackCount = worldObj.Values(LongValueKey.StackCount);
                    if (stackCount > 1)
                    {
                        // When stack count > 0, what we will be looking at is :
                        //      targetName = Rockdown Guy 50 S
                        // The single character is left over from the item name being plural in the give message
                        var endingCharsToIgnore = 2 + (stackCount.ToString()).Length;
                        targetName = targetName.Substring(0, targetName.Length - endingCharsToIgnore).Trim();
                    }

                    var eventArgs = new EndGiveItemEventArgs(worldObj, targetName, GiveItemOutcome.Successful);
                    REPlugin.Instance.Debug.WriteObject(eventArgs);

                    if (this.EndGiveItem != null)
                    {
                        this.EndGiveItem(sender, eventArgs);
                    }

                    this._giveItemPending.Reset();
                    this._pendingGiveItemCapturedWorldObject = null;
                }
            }
        }
开发者ID:mrvoorhe,项目名称:redox-extensions,代码行数:53,代码来源:REEvents.cs


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