[Rpgworldmodel-commits] SF.net SVN: rpgworldmodel: [9] src/RPGWorldModel.Abstracts
Status: Inactive
Brought to you by:
deadwood_pl
From: <dea...@us...> - 2006-07-03 20:23:49
|
Revision: 9 Author: deadwood_pl Date: 2006-07-03 13:23:33 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/rpgworldmodel/?rev=9&view=rev Log Message: ----------- Remove IHandAllocator interface. Initial work on IEquipable interface implementation. Modified Paths: -------------- src/RPGWorldModel.Abstracts/Humanoid.cs src/RPGWorldModel.Abstracts/IEquip.cs src/RPGWorldModel.Abstracts/IEquipable.cs src/RPGWorldModel.Abstracts/Item.cs src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj src/RPGWorldModel.Abstracts/Sword.cs src/RPGWorldModel.Abstracts/Weapon.cs Removed Paths: ------------- src/RPGWorldModel.Abstracts/IHandAllocator.cs Modified: src/RPGWorldModel.Abstracts/Humanoid.cs =================================================================== --- src/RPGWorldModel.Abstracts/Humanoid.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -28,6 +28,7 @@ equipmentSlots.Add(new EquipmentSlotNeck()); equipmentSlots.Add(new EquipmentSlotTorso()); equipmentSlots.Add(new EquipmentSlotBack()); + equipmentSlots.Add(new EquipmentSlotWaist()); equipmentSlots.Add(new EquipmentSlotLeftArm()); equipmentSlots.Add(new EquipmentSlotRightArm()); equipmentSlots.Add(new EquipmentSlotLeftHand()); Modified: src/RPGWorldModel.Abstracts/IEquip.cs =================================================================== --- src/RPGWorldModel.Abstracts/IEquip.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/IEquip.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -71,6 +71,10 @@ { } + public class EquipmentSlotWaist : EquipmentSlot + { + } + public class EquipmentSlotBack : EquipmentSlot { } Modified: src/RPGWorldModel.Abstracts/IEquipable.cs =================================================================== --- src/RPGWorldModel.Abstracts/IEquipable.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/IEquipable.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -6,9 +6,64 @@ { public interface IEquipable { + void InitializeEquipable(); } public class EquipableList : List<IEquipable> { } + + + /* + * Equipment location - maps to equipement slot + */ + public abstract class EquipmentLocation + { + } + + public class EquipmentLocationList : List<EquipmentLocation> + { + } + + public class EquipmentLocationDescriptor + { + protected EquipmentLocationList equipmentLocationList = new EquipmentLocationList(); + + public IEnumerable<EquipmentLocation> EquipmentLocations + { + get { return equipmentLocationList; } + } + + public void AddEquipmentLocation(EquipmentLocation location) + { + foreach (EquipmentLocation containedLocation in equipmentLocationList) + { + if (containedLocation.GetType() == location.GetType()) + return; + } + + equipmentLocationList.Add(location); + } + } + + public class EquipmentLocationDescriptorList : List<EquipmentLocationDescriptor> + { + } + + public class EquipmentLocationLeftHand : EquipmentLocation + { + } + + public class EquipmentLocationRightHand : EquipmentLocation + { + } + + public class EquipmentLocationBack : EquipmentLocation + { + } + + public class EquipmentLocationWaist : EquipmentLocation + { + } + } Deleted: src/RPGWorldModel.Abstracts/IHandAllocator.cs =================================================================== --- src/RPGWorldModel.Abstracts/IHandAllocator.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/IHandAllocator.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace RPGWorldModel.Abstracts.Interfaces -{ - /// <summary> - /// Iterface for entities alocating entity hands - /// </summary> - public interface IHandAllocator - { - AllocatedHands Hands - { - get; - } - - void SetHandAllocation(HandAllocation newHandAllocation); - void InitializeHandAllocator(); - } - - public enum AllocatedHands - { - OneHand, - TwoHands - } - - public class HandAllocation : Initializable - { - private AllocatedHands allocatedHands = AllocatedHands.OneHand; - public AllocatedHands AllocatedHands - { - get { return allocatedHands; } - set { allocatedHands = value; } - } - } -} Modified: src/RPGWorldModel.Abstracts/Item.cs =================================================================== --- src/RPGWorldModel.Abstracts/Item.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/Item.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -12,6 +12,8 @@ { protected Durability durability = new Durability(); + protected EquipmentLocationDescriptorList equipmentLocationDescriptors = + new EquipmentLocationDescriptorList(); #region Initialize Overrides @@ -19,7 +21,8 @@ { base.InitializeEntity(); - // InitializeEquipable ? + InitializeEquipable(); + InitializeDamagable(); } @@ -34,6 +37,12 @@ #endregion + #region IEquipableMembers + + public abstract void InitializeEquipable(); + + #endregion + #region IDamagable Members public short MaxDurability Modified: src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj =================================================================== --- src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-07-03 20:23:33 UTC (rev 9) @@ -44,7 +44,6 @@ <Compile Include="IDamageInflictor.cs" /> <Compile Include="IEquip.cs" /> <Compile Include="IEquipable.cs" /> - <Compile Include="IHandAllocator.cs" /> <Compile Include="ILiveEntity.cs" /> <Compile Include="IMagicEntity.cs" /> <Compile Include="INamedEntity.cs" /> Modified: src/RPGWorldModel.Abstracts/Sword.cs =================================================================== --- src/RPGWorldModel.Abstracts/Sword.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/Sword.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -23,15 +23,6 @@ } } - public override void InitializeHandAllocator() - { - if (!allocation.IsInitialized) - { - allocation.AllocatedHands = AllocatedHands.OneHand; - allocation.IsInitialized = true; - } - } - public override void InitializeDamagable() { if (!durability.IsInitialized) @@ -67,7 +58,28 @@ randomizeDamageDescriptor(damageDescriptor); } } - + + public override void InitializeEquipable() + { + equipmentLocationDescriptors.Clear(); + + // Building descriptors + EquipmentLocationDescriptor leftHand = new EquipmentLocationDescriptor(); + leftHand.AddEquipmentLocation(new EquipmentLocationLeftHand()); + equipmentLocationDescriptors.Add(leftHand); + + EquipmentLocationDescriptor rightHand = new EquipmentLocationDescriptor(); + rightHand.AddEquipmentLocation(new EquipmentLocationRightHand()); + equipmentLocationDescriptors.Add(rightHand); + + EquipmentLocationDescriptor waist = new EquipmentLocationDescriptor(); + waist.AddEquipmentLocation(new EquipmentLocationWaist()); + equipmentLocationDescriptors.Add(waist); + + EquipmentLocationDescriptor back = new EquipmentLocationDescriptor(); + back.AddEquipmentLocation(new EquipmentLocationBack()); + equipmentLocationDescriptors.Add(back); + } #endregion } } Modified: src/RPGWorldModel.Abstracts/Weapon.cs =================================================================== --- src/RPGWorldModel.Abstracts/Weapon.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/Weapon.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -5,9 +5,8 @@ namespace RPGWorldModel.Abstracts.Entities.Items { - public abstract class Weapon : Item, IHandAllocator, IDamageInflictor + public abstract class Weapon : Item, IDamageInflictor { - protected HandAllocation allocation = new HandAllocation(); protected DamageDescriptorDictionary damageDescriptors = new DamageDescriptorDictionary(); #region Initialize Overrides @@ -16,8 +15,6 @@ { base.InitializeEntity(); - InitializeHandAllocator(); - InitializeDamageInflictor(); } @@ -32,26 +29,6 @@ #endregion - - - #region IHandAllocator Members - - public AllocatedHands Hands - { - get { return allocation.AllocatedHands; } - } - - public abstract void InitializeHandAllocator(); - - public virtual void SetHandAllocation(HandAllocation newHandAllocation) - { - if (newHandAllocation == null) - throw new ArgumentException("newHandAllocation cannot be null", "newHandAllocation"); - - allocation = newHandAllocation; - } - #endregion - #region IDamageInflictor Members public abstract void InitializeDamageInflictor(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |