本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}