29 using System.Collections;
30 using System.Collections.Generic;
32 using OpenSim.Region.ScriptEngine.Shared.Api;
34 namespace OpenSim.
Region.ScriptEngine.Shared.Api.Plugins
55 public int TimersCount
66 m_CmdManager = CmdManager;
72 static private string MakeTimerKey(uint localID, UUID itemID)
74 return localID.ToString() + itemID.ToString();
77 private Dictionary<string,TimerInfo> Timers =
new Dictionary<string,TimerInfo>();
78 private object TimerListLock =
new object();
84 UnSetTimerEvents(m_localID, m_itemID);
90 ts.localID = m_localID;
92 ts.interval = Convert.ToInt64(sec * 10000000);
97 ts.next = DateTime.Now.Ticks + ts.interval;
99 string key = MakeTimerKey(m_localID, m_itemID);
110 string key = MakeTimerKey(m_localID, m_itemID);
113 if (Timers.ContainsKey(key))
123 if (Timers.Count == 0)
126 Dictionary<string, TimerInfo> tvals;
130 tvals =
new Dictionary<string, TimerInfo>(Timers);
136 if (ts.
next < DateTime.Now.Ticks)
140 m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
146 ts.next = DateTime.Now.Ticks + ts.interval;
153 List<Object> data =
new List<Object>();
157 Dictionary<string, TimerInfo>.ValueCollection tvals = Timers.Values;
162 data.Add(ts.interval);
163 data.Add(ts.next-DateTime.Now.Ticks);
167 return data.ToArray();
175 while (idx < data.Length)
179 ts.localID = localID;
181 ts.interval = (long)data[idx];
182 ts.next = DateTime.Now.Ticks + (long)data[idx+1];
187 Timers.Add(MakeTimerKey(localID, itemID), ts);
194 List<TimerInfo> retList =
new List<TimerInfo>();
199 retList.Add(i.Clone());
List< TimerInfo > GetTimersInfo()
Timer(AsyncCommandManager CmdManager)
Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
void SetTimerEvent(uint m_localID, UUID m_itemID, double sec)
AsyncCommandManager m_CmdManager
void UnSetTimerEvents(uint m_localID, UUID m_itemID)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
Object[] GetSerializationData(UUID itemID)
Holds all the data required to execute a scripting event.
void CreateFromData(uint localID, UUID itemID, UUID objectID, Object[] data)