protected UIShapeBase(SerializationInfo info, StreamingContext context) : base(info, context) { m_PosX = info.GetSingle("PosX"); m_PosY = info.GetSingle("PosY"); m_SizeX = info.GetSingle("SizeX"); m_SizeY = info.GetSingle("SizeY"); m_Order = info.GetInt32("Order"); m_TabOrder = info.GetInt32("TabOrder"); m_ClientBorder = info.GetSingle("ClientBorder"); m_UseCaching = info.GetBoolean("UseCaching"); m_TooltipText = info.GetString("TooltipText"); m_Script = info.GetString("Script"); object entityProps = (object)info.GetValue("_uiProperties", typeof(object)); _uiProperties = entityProps as DynamicPropertyCollection; if (_uiProperties == null) { _oldEntityProperties = entityProps as CloneableBase; //_entityProperties = EditorManager.EngineManager.EntityClassManager.CreateCollection(this,_entityClass); } if (SerializationHelper.HasElement(info, "UIKey")) { m_UIKey = info.GetString("UIKey"); } }
/// <summary> /// Gets the clone. /// </summary> /// <typeparam name="T">Any type that derives from <see cref="CloneableBase"/></typeparam> /// <param name="cloneableBase">The cloneable base.</param> /// <returns>A clone of the passed object</returns> public T GetClone <T>(CloneableBase cloneableBase) where T : CloneableBase { // Derek uses a cast to re-type the object but I would prefer using a generic in this // situation. T can only be a class the derives from ClonableBase making it // much safer to use this factory. return((T)cloneableBase.Clone()); }
/// <summary> /// Called when deserializing /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected EntityShape(SerializationInfo info, StreamingContext context) : base(info, context) { _entityClass = info.GetString( "_entityClass" ); _modelFile = info.GetString( "_modelFile" ); // load entity properties object entityProps = (object) info.GetValue( "_entityProperties", typeof(object) ); _entityProperties = entityProps as DynamicPropertyCollection; // Store the old property collection data in a member variable (when loading old scene files). // We'll migrate the property values in the OnDeserialization when all nested properties are fully loaded. if (_entityProperties == null) { _oldEntityProperties = entityProps as CloneableBase; UpdateEntityProperties(true); //_entityProperties = EditorManager.EngineManager.EntityClassManager.CreateCollection(this,_entityClass); } if (SerializationHelper.HasElement(info,"_bCastStaticShadows")) _bCastStaticShadows = info.GetBoolean("_bCastStaticShadows"); if (SerializationHelper.HasElement(info,"_bCastDynamicShadows")) _bCastDynamicShadows = info.GetBoolean("_bCastDynamicShadows"); if (SerializationHelper.HasElement(info,"_vLightGridOfs")) _vLightGridOfs = (Vector3F)info.GetValue("_vLightGridOfs", typeof(Vector3F)); if (SerializationHelper.HasElement(info,"_iVisibleBitmask")) _iVisibleBitmask = (FlagsInt32_e)info.GetValue("_iVisibleBitmask", typeof(FlagsInt32_e)); if (SerializationHelper.HasElement(info,"_iLightInfluenceBitmask")) _iLightInfluenceBitmask = (FlagsInt32_e)info.GetValue("_iLightInfluenceBitmask", typeof(FlagsInt32_e)); // if (SerializationHelper.HasElement(info,"_fLightmapTiling")) // _fLightmapTiling = info.GetSingle("_fLightmapTiling"); if (SerializationHelper.HasElement(info,"_ambientColor")) _ambientColor = (Color)info.GetValue("_ambientColor", typeof(Color)); if (SerializationHelper.HasElement(info, "_farClipDistance")) _farClipDistance = info.GetSingle("_farClipDistance"); if (SerializationHelper.HasElement(info, "_nearClipDistance")) _nearClipDistance = info.GetSingle("_nearClipDistance"); if (SerializationHelper.HasElement(info, "_renderOrderPriority")) _renderOrderPriority = info.GetSByte("_renderOrderPriority"); if (SerializationHelper.HasElement(info, "_classDefTemplate")) _classDefTemplate = info.GetString("_classDefTemplate"); if (SerializationHelper.HasElement(info, "_copySource")) _copySource = (EntityShape)info.GetValue("_copySource", typeof(EntityShape)); if (SerializationHelper.HasElement(info, "_customMaterialSetName")) _customMaterialSetName = info.GetString("_customMaterialSetName"); }
protected UIShapeBase(SerializationInfo info, StreamingContext context) : base(info, context) { m_PosX = info.GetSingle("PosX"); m_PosY = info.GetSingle("PosY"); m_SizeX = info.GetSingle("SizeX"); m_SizeY = info.GetSingle("SizeY"); m_Order = info.GetInt32("Order"); m_TabOrder = info.GetInt32("TabOrder"); m_ClientBorder = info.GetSingle("ClientBorder"); m_UseCaching = info.GetBoolean("UseCaching"); m_TooltipText = info.GetString("TooltipText"); m_Script = info.GetString("Script"); object entityProps = (object)info.GetValue("_uiProperties", typeof(object)); _uiProperties = entityProps as DynamicPropertyCollection; if (_uiProperties == null) { _oldEntityProperties = entityProps as CloneableBase; //_entityProperties = EditorManager.EngineManager.EntityClassManager.CreateCollection(this,_entityClass); } if (SerializationHelper.HasElement(info, "UIKey")) m_UIKey = info.GetString("UIKey"); }