Add support for the extra params to scene and the event manager
parent
de21929426
commit
da0f6b926f
|
@ -217,6 +217,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </remarks>
|
||||
public event NewScript OnNewScript;
|
||||
|
||||
public delegate void ExtraSettingChangedDelegate(Scene scene, string name, string value);
|
||||
public event ExtraSettingChangedDelegate OnExtraSettingChanged;
|
||||
|
||||
public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
|
||||
{
|
||||
NewScript handlerNewScript = OnNewScript;
|
||||
|
@ -2616,5 +2619,25 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerExtraSettingChanged(Scene scene, string name, string val)
|
||||
{
|
||||
ExtraSettingChangedDelegate handler = OnExtraSettingChanged;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (ExtraSettingChangedDelegate d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(scene, name, val);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for ExtraSettingChanged failed - continuing {0} - {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5854,5 +5854,44 @@ Environment.Exit(1);
|
|||
|
||||
callback(asset);
|
||||
}
|
||||
|
||||
public string GetExtraSetting(string name)
|
||||
{
|
||||
string val;
|
||||
|
||||
if (!m_extraSettings.TryGetValue(name, out val))
|
||||
return String.Empty;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
public void StoreExtraSetting(string name, string val)
|
||||
{
|
||||
string oldVal;
|
||||
|
||||
if (m_extraSettings.TryGetValue(name, out oldVal))
|
||||
{
|
||||
if (oldVal == val)
|
||||
return;
|
||||
}
|
||||
|
||||
m_extraSettings[name] = val;
|
||||
|
||||
m_SimulationDataService.SaveExtra(RegionInfo.RegionID, name, val);
|
||||
|
||||
m_eventManager.TriggerExtraSettingChanged(this, name, val);
|
||||
}
|
||||
|
||||
public void RemoveExtraSetting(string name)
|
||||
{
|
||||
if (!m_extraSettings.ContainsKey(name))
|
||||
return;
|
||||
|
||||
m_extraSettings.Remove(name);
|
||||
|
||||
m_SimulationDataService.RemoveExtra(RegionInfo.RegionID, name);
|
||||
|
||||
m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue