protected override void Load(FunctionData funcData)
 {
     ScriptableData.CallData callData = funcData.Call;
     if (null == callData)
     {
         return;
     }
     Load(callData);
     for (int i = 0; i < funcData.Statements.Count; ++i)
     {
         ScriptableData.CallData stCall = funcData.Statements[i] as ScriptableData.CallData;
         if (null == stCall)
         {
             continue;
         }
         if (stCall.GetId() == "mainplayer")
         {
             m_MainPlayer = true;
         }
         if (stCall.GetId() == "skill")
         {
             if (stCall.GetParamNum() >= 1)
             {
                 m_SkillId = int.Parse(stCall.GetParamId(0));
             }
         }
     }
 }
Esempio n. 2
0
        protected override void Load(FunctionData funcData)
        {
            ScriptableData.CallData callData = funcData.Call;
            if (null != callData)
            {
                Load(callData);
                foreach (ScriptableData.ISyntaxComponent statement in funcData.Statements)
                {
                    ScriptableData.CallData stCall = statement as ScriptableData.CallData;
                    string id    = stCall.GetId();
                    string param = stCall.GetParamId(0);

                    if (id == "direction")
                    {
                        if (stCall.GetParamNum() >= 1)
                        {
                            m_DirectionType = (DirectionType)int.Parse(stCall.GetParamId(0));
                        }
                        if (stCall.GetParamNum() >= 2)
                        {
                            m_AlwaysUpdateDirection = bool.Parse(stCall.GetParamId(1));
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        protected override void Load(ScriptableData.CallData callData)
        {
            if (callData.GetParamNum() > 0)
            {
                // m_IsLockRotate = bool.Parse(callData.GetParamId(0));
            }
            m_SectionList.Clear();
            int section_num = 0;

            while (callData.GetParamNum() >= 7 * (section_num + 1) + 1)
            {
                MoveSectionInfo section = new MoveSectionInfo();
                section.moveTime    = (float)System.Convert.ToDouble(callData.GetParamId((section_num * 7) + 1));
                section.speedVect.x = (float)System.Convert.ToDouble(callData.GetParamId((section_num * 7) + 2));
                section.speedVect.y = (float)System.Convert.ToDouble(callData.GetParamId((section_num * 7) + 3));
                section.speedVect.z = (float)System.Convert.ToDouble(callData.GetParamId((section_num * 7) + 4));
                section.accelVect.x = (float)System.Convert.ToDouble(callData.GetParamId((section_num * 7) + 5));
                section.accelVect.y = (float)System.Convert.ToDouble(callData.GetParamId((section_num * 7) + 6));
                section.accelVect.z = (float)System.Convert.ToDouble(callData.GetParamId((section_num * 7) + 7));
                m_SectionList.Add(section);
                section_num++;
            }
            if (m_SectionList.Count == 0)
            {
                return;
            }
            m_IsCurveMoving = true;
        }
Esempio n. 4
0
 public void AddStatement(CallData statement)
 {
     m_Statements.Add(statement);
     if ((int)ExtentClassEnum.EXTENT_CLASS_STATEMENT != m_ExtentClass)
     {
         m_ExtentClass = (int)ExtentClassEnum.EXTENT_CLASS_STATEMENT;
     }
 }
Esempio n. 5
0
 public void CopyFrom(CallData other)
 {
     m_IsHighOrder = other.m_IsHighOrder;
     m_Name        = other.m_Name;
     m_Call        = other.m_Call;
     m_Params      = other.m_Params;
     m_ParamClass  = other.m_ParamClass;
 }
Esempio n. 6
0
 public void AddParams(CallData param)
 {
     m_Params.Add(param);
     if ((int)ParamClassEnum.PARAM_CLASS_NOTHING == m_ParamClass)
     {
         m_ParamClass = (int)ParamClassEnum.PARAM_CLASS_PARENTHESIS;
     }
 }
Esempio n. 7
0
        protected override void Load(ScriptableData.CallData callData)
        {
            int num = callData.GetParamNum();

            if (num > 0)
            {
                m_AnimName = callData.GetParamId(0);
            }
        }
Esempio n. 8
0
        protected override void Load(ScriptableData.CallData callData)
        {
            int num = callData.GetParamNum();

            if (num >= 2)
            {
                m_AnimName = callData.GetParamId(0);
                m_Speed    = float.Parse(callData.GetParamId(1));
            }
        }
Esempio n. 9
0
        protected override void Load(ScriptableData.FunctionData funcData)
        {
            ScriptableData.CallData callData = funcData.Call;
            if (null != callData)
            {
                Load(callData);

                foreach (ScriptableData.ISyntaxComponent statement in funcData.Statements)
                {
                    ScriptableData.CallData stCall = statement as ScriptableData.CallData;
                    if (null != stCall && stCall.GetParamNum() > 0)
                    {
                        string id    = stCall.GetId();
                        string param = stCall.GetParamId(0);

                        if (id == "speed")
                        {
                            m_Speed = float.Parse(param);
                            if (stCall.GetParamNum() >= 2)
                            {
                                m_IsEffectSkillTime = bool.Parse(stCall.GetParamId(1));
                            }
                        }
                        else if (id == "weight")
                        {
                            m_Weight = float.Parse(param);
                        }
                        else if (id == "layer")
                        {
                            m_Layer = int.Parse(param);
                        }
                        else if (id == "playmode")
                        {
                            m_PlayMode = int.Parse(param);
                            if (stCall.GetParamNum() >= 2)
                            {
                                m_CrossFadeTime = long.Parse(stCall.GetParamId(1));
                            }
                        }
                        else if (id == "blendmode")
                        {
                            m_BlendMode = int.Parse(param);
                        }
                        else if (id == "mixingnode")
                        {
                            m_MixingNode = param;
                        }
                        else if (id == "wrapmode")
                        {
                            m_WrapMode = int.Parse(param);
                        }
                    }
                }
            }
        }
Esempio n. 10
0
 protected override void Load(ScriptableData.CallData callData)
 {
     if (callData.GetParamNum() > 0)
     {
         m_ChildName = callData.GetParamId(0);
     }
     if (callData.GetParamNum() > 1)
     {
         m_NodeName = callData.GetParamId(1);
     }
 }
 /// <summary>
 /// 加载命令,存到loaded的链表中
 /// </summary>
 /// <param name="messageHandlerData"></param>
 public void Load(ScriptableData.FunctionData messageHandlerData)
 {
     ScriptableData.CallData callData = messageHandlerData.Call;
     if (callData != null && callData.HaveParam())
     {
         int      argsNum = callData.GetParamNum();
         string[] args    = new string[argsNum];
         for (int i = 0; i < argsNum; i++)
         {
             args[i] = callData.GetParamId(i);
         }
         m_sMessageId = string.Join(":", args);
     }
     RefreshCommand(messageHandlerData);
 }
Esempio n. 12
0
        public static void writeSyntaxComponent(StringBuilder stream, ISyntaxComponent data, int indent, bool isLastOfStatement)
        {
#if FULL_VERSION
            ValueData val = data as ValueData;
            if (null != val)
            {
                if (isLastOfStatement)
                {
                    writeLine(stream, val.ToScriptString() + ";", indent);
                }
                else
                {
                    writeLine(stream, val.ToScriptString(), indent);
                }
            }
            else
            {
                CallData call = data as CallData;
                if (null != call)
                {
                    if (isLastOfStatement)
                    {
                        writeLine(stream, call.ToScriptString() + ";", indent);
                    }
                    else
                    {
                        writeLine(stream, call.ToScriptString(), indent);
                    }
                }
                else
                {
                    FunctionData function = data as FunctionData;
                    if (null != function)
                    {
                        writeFunctionData(stream, function, indent, isLastOfStatement);
                    }
                    else
                    {
                        StatementData statement = data as StatementData;
                        writeStatementData(stream, statement, indent);
                    }
                }
            }
#endif
        }
Esempio n. 13
0
        public override string ToScriptString()
        {
#if FULL_VERSION
            //与write方法不同,这里输出无缩进单行表示
            FunctionData tempData = First;
            CallData     callData = null;
            callData = tempData.Call;
            if (null != callData && callData.GetParamClass() == (int)CallData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR)
            {
                if (callData.HaveId() && callData.HaveParam() && tempData.HaveStatement())
                {
                    string line = string.Format("{0} {1} {2}", callData.GetParam(0).ToScriptString(), callData.GetId(), tempData.GetStatement(0).ToScriptString());
                    if (Functions.Count == 2)
                    {
                        FunctionData funcData = Functions[1];
                        if (funcData.HaveId() && funcData.HaveStatement())
                        {
                            line = string.Format("{0} {1} {2}", line, funcData.GetId(), funcData.GetStatement(0).ToScriptString());
                        }
                    }
                    return(line);
                }
                else
                {
                    return("");
                }
            }
            else
            {
                StringBuilder stream = new StringBuilder();
                int           ct     = Functions.Count;
                for (int i = 0; i < ct; ++i)
                {
                    FunctionData funcData = Functions[i];
                    stream.Append(funcData.ToScriptString());
                }
                return(stream.ToString());
            }
#else
            return(ToString());
#endif
        }
Esempio n. 14
0
        public static void writeStatementData(StringBuilder stream, StatementData data, int indent)
        {
#if FULL_VERSION
            FunctionData tempData = data.First;
            CallData     callData = tempData.Call;
            if (null != callData && callData.GetParamClass() == (int)CallData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR)
            {
                if (callData.HaveId() && callData.HaveParam() && tempData.HaveStatement())
                {
                    string line = string.Format("{0} {1} {2}", callData.GetParam(0).ToScriptString(), callData.GetId(), tempData.GetStatement(0).ToScriptString());
                    if (data.Functions.Count == 2)
                    {
                        FunctionData funcData = data.Functions[1];
                        if (funcData.HaveId() && funcData.HaveStatement())
                        {
                            line = string.Format("{0} {1} {2}", line, funcData.GetId(), funcData.GetStatement(0).ToScriptString());
                        }
                    }
                    writeLine(stream, line + ";", indent);
                }
            }
            else
            {
                int  ct = data.Functions.Count;
                bool isLastOfStatement = false;
                if (ct == 0)
                {
                    isLastOfStatement = true;
                }
                for (int i = 0; i < ct; ++i)
                {
                    if (i == ct - 1)
                    {
                        isLastOfStatement = true;
                    }
                    FunctionData func = data.Functions[i];
                    writeFunctionData(stream, func, indent, isLastOfStatement);
                }
            }
#endif
        }
Esempio n. 15
0
        protected override void Load(ScriptableData.CallData callData)
        {
            int num = callData.GetParamNum();

            if (num > 0)
            {
                m_EffectPath = callData.GetParamId(0);
            }
            if (num > 1)
            {
                m_DeleteTime = float.Parse(callData.GetParamId(1)) / 1000.0f;
            }
            if (num > 2)
            {
                m_AttachPath = callData.GetParamId(2);
            }
            if (num > 3)
            {
                m_IsAttach = bool.Parse(callData.GetParamId(3));
            }
        }
Esempio n. 16
0
        protected override void Load(ScriptableData.FunctionData funcData)
        {
            ScriptableData.CallData callData = funcData.Call;
            if (null != callData)
            {
                Load(callData);

                for (int i = 0; i < funcData.Statements.Count; ++i)
                {
                    if (funcData.Statements[i] is ScriptableData.CallData stCall)
                    {
                        string id = stCall.GetId();
                        if (id == "transform")
                        {
                            if (stCall.GetParamNum() > 0)
                            {
                                if (stCall.GetParam(0) is ScriptableData.CallData param0)
                                {
                                    m_Pos = ScriptableDataUtility.CalcVector3(param0);
                                }
                            }
                            if (stCall.GetParamNum() > 1)
                            {
                                if (stCall.GetParam(1) is ScriptableData.CallData param1)
                                {
                                    m_Euler = ScriptableDataUtility.CalcEularRotation(param1);
                                }
                            }
                            if (stCall.GetParamNum() > 2)
                            {
                                if (stCall.GetParam(2) is ScriptableData.CallData param2)
                                {
                                    m_Scale = ScriptableDataUtility.CalcVector3(param2);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 17
0
    public bool Init(ScriptableData.ScriptableDataInfo config)
    {
        bool ret = false;

        ScriptableData.FunctionData story = config.First;
        if (story != null && (story.GetId() == "story" || story.GetId() == "script"))
        {
            ret = true;
            //参数
            ScriptableData.CallData callData = story.Call;
            if (callData != null && callData.HaveParam())
            {
                //第一个参数是剧情的id
                m_iStoryId = int.Parse(callData.GetParamId(0));
            }
            foreach (var info in story.Statements)
            {
                if (info.GetId() == "local")
                {
                    ScriptableData.FunctionData sectionData = info as ScriptableData.FunctionData;
                    if (null != sectionData)
                    {
                        foreach (ScriptableData.ISyntaxComponent def in sectionData.Statements)
                        {
                            ScriptableData.CallData defData = def as ScriptableData.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_dicLocalVariables.ContainsKey(id))
                                    {
                                        m_dicLocalVariables.Add(id, val.Value);
                                    }
                                    else
                                    {
                                        m_dicLocalVariables[id] = val.Value;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Debug.LogError("剧情" + m_iStoryId + "DSL语法,必须是个函数");
                    }
                }
                else if (info.GetId() == "onmessage")
                {
                    ScriptableData.FunctionData sectionData = info as ScriptableData.FunctionData;
                    if (null != sectionData)
                    {
                        StoryMessageHandler handler = new StoryMessageHandler();
                        handler.Load(sectionData);
                        m_listMessageHandlers.Add(handler);
                    }
                    else
                    {
                        Debug.LogError("剧情" + m_iStoryId + "DSL语法,必须是个函数");
                    }
                }
                else
                {
                    Debug.LogError("StoryInstance::Init,不知道DSL语法部分:" + info.GetId());
                }
            }
        }
        else
        {
            Debug.LogError("StoryInstance::Init,不是一个DSL语法");
        }
        return(ret);
    }
Esempio n. 18
0
 protected virtual void Load(ScriptableData.CallData callData)
 {
 }
Esempio n. 19
0
        public static string getCallString(CallData data)
        {
#if FULL_VERSION
            string lineNo = "";//formatString("/* %d */",data.GetLine());
            string line   = "";
            if (data.IsHighOrder)
            {
                line = getCallString(data.Call);
            }
            else if (data.HaveId())
            {
                line = quoteString(data.GetId(), data.GetIdType());
            }
            if (data.HaveParam())
            {
                int paramClass = data.GetParamClass();
                if ((int)CallData.ParamClassEnum.PARAM_CLASS_OPERATOR == paramClass)
                {
                    switch (data.GetParamNum())
                    {
                    case 1:
                        return(string.Format("{0} {1}", line, data.GetParam(0).ToScriptString()));

                    case 2:
                        return(string.Format("{0} {1} {2}", data.GetParam(0).ToScriptString(), line, data.GetParam(1).ToScriptString()));

                    default:
                        return(line);
                    }
                }
                else
                {
                    string lbracket = "";
                    string rbracket = "";
                    switch (paramClass)
                    {
                    case (int)CallData.ParamClassEnum.PARAM_CLASS_PARENTHESIS:
                        lbracket = "(";
                        rbracket = ")";
                        break;

                    case (int)CallData.ParamClassEnum.PARAM_CLASS_BRACKET:
                        lbracket = "[";
                        rbracket = "]";
                        break;

                    case (int)CallData.ParamClassEnum.PARAM_CLASS_PERIOD:
                        lbracket = ".";
                        rbracket = "";
                        break;

                    case (int)CallData.ParamClassEnum.PARAM_CLASS_PERIOD_PARENTHESIS:
                        lbracket = ".(";
                        rbracket = ")";
                        break;

                    case (int)CallData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACKET:
                        lbracket = ".[";
                        rbracket = "]";
                        break;

                    case (int)CallData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACE:
                        lbracket = ".{";
                        rbracket = "}";
                        break;
                    }
                    StringBuilder stream = new StringBuilder();
                    stream.Append(lbracket);
                    int ct = data.GetParamNum();
                    for (int i = 0; i < ct; ++i)
                    {
                        if (i > 0)
                        {
                            stream.Append(",");
                        }
                        ISyntaxComponent param = data.GetParam(i);
                        if ((int)CallData.ParamClassEnum.PARAM_CLASS_PERIOD == paramClass)
                        {
                            stream.Append(unquoteString(param.ToScriptString()));
                        }
                        else
                        {
                            stream.Append(param.ToScriptString());
                        }
                    }
                    stream.Append(rbracket);
                    return(string.Format("{0}{1}{2}", lineNo, line, stream.ToString()));
                }
            }
            else
            {
                return(string.Format("{0}{1}", lineNo, line));
            }
#else
            return("");
#endif
        }