Exemplo n.º 1
0
        private void Prepare(StoryMessageHandler handler)
        {
            var runtime = StoryRuntime.New();

            handler.PushRuntime(runtime);
            if (null != m_InitialCommands)
            {
                for (int i = 0; i < m_InitialCommands.Count; ++i)
                {
                    IStoryCommand cmd = m_InitialCommands[i].Clone();
                    if (null != cmd.PrologueCommand)
                    {
                        runtime.CommandQueue.Enqueue(cmd.PrologueCommand);
                    }
                    runtime.CommandQueue.Enqueue(cmd);
                    if (null != cmd.EpilogueCommand)
                    {
                        runtime.CommandQueue.Enqueue(cmd.EpilogueCommand);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void PopStack(StoryInstance instance, StoryMessageHandler handler)
        {
            handler.PopRuntime();
            var    old     = handler.PeekLocalInfo();
            bool   haveVal = old.HaveValue;
            object val     = old.Value;

            handler.PopLocalInfo();
            if (handler.LocalInfoStack.Count > 0)
            {
                var info = handler.PeekLocalInfo();
                instance.StackVariables = info.StackVariables;
                m_HaveValue             = haveVal;
                m_Value = val;
            }
            else
            {
                instance.StackVariables = handler.StackVariables;
                m_HaveValue             = haveVal;
                m_Value = val;
            }
        }
Exemplo n.º 3
0
        protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
        {
            if (m_HaveCondition && m_Condition.HaveValue && m_Condition.Value == 0)
            {
                return(false);
            }
            if (m_RealStartTime <= 0)
            {
                m_RealStartTime = (int)GameFramework.TimeUtility.GetLocalRealMilliseconds();
            }
            int curTime = (int)GameFramework.TimeUtility.GetLocalRealMilliseconds();
            int val     = m_Time.Value;

            if (curTime <= m_RealStartTime + val && curTime <= m_RealStartTime + StoryValueHelper.c_MaxWaitCommandTime)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
        {
            UserThread userThread = instance.Context as UserThread;

            if (null != userThread)
            {
                string key  = m_Key.Value;
                string type = m_Type.Value;
                if (type == "int")
                {
                    GlobalData.Instance.RemoveInt(key);
                }
                else if (type == "float")
                {
                    GlobalData.Instance.RemoveFloat(key);
                }
                else
                {
                    GlobalData.Instance.RemoveStr(key);
                }
            }
            return(false);
        }
Exemplo n.º 5
0
 public void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
     m_HaveValue = false;
     m_X.Evaluate(instance, handler, iterator, args);
     if (m_X.HaveValue)
     {
         int x = m_X.Value.Get <int>();
         if (x == 0)
         {
             m_HaveValue = true;
             m_Value     = 0;
         }
         else
         {
             m_Y.Evaluate(instance, handler, iterator, args);
             if (m_Y.HaveValue)
             {
                 int y = m_Y.Value.Get <int>();
                 m_HaveValue = true;
                 m_Value     = (y != 0 ? 1 : 0);
             }
         }
     }
 }
Exemplo n.º 6
0
 public void Evaluate(StoryInstance instance, StoryMessageHandler handler, object iterator, object[] args)
 {
     m_HaveValue = false;
     m_X.Evaluate(instance, handler, iterator, args);
     if (m_X.HaveValue)
     {
         int x = (int)Convert.ChangeType(m_X.Value, typeof(int));
         if (x == 0)
         {
             m_HaveValue = true;
             m_Value     = 0;
         }
         else
         {
             m_Y.Evaluate(instance, handler, iterator, args);
             if (m_Y.HaveValue)
             {
                 int y = (int)Convert.ChangeType(m_Y.Value, typeof(int));
                 m_HaveValue = true;
                 m_Value     = (y != 0 ? 1 : 0);
             }
         }
     }
 }
        protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
        {
            bool       ret        = false;
            UserThread userThread = instance.Context as UserThread;

            if (null != userThread)
            {
                int ct = 0;
                for (int i = 0; i < m_MsgIds.Count; i++)
                {
                    ct += userThread.StorySystem.CountMessage(m_MsgIds[i].Value);
                }
                if (ct <= 0)
                {
                    string varName = m_SetVar.Value;
                    object varVal  = m_SetVal.Value;
                    instance.SetVariable(varName, varVal);
                }
                else
                {
                    int curTime = m_CurTime;
                    m_CurTime += (int)delta;
                    if (curTime <= m_TimeoutVal.Value)
                    {
                        ret = true;
                    }
                    else
                    {
                        string varName = m_TimeoutSetVar.Value;
                        object varVal  = m_TimeoutSetVal.Value;
                        instance.SetVariable(varName, varVal);
                    }
                }
            }
            return(ret);
        }
Exemplo n.º 8
0
        protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
        {
            if (m_HaveCondition && m_Condition.HaveValue && m_Condition.Value == 0)
            {
                return(false);
            }
            if (GameFramework.GlobalVariables.Instance.IsStorySkipped)
            {
                return(false);
            }
            int curTime = m_CurTime;

            m_CurTime += (int)delta;
            int val = m_Time.Value;

            if (curTime <= val && curTime <= StoryValueHelper.c_MaxWaitCommandTime)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 9
0
 protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
 }
Exemplo n.º 10
0
 protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
 {
     handler.IsSuspended = true;
     return(false);
 }
Exemplo n.º 11
0
 protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
 {
     instance.IsTerminated = true;
     return(false);
 }
Exemplo n.º 12
0
 internal void PostCall(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
     PopStack(instance, handler);
 }
Exemplo n.º 13
0
 protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
     m_Cmd.PostCall(instance, handler, iterator, args);
 }
 protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, object iterator, object[] args)
 {
     m_AttrName.Evaluate(instance, handler, iterator, args);
     m_Value.Evaluate(instance, handler, iterator, args);
 }
Exemplo n.º 15
0
 public StoryMessageHandler Clone()
 {
     StoryMessageHandler handler = new StoryMessageHandler();
     for (int i = 0; i < m_LoadedCommands.Count; i++) {
         handler.m_LoadedCommands.Add(m_LoadedCommands[i].Clone());
     }
     handler.m_MessageId = m_MessageId;
     handler.m_ArgumentNames = m_ArgumentNames;
     return handler;
 }
Exemplo n.º 16
0
 public bool Init(Dsl.DslInfo config)
 {
     bool ret = false;
     Dsl.FunctionData story = config.First;
     if (null != story && (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());
                     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_MessageQueues.ContainsKey(msgId)) {
                         m_MessageHandlers.Add(handler);
                         m_MessageQueues.Add(msgId, new Queue<MessageInfo>());
                     } 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());
                     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());
                 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());
         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;
 }
Exemplo n.º 17
0
 private void PushStack(StoryInstance instance, StoryMessageHandler handler, StoryLocalInfo info)
 {
     handler.PushLocalInfo(info);
     instance.StackVariables = info.StackVariables;
 }
Exemplo n.º 18
0
 internal void Evaluate(StoryInstance instance, StoryMessageHandler handler, object iterator, object[] args)
 {
     m_Key.Evaluate(instance, handler, iterator, args);
     m_Value.Evaluate(instance, handler, iterator, args);
 }
Exemplo n.º 19
0
 protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
 {
     StoryValueManager.Instance.ClearSubstitutes();
     return(false);
 }
Exemplo n.º 20
0
    public void Evaluate(StoryInstance instance, StoryMessageHandler handler, StoryValueParams _params)
    {
        ArrayList  args  = _params.Values;
        int        objId = (int)args[0];
        int        index = (int)System.Convert.ChangeType(args[1], typeof(int));
        EntityInfo npc   = PluginFramework.Instance.GetEntityById(objId);

        if (null != npc)
        {
            int skillId = 0;
            switch (index)
            {
            case 0:
                skillId = npc.ConfigData.skill0;
                break;

            case 1:
                skillId = npc.ConfigData.skill1;
                break;

            case 2:
                skillId = npc.ConfigData.skill2;
                break;

            case 3:
                skillId = npc.ConfigData.skill3;
                break;

            case 4:
                skillId = npc.ConfigData.skill4;
                break;

            case 5:
                skillId = npc.ConfigData.skill5;
                break;

            case 6:
                skillId = npc.ConfigData.skill6;
                break;

            case 7:
                skillId = npc.ConfigData.skill7;
                break;

            case 8:
                skillId = npc.ConfigData.skill8;
                break;

            default:
                skillId = 0;
                break;
            }
            if (skillId > 0)
            {
                SkillInfo skillInfo = npc.GetSkillStateInfo().GetSkillInfoById(skillId);
                if (null == skillInfo)
                {
                    skillInfo = new SkillInfo(skillId);
                    npc.GetSkillStateInfo().AddSkill(skillInfo);
                }
                m_Proxy.Value = skillInfo;
            }
            else
            {
                m_Proxy.Value = null;
            }
        }
    }
Exemplo n.º 21
0
 public void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
     m_HaveValue = false;
     m_X.Evaluate(instance, handler, iterator, args);
     TryUpdateValue();
 }
Exemplo n.º 22
0
 protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, object iterator, object[] args)
 {
     m_Cmd.PostCall(instance, handler, iterator, args);
 }
Exemplo n.º 23
0
 public bool ExecDebugger(StoryInstance instance, StoryMessageHandler handler, long delta, object iterator, object[] args)
 {
     return(false);
 }
Exemplo n.º 24
0
 internal void PostCall(StoryInstance instance, StoryMessageHandler handler, object iterator, object[] args)
 {
     PopStack(instance, handler);
 }
Exemplo n.º 25
0
 protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
 {
     handler.PeekRuntime().IsReturn = true;
     return(false);
 }
Exemplo n.º 26
0
        protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
        {
            Scene scene = instance.Context as Scene;

            if (null != scene)
            {
                var obj = m_Arg.Value;
                if (obj.IsInteger)
                {
                    int        unitId = obj.Get <int>();
                    EntityInfo entity = scene.SceneContext.GetEntityByUnitId(unitId);
                    if (null != entity)
                    {
                        Vector3 pos = entity.GetMovementStateInfo().GetPosition3D();
                        Msg_RC_SendGfxMessage msg = new GameFrameworkMessage.Msg_RC_SendGfxMessage();
                        msg.name        = "GameRoot";
                        msg.msg         = "CameraLook";
                        msg.is_with_tag = false;
                        Msg_RC_SendGfxMessage.EventArg arg = new Msg_RC_SendGfxMessage.EventArg();
                        arg.val_type = ArgType.FLOAT;
                        arg.str_val  = pos.X.ToString();
                        msg.args.Add(arg);
                        arg.val_type = ArgType.FLOAT;
                        arg.str_val  = (pos.Y + entity.GetRadius()).ToString();
                        msg.args.Add(arg);
                        arg.val_type = ArgType.FLOAT;
                        arg.str_val  = pos.Z.ToString();
                        msg.args.Add(arg);

                        if (m_HaveUserId)
                        {
                            int        userId = m_UserId.Value;
                            EntityInfo user   = scene.GetEntityById(userId);
                            if (null != user)
                            {
                                User us = user.CustomData as User;
                                if (null != us)
                                {
                                    us.SendMessage(RoomMessageDefine.Msg_RC_SendGfxMessage, msg);
                                }
                            }
                        }
                        else
                        {
                            scene.NotifyAllUser(RoomMessageDefine.Msg_RC_SendGfxMessage, msg);
                        }
                    }
                }
                else
                {
                    Vector3 pos = obj.Get <Vector3>();
                    Msg_RC_SendGfxMessage msg = new GameFrameworkMessage.Msg_RC_SendGfxMessage();
                    msg.name        = "GameRoot";
                    msg.msg         = "CameraLook";
                    msg.is_with_tag = false;
                    Msg_RC_SendGfxMessage.EventArg arg = new Msg_RC_SendGfxMessage.EventArg();
                    arg.val_type = ArgType.FLOAT;
                    arg.str_val  = pos.X.ToString();
                    msg.args.Add(arg);
                    arg.val_type = ArgType.FLOAT;
                    arg.str_val  = pos.Y.ToString();
                    msg.args.Add(arg);
                    arg.val_type = ArgType.FLOAT;
                    arg.str_val  = pos.Z.ToString();
                    msg.args.Add(arg);

                    if (m_HaveUserId)
                    {
                        int        userId = m_UserId.Value;
                        EntityInfo user   = scene.GetEntityById(userId);
                        if (null != user)
                        {
                            User us = user.CustomData as User;
                            if (null != us)
                            {
                                us.SendMessage(RoomMessageDefine.Msg_RC_SendGfxMessage, msg);
                            }
                        }
                    }
                    else
                    {
                        scene.NotifyAllUser(RoomMessageDefine.Msg_RC_SendGfxMessage, msg);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 27
0
 public void Evaluate(StoryInstance instance, StoryMessageHandler handler, object iterator, object[] args)
 {
     m_HaveValue = false;
     m_UserGuid.Evaluate(instance, handler, iterator, args);
     TryUpdateValue(instance);
 }
Exemplo n.º 28
0
 protected override bool ExecCommand(StoryInstance instance, StoryMessageHandler handler, long delta)
 {
     if (m_VarName.StartsWith("@@"))
     {
         if (null != instance.GlobalVariables)
         {
             if (instance.GlobalVariables.ContainsKey(m_VarName))
             {
                 var oval = instance.GlobalVariables[m_VarName];
                 if (oval.IsInteger)
                 {
                     int ov = oval.Get <int>();
                     if (m_ParamNum > 1 && m_Value.HaveValue)
                     {
                         int v = m_Value.Value;
                         ov += v;
                         instance.GlobalVariables[m_VarName] = ov;
                     }
                     else
                     {
                         ++ov;
                         instance.GlobalVariables[m_VarName] = ov;
                     }
                 }
                 else
                 {
                     float ov = oval.Get <float>();
                     if (m_ParamNum > 1 && m_Value.HaveValue)
                     {
                         float v = m_Value.Value;
                         ov += v;
                         instance.GlobalVariables[m_VarName] = ov;
                     }
                     else
                     {
                         ++ov;
                         instance.GlobalVariables[m_VarName] = ov;
                     }
                 }
             }
         }
     }
     else if (m_VarName.StartsWith("@"))
     {
         if (instance.LocalVariables.ContainsKey(m_VarName))
         {
             var oval = instance.LocalVariables[m_VarName];
             if (oval.IsInteger)
             {
                 int ov = oval.Get <int>();
                 if (m_ParamNum > 1 && m_Value.HaveValue)
                 {
                     int v = m_Value.Value;
                     ov += v;
                     instance.LocalVariables[m_VarName] = ov;
                 }
                 else
                 {
                     ++ov;
                     instance.LocalVariables[m_VarName] = ov;
                 }
             }
             else
             {
                 float ov = oval.Get <float>();
                 if (m_ParamNum > 1 && m_Value.HaveValue)
                 {
                     float v = m_Value.Value;
                     ov += v;
                     instance.LocalVariables[m_VarName] = ov;
                 }
                 else
                 {
                     ++ov;
                     instance.LocalVariables[m_VarName] = ov;
                 }
             }
         }
     }
     else if (m_VarName.StartsWith("$"))
     {
         if (instance.StackVariables.ContainsKey(m_VarName))
         {
             var oval = instance.StackVariables[m_VarName];
             if (oval.IsInteger)
             {
                 int ov = oval.Get <int>();
                 if (m_ParamNum > 1 && m_Value.HaveValue)
                 {
                     int v = m_Value.Value;
                     ov += v;
                     instance.StackVariables[m_VarName] = ov;
                 }
                 else
                 {
                     ++ov;
                     instance.StackVariables[m_VarName] = ov;
                 }
             }
             else
             {
                 float ov = oval.Get <float>();
                 if (m_ParamNum > 1 && m_Value.HaveValue)
                 {
                     float v = m_Value.Value;
                     ov += v;
                     instance.StackVariables[m_VarName] = ov;
                 }
                 else
                 {
                     ++ov;
                     instance.StackVariables[m_VarName] = ov;
                 }
             }
         }
     }
     return(false);
 }
Exemplo n.º 29
0
 protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
     m_UserGuid.Evaluate(instance, handler, iterator, args);
     m_ItemId.Evaluate(instance, handler, iterator, args);
     m_ItemNum.Evaluate(instance, handler, iterator, args);
 }
Exemplo n.º 30
0
        public void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
        {
            m_HaveValue = false;
            m_Object.Evaluate(instance, handler, iterator, args);
            m_Method.Evaluate(instance, handler, iterator, args);

            bool canCalc = true;

            if (!m_Object.HaveValue || !m_Method.HaveValue)
            {
                canCalc = false;
            }
            if (canCalc)
            {
                m_HaveValue = true;
                var    obj    = m_Object.Value;
                string method = m_Method.Value;
                if (obj.IsObject && !string.IsNullOrEmpty(method))
                {
                    object      v    = 0;
                    IEnumerable list = obj.ObjectVal as IEnumerable;
                    if (null != list)
                    {
                        if (method == "orderby" || method == "orderbydesc")
                        {
                            bool        desc    = method == "orderbydesc";
                            ObjList     results = new ObjList();
                            IEnumerator enumer  = list.GetEnumerator();
                            while (enumer.MoveNext())
                            {
                                object val = enumer.Current;
                                results.Add(val);
                            }
                            results.Sort((object o1, object o2) => {
                                BoxedValue r1 = BoxedValue.NullObject;
                                for (int i = 0; i < m_Args.Count; i++)
                                {
                                    m_Args[i].Evaluate(instance, handler, BoxedValue.From(o1), args);
                                    r1 = m_Args[i].Value;
                                }
                                BoxedValue r2 = BoxedValue.NullObject;
                                for (int i = 0; i < m_Args.Count; i++)
                                {
                                    m_Args[i].Evaluate(instance, handler, BoxedValue.From(o2), args);
                                    r2 = m_Args[i].Value;
                                }
                                string rs1 = r1.ToString();
                                string rs2 = r2.ToString();
                                int r      = 0;
                                if (null != rs1 && null != rs2)
                                {
                                    r = rs1.CompareTo(rs2);
                                }
                                else
                                {
                                    float rd1 = r1.Get <float>();
                                    float rd2 = r2.Get <float>();
                                    r         = rd1.CompareTo(rd2);
                                }
                                if (desc)
                                {
                                    r = -r;
                                }
                                return(r);
                            });
                            v = results;
                        }
                        else if (method == "where")
                        {
                            ObjList     results = new ObjList();
                            IEnumerator enumer  = list.GetEnumerator();
                            while (enumer.MoveNext())
                            {
                                object val = enumer.Current;

                                BoxedValue r = BoxedValue.NullObject;
                                for (int i = 0; i < m_Args.Count; i++)
                                {
                                    m_Args[i].Evaluate(instance, handler, BoxedValue.From(val), args);
                                    r = m_Args[i].Value;
                                }
                                if (r.Get <int>() != 0)
                                {
                                    results.Add(val);
                                }
                            }
                            v = results;
                        }
                        else if (method == "top")
                        {
                            BoxedValue r = BoxedValue.NullObject;
                            for (int i = 0; i < m_Args.Count; i++)
                            {
                                m_Args[i].Evaluate(instance, handler, iterator, args);
                                r = m_Args[i].Value;
                            }
                            int         ct      = r.Get <int>();
                            ObjList     results = new ObjList();
                            IEnumerator enumer  = list.GetEnumerator();
                            while (enumer.MoveNext())
                            {
                                object val = enumer.Current;
                                if (ct > 0)
                                {
                                    results.Add(val);
                                    --ct;
                                }
                            }
                            v = results;
                        }
                    }
                    m_Value = BoxedValue.From(v);
                }
                else
                {
                    m_Value = BoxedValue.NullObject;
                }
            }

            for (int i = 0; i < m_Args.Count; i++)
            {
                m_Args[i].Evaluate(instance, handler, iterator, args);
            }
        }
Exemplo n.º 31
0
 protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
     m_Key.Evaluate(instance, handler, iterator, args);
     m_Value.Evaluate(instance, handler, iterator, args);
 }
Exemplo n.º 32
0
 protected override void Evaluate(StoryInstance instance, StoryMessageHandler handler, BoxedValue iterator, BoxedValueList args)
 {
     //PreCall do all things, so do nothing here.
 }