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


C# Decal.Value方法代码示例

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


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

示例1: OnVisualSound

        private void OnVisualSound(Decal.Adapter.Message pMsg)
        {
            try
            {
                if(MyCastList.Count == 0 && OtherCastList.Count == 0) {return;}

                int AnimationTarget = 0;
                try{AnimationTarget = pMsg.Value<int>(0);}catch{AnimationTarget = 0;}
                if(AnimationTarget == 0) { return;}

                if(Core.WorldFilter[AnimationTarget].ObjectClass != ObjectClass.Monster) {return;}
                if(!CombatHudMobTrackingList.Any(x => x.Id == AnimationTarget))
                {
                    CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[AnimationTarget]));
                }

                MonsterObject MobTarget = CombatHudMobTrackingList.Find(x => x.Id == AnimationTarget);

                int SpellAnimation = pMsg.Value<int>(1);
                double AnimationDuration = pMsg.Value<double>(2);

                if(MyCastList.Count > 0 && MyCastList.Any(x => x.SpellAnimation == SpellAnimation && x.SpellTargetId == AnimationTarget))
                {
                    SpellCastInfo MyCastSpell = MyCastList.Find(x => x.SpellAnimation == SpellAnimation && x.SpellTargetId == AnimationTarget);
                    int index = MobTarget.DebuffSpellList.FindIndex(x => x.SpellId == MyCastSpell.SpellCastId);

                    if(index >= 0)
                   	{
                        MobTarget.DebuffSpellList[index].SpellCastTime = DateTime.Now;
                        MobTarget.DebuffSpellList[index].SecondsRemaining = SpellIndex[MyCastSpell.SpellCastId].duration;
                   	}
                   	else
                   	{
                   		MonsterObject.DebuffSpell dbspellnew = new MonsterObject.DebuffSpell();
                   		dbspellnew.SpellId = MyCastSpell.SpellCastId;
                   		dbspellnew.SpellCastTime = DateTime.Now;
                   		dbspellnew.SecondsRemaining = SpellIndex[MyCastSpell.SpellCastId].duration;
                   		MobTarget.DebuffSpellList.Add(dbspellnew);
                   	}
                   	MyCastList.Remove(MyCastSpell);
                   	UpdateTactician();
                }

                if(OtherCastList.Count > 0 && OtherCastList.Any(x => x.Animation == SpellAnimation))
                {
                    int index_o = OtherCastList.FindIndex(x => x.Animation == SpellAnimation);

                    if(index_o >= 0)
                    {
                        OtherDebuffCastInfo OtherCastSpell = OtherCastList[index_o];
                        int index = MobTarget.DebuffSpellList.FindIndex(x => x.SpellId == OtherCastSpell.SpellId);

                        if(index >= 0)
                       	{
                            MobTarget.DebuffSpellList[index].SpellCastTime = DateTime.Now;
                            MobTarget.DebuffSpellList[index].SecondsRemaining = SpellIndex[OtherCastSpell.SpellId].duration;
                       	}
                        else
                       	{
                       		MonsterObject.DebuffSpell dbspellnew = new MonsterObject.DebuffSpell();
                       		dbspellnew.SpellId = OtherCastSpell.SpellId;
                       		dbspellnew.SpellCastTime = DateTime.Now;
                       		dbspellnew.SecondsRemaining = SpellIndex[OtherCastSpell.SpellId].duration;
                       		MobTarget.DebuffSpellList.Add(dbspellnew);
                       	}
                       	OtherCastList.Remove(OtherCastSpell);
                       	UpdateTactician();
                    }
                }

                MyCastList.RemoveAll(x => (DateTime.Now - x.CastTime).TotalSeconds > 8);
                OtherCastList.RemoveAll(x => (DateTime.Now - x.HeardTime).TotalSeconds > 8);

            }catch(Exception ex){LogError(ex);}
        }
开发者ID:Kkarinisme,项目名称:GearTemp,代码行数:75,代码来源:CombatHudMechanics.cs

示例2: OnIdentCombat

        private void OnIdentCombat(Decal.Adapter.Message pMsg)
        {
            try
            {
                int PossibleMobID = Convert.ToInt32(pMsg["object"]);
                if(Core.WorldFilter[PossibleMobID].ObjectClass == ObjectClass.Monster)
                {
                    if(CombatHudMobTrackingList.Count == 0)
                    {
                        CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[PossibleMobID]));
                    }
                    else if(!CombatHudMobTrackingList.Any(x => x.Id == PossibleMobID))
                    {
                        CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[PossibleMobID]));
                    }

                    MonsterObject UpdateMonster = CombatHudMobTrackingList.First(x => x.Id == PossibleMobID);

                    if((pMsg.Value<int>("flags") & 0x200) == 0x200)
                    {
                        //Empty try/catch to deal with cast not valid error.  (infrequent)
                        try
                        {
                            if(pMsg.Value<int>(22) > 0) {UpdateMonster.HealthMax = pMsg.Value<int>(22);}
              					if(pMsg.Value<int>(20) > 0) {UpdateMonster.HealthCurrent = pMsg.Value<int>(20);}
                        }catch{}
            //        				if(pMsg.Value<int>(20) > 0){CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).StaminaMax = pMsg.Value<int>(20);}
            //        				if(pMsg.Value<int>(28) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).StaminaCurrent = pMsg.Value<int>(28);}
            //        				if(pMsg.Value<int>(22) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).ManaMax = pMsg.Value<int>(22);}
            //        				if(pMsg.Value<int>(29) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).ManaCurrent = pMsg.Value<int>(29);}
                        if(UpdateMonster.HealthMax > 0)
                        {
                            UpdateMonster.HealthRemaining = Convert.ToInt32((double)UpdateMonster.HealthCurrent/(double)UpdateMonster.HealthMax*100);
                        }

                    }
                }
                UpdateTactician();
                UpdateFocusHud();
            }
            catch (Exception ex) {LogError(ex);}
        }
开发者ID:Kkarinisme,项目名称:GearTemp,代码行数:42,代码来源:CombatHudMechanics.cs


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