annotate api/Objects/UnitMemberType.cs @ 279:51b3027a7dae

Re #295: Index out of bounds when changing unit size and clicking in equipment list * Trigger 'fake' equipment amount changed events when the unit size changes for all ratio equipment - ratio won't have changed, but absolute number will
author IBBoard <dev@ibboard.co.uk>
date Wed, 14 Jul 2010 20:01:14 +0000
parents cdda78975be1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
252
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (UnitMember.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2010 IBBoard
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
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.
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 namespace IBBoard.WarFoundry.API.Objects
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 {
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 /// <summary>
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 /// A container object for representations of different unit member types, such as "Infantry", "Elite Infantry" and "Commoner".
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 /// The idea of the UnitMemberType is to define not just the <see>UnitType</see>s, but also the types of type, as Archer and Swordsmen
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 /// are often just differently equipped versions of the same member type (Infantry).
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 /// </summary>
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 public class UnitMemberType : WarFoundryObject
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 {
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 private Stats stats;
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 public UnitMemberType(string typeID, string typeName, Stats typeStats) : base(typeID, typeName)
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 {
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 stats = typeStats;
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 }
254
cdda78975be1 Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents: 252
diff changeset
22
cdda78975be1 Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents: 252
diff changeset
23 public string StatsID
cdda78975be1 Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents: 252
diff changeset
24 {
cdda78975be1 Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents: 252
diff changeset
25 get
cdda78975be1 Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents: 252
diff changeset
26 {
cdda78975be1 Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents: 252
diff changeset
27 return stats.StatsID;
cdda78975be1 Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents: 252
diff changeset
28 }
cdda78975be1 Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents: 252
diff changeset
29 }
252
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 /// <value>
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 /// The set of <see cref="Stat"/>s for the unit member type in a format that is valid for the game system.
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 /// </value>
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 public Stat[] StatsArray
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 {
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 get
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 {
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 return stats.StatsArray;
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 }
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 }
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 public Stat[] StatsArrayWithName
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 {
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 get
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 {
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46 Stat[] extendedStats = new Stat[stats.StatCount+1];
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 extendedStats[0] = new Stat(new StatSlot("name"), Name);
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 stats.StatsArray.CopyTo(extendedStats, 1);
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49 return extendedStats;
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 }
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 }
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52 }
a54da5a8b5bb Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 }