Mercurial > repos > snowblizz-super-API-ideas
annotate api/Requirements/RequirementOR.cs @ 180:55dc7c97fcfe
* Remove rogue WriteLines
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 24 Oct 2009 15:16:35 +0000 |
parents | 2f3cafb69799 |
children | 6083010a005c |
rev | line source |
---|---|
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
82
diff
changeset
|
1 // This file (RequirementOR.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 IBBoard. |
15 | 2 // |
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
82
diff
changeset
|
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
15 | 4 |
82 | 5 using System; |
0 | 6 using System.Collections.Generic; |
7 using IBBoard.Lang; | |
82 | 8 using IBBoard.WarFoundry.API.Objects; |
9 | |
10 namespace IBBoard.WarFoundry.API.Requirements | |
11 { | |
12 /// <summary> | |
13 /// Summary description for UnitRequirementOR. | |
14 /// </summary> | |
15 public class RequirementOR : AbstractRequirement | |
16 { | |
17 private static string or; | |
18 | |
19 static RequirementOR() | |
20 { | |
21 or = Translation.GetTranslation("requirement_or", true); | |
22 | |
23 if (or == null) | |
24 { | |
25 or = "{0} or {1}"; | |
26 } | |
27 } | |
28 | |
29 private AbstractRequirement reqA, reqB; | |
30 | |
31 public RequirementOR(AbstractRequirement requirementA, AbstractRequirement requirementB) | |
32 { | |
33 reqA = requirementA; | |
34 reqB = requirementB; | |
35 } | |
36 | |
37 public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj) | |
0 | 38 { |
39 FailedRequirement failed = null; | |
82 | 40 |
0 | 41 if (reqA.CanAddToWarFoundryObject(obj) !=null && reqB.CanAddToWarFoundryObject(obj)!=null) |
42 { | |
43 failed = new FailedRequirement(this); | |
44 } | |
45 | |
82 | 46 return failed; |
47 } | |
48 | |
49 public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj) | |
0 | 50 { |
51 FailedRequirement failed = null; | |
82 | 52 |
0 | 53 if (reqA.CanRemoveFromWarFoundryObject(obj)!=null && reqB.CanRemoveFromWarFoundryObject(obj)!=null) |
54 { | |
55 failed = new FailedRequirement(this); | |
56 } | |
57 | |
82 | 58 return failed; |
59 } | |
60 | |
61 public override string Description | |
62 { | |
63 get { return String.Format(or, reqA.Description, reqB.Description); } | |
64 } | |
65 } | |
66 } |