public IStoryValue <object> CalcValue(ScriptableData.ISyntaxComponent param) { if (param.IsValid() && param.GetId().Length == 0) { //处理括弧 ScriptableData.CallData callData = param as ScriptableData.CallData; if (null != callData && callData.GetParamNum() > 0) { int ct = callData.GetParamNum(); return(CalcValue(callData.GetParam(ct - 1))); } else { //不支持的语法 return(null); } } else { IStoryValue <object> ret = null; string id = param.GetId(); if (m_dicValueHandlers.ContainsKey(id)) { ret = m_dicValueHandlers[id].Build(param); } return(ret); } }
protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta) { UserThread userThread = instance.Context as UserThread; if (null != userThread) { ulong userGuid = m_UserGuid.Value; string dictId = m_DictId.Value; ArrayList arglist = new ArrayList(); for (int i = 0; i < m_DictArgs.Count; ++i) { IStoryValue val = m_DictArgs[i]; arglist.Add(val.Value); } object[] args = arglist.ToArray(); Msg_LC_HighlightPrompt builder = new Msg_LC_HighlightPrompt(); builder.dict_id = dictId; foreach (object arg in args) { builder.argument.Add(arg.ToString()); } if (userGuid > 0) { userThread.NotifyUser(userGuid, LobbyMessageDefine.Msg_LC_HighlightPrompt, builder); } else { userThread.NotifyAllUser(LobbyMessageDefine.Msg_LC_HighlightPrompt, builder); } } return(false); }
public IStoryValue Clone() { IStoryValue <T> newOriginal = m_Original.Clone(); StoryValueAdapter <T> val = new StoryValueAdapter <T>(newOriginal); return(val); }
protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta) { UserThread userThread = instance.Context as UserThread; if (null != userThread) { string objname = m_ObjTag.Value; string _msg = m_Msg.Value; Msg_LC_SendGfxMessage msg = new Msg_LC_SendGfxMessage(); msg.is_with_tag = true; msg.name = objname; msg.msg = _msg; for (int i = 0; i < m_Args.Count; ++i) { IStoryValue val = m_Args[i]; object v = val.Value; if (null == v) { Msg_LC_SendGfxMessage.EventArg arg = new Msg_LC_SendGfxMessage.EventArg(); arg.val_type = LobbyArgType.NULL; arg.str_val = ""; msg.args.Add(arg); } else if (v is int) { Msg_LC_SendGfxMessage.EventArg arg = new Msg_LC_SendGfxMessage.EventArg(); arg.val_type = LobbyArgType.INT; arg.str_val = ((int)v).ToString(); msg.args.Add(arg); } else if (v is float) { Msg_LC_SendGfxMessage.EventArg arg = new Msg_LC_SendGfxMessage.EventArg(); arg.val_type = LobbyArgType.FLOAT; arg.str_val = ((float)v).ToString(); msg.args.Add(arg); } else { Msg_LC_SendGfxMessage.EventArg arg = new Msg_LC_SendGfxMessage.EventArg(); arg.val_type = LobbyArgType.STRING; arg.str_val = v.ToString(); msg.args.Add(arg); } } if (m_HaveUserGuid) { ulong userGuid = m_UserGuid.Value; userThread.NotifyUser(userGuid, LobbyMessageDefine.Msg_LC_SendGfxMessage, msg); } else { userThread.NotifyAllUser(LobbyMessageDefine.Msg_LC_SendGfxMessage, msg); } } return(false); }
protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta) { UserThread userThread = instance.Context as UserThread; if (null != userThread) { string evname = m_EventName.Value; string group = m_Group.Value; Msg_LC_PublishEvent msg = new Msg_LC_PublishEvent(); msg.group = group; msg.ev_name = evname; msg.is_logic_event = false; for (int i = 0; i < m_Args.Count; ++i) { IStoryValue val = m_Args[i]; object v = val.Value; if (null == v) { Msg_LC_PublishEvent.EventArg arg = new Msg_LC_PublishEvent.EventArg(); arg.val_type = LobbyArgType.NULL; arg.str_val = ""; msg.args.Add(arg); } else if (v is int) { Msg_LC_PublishEvent.EventArg arg = new Msg_LC_PublishEvent.EventArg(); arg.val_type = LobbyArgType.INT; arg.str_val = ((int)v).ToString(); msg.args.Add(arg); } else if (v is float) { Msg_LC_PublishEvent.EventArg arg = new Msg_LC_PublishEvent.EventArg(); arg.val_type = LobbyArgType.FLOAT; arg.str_val = ((float)v).ToString(); msg.args.Add(arg); } else { Msg_LC_PublishEvent.EventArg arg = new Msg_LC_PublishEvent.EventArg(); arg.val_type = LobbyArgType.STRING; arg.str_val = v.ToString(); msg.args.Add(arg); } } if (m_HaveUserGuid) { ulong userGuid = m_UserGuid.Value; userThread.NotifyUser(userGuid, LobbyMessageDefine.Msg_LC_PublishEvent, msg); } else { userThread.NotifyAllUser(LobbyMessageDefine.Msg_LC_PublishEvent, msg); } } return(false); }
protected override void Evaluate(StoryInstance instance, object iterator, object[] args) { m_MsgId.Evaluate(instance, iterator, args); for (int i = 0; i < m_MsgArgs.Count; ++i) { IStoryValue <object> val = m_MsgArgs[i]; val.Evaluate(instance, iterator, args); } }
private void SetProxy(IStoryValue <object> proxy) { m_HaveValue = false; m_ArgIndex = c_NotArg; m_LocalName = null; m_GlobalName = null; m_Proxy = proxy; m_Value = null; }
protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta) { UserThread userThread = instance.Context as UserThread; if (null != userThread) { string _msg = m_Msg.Value; Msg_LRL_StoryMessage msg = new Msg_LRL_StoryMessage(); msg.MsgId = _msg; for (int i = 0; i < m_Args.Count; ++i) { IStoryValue val = m_Args[i]; object v = val.Value; if (null == v) { Msg_LRL_StoryMessage.MessageArg arg = new Msg_LRL_StoryMessage.MessageArg(); arg.val_type = Msg_LRL_StoryMessage.ArgType.NULL; arg.str_val = ""; msg.Args.Add(arg); } else if (v is int) { Msg_LRL_StoryMessage.MessageArg arg = new Msg_LRL_StoryMessage.MessageArg(); arg.val_type = Msg_LRL_StoryMessage.ArgType.INT; arg.str_val = ((int)v).ToString(); msg.Args.Add(arg); } else if (v is float) { Msg_LRL_StoryMessage.MessageArg arg = new Msg_LRL_StoryMessage.MessageArg(); arg.val_type = Msg_LRL_StoryMessage.ArgType.FLOAT; arg.str_val = ((float)v).ToString(); msg.Args.Add(arg); } else { Msg_LRL_StoryMessage.MessageArg arg = new Msg_LRL_StoryMessage.MessageArg(); arg.val_type = Msg_LRL_StoryMessage.ArgType.STRING; arg.str_val = v.ToString(); msg.Args.Add(arg); } } if (m_HaveUserGuid) { ulong userGuid = m_UserGuid.Value; msg.UserGuid = userGuid; userThread.SendServerMessage(msg); } else { userThread.SendServerMessage(msg); } } return(false); }
protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, object iterator, object[] args) { m_MsgId.Evaluate(instance, handler, iterator, args); for (int i = 0; i < m_MsgArgs.Count; ++i) { IStoryValue val = m_MsgArgs[i]; val.Evaluate(instance, handler, iterator, args); } }
private void SetProxy(IStoryValue proxy) { m_HaveValue = false; m_ArgIndex = c_NotArg; m_LocalName = null; m_GlobalName = null; m_StackName = null; m_Proxy = proxy; m_Value = BoxedValue.NullObject; m_IsConst = false; }
private void CalcInitValue(Dsl.ISyntaxComponent param) { IStoryValue val = StoryValueManager.Instance.CalcValue(param); if (null != val) { //对初始化即能求得值的函数,不需要再记录函数表达式,直接转换为常量值。 if (val.HaveValue) { SetValue(val.Value); } else { SetProxy(val); } } else if (param is Dsl.ValueData) { string id = param.GetId(); int idType = param.GetIdType(); if (idType == Dsl.ValueData.NUM_TOKEN) { if (id.StartsWith("0x")) { SetValue(uint.Parse(id.Substring(2), System.Globalization.NumberStyles.HexNumber)); } else if (id.IndexOf('.') >= 0 || id.IndexOf('e') > 0 || id.IndexOf('E') > 0) { SetValue(float.Parse(id, System.Globalization.NumberStyles.Float)); } else { SetValue(int.Parse(id, System.Globalization.NumberStyles.Integer)); } } else if (idType == Dsl.ValueData.ID_TOKEN && (id == "true" || id == "false")) { SetValue(id == "true"); } else { SetValue(id); } } else { #if DEBUG string err = string.Format("Unknown value, id:{0} line:{1}", param.GetId(), param.GetLine()); throw new Exception(err); #else GameFramework.LogSystem.Error("Unknown value, id:{0}", param.GetId()); #endif } }
public IStoryValueParam Clone() { StoryValueParams <P> val = new StoryValueParams <P>(); for (int i = 0; i < m_Args.Count; ++i) { IStoryValue <P> arg = m_Args[i]; val.m_Args.Add(arg.Clone()); m_Values.Add(default(P)); } return(val); }
protected override IStoryCommand CloneCommand() { FireMessageCommand cmd = new FireMessageCommand(); cmd.m_MsgId = m_MsgId.Clone(); for (int i = 0; i < m_MsgArgs.Count; ++i) { IStoryValue val = m_MsgArgs[i]; cmd.m_MsgArgs.Add(val.Clone()); } return(cmd); }
protected override IStoryCommand CloneCommand() { HighlightPromptCommand cmd = new HighlightPromptCommand(); cmd.m_UserGuid = m_UserGuid.Clone(); cmd.m_DictId = m_DictId.Clone(); for (int i = 0; i < m_DictArgs.Count; ++i) { IStoryValue val = m_DictArgs[i]; cmd.m_DictArgs.Add(val.Clone()); } return(cmd); }
public void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args) { for (int i = 0; i < m_Args.Count; ++i) { IStoryValue <P> val = m_Args[i]; val.Evaluate(instance, handler, iterator, args); } for (int i = 0; i < m_Args.Count; ++i) { IStoryValue <P> val = m_Args[i]; m_Values[i] = val.Value; } }
protected override void Evaluate(StoryInstance instance, object iterator, object[] args) { if (m_HaveUserGuid) { m_UserGuid.Evaluate(instance, iterator, args); } m_ObjTag.Evaluate(instance, iterator, args); m_Msg.Evaluate(instance, iterator, args); for (int i = 0; i < m_Args.Count; ++i) { IStoryValue <object> val = m_Args[i]; val.Evaluate(instance, iterator, args); } }
public override IStoryCommand Clone() { SendServerStoryMessageCommand cmd = new SendServerStoryMessageCommand(); cmd.m_HaveUserGuid = m_HaveUserGuid; cmd.m_UserGuid = m_UserGuid.Clone(); cmd.m_Msg = m_Msg.Clone(); for (int i = 0; i < m_Args.Count; ++i) { IStoryValue <object> val = m_Args[i]; cmd.m_Args.Add(val.Clone()); } return(cmd); }
protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, object iterator, object[] args) { if (m_HaveUserGuid) { m_UserGuid.Evaluate(instance, handler, iterator, args); } m_EventName.Evaluate(instance, handler, iterator, args); m_Group.Evaluate(instance, handler, iterator, args); for (int i = 0; i < m_Args.Count; ++i) { IStoryValue val = m_Args[i]; val.Evaluate(instance, handler, iterator, args); } }
protected override IStoryCommand CloneCommand() { SendClientStoryMessageCommand cmd = new SendClientStoryMessageCommand(); cmd.m_HaveUserGuid = m_HaveUserGuid; cmd.m_UserGuid = m_UserGuid.Clone(); cmd.m_Msg = m_Msg.Clone(); for (int i = 0; i < m_Args.Count; ++i) { IStoryValue val = m_Args[i]; cmd.m_Args.Add(val.Clone()); } return(cmd); }
protected override IStoryCommand CloneCommand() { PublishGfxEventCommand cmd = new PublishGfxEventCommand(); cmd.m_HaveUserGuid = m_HaveUserGuid; cmd.m_UserGuid = m_UserGuid.Clone(); cmd.m_EventName = m_EventName.Clone(); cmd.m_Group = m_Group.Clone(); for (int i = 0; i < m_Args.Count; ++i) { IStoryValue val = m_Args[i]; cmd.m_Args.Add(val.Clone()); } return(cmd); }
protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args) { m_Receiver.Evaluate(instance, handler, iterator, args); m_Title.Evaluate(instance, handler, iterator, args); m_Content.Evaluate(instance, handler, iterator, args); m_Sender.Evaluate(instance, handler, iterator, args); m_LevelDemand.Evaluate(instance, handler, iterator, args); m_ValidPeriod.Evaluate(instance, handler, iterator, args); m_Money.Evaluate(instance, handler, iterator, args); m_Gold.Evaluate(instance, handler, iterator, args); for (int i = 0; i < m_MailItems.Count; ++i) { IStoryValue <int> val = m_MailItems[i]; val.Evaluate(instance, handler, iterator, args); } }
protected override void Evaluate(StoryInstance instance, object iterator, object[] args) { m_Receiver.Evaluate(instance, iterator, args); m_Title.Evaluate(instance, iterator, args); m_Content.Evaluate(instance, iterator, args); m_Sender.Evaluate(instance, iterator, args); m_LevelDemand.Evaluate(instance, iterator, args); m_ValidPeriod.Evaluate(instance, iterator, args); m_Money.Evaluate(instance, iterator, args); m_Gold.Evaluate(instance, iterator, args); for (int i = 0; i < m_MailItems.Count; ++i) { IStoryValue <int> val = m_MailItems[i]; val.Evaluate(instance, iterator, args); } }
protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta) { UserThread userThread = instance.Context as UserThread; if (null != userThread) { string msgId = m_MsgId.Value; ArrayList arglist = new ArrayList(); for (int i = 0; i < m_MsgArgs.Count; ++i) { IStoryValue val = m_MsgArgs[i]; arglist.Add(val.Value); } object[] args = arglist.ToArray(); userThread.StorySystem.SendMessage(msgId, args); } return(false); }
protected override IStoryCommand CloneCommand() { SendMailCommand cmd = new SendMailCommand(); cmd.m_Receiver = m_Receiver.Clone(); cmd.m_Title = m_Title.Clone(); cmd.m_Content = m_Content.Clone(); cmd.m_Sender = m_Sender.Clone(); cmd.m_LevelDemand = m_LevelDemand.Clone(); cmd.m_ValidPeriod = m_ValidPeriod.Clone(); cmd.m_Money = m_Money.Clone(); cmd.m_Gold = m_Gold.Clone(); for (int i = 0; i < m_MailItems.Count; ++i) { IStoryValue <int> val = m_MailItems[i]; cmd.m_MailItems.Add(val.Clone()); } return(cmd); }
private void CalcInitValue(ScriptableData.ISyntaxComponent param) { IStoryValue <object> val = StoryValueManager.singleton.CalcValue(param); if (null != val) { //对初始化即能求得值的函数,不需要再记录函数表达式,直接转换为常量值。 if (val.HaveValue) { SetValue(val.Value); } else { SetProxy(val); } } else { string id = param.GetId(); int idType = param.GetIdType(); if (idType == ScriptableData.ValueData.NUM_TOKEN) { if (id.IndexOf('.') >= 0) { SetValue(float.Parse(id, System.Globalization.NumberStyles.Float)); } else if (id.StartsWith("0x")) { SetValue(uint.Parse(id.Substring(2), System.Globalization.NumberStyles.HexNumber)); } else { SetValue(int.Parse(id, System.Globalization.NumberStyles.Integer)); } } else { SetValue(id); } } }
internal EventInfo(EventInfo other) { m_Event = other.m_Event.Clone(); m_Tag = other.m_Tag.Clone(); m_Path = other.m_Path.Clone(); }
private void SetProxy(IStoryValue proxy) { m_Proxy = proxy; }
public IStoryValue <object> CalcValue(Dsl.ISyntaxComponent param) { lock (m_Lock) { if (param.IsValid() && param.GetId().Length == 0) { //处理括弧 Dsl.CallData callData = param as Dsl.CallData; if (null != callData) { switch (callData.GetParamClass()) { case (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PARENTHESIS: if (callData.GetParamNum() > 0) { int ct = callData.GetParamNum(); return(CalcValue(callData.GetParam(ct - 1))); } else { //不支持的语法 return(null); } case (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_BRACKET: { IStoryValue <object> ret = null; IStoryValueFactory factory = GetFactory("jsonarray"); if (null != factory) { try { ret = factory.Build(); ret.InitFromDsl(param); } catch (Exception ex) { GameFramework.LogSystem.Error("value:{0} line:{1} failed.", param.ToScriptString(), param.GetLine()); throw ex; } } return(ret); } default: return(null); } } else { Dsl.FunctionData funcData = param as Dsl.FunctionData; if (null != funcData && funcData.HaveStatement()) { callData = funcData.Call; if (null == callData || !callData.HaveParam()) { IStoryValue <object> ret = null; IStoryValueFactory factory = GetFactory("jsonobject"); if (null != factory) { try { ret = factory.Build(); ret.InitFromDsl(param); } catch (Exception ex) { GameFramework.LogSystem.Error("value:{0} line:{1} failed.", param.ToScriptString(), param.GetLine()); throw ex; } } return(ret); } else { //不支持的语法 return(null); } } else { //不支持的语法 return(null); } } } else { Dsl.CallData callData = param as Dsl.CallData; if (null != callData) { Dsl.CallData innerCall = callData.Call; if (callData.IsHighOrder && callData.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PARENTHESIS && ( innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD || innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_BRACKET || innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACE || innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACKET || innerCall.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_PARENTHESIS )) { //obj.member(a,b,...) or obj[member](a,b,...) or obj.(member)(a,b,...) or obj.[member](a,b,...) or obj.{member}(a,b,...) -> dotnetcall(obj,member,a,b,...) Dsl.CallData newCall = new Dsl.CallData(); newCall.Name = new Dsl.ValueData("dotnetcall", Dsl.ValueData.ID_TOKEN); newCall.SetParamClass((int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PARENTHESIS); if (innerCall.IsHighOrder) { newCall.Params.Add(innerCall.Call); newCall.Params.Add(innerCall.GetParam(0)); for (int i = 0; i < callData.GetParamNum(); ++i) { Dsl.ISyntaxComponent p = callData.Params[i]; newCall.Params.Add(p); } } else { newCall.Params.Add(innerCall.Name); newCall.Params.Add(innerCall.GetParam(0)); for (int i = 0; i < callData.GetParamNum(); ++i) { Dsl.ISyntaxComponent p = callData.Params[i]; newCall.Params.Add(p); } } return(CalcValue(newCall)); } else if (callData.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD || callData.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_BRACKET || callData.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACE || callData.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACKET || callData.GetParamClass() == (int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PERIOD_PARENTHESIS) { //obj.property or obj[property] or obj.(property) or obj.[property] or obj.{property} -> dotnetget(obj,property) Dsl.CallData newCall = new Dsl.CallData(); newCall.Name = new Dsl.ValueData("dotnetget", Dsl.ValueData.ID_TOKEN); newCall.SetParamClass((int)Dsl.CallData.ParamClassEnum.PARAM_CLASS_PARENTHESIS); if (callData.IsHighOrder) { newCall.Params.Add(callData.Call); newCall.Params.Add(callData.GetParam(0)); } else { newCall.Params.Add(callData.Name); newCall.Params.Add(callData.GetParam(0)); } return(CalcValue(newCall)); } } IStoryValue <object> ret = null; string id = param.GetId(); IStoryValueFactory factory = GetFactory(id); if (null != factory) { try { ret = factory.Build(); ret.InitFromDsl(param); } catch (Exception ex) { GameFramework.LogSystem.Error("value:{0} line:{1} failed.", param.ToScriptString(), param.GetLine()); throw ex; } } return(ret); } } }
public IStoryValue CalcValue(Dsl.ISyntaxComponent param) { lock (m_Lock) { Dsl.FunctionData callData = param as Dsl.FunctionData; if (null != callData && callData.IsValid() && callData.GetId().Length == 0 && !callData.IsHighOrder && (callData.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PARENTHESIS || callData.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_BRACKET)) { //处理圆括弧与方括弧 switch (callData.GetParamClass()) { case (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PARENTHESIS: if (callData.GetParamNum() > 0) { int ct = callData.GetParamNum(); return(CalcValue(callData.GetParam(ct - 1))); } else { return(null); } case (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_BRACKET: { IStoryValue ret = null; IStoryValueFactory factory = GetFactory("array"); if (null != factory) { try { ret = factory.Build(); ret.InitFromDsl(param); } catch (Exception ex) { var msg = string.Format("[LoadStory] value:{0} line:{1} failed.", param.ToScriptString(false), param.GetLine()); throw new Exception(msg, ex); } } return(ret); } default: return(null); } } else { Dsl.FunctionData funcData = param as Dsl.FunctionData; if (null != funcData && funcData.HaveStatement()) { //处理大括弧 callData = funcData; if (null == callData || !callData.HaveParam()) { IStoryValue ret = null; IStoryValueFactory factory = GetFactory("hashtable"); if (null != factory) { try { ret = factory.Build(); ret.InitFromDsl(param); } catch (Exception ex) { var msg = string.Format("[LoadStory] value:{0} line:{1} failed.", param.ToScriptString(false), param.GetLine()); throw new Exception(msg, ex); } } return(ret); } else { //不支持的语法 return(null); } } else { if (null != callData) { Dsl.FunctionData innerCall = callData.LowerOrderFunction; if (callData.IsHighOrder && callData.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PARENTHESIS && ( innerCall.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD || innerCall.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_BRACKET || innerCall.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACE || innerCall.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACKET || innerCall.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_PARENTHESIS )) { //obj.member(a,b,...) or obj[member](a,b,...) or obj.(member)(a,b,...) or obj.[member](a,b,...) or obj.{member}(a,b,...) -> dotnetcall(obj,member,a,b,...) string method = innerCall.GetParamId(0); string apiName; if (method == "orderby" || method == "orderbydesc" || method == "where" || method == "top") { apiName = "linq"; } else { apiName = "dotnetcall"; } Dsl.FunctionData newCall = new Dsl.FunctionData(); newCall.Name = new Dsl.ValueData(apiName, Dsl.ValueData.ID_TOKEN); newCall.SetParamClass((int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PARENTHESIS); if (innerCall.IsHighOrder) { newCall.Params.Add(innerCall.LowerOrderFunction); newCall.Params.Add(ObjectMemberConverter.Convert(innerCall.GetParam(0), innerCall.GetParamClass())); for (int i = 0; i < callData.GetParamNum(); ++i) { Dsl.ISyntaxComponent p = callData.Params[i]; newCall.Params.Add(p); } } else { newCall.Params.Add(innerCall.Name); newCall.Params.Add(ObjectMemberConverter.Convert(innerCall.GetParam(0), innerCall.GetParamClass())); for (int i = 0; i < callData.GetParamNum(); ++i) { Dsl.ISyntaxComponent p = callData.Params[i]; newCall.Params.Add(p); } } return(CalcValue(newCall)); } else if (callData.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD || callData.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_BRACKET || callData.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACE || callData.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACKET || callData.GetParamClass() == (int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_PARENTHESIS) { //obj.property or obj[property] or obj.(property) or obj.[property] or obj.{property} -> dotnetget(obj,property) Dsl.FunctionData newCall = new Dsl.FunctionData(); newCall.Name = new Dsl.ValueData("dotnetget", Dsl.ValueData.ID_TOKEN); newCall.SetParamClass((int)Dsl.FunctionData.ParamClassEnum.PARAM_CLASS_PARENTHESIS); if (callData.IsHighOrder) { newCall.Params.Add(callData.LowerOrderFunction); newCall.Params.Add(ObjectMemberConverter.Convert(callData.GetParam(0), callData.GetParamClass())); } else { newCall.Params.Add(callData.Name); newCall.Params.Add(ObjectMemberConverter.Convert(callData.GetParam(0), callData.GetParamClass())); } return(CalcValue(newCall)); } } IStoryValue ret = null; string id = param.GetId(); if (param.GetIdType() == Dsl.ValueData.ID_TOKEN) { IStoryValueFactory factory = GetFactory(id); if (null != factory) { try { ret = factory.Build(); ret.InitFromDsl(param); } catch (Exception ex) { var msg = string.Format("[LoadStory] value:{0}[{1}] line:{2} failed.", id, param.ToScriptString(false), param.GetLine()); throw new Exception(msg, ex); } } else { #if DEBUG string err = string.Format("[LoadStory] value:{0}[{1}] line:{2} failed.", id, param.ToScriptString(false), param.GetLine()); GameFramework.LogSystem.Error("{0}", err); throw new Exception(err); #else GameFramework.LogSystem.Error("[LoadStory] value:{0} line:{1} failed.", id, param.GetLine()); #endif } } return(ret); } } } }
internal EventInfo(EventInfo other) { m_Event = other.m_Event.Clone(); m_Tag = other.m_Tag.Clone(); m_Path = other.m_Path.Clone(); }
internal EventInfo() { m_Event = new StoryValue <string>(); m_Tag = new StoryValue <string>(); m_Path = new StoryValue <string>(); }
internal void CopyFrom(ParamInfo other) { Type = other.Type; Key = other.Key.Clone(); Value = other.Value.Clone(); }
private void Init() { Type = string.Empty; Key = new StoryValue<string>(); Value = new StoryValue(); }
internal VarInfo(VarInfo other) { m_VarName = other.m_VarName.Clone(); m_ControlPath = other.m_ControlPath.Clone(); }
internal VarInfo() { m_VarName = new StoryValue<string>(); m_ControlPath = new StoryValue<string>(); }
internal EventInfo() { m_Event = new StoryValue<string>(); m_Tag = new StoryValue<string>(); m_Path = new StoryValue<string>(); }