static public int get_Value(IntPtr l) { try { StorySystem.StoryValue self = (StorySystem.StoryValue)checkSelf(l); pushValue(l, true); pushValue(l, self.Value); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { StorySystem.StoryValue o; o = new StorySystem.StoryValue(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
private void CopyFrom(StoryValue other) { m_ArgIndex = other.m_ArgIndex; m_LocalName = other.m_LocalName; m_GlobalName = other.m_GlobalName; m_StackName = other.m_StackName; if (null != other.m_Proxy) { m_Proxy = other.m_Proxy.Clone(); } m_Value = other.m_Value; m_HaveValue = other.m_HaveValue; m_IsConst = other.m_IsConst; }
static public int InitFromDsl(IntPtr l) { try { StorySystem.StoryValue self = (StorySystem.StoryValue)checkSelf(l); Dsl.ISyntaxComponent a1; checkType(l, 2, out a1); self.InitFromDsl(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public IStoryValue <object> Clone() { StoryValue obj = new StoryValue(); obj.m_ArgIndex = m_ArgIndex; obj.m_LocalName = m_LocalName; obj.m_GlobalName = m_GlobalName; obj.m_StackName = m_StackName; if (null != m_Proxy) { obj.m_Proxy = m_Proxy.Clone(); } obj.m_HaveValue = m_HaveValue; obj.m_Value = m_Value; obj.m_IsConst = m_IsConst; return(obj); }
static public int Evaluate(IntPtr l) { try { StorySystem.StoryValue self = (StorySystem.StoryValue)checkSelf(l); StorySystem.StoryInstance a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); System.Object[] a3; checkArray(l, 4, out a3); self.Evaluate(a1, a2, a3); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private StoryValue NewValueObject() { StoryValue obj = new StoryValue(); return(obj); }
public bool Init(Dsl.DslInfo config) { if (null == config || null == config.First) { return(false); } bool ret = false; Dsl.FunctionData story = config.First; if (story.GetId() == "story" || story.GetId() == "script") { ret = true; Dsl.CallData callData = story.Call; if (null != callData && callData.HaveParam()) { m_StoryId = callData.GetParamId(0); } for (int i = 0; i < story.Statements.Count; i++) { if (story.Statements[i].GetId() == "local") { Dsl.FunctionData sectionData = story.Statements[i] as Dsl.FunctionData; if (null != sectionData) { for (int j = 0; j < sectionData.Statements.Count; j++) { Dsl.CallData defData = sectionData.Statements[j] as Dsl.CallData; if (null != defData && defData.HaveId() && defData.HaveParam()) { string id = defData.GetId(); if (id.StartsWith("@") && !id.StartsWith("@@")) { StoryValue val = new StoryValue(); val.InitFromDsl(defData.GetParam(0)); if (!m_PreInitedLocalVariables.ContainsKey(id)) { m_PreInitedLocalVariables.Add(id, val.Value); } else { m_PreInitedLocalVariables[id] = val.Value; } } } } } else { #if DEBUG string err = string.Format("Story {0} DSL, local must be a function ! line:{1} local:{2}", m_StoryId, story.Statements[i].GetLine(), story.Statements[i].ToScriptString(false)); throw new Exception(err); #else LogSystem.Error("Story {0} DSL, local must be a function !", m_StoryId); #endif } } else if (story.Statements[i].GetId() == "onmessage" || story.Statements[i].GetId() == "onnamespacedmessage") { StoryMessageHandler handler = null; Dsl.StatementData msgData = story.Statements[i] as Dsl.StatementData; if (null != msgData) { handler = new StoryMessageHandler(); handler.Load(msgData); } else { Dsl.FunctionData sectionData = story.Statements[i] as Dsl.FunctionData; if (null != sectionData) { handler = new StoryMessageHandler(); handler.Load(sectionData); } } if (null != handler) { string msgId; if (!string.IsNullOrEmpty(m_Namespace) && story.Statements[i].GetId() == "onnamespacedmessage") { msgId = string.Format("{0}:{1}", m_Namespace, handler.MessageId); handler.MessageId = msgId; } else { msgId = handler.MessageId; } if (!m_LoadedMessageHandlers.ContainsKey(msgId)) { m_LoadedMessageHandlers.Add(msgId, handler); m_MessageHandlers.Add(handler.Clone()); m_MessageQueues.Add(msgId, new Queue <MessageInfo>()); m_ConcurrentMessageQueues.Add(msgId, new Queue <MessageInfo>()); m_ConcurrentMessageHandlerPool.Add(msgId, new Queue <StoryMessageHandler>()); } else { #if DEBUG string err = string.Format("Story {0} DSL, onmessage or onnamespacedmessage {1} duplicate, discard it ! line:{2}", m_StoryId, msgId, story.Statements[i].GetLine()); throw new Exception(err); #else LogSystem.Error("Story {0} DSL, onmessage {1} duplicate, discard it !", m_StoryId, msgId); #endif } } else { #if DEBUG string err = string.Format("Story {0} DSL, onmessage must be a function or statement ! line:{1} onmessage:{2}", m_StoryId, story.Statements[i].GetLine(), story.Statements[i].ToScriptString(false)); throw new Exception(err); #else LogSystem.Error("Story {0} DSL, onmessage must be a function !", m_StoryId); #endif } } else { #if DEBUG string err = string.Format("StoryInstance::Init, Story {0} unknown part {1}, line:{2} section:{3}", m_StoryId, story.Statements[i].GetId(), story.Statements[i].GetLine(), story.Statements[i].ToScriptString(false)); throw new Exception(err); #else LogSystem.Error("StoryInstance::Init, Story {0} unknown part {1}", m_StoryId, story.Statements[i].GetId()); #endif } } } else { #if DEBUG string err = string.Format("StoryInstance::Init, isn't story DSL, line:{0} story:{1}", story.GetLine(), story.ToScriptString(false)); throw new Exception(err); #else LogSystem.Error("StoryInstance::Init, isn't story DSL"); #endif } LogSystem.Debug("StoryInstance.Init message handler num:{0} {1}", m_MessageHandlers.Count, ret); return(ret); }
protected virtual StoryValue NewValueObject() { StoryValue obj = new StoryValue(); return(obj); }