Mercurial > repos > IBDev-IBBoard.WarFoundry.API
view api/Requirements/RequirementOR.cs @ 0:520818033bb6
Initial commit of WarFoundry code
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 19 Dec 2008 15:57:51 +0000 |
parents | |
children | 306558904c2a |
line wrap: on
line source
using System; using System.Collections.Generic; using IBBoard.Lang; using IBBoard.WarFoundry.API.Objects; namespace IBBoard.WarFoundry.API.Requirements { /// <summary> /// Summary description for UnitRequirementOR. /// </summary> public class RequirementOR : AbstractRequirement { private static string or; static RequirementOR() { or = Translation.GetTranslation("requirement_or", true); if (or == null) { or = "{0} or {1}"; } } private AbstractRequirement reqA, reqB; public RequirementOR(AbstractRequirement requirementA, AbstractRequirement requirementB) { reqA = requirementA; reqB = requirementB; } public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj) { FailedRequirement failed = null; if (reqA.CanAddToWarFoundryObject(obj) !=null && reqB.CanAddToWarFoundryObject(obj)!=null) { failed = new FailedRequirement(this); } return failed; } public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj) { FailedRequirement failed = null; if (reqA.CanRemoveFromWarFoundryObject(obj)!=null && reqB.CanRemoveFromWarFoundryObject(obj)!=null) { failed = new FailedRequirement(this); } return failed; } public override string Description { get { return String.Format(or, reqA.Description, reqB.Description); } } } }