Exemplo n.º 1
0
        public void TestMethod2()
        {
            CLActionStack st = new CLActionStack();

            for (int i = 0; i < 2 * CLActionStack.StackSize; i++)
            {
                CLActionTest t = new CLActionTest(i.ToString());
                st.Push(t);
            }
            Assert.AreEqual(CLActionStack.StackSize - 1, st.Count);
            int      lastPushedEl = 2 * CLActionStack.StackSize - 1;
            CLAction tcla         = st.Pop();

            Assert.AreEqual(lastPushedEl.ToString(), tcla.Name);
            Assert.AreEqual(CLActionStack.StackSize - 2, st.Count);
            lastPushedEl--;
            tcla = st.Pop();
            Assert.AreEqual(lastPushedEl.ToString(), tcla.Name);
            Assert.AreEqual(CLActionStack.StackSize - 3, st.Count);
            lastPushedEl--;
            for (int i = 0; i < CLActionStack.StackSize - 3; i++)
            {
                tcla = st.Pop();
                Assert.IsNotNull(tcla);
                Assert.AreEqual(lastPushedEl.ToString(), tcla.Name);
                lastPushedEl--;
            }
            Assert.AreEqual(0, st.Count);
            tcla = st.Pop();
            Assert.IsNull(tcla);
            Assert.AreEqual(0, st.Count);
        }
Exemplo n.º 2
0
    private void AnalysisAction(CLAction action, params object[] objs)
    {
        var           method = this.GetType().GetMethod(action.type.ToString(), BindingFlags.NonPublic | BindingFlags.Instance);
        List <object> pms    = new List <object>();

        ParameterInfo[] pmsinfo = method.GetParameters();
        for (int i = 0; i < action.values.Length; i++)
        {
            if (action.values[i] == null)
            {
                break;
            }
            pms.Add(AnalysisValue(action.values[i], objs));
            if (pmsinfo[i].ParameterType == pms[i].GetType())
            {
            }
            else if (pmsinfo[i].ParameterType == typeof(string))
            {
                pms[i] = pms[i].ToString();
            }
            else
            {
            }
        }
        method.Invoke(this, pms.ToArray());
    }
Exemplo n.º 3
0
        public void TestMethod1()
        {
            CLActionStack st = new CLActionStack();

            for (int i = 0; i < 40; i++)
            {
                CLActionTest t = new CLActionTest(i.ToString());
                st.Push(t);
            }
            Assert.AreEqual(40, st.Count);
            for (int i = 0; i < 10; i++)
            {
                _ = st.Pop();
            }
            Assert.AreEqual(30, st.Count);
            CLAction tcla = st.Pop();

            Assert.AreEqual("29", tcla.Name);
            Assert.AreEqual(29, st.Count);
            tcla = st.Pop();
            Assert.AreEqual("28", tcla.Name);
            Assert.AreEqual(28, st.Count);
            for (int i = 0; i < 28; i++)
            {
                tcla = st.Pop();
                Assert.IsNotNull(tcla);
            }
            tcla = st.Pop();
            Assert.IsNull(tcla);
            Assert.AreEqual(0, st.Count);
        }
Exemplo n.º 4
0
 public void addAction(CLAction action,MonoBehaviour target,bool pause)
 {
     if (!_targetDict.ContainsKey(target))
     {
         _targetDict[target] = new HashSet<CLAction>();
     }
     action.target = target;
     _targetDict[target].Add(action);
 }
Exemplo n.º 5
0
 public void addAction(CLAction action, MonoBehaviour target, bool pause)
 {
     if (!_targetDict.ContainsKey(target))
     {
         _targetDict[target] = new HashSet <CLAction>();
     }
     action.target = target;
     _targetDict[target].Add(action);
 }
Exemplo n.º 6
0
    public void removeAction(MonoBehaviour target, CLAction action)
    {
        if (action == null || target == null)
        {
            return;
        }

        if (_targetDict.ContainsKey(target))
        {
            _targetDict[target].Remove(action);
            if (_targetDict[target].Count == 0)
            {
                _targetDict.Remove(target);
            }
        }
    }
Exemplo n.º 7
0
    public void removeAction(MonoBehaviour target, CLAction action)
    {
        if (action == null || target == null)
        {
            return;
        }

        if (_targetDict.ContainsKey(target))
        {
            _targetDict[target].Remove(action);
            if (_targetDict[target].Count == 0)
            {
                _targetDict.Remove(target);
            }
        }
    }
Exemplo n.º 8
0
 public static CLAction runAction(this MonoBehaviour target, CLAction action)
 {
     ActionManager.instance.addAction(action, target, false);
     return(action);
 }
Exemplo n.º 9
0
 public static CLAction stopAction(this MonoBehaviour target, CLAction action)
 {
     ActionManager.instance.removeAction(target, action);
     return(action);
 }
Exemplo n.º 10
0
 public static CLAction runAction(this MonoBehaviour target,CLAction action)
 {
     ActionManager.instance.addAction(action,target,false);
     return action;
 }
Exemplo n.º 11
0
 public static CLAction stopAction(this MonoBehaviour target,CLAction action)
 {
     ActionManager.instance.removeAction(target,action);
     return action;
 }