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


C# Stat.Get方法代码示例

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


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

示例1: ToBuff

    public static Buff ToBuff(Stat stat)
    {
        var members = EnumTool.GetNames(stat.KeyType);
        Dictionary<Enum, float> values = new Dictionary<Enum, float>();
        for (int i = 1; true; i++)
        {
            string form1 = string.Format("Stat{0}Type", i);
            string form2 = string.Format("Stat{0}Value", i);
            if (members.Contains(form1) && members.Contains(form2))
            {
                Enum statType = stat.GetRawValue(EnumTool.Parse(stat.KeyType.Name, form1) as Enum) as Enum;
                float value = stat.Get(EnumTool.Parse(stat.KeyType.Name, form2) as Enum);
                if (statType.ToString() != "None")
                {
                    values.Add(statType, value);
                }
            }
            else
            {
                break;
            }
        }

        string name = stat.KeyType.ToString() + stat.Get(EnumTool.Parse(stat.KeyType, "ID") as Enum);
        float duration = float.MaxValue;
        return new Buff(name, duration, values);
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:27,代码来源:Buff.cs

示例2: ApplyStat

    static string ApplyStat(string actionPattern, Stat stat)
    {
        while (actionPattern.Contains("["))
        {
            int startIndex = actionPattern.IndexOf("[");
            int endIndex = actionPattern.IndexOf("]", startIndex);
            string strStatType = actionPattern.Substring(startIndex + 1, endIndex - startIndex - 1);
            Enum statType = EnumTool.Parse(stat.KeyType, strStatType) as Enum;
            Assert.IsTrue(statType != null, string.Format("[{0}]", strStatType));

            float statValue = stat.Get(statType);
            actionPattern = actionPattern.Replace(actionPattern.Substring(startIndex, endIndex - startIndex + 1), statValue.ToString());
        }
        return actionPattern;
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:15,代码来源:ActionPattern.cs

示例3: GetStatOrValue

    private float GetStatOrValue(Enum statusType, Stat stat, Dictionary<Enum, Enum> statContainer, Dictionary<Enum, float> valueContainer, float defaultVal)
    {
        CheckStatusType(statusType);

        if (statContainer.ContainsKey(statusType))
        {
            return stat.Get(statContainer[statusType]);
        }
        if (valueContainer.ContainsKey(statusType))
        {
            return valueContainer[statusType];
        }
        return defaultVal;
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:14,代码来源:Status.cs

示例4: ApplyScaleAndCritical

    static string ApplyScaleAndCritical(string pattern, Stat stat, E_BlockType type, float effectFactor, int inARowCount, bool isCharged)
    {
        float inARowFactor = (inARowCount - 3) * GetInARowFactorRatio(type);
        float ciriticalFactor = 0f;
        float extraDamageFactor = 0f;
        if (stat != null)
        {
            if (type == E_BlockType.Attack1 || type == E_BlockType.Attack2)
            {
                int parenOpen;
                int parenclose;
                SearchParenIndexs(pattern, "Attack", out parenOpen, out parenclose);

                bool isCritical = RandomTool.IsIn(stat.Get(ItemHeroStat.criticalHitChance));
                if (isCritical)
                {
                    pattern = pattern.Insert(parenclose, "; param=critical");
                    ciriticalFactor = stat.Get(ItemHeroStat.criticalHitDamage);
                }
                if (isCharged)
                {
                    pattern = pattern.Insert(parenclose, "; param=charged");
                }

                extraDamageFactor = stat.Get(ItemHeroStat.extraDamageFactor);
            }
        }
        return string.Format(pattern, 1 + effectFactor + inARowFactor + ciriticalFactor + extraDamageFactor);
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:29,代码来源:BlockCommand.cs

示例5: ApplyScaleAndCritical

    static string ApplyScaleAndCritical(string pattern, Stat stat, BlockType type, float effectFactor, int criticalBuffId)
    {
        float ciriticalFactor = 0;

        if (stat != null)
        {
            if (type == BlockType.Attack1 || type == BlockType.Attack2)
            {
                bool isCritical = RandomTool.IsIn(stat.Get(HeroStatType.criticalHitChance));
                if (isCritical)
                {
                    int parenOpen;
                    int parenclose;
                    SearchParenIndexs(pattern, "PhysicalAttack", out parenOpen, out parenclose);

                    pattern = pattern.Insert(parenclose, "; param=critical");
                    if (criticalBuffId > 0)
                    {
                        pattern = string.Format("Sequence({0}; Action(Contact; Buff; {1}) )", pattern, criticalBuffId);
                    }
                    ciriticalFactor = stat.Get(HeroStatType.criticalHitDamageFactor);
                }
            }
        }
        return string.Format(pattern, 1 + effectFactor + ciriticalFactor);
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:26,代码来源:BlockCommand.cs

示例6: ApplyStat

 static string ApplyStat(string statMod, Stat stat)
 {
     while (statMod.Contains("["))
     {
         int startIndex = statMod.IndexOf("[");
         int endIndex = statMod.IndexOf("]", startIndex);
         string strStatType = statMod.Substring(startIndex + 1, endIndex - startIndex - 1);
         Enum statType = EnumTool.Parse(stat.KeyType, strStatType) as Enum;
         float statValue = stat.Get(statType);
         statMod = statMod.Replace(statMod.Substring(startIndex, endIndex - startIndex + 1), statValue.ToString());
     }
     return statMod;
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:13,代码来源:Buff.cs


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