Annotation of /trunk/ModularRex/RexFramework/RexObjectProperties.cs
Parent Directory
|
Revision Log
Revision 39 - (view) (download)
| 1 : | mikkopa | 28 | using System; |
| 2 : | mikkopa | 39 | using System.Collections; |
| 3 : | mikkopa | 28 | using System.Collections.Generic; |
| 4 : | using System.Reflection; | ||
| 5 : | using System.Text; | ||
| 6 : | using System.Xml; | ||
| 7 : | using System.Xml.Schema; | ||
| 8 : | using System.Xml.Serialization; | ||
| 9 : | using log4net; | ||
| 10 : | using OpenMetaverse; | ||
| 11 : | |||
| 12 : | namespace ModularRex.RexFramework | ||
| 13 : | { | ||
| 14 : | public delegate void OnRexObjectPropertiesUpdateDelegate(UUID id, RexObjectProperties prop, bool dbSave); | ||
| 15 : | |||
| 16 : | public delegate void OnRexObjectPropertiesDataUpdateDelegate(UUID id, string data, bool dbSave); | ||
| 17 : | |||
| 18 : | public class RexObjectProperties | ||
| 19 : | { | ||
| 20 : | private static readonly ILog m_log = | ||
| 21 : | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
| 22 : | |||
| 23 : | mikkopa | 39 | #region Properties |
| 24 : | mikkopa | 28 | |
| 25 : | mikkopa | 39 | private UUID parentObjectID = UUID.Zero; |
| 26 : | public UUID ParentObjectID | ||
| 27 : | { | ||
| 28 : | get { return parentObjectID; } | ||
| 29 : | set { parentObjectID = value; } | ||
| 30 : | mikkopa | 28 | } |
| 31 : | |||
| 32 : | mikkopa | 39 | private byte m_RexDrawType = 1; |
| 33 : | mikkopa | 28 | public byte RexDrawType |
| 34 : | { | ||
| 35 : | get { return m_RexDrawType; } | ||
| 36 : | set | ||
| 37 : | { | ||
| 38 : | m_RexDrawType = value; | ||
| 39 : | SchedulePropertiesUpdate(true); | ||
| 40 : | } | ||
| 41 : | } | ||
| 42 : | |||
| 43 : | private bool m_RexIsVisible = true; | ||
| 44 : | public bool RexIsVisible | ||
| 45 : | { | ||
| 46 : | get { return m_RexIsVisible; } | ||
| 47 : | set | ||
| 48 : | { | ||
| 49 : | m_RexIsVisible = value; | ||
| 50 : | SchedulePropertiesUpdate(true); | ||
| 51 : | } | ||
| 52 : | } | ||
| 53 : | |||
| 54 : | mikkopa | 39 | private bool m_RexCastShadows = false; |
| 55 : | mikkopa | 28 | public bool RexCastShadows |
| 56 : | { | ||
| 57 : | get { return m_RexCastShadows; } | ||
| 58 : | set | ||
| 59 : | { | ||
| 60 : | m_RexCastShadows = value; | ||
| 61 : | SchedulePropertiesUpdate(true); | ||
| 62 : | } | ||
| 63 : | } | ||
| 64 : | |||
| 65 : | mikkopa | 39 | private bool m_RexLightCreatesShadows = false; |
| 66 : | mikkopa | 28 | public bool RexLightCreatesShadows |
| 67 : | { | ||
| 68 : | get { return m_RexLightCreatesShadows; } | ||
| 69 : | set | ||
| 70 : | { | ||
| 71 : | m_RexLightCreatesShadows = value; | ||
| 72 : | SchedulePropertiesUpdate(true); | ||
| 73 : | } | ||
| 74 : | } | ||
| 75 : | |||
| 76 : | mikkopa | 39 | private bool m_RexDescriptionTexture = false; |
| 77 : | mikkopa | 28 | public bool RexDescriptionTexture |
| 78 : | { | ||
| 79 : | get { return m_RexDescriptionTexture; } | ||
| 80 : | set | ||
| 81 : | { | ||
| 82 : | m_RexDescriptionTexture = value; | ||
| 83 : | SchedulePropertiesUpdate(true); | ||
| 84 : | } | ||
| 85 : | } | ||
| 86 : | |||
| 87 : | mikkopa | 39 | private bool m_RexScaleToPrim = false; |
| 88 : | mikkopa | 28 | public bool RexScaleToPrim |
| 89 : | { | ||
| 90 : | get { return m_RexScaleToPrim; } | ||
| 91 : | set | ||
| 92 : | { | ||
| 93 : | m_RexScaleToPrim = value; | ||
| 94 : | SchedulePropertiesUpdate(true); | ||
| 95 : | } | ||
| 96 : | } | ||
| 97 : | |||
| 98 : | mikkopa | 39 | private float m_RexDrawDistance = 0; |
| 99 : | mikkopa | 28 | public float RexDrawDistance |
| 100 : | { | ||
| 101 : | get { return m_RexDrawDistance; } | ||
| 102 : | set | ||
| 103 : | { | ||
| 104 : | m_RexDrawDistance = value; | ||
| 105 : | SchedulePropertiesUpdate(true); | ||
| 106 : | } | ||
| 107 : | } | ||
| 108 : | |||
| 109 : | private float m_RexLOD = 1.0F; | ||
| 110 : | public float RexLOD | ||
| 111 : | { | ||
| 112 : | get { return m_RexLOD; } | ||
| 113 : | set | ||
| 114 : | { | ||
| 115 : | m_RexLOD = value; | ||
| 116 : | SchedulePropertiesUpdate(true); | ||
| 117 : | } | ||
| 118 : | } | ||
| 119 : | |||
| 120 : | private UUID m_RexMeshUUID = UUID.Zero; | ||
| 121 : | public UUID RexMeshUUID | ||
| 122 : | { | ||
| 123 : | get { return m_RexMeshUUID; } | ||
| 124 : | set | ||
| 125 : | { | ||
| 126 : | m_RexMeshUUID = value; | ||
| 127 : | SchedulePropertiesUpdate(true); | ||
| 128 : | } | ||
| 129 : | } | ||
| 130 : | |||
| 131 : | private UUID m_RexCollisionMeshUUID = UUID.Zero; | ||
| 132 : | public UUID RexCollisionMeshUUID | ||
| 133 : | { | ||
| 134 : | get { return m_RexCollisionMeshUUID; } | ||
| 135 : | set | ||
| 136 : | { | ||
| 137 : | m_RexCollisionMeshUUID = value; | ||
| 138 : | SchedulePropertiesUpdate(true); | ||
| 139 : | } | ||
| 140 : | } | ||
| 141 : | |||
| 142 : | private UUID m_RexParticleScriptUUID = UUID.Zero; | ||
| 143 : | public UUID RexParticleScriptUUID | ||
| 144 : | { | ||
| 145 : | get { return m_RexParticleScriptUUID; } | ||
| 146 : | set | ||
| 147 : | { | ||
| 148 : | m_RexParticleScriptUUID = value; | ||
| 149 : | SchedulePropertiesUpdate(true); | ||
| 150 : | } | ||
| 151 : | } | ||
| 152 : | |||
| 153 : | private UUID m_RexAnimationPackageUUID = UUID.Zero; | ||
| 154 : | public UUID RexAnimationPackageUUID | ||
| 155 : | { | ||
| 156 : | get { return m_RexAnimationPackageUUID; } | ||
| 157 : | set | ||
| 158 : | { | ||
| 159 : | m_RexAnimationPackageUUID = value; | ||
| 160 : | SchedulePropertiesUpdate(true); | ||
| 161 : | } | ||
| 162 : | } | ||
| 163 : | |||
| 164 : | private string m_RexAnimationName = String.Empty; | ||
| 165 : | public string RexAnimationName | ||
| 166 : | { | ||
| 167 : | get { return m_RexAnimationName; } | ||
| 168 : | set | ||
| 169 : | { | ||
| 170 : | m_RexAnimationName = value; | ||
| 171 : | SchedulePropertiesUpdate(true); | ||
| 172 : | } | ||
| 173 : | } | ||
| 174 : | |||
| 175 : | private float m_RexAnimationRate = 1.0F; | ||
| 176 : | public float RexAnimationRate | ||
| 177 : | { | ||
| 178 : | get { return m_RexAnimationRate; } | ||
| 179 : | set | ||
| 180 : | { | ||
| 181 : | m_RexAnimationRate = value; | ||
| 182 : | SchedulePropertiesUpdate(true); | ||
| 183 : | } | ||
| 184 : | } | ||
| 185 : | |||
| 186 : | mikkopa | 39 | |
| 187 : | #region Material Stuff | ||
| 188 : | |||
| 189 : | mikkopa | 28 | public RexMaterialsDictionary RexMaterials = new RexMaterialsDictionary(); |
| 190 : | public RexMaterialsDictionary GetRexMaterials() | ||
| 191 : | { | ||
| 192 : | return (RexMaterialsDictionary)RexMaterials.Clone(); | ||
| 193 : | } | ||
| 194 : | |||
| 195 : | mikkopa | 39 | /// <summary> |
| 196 : | /// This is only to be used from NHibernate. Use RexMaterials instead in other cases. | ||
| 197 : | /// </summary> | ||
| 198 : | public IList<RexMaterialsDictionaryItem> RexMaterialDictionaryItems | ||
| 199 : | { | ||
| 200 : | get | ||
| 201 : | { | ||
| 202 : | IList<RexMaterialsDictionaryItem> tempRexMaterialDictionaryItems = new List<RexMaterialsDictionaryItem>(); | ||
| 203 : | foreach (KeyValuePair<uint, UUID> entry in RexMaterials) | ||
| 204 : | { | ||
| 205 : | tempRexMaterialDictionaryItems.Add(new RexMaterialsDictionaryItem(entry)); | ||
| 206 : | } | ||
| 207 : | return tempRexMaterialDictionaryItems; | ||
| 208 : | } | ||
| 209 : | set | ||
| 210 : | { | ||
| 211 : | //rexMaterialDictionary = new Dictionary<uint, UUID>(); | ||
| 212 : | if (value != null) | ||
| 213 : | { | ||
| 214 : | foreach (RexMaterialsDictionaryItem e in value) | ||
| 215 : | { | ||
| 216 : | //rexMaterialDictionary.Add(e.Num, e.AssetID); | ||
| 217 : | RexMaterials.Add(e.Num, e.AssetID); | ||
| 218 : | } | ||
| 219 : | } | ||
| 220 : | } | ||
| 221 : | } | ||
| 222 : | |||
| 223 : | #endregion | ||
| 224 : | |||
| 225 : | mikkopa | 28 | private string m_RexClassName = String.Empty; |
| 226 : | public string RexClassName | ||
| 227 : | { | ||
| 228 : | get { return m_RexClassName; } | ||
| 229 : | set | ||
| 230 : | { | ||
| 231 : | m_RexClassName = value; | ||
| 232 : | SchedulePropertiesUpdate(true); | ||
| 233 : | } | ||
| 234 : | } | ||
| 235 : | |||
| 236 : | private UUID m_RexSoundUUID = UUID.Zero; | ||
| 237 : | public UUID RexSoundUUID | ||
| 238 : | { | ||
| 239 : | get { return m_RexSoundUUID; } | ||
| 240 : | set | ||
| 241 : | { | ||
| 242 : | m_RexSoundUUID = value; | ||
| 243 : | SchedulePropertiesUpdate(true); | ||
| 244 : | } | ||
| 245 : | } | ||
| 246 : | |||
| 247 : | mikkopa | 39 | private float m_RexSoundVolume = 0; |
| 248 : | mikkopa | 28 | public float RexSoundVolume |
| 249 : | { | ||
| 250 : | get { return m_RexSoundVolume; } | ||
| 251 : | set | ||
| 252 : | { | ||
| 253 : | m_RexSoundVolume = value; | ||
| 254 : | SchedulePropertiesUpdate(true); | ||
| 255 : | } | ||
| 256 : | } | ||
| 257 : | |||
| 258 : | mikkopa | 39 | private float m_RexSoundRadius = 0; |
| 259 : | mikkopa | 28 | public float RexSoundRadius |
| 260 : | { | ||
| 261 : | get { return m_RexSoundRadius; } | ||
| 262 : | set | ||
| 263 : | { | ||
| 264 : | m_RexSoundRadius = value; | ||
| 265 : | SchedulePropertiesUpdate(true); | ||
| 266 : | } | ||
| 267 : | } | ||
| 268 : | |||
| 269 : | private string m_rexData = String.Empty; | ||
| 270 : | public string RexData | ||
| 271 : | { | ||
| 272 : | get { return m_rexData; } | ||
| 273 : | set | ||
| 274 : | { | ||
| 275 : | if (value.Length > 3000) | ||
| 276 : | m_rexData = value.Substring(0, 3000); | ||
| 277 : | else | ||
| 278 : | m_rexData = value; | ||
| 279 : | |||
| 280 : | ScheduleDataUpdate(true); | ||
| 281 : | } | ||
| 282 : | } | ||
| 283 : | |||
| 284 : | mikkopa | 39 | private int m_RexSelectPriority = 0; |
| 285 : | mikkopa | 28 | public int RexSelectPriority |
| 286 : | { | ||
| 287 : | get { return m_RexSelectPriority; } | ||
| 288 : | set | ||
| 289 : | { | ||
| 290 : | m_RexSelectPriority = value; | ||
| 291 : | SchedulePropertiesUpdate(true); | ||
| 292 : | } | ||
| 293 : | } | ||
| 294 : | #endregion | ||
| 295 : | |||
| 296 : | #region Events | ||
| 297 : | |||
| 298 : | public event OnRexObjectPropertiesDataUpdateDelegate OnDataUpdate; | ||
| 299 : | public event OnRexObjectPropertiesUpdateDelegate OnPropertiesUpdate; | ||
| 300 : | |||
| 301 : | #endregion | ||
| 302 : | |||
| 303 : | /// <summary> | ||
| 304 : | /// Initialises a new RexObjectProperties class from | ||
| 305 : | /// the specified binary array. Unpacks the array | ||
| 306 : | /// according to the viewer-specified format into | ||
| 307 : | /// the properties. | ||
| 308 : | /// </summary> | ||
| 309 : | /// <param name="data"></param> | ||
| 310 : | public RexObjectProperties(byte[] data) | ||
| 311 : | { | ||
| 312 : | SetRexPrimDataFromBytes(data); | ||
| 313 : | } | ||
| 314 : | |||
| 315 : | mikkopa | 39 | public RexObjectProperties() { } |
| 316 : | |||
| 317 : | mikkopa | 28 | #region Old RexServer ToByte/FromByte methods |
| 318 : | public byte[] GetRexPrimDataToBytes() | ||
| 319 : | { | ||
| 320 : | try | ||
| 321 : | { | ||
| 322 : | // Display | ||
| 323 : | int size = sizeof(byte) + // drawtype | ||
| 324 : | sizeof(bool) + sizeof(bool) + sizeof(bool) + sizeof(bool) + sizeof(bool) + // visible,castshadows,lightcreatesshadows,desctex,scaletoprim | ||
| 325 : | sizeof(float) + sizeof(float) + // drawdist,lod | ||
| 326 : | 16 + 16 + 16 + 16 + // meshuuid,colmeshuuid,particleuuid,animpackuuid | ||
| 327 : | sizeof(int); // selectpriority | ||
| 328 : | |||
| 329 : | // Animname,animrate | ||
| 330 : | size += (m_RexAnimationName.Length + 1 + sizeof(float)); | ||
| 331 : | |||
| 332 : | // Materialdata | ||
| 333 : | size += sizeof(byte); // Number of materials | ||
| 334 : | RexMaterialsDictionary materials = GetRexMaterials(); | ||
| 335 : | size += (materials.Values.Count * (sizeof(byte) + 16 + sizeof(byte))); // materialassettype,matuuid,matindex | ||
| 336 : | |||
| 337 : | // Misc | ||
| 338 : | size = size + m_RexClassName.Length + 1 + // classname & endbyte | ||
| 339 : | 16 + sizeof(float) + sizeof(float); // sounduuid,sndvolume,sndradius | ||
| 340 : | |||
| 341 : | // Build byte array | ||
| 342 : | byte[] buffer = new byte[size]; | ||
| 343 : | int idx = 0; | ||
| 344 : | |||
| 345 : | buffer[idx++] = m_RexDrawType; | ||
| 346 : | BitConverter.GetBytes(m_RexIsVisible).CopyTo(buffer, idx); | ||
| 347 : | idx += sizeof(bool); | ||
| 348 : | BitConverter.GetBytes(m_RexCastShadows).CopyTo(buffer, idx); | ||
| 349 : | idx += sizeof(bool); | ||
| 350 : | BitConverter.GetBytes(m_RexLightCreatesShadows).CopyTo(buffer, idx); | ||
| 351 : | idx += sizeof(bool); | ||
| 352 : | BitConverter.GetBytes(m_RexDescriptionTexture).CopyTo(buffer, idx); | ||
| 353 : | idx += sizeof(bool); | ||
| 354 : | BitConverter.GetBytes(m_RexScaleToPrim).CopyTo(buffer, idx); | ||
| 355 : | idx += sizeof(bool); | ||
| 356 : | |||
| 357 : | BitConverter.GetBytes(m_RexDrawDistance).CopyTo(buffer, idx); | ||
| 358 : | idx += sizeof(float); | ||
| 359 : | BitConverter.GetBytes(m_RexLOD).CopyTo(buffer, idx); | ||
| 360 : | idx += sizeof(float); | ||
| 361 : | |||
| 362 : | m_RexMeshUUID.GetBytes().CopyTo(buffer, idx); | ||
| 363 : | idx += 16; | ||
| 364 : | m_RexCollisionMeshUUID.GetBytes().CopyTo(buffer, idx); | ||
| 365 : | idx += 16; | ||
| 366 : | m_RexParticleScriptUUID.GetBytes().CopyTo(buffer, idx); | ||
| 367 : | idx += 16; | ||
| 368 : | |||
| 369 : | m_RexAnimationPackageUUID.GetBytes().CopyTo(buffer, idx); | ||
| 370 : | idx += 16; | ||
| 371 : | Encoding.ASCII.GetBytes(m_RexAnimationName).CopyTo(buffer, idx); | ||
| 372 : | idx += (m_RexAnimationName.Length); | ||
| 373 : | buffer[idx++] = 0; | ||
| 374 : | BitConverter.GetBytes(m_RexAnimationRate).CopyTo(buffer, idx); | ||
| 375 : | idx += sizeof(float); | ||
| 376 : | |||
| 377 : | buffer[idx++] = (byte)materials.Values.Count; | ||
| 378 : | foreach (KeyValuePair<uint, UUID> kvp in materials) | ||
| 379 : | { | ||
| 380 : | // Removed - do we really need to know this? | ||
| 381 : | // Adds a dependency for a single scene method | ||
| 382 : | // which may break in future. Dont see why | ||
| 383 : | // the client needs it either. | ||
| 384 : | |||
| 385 : | /* | ||
| 386 : | AssetBase tempmodel = m_parentGroup.Scene.AssetCache.FetchAsset(kvp.Value); // materialassettype | ||
| 387 : | if (tempmodel != null) | ||
| 388 : | { | ||
| 389 : | byte temptype = (byte)(tempmodel.Type); | ||
| 390 : | buffer[idx++] = temptype; | ||
| 391 : | } | ||
| 392 : | else | ||
| 393 : | */ | ||
| 394 : | buffer[idx++] = 0; | ||
| 395 : | |||
| 396 : | kvp.Value.GetBytes().CopyTo(buffer, idx); // matuuid | ||
| 397 : | idx += 16; | ||
| 398 : | |||
| 399 : | byte tempindex = (byte)kvp.Key; // matindex | ||
| 400 : | buffer[idx++] = tempindex; | ||
| 401 : | } | ||
| 402 : | |||
| 403 : | Encoding.ASCII.GetBytes(m_RexClassName).CopyTo(buffer, idx); | ||
| 404 : | idx += (m_RexClassName.Length); | ||
| 405 : | buffer[idx++] = 0; | ||
| 406 : | |||
| 407 : | m_RexSoundUUID.GetBytes().CopyTo(buffer, idx); | ||
| 408 : | idx += 16; | ||
| 409 : | BitConverter.GetBytes(m_RexSoundVolume).CopyTo(buffer, idx); | ||
| 410 : | idx += sizeof(float); | ||
| 411 : | BitConverter.GetBytes(m_RexSoundRadius).CopyTo(buffer, idx); | ||
| 412 : | idx += sizeof(float); | ||
| 413 : | |||
| 414 : | BitConverter.GetBytes(m_RexSelectPriority).CopyTo(buffer, idx); | ||
| 415 : | // ReSharper disable RedundantAssignment | ||
| 416 : | idx += sizeof(int); | ||
| 417 : | // ReSharper restore RedundantAssignment | ||
| 418 : | |||
| 419 : | return buffer; | ||
| 420 : | } | ||
| 421 : | catch (Exception e) | ||
| 422 : | { | ||
| 423 : | m_log.Error(e.ToString()); | ||
| 424 : | return null; | ||
| 425 : | } | ||
| 426 : | } | ||
| 427 : | |||
| 428 : | public void SetRexPrimDataFromBytes(byte[] bytes) | ||
| 429 : | { | ||
| 430 : | try | ||
| 431 : | { | ||
| 432 : | int idx = 0; | ||
| 433 : | RexDrawType = bytes[idx++]; | ||
| 434 : | |||
| 435 : | RexIsVisible = BitConverter.ToBoolean(bytes, idx); | ||
| 436 : | idx += sizeof(bool); | ||
| 437 : | RexCastShadows = BitConverter.ToBoolean(bytes, idx); | ||
| 438 : | idx += sizeof(bool); | ||
| 439 : | RexLightCreatesShadows = BitConverter.ToBoolean(bytes, idx); | ||
| 440 : | idx += sizeof(bool); | ||
| 441 : | RexDescriptionTexture = BitConverter.ToBoolean(bytes, idx); | ||
| 442 : | idx += sizeof(bool); | ||
| 443 : | RexScaleToPrim = BitConverter.ToBoolean(bytes, idx); | ||
| 444 : | idx += sizeof(bool); | ||
| 445 : | |||
| 446 : | RexDrawDistance = BitConverter.ToSingle(bytes, idx); | ||
| 447 : | idx += sizeof(float); | ||
| 448 : | RexLOD = BitConverter.ToSingle(bytes, idx); | ||
| 449 : | idx += sizeof(float); | ||
| 450 : | |||
| 451 : | RexMeshUUID = new UUID(bytes, idx); | ||
| 452 : | idx += 16; | ||
| 453 : | RexCollisionMeshUUID = new UUID(bytes, idx); | ||
| 454 : | idx += 16; | ||
| 455 : | RexParticleScriptUUID = new UUID(bytes, idx); | ||
| 456 : | idx += 16; | ||
| 457 : | |||
| 458 : | // animation | ||
| 459 : | RexAnimationPackageUUID = new UUID(bytes, idx); | ||
| 460 : | idx += 16; | ||
| 461 : | StringBuilder bufferanimname = new StringBuilder(); | ||
| 462 : | while ((idx < bytes.Length) && (bytes[idx] != 0)) | ||
| 463 : | { | ||
| 464 : | char c = (char)bytes[idx++]; | ||
| 465 : | bufferanimname.Append(c); | ||
| 466 : | } | ||
| 467 : | RexAnimationName = bufferanimname.ToString(); | ||
| 468 : | idx++; | ||
| 469 : | RexAnimationRate = BitConverter.ToSingle(bytes, idx); | ||
| 470 : | idx += sizeof(float); | ||
| 471 : | |||
| 472 : | // materials, before setting materials clear them | ||
| 473 : | RexMaterials.ClearMaterials(); | ||
| 474 : | byte matcount = bytes[idx++]; | ||
| 475 : | for (int i = 0; i < matcount; i++) | ||
| 476 : | { | ||
| 477 : | idx++; // skip type | ||
| 478 : | UUID matuuid = new UUID(bytes, idx); | ||
| 479 : | idx += 16; | ||
| 480 : | byte matindex = bytes[idx++]; | ||
| 481 : | RexMaterials.AddMaterial(Convert.ToUInt32(matindex), matuuid); | ||
| 482 : | } | ||
| 483 : | |||
| 484 : | // misc | ||
| 485 : | StringBuilder buffer = new StringBuilder(); | ||
| 486 : | while ((idx < bytes.Length) && (bytes[idx] != 0)) | ||
| 487 : | { | ||
| 488 : | char c = (char)bytes[idx++]; | ||
| 489 : | buffer.Append(c); | ||
| 490 : | } | ||
| 491 : | RexClassName = buffer.ToString(); | ||
| 492 : | idx++; | ||
| 493 : | |||
| 494 : | RexSoundUUID = new UUID(bytes, idx); | ||
| 495 : | idx += 16; | ||
| 496 : | RexSoundVolume = BitConverter.ToSingle(bytes, idx); | ||
| 497 : | idx += sizeof(float); | ||
| 498 : | RexSoundRadius = BitConverter.ToSingle(bytes, idx); | ||
| 499 : | idx += sizeof(float); | ||
| 500 : | |||
| 501 : | if (bytes.Length >= (idx + sizeof(int))) | ||
| 502 : | { | ||
| 503 : | RexSelectPriority = BitConverter.ToInt32(bytes, idx); | ||
| 504 : | // ReSharper disable RedundantAssignment | ||
| 505 : | idx += sizeof(int); | ||
| 506 : | // ReSharper restore RedundantAssignment | ||
| 507 : | } | ||
| 508 : | |||
| 509 : | SchedulePropertiesUpdate(true); | ||
| 510 : | } | ||
| 511 : | catch (Exception e) | ||
| 512 : | { | ||
| 513 : | m_log.Error(e.ToString()); | ||
| 514 : | } | ||
| 515 : | } | ||
| 516 : | #endregion | ||
| 517 : | |||
| 518 : | #region Debug | ||
| 519 : | public void PrintRexPrimdata() | ||
| 520 : | { | ||
| 521 : | try | ||
| 522 : | { | ||
| 523 : | m_log.Warn("RexDrawType:" + RexDrawType); | ||
| 524 : | m_log.Warn("RexIsVisible:" + RexIsVisible); | ||
| 525 : | m_log.Warn("RexCastShadows:" + RexCastShadows); | ||
| 526 : | m_log.Warn("RexLightCreatesShadows:" + RexLightCreatesShadows); | ||
| 527 : | m_log.Warn("RexDescriptionTexture:" + RexDescriptionTexture); | ||
| 528 : | m_log.Warn("RexScaleToPrim:" + RexScaleToPrim); | ||
| 529 : | m_log.Warn("RexDrawDistance:" + RexDrawDistance); | ||
| 530 : | m_log.Warn("RexLOD" + RexLOD); | ||
| 531 : | m_log.Warn("RexMeshUUID:" + RexMeshUUID); | ||
| 532 : | m_log.Warn("RexCollisionMeshUUID:" + RexCollisionMeshUUID); | ||
| 533 : | m_log.Warn("RexParticleScriptUUID:" + RexParticleScriptUUID); | ||
| 534 : | m_log.Warn("RexAnimationPackageUUID:" + RexAnimationPackageUUID); | ||
| 535 : | m_log.Warn("RexAnimationName:" + RexAnimationName); | ||
| 536 : | m_log.Warn("RexAnimationRate:" + RexAnimationRate); | ||
| 537 : | m_log.Warn("RexMaterials:" + RexMaterials); | ||
| 538 : | m_log.Warn("RexClassName:" + RexClassName); | ||
| 539 : | m_log.Warn("RexSoundUUID:" + RexSoundUUID); | ||
| 540 : | m_log.Warn("RexSoundVolume:" + RexSoundVolume); | ||
| 541 : | m_log.Warn("RexSoundRadius:" + RexSoundRadius); | ||
| 542 : | m_log.Warn("RexSelectPriority:" + RexSelectPriority); | ||
| 543 : | } | ||
| 544 : | catch (Exception e) | ||
| 545 : | { | ||
| 546 : | m_log.Error(e.ToString()); | ||
| 547 : | } | ||
| 548 : | } | ||
| 549 : | #endregion | ||
| 550 : | |||
| 551 : | /// <summary> | ||
| 552 : | /// TODO | ||
| 553 : | /// </summary> | ||
| 554 : | /// <param name="saveToDB"></param> | ||
| 555 : | public void SchedulePropertiesUpdate(bool saveToDB) | ||
| 556 : | { | ||
| 557 : | if(OnPropertiesUpdate != null) | ||
| 558 : | { | ||
| 559 : | OnPropertiesUpdate(ParentObjectID, this, saveToDB); | ||
| 560 : | } | ||
| 561 : | } | ||
| 562 : | |||
| 563 : | /// <summary> | ||
| 564 : | /// TODO | ||
| 565 : | /// </summary> | ||
| 566 : | /// <param name="saveToDB"></param> | ||
| 567 : | public void ScheduleDataUpdate(bool saveToDB) | ||
| 568 : | { | ||
| 569 : | if(OnDataUpdate != null) | ||
| 570 : | { | ||
| 571 : | OnDataUpdate(ParentObjectID, RexData, saveToDB); | ||
| 572 : | } | ||
| 573 : | } | ||
| 574 : | |||
| 575 : | |||
| 576 : | } | ||
| 577 : | } |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

