Ejemplo n.º 1
0
        protected override bool ExecCommand(StoryInstance instance, long delta)
        {
            int ct = 0;

            for (int i = 0; i < m_MsgIds.Count; i++)
            {
                ct += instance.CountMessage(m_MsgIds[i].Value);
            }
            bool ret = false;

            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);
        }
Ejemplo n.º 2
0
        protected override bool ExecCommand(StoryInstance instance, long delta)
        {
            int    ct         = 0;
            string _namespace = instance.Namespace;

            if (string.IsNullOrEmpty(_namespace))
            {
                for (int i = 0; i < m_MsgIds.Count; i++)
                {
                    ct += instance.CountMessage(m_MsgIds[i].Value);
                }
            }
            else
            {
                for (int i = 0; i < m_MsgIds.Count; i++)
                {
                    ct += instance.CountMessage(string.Format("{0}:{1}", _namespace, m_MsgIds[i].Value));
                }
            }
            bool ret = false;

            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);
        }
Ejemplo n.º 3
0
        public int CountMessage(string msgId)
        {
            int sum = 0;
            int ct  = m_StoryLogicInfos.Count;

            for (int ix = ct - 1; ix >= 0; --ix)
            {
                StoryInstance info = m_StoryLogicInfos[ix];
                sum += info.CountMessage(msgId);
            }
            return(sum);
        }
        public int CountMessage(string msgId)
        {
            int sum = 0;
            int ct  = m_StoryLogicInfos.Count;

            for (int ix = ct - 1; ix >= 0; --ix)
            {
                StoryInstance info = m_StoryLogicInfos[ix];
                sum += info.CountMessage(msgId);
            }
            foreach (var pair in m_AiStoryInstancePool)
            {
                var infos = pair.Value;
                int aiCt  = infos.Count;
                for (int ix = aiCt - 1; ix >= 0; --ix)
                {
                    if (infos[ix].m_IsUsed && null != infos[ix].m_StoryInstance)
                    {
                        sum += infos[ix].m_StoryInstance.CountMessage(msgId);
                    }
                }
            }
            return(sum);
        }
Ejemplo n.º 5
0
 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     int ct = 0;
     string _namespace = instance.Namespace;
     if (string.IsNullOrEmpty(_namespace)) {
         for (int i = 0; i < m_MsgIds.Count; i++) {
             ct += instance.CountMessage(m_MsgIds[i].Value);
         }
     } else {
         for (int i = 0; i < m_MsgIds.Count; i++) {
             ct += instance.CountMessage(string.Format("{0}:{1}", _namespace, m_MsgIds[i].Value));
         }
     }
     bool ret = false;
     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;
 }
Ejemplo n.º 6
0
 protected override bool ExecCommand(StoryInstance instance, long delta)
 {
     int ct = 0;
     for (int i = 0; i < m_MsgIds.Count; i++) {
         ct += instance.CountMessage(m_MsgIds[i].Value);
     }
     bool ret = false;
     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;
 }