Annotation of /trunk/ModularRex/RexFramework/RexMaterialsDictionary.cs
Parent Directory
|
Revision Log
Revision 40 - (view) (download)
| 1 : | mikkopa | 39 | using System; |
| 2 : | using System.Collections; | ||
| 3 : | using System.Collections.Generic; | ||
| 4 : | using System.Text; | ||
| 5 : | using System.Xml; | ||
| 6 : | using System.Xml.Schema; | ||
| 7 : | using System.Xml.Serialization; | ||
| 8 : | using log4net; | ||
| 9 : | using OpenMetaverse; | ||
| 10 : | |||
| 11 : | |||
| 12 : | |||
| 13 : | namespace ModularRex.RexFramework | ||
| 14 : | { | ||
| 15 : | /// <summary> | ||
| 16 : | /// Rex Material Dictionary | ||
| 17 : | /// May get unfolded as a seperate class | ||
| 18 : | /// </summary> | ||
| 19 : | public class RexMaterialsDictionary : Dictionary<uint, UUID>, ICloneable, IXmlSerializable | ||
| 20 : | { | ||
| 21 : | private RexObjectProperties MyPart; | ||
| 22 : | |||
| 23 : | public void SetSceneObjectPart(RexObjectProperties vPart) | ||
| 24 : | { | ||
| 25 : | MyPart = vPart; | ||
| 26 : | } | ||
| 27 : | |||
| 28 : | public void AddMaterial(uint vIndex, UUID vMaterialUUID) | ||
| 29 : | { | ||
| 30 : | lock (this) | ||
| 31 : | { | ||
| 32 : | this[vIndex] = vMaterialUUID; | ||
| 33 : | } | ||
| 34 : | if (MyPart != null) | ||
| 35 : | MyPart.SchedulePropertiesUpdate(true); | ||
| 36 : | } | ||
| 37 : | |||
| 38 : | public void DeleteMaterialByIndex(uint vIndex) | ||
| 39 : | { | ||
| 40 : | lock (this) | ||
| 41 : | { | ||
| 42 : | if (ContainsKey(vIndex)) | ||
| 43 : | { | ||
| 44 : | Remove(vIndex); | ||
| 45 : | if (MyPart != null) | ||
| 46 : | MyPart.SchedulePropertiesUpdate(true); | ||
| 47 : | } | ||
| 48 : | } | ||
| 49 : | } | ||
| 50 : | |||
| 51 : | public void ClearMaterials() | ||
| 52 : | { | ||
| 53 : | lock (this) | ||
| 54 : | { | ||
| 55 : | Clear(); | ||
| 56 : | } | ||
| 57 : | if (MyPart != null) | ||
| 58 : | MyPart.SchedulePropertiesUpdate(true); | ||
| 59 : | } | ||
| 60 : | |||
| 61 : | |||
| 62 : | public void ReadXml(XmlReader reader) | ||
| 63 : | { | ||
| 64 : | |||
| 65 : | } | ||
| 66 : | |||
| 67 : | public void WriteXml(XmlWriter writer) | ||
| 68 : | { | ||
| 69 : | |||
| 70 : | } | ||
| 71 : | |||
| 72 : | public XmlSchema GetSchema() | ||
| 73 : | { | ||
| 74 : | return null; | ||
| 75 : | } | ||
| 76 : | |||
| 77 : | public Object Clone() | ||
| 78 : | { | ||
| 79 : | RexMaterialsDictionary clone = new RexMaterialsDictionary(); | ||
| 80 : | lock (this) | ||
| 81 : | { | ||
| 82 : | foreach (uint matindex in Keys) | ||
| 83 : | clone.Add(matindex, this[matindex]); | ||
| 84 : | } | ||
| 85 : | return clone; | ||
| 86 : | } | ||
| 87 : | |||
| 88 : | public override string ToString() | ||
| 89 : | { | ||
| 90 : | string s = String.Empty; | ||
| 91 : | |||
| 92 : | foreach (uint matindex in Keys) | ||
| 93 : | s = s + "idx:" + matindex + ",value:" + this[matindex] + "\n"; | ||
| 94 : | |||
| 95 : | return s; | ||
| 96 : | } | ||
| 97 : | } | ||
| 98 : | |||
| 99 : | public class RexMaterialsDictionaryItem | ||
| 100 : | { | ||
| 101 : | private int id = 0; | ||
| 102 : | public int ID | ||
| 103 : | { | ||
| 104 : | get { return id; } | ||
| 105 : | set { id = value; } | ||
| 106 : | } | ||
| 107 : | |||
| 108 : | public RexMaterialsDictionaryItem() { } | ||
| 109 : | |||
| 110 : | public RexMaterialsDictionaryItem(KeyValuePair<uint, UUID> e) | ||
| 111 : | { | ||
| 112 : | num = e.Key; | ||
| 113 : | assetId = e.Value; | ||
| 114 : | } | ||
| 115 : | |||
| 116 : | public KeyValuePair<uint,UUID> getDictionaryEntry() | ||
| 117 : | { | ||
| 118 : | return new KeyValuePair<uint, UUID>(num, assetId); | ||
| 119 : | } | ||
| 120 : | |||
| 121 : | private uint num = 0; | ||
| 122 : | public uint Num | ||
| 123 : | { | ||
| 124 : | get { return num; } | ||
| 125 : | set { num = value; } | ||
| 126 : | } | ||
| 127 : | |||
| 128 : | private UUID assetId = UUID.Zero; | ||
| 129 : | public UUID AssetID | ||
| 130 : | { | ||
| 131 : | get { return assetId; } | ||
| 132 : | set { assetId = value; } | ||
| 133 : | } | ||
| 134 : | |||
| 135 : | private UUID rexObjectUUID; | ||
| 136 : | public UUID RexObjectUUID | ||
| 137 : | { | ||
| 138 : | get { return rexObjectUUID; } | ||
| 139 : | set { rexObjectUUID = value; } | ||
| 140 : | } | ||
| 141 : | } | ||
| 142 : | |||
| 143 : | } |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

