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


C# Equipment.Matches方法代码示例

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


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

示例1: CanLookup

    public bool CanLookup(
		string fname, LookupType type,
		SkillDef scontext=null,
		Character ccontext=null,
		Character tcontext=null,
		Equipment econtext=null,
		Item icontext=null,
		Formula f=null
	)
    {
        switch(type) {
            case LookupType.Auto:
                return (icontext != null && icontext.HasParam(fname)) ||
                             (econtext != null && econtext.HasParam(fname)) ||
                             (scontext != null && scontext.HasParam(fname)) ||
                             (ccontext != null && ccontext.HasStat(fname)) ||
         							 (tcontext != null && tcontext.HasStat(fname));
            case LookupType.SkillParam:
                return scontext.HasParam(fname);
            case LookupType.ItemParam: {
                if(icontext == null && scontext != null) {
                    icontext = scontext.InvolvedItem;
                }
                if(icontext == null && econtext != null) {
                    icontext = econtext.baseItem;
                }
                return icontext != null && icontext.HasParam(fname);
            }
            case LookupType.ReactedItemParam: {
                icontext = scontext.currentReactedSkill.InvolvedItem;
                return icontext != null && icontext.HasParam(fname);
            }
            case LookupType.ActorStat:
                if(scontext != null) { return scontext.character.HasStat(fname); }
                if(econtext != null) { return econtext.wielder.HasStat(fname); }
                if(ccontext != null) { return ccontext.HasStat(fname); }
                return false;
            case LookupType.ActorMountStat: {
                Character m = null;
                if(scontext != null) { m = scontext.currentTargetCharacter.mountedCharacter; }
                if(econtext != null) { m = econtext.wielder.mountedCharacter; }
                if(tcontext != null) { m = tcontext.mountedCharacter; }
                if(m != null) { return m.HasStat(fname); }
                // Debug.Log("can lookup "+fname+" on mount "+m+" ? "+(m != null && m.HasStat(fname)));
                return false;
            }
            case LookupType.ActorMounterStat: {
                Character m = null;
                if(scontext != null) { m = scontext.currentTargetCharacter.mountingCharacter; }
                if(econtext != null) { m = econtext.wielder.mountingCharacter; }
                if(tcontext != null) { m = tcontext.mountingCharacter; }
                if(m != null) { return m.HasStat(fname); }
                return false;
            }
            case LookupType.ActorEquipmentParam:
                if(scontext != null) {
                    ccontext = scontext.character;
                } else if(ccontext == null && econtext != null) {
                    if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
                        return econtext.HasParam(fname);
                    } else {
                        ccontext = econtext.wielder;
                    }
                }
                return CanLookupEquipmentParamOn(fname, type, ccontext, f);
            case LookupType.ActorMountEquipmentParam:
                if(scontext != null) {
                    ccontext = scontext.character.mountedCharacter;
                } else if(ccontext == null && econtext != null) {
                    if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
                        return econtext.HasParam(fname);
                    } else {
                        ccontext = econtext.wielder.mountedCharacter;
                    }
                }
                return CanLookupEquipmentParamOn(fname, type, ccontext, f);
            case LookupType.ActorMounterEquipmentParam:
                if(scontext != null) {
                    ccontext = scontext.character.mountingCharacter;
                } else if(ccontext == null && econtext != null) {
                    if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
                        return econtext.HasParam(fname);
                    } else {
                        ccontext = econtext.wielder.mountingCharacter;
                    }
                }
                return CanLookupEquipmentParamOn(fname, type, ccontext, f);
            case LookupType.ActorSkillParam:
                if(scontext != null) { return scontext.HasParam(fname); }
                return false;
            case LookupType.ActorStatusEffect:
                if(scontext != null) { return scontext.character.HasStatusEffect(fname); }
                if(econtext != null) { return econtext.wielder.HasStatusEffect(fname); }
                if(ccontext != null) { return ccontext.HasStatusEffect(fname); }
                return false;
            case LookupType.ActorMountStatusEffect: {
                Character m = null;
                if(scontext != null) { m = scontext.character.mountedCharacter; }
                if(econtext != null) { m = econtext.wielder.mountedCharacter; }
                if(ccontext != null) { m = ccontext.mountedCharacter; }
//.........这里部分代码省略.........
开发者ID:JoeOsborn,项目名称:SRPGCK,代码行数:101,代码来源:Formulae.cs

示例2: Lookup

    public float Lookup(
		string fname, LookupType type,
		SkillDef scontext=null,
		Character ccontext=null,
		Character tcontext=null,
		Equipment econtext=null,
		Item icontext=null,
		Formula f=null
	)
    {
        switch(type) {
            case LookupType.Auto: {
                float ret =
                    (icontext != null ? icontext.GetParam(fname) :
                    (econtext != null ? econtext.GetParam(fname) :
                    (scontext != null ? scontext.GetParam(fname) :
                    (ccontext != null ? ccontext.GetStat(fname) :
                    (tcontext != null ? tcontext.GetStat(fname) :
                    (HasFormula(fname) ? LookupFormula(fname).GetValue(this, scontext, ccontext, tcontext, econtext, icontext) : float.NaN))))));
                if(float.IsNaN(ret)) {
                    Debug.LogError("auto lookup failed for "+fname);
                }
                return ret;
            }
            case LookupType.SkillParam:
                return scontext.GetParam(fname);
            case LookupType.ItemParam: {
                if(icontext == null && scontext != null) {
                    icontext = scontext.InvolvedItem;
                }
                if(icontext == null && econtext != null) {
                    icontext = econtext.baseItem;
                }
                return icontext.GetParam(fname, scontext);
            }
            case LookupType.ReactedItemParam: {
                icontext = scontext.currentReactedSkill.InvolvedItem;
                return icontext.GetParam(fname, scontext);
            }
            case LookupType.ActorStat:
                if(scontext != null) { return scontext.character.GetStat(fname); }
                if(econtext != null) { return econtext.wielder.GetStat(fname); }
                if(ccontext != null) { return ccontext.GetStat(fname); }
                Debug.LogError("Cannot find actor stat "+fname);
                return float.NaN;
            case LookupType.ActorMountStat: {
                Character m = null;
                if(scontext != null) { m = scontext.character.mountedCharacter; }
                if(econtext != null) { m = econtext.wielder.mountedCharacter; }
                if(ccontext != null) { m = ccontext.mountedCharacter; }
                // Debug.Log("lookup "+fname+" on mount "+m+" ? "+(m != null ? m.GetStat(fname) : 0));
                if(m != null) {
                    return m.GetStat(fname);
                }
                Debug.LogError("Cannot find actor mount stat "+fname);
                return float.NaN;
            }
            case LookupType.ActorMounterStat: {
                Character m = null;
                if(scontext != null) { m = scontext.character.mountingCharacter; }
                if(econtext != null) { m = econtext.wielder.mountingCharacter; }
                if(ccontext != null) { m = ccontext.mountingCharacter; }
                if(m != null) {
                    return m.GetStat(fname);
                }
                Debug.LogError("Cannot find actor mounter stat "+fname);
                return float.NaN;
            }
            case LookupType.ActorEquipmentParam:
                if(scontext != null) {
                    ccontext = scontext.character;
                } else if(ccontext == null && econtext != null) {
                    if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
                        return econtext.GetParam(fname);
                    } else {
                        ccontext = econtext.wielder;
                    }
                }
                return LookupEquipmentParamOn(fname, type, ccontext, f, scontext);
            case LookupType.ActorMountEquipmentParam:
                if(scontext != null) {
                    ccontext = scontext.character.mountedCharacter;
                } else if(ccontext == null && econtext != null) {
                    if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
                        return econtext.GetParam(fname);
                    } else {
                        ccontext = econtext.wielder.mountedCharacter;
                    }
                }
                return LookupEquipmentParamOn(fname, type, ccontext, f, scontext);
            case LookupType.ActorMounterEquipmentParam:
                if(scontext != null) {
                    ccontext = scontext.character.mountingCharacter;
                } else if(ccontext == null && econtext != null) {
                    if(econtext.Matches(f.equipmentSlots, f.equipmentCategories)) {
                        return econtext.GetParam(fname);
                    } else {
                        ccontext = econtext.wielder.mountingCharacter;
                    }
                }
//.........这里部分代码省略.........
开发者ID:JoeOsborn,项目名称:SRPGCK,代码行数:101,代码来源:Formulae.cs


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