Esempio n. 1
0
    public override string PrintTreeTraversal(System.Collections.Generic.Stack <int> stack, Entity entity)
    {
        string ans          = base.PrintTreeTraversal(stack, entity);
        Entity attackTarget = entity.memory[targetKey] as Entity;

        ans += $": {attackTarget}";
        return(ans);
    }
Esempio n. 2
0
    public override string PrintTreeTraversal(System.Collections.Generic.Stack <int> stack, Entity entity)
    {
        int i = stack.Count == 0 ? 0 : stack.Pop();

        if (i < behaviors.Length)
        {
            return($"{gameObject.name} (Sequence) \n{behaviors[i].PrintTreeTraversal(stack, entity)}");
        }
        else
        {
            return($"{gameObject.name} (Sequence) all succeeded");
        }
    }
Esempio n. 3
0
 static int Clear(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         System.Collections.Generic.Stack <FairyGUI.GComponent> obj = (System.Collections.Generic.Stack <FairyGUI.GComponent>)ToLua.CheckObject <System.Collections.Generic.Stack <FairyGUI.GComponent> >(L, 1);
         obj.Clear();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 4
0
 static int GetEnumerator(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         System.Collections.Generic.Stack <FairyGUI.GComponent> obj = (System.Collections.Generic.Stack <FairyGUI.GComponent>)ToLua.CheckObject <System.Collections.Generic.Stack <FairyGUI.GComponent> >(L, 1);
         System.Collections.IEnumerator o = obj.GetEnumerator();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 5
0
 static int CopyTo(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Stack <FairyGUI.GComponent> obj = (System.Collections.Generic.Stack <FairyGUI.GComponent>)ToLua.CheckObject <System.Collections.Generic.Stack <FairyGUI.GComponent> >(L, 1);
         FairyGUI.GComponent[] arg0 = ToLua.CheckObjectArray <FairyGUI.GComponent>(L, 2);
         int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.CopyTo(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 6
0
 static int Contains(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.Stack <FairyGUI.GComponent> obj = (System.Collections.Generic.Stack <FairyGUI.GComponent>)ToLua.CheckObject <System.Collections.Generic.Stack <FairyGUI.GComponent> >(L, 1);
         FairyGUI.GComponent arg0 = (FairyGUI.GComponent)ToLua.CheckObject <FairyGUI.GComponent>(L, 2);
         bool o = obj.Contains(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    public override string PrintTreeTraversal(System.Collections.Generic.Stack <int> stack, Entity entity)
    {
        string ans  = "";
        int    mask = stack.Pop();

        for (int i = 0; i < behaviors.Length; i++)
        {
            int curMask = i << 1;
            if ((mask & curMask) == 0)
            {
                continue;
            }
            ans += $"{behaviors[i].PrintTreeTraversal(stack, entity)}\n";
        }
        return($"{gameObject.name} (Priority):\n=={ans}==");
    }
Esempio n. 8
0
    static int get_stack(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyUI obj = (FairyUI)o;
            System.Collections.Generic.Stack <FairyGUI.GComponent> ret = obj.stack;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index stack on a nil value"));
        }
    }
    static int set_commonDlgStack(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIManager obj = (UIManager)o;
            System.Collections.Generic.Stack <UILayer> arg0 = (System.Collections.Generic.Stack <UILayer>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Stack <UILayer>));
            obj.commonDlgStack = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index commonDlgStack on a nil value" : e.Message));
        }
    }
Esempio n. 10
0
    static int get_Count(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            System.Collections.Generic.Stack <FairyGUI.GComponent> obj = (System.Collections.Generic.Stack <FairyGUI.GComponent>)o;
            int ret = obj.Count;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Count on a nil value"));
        }
    }
    static int set_stackPages(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyUIManager obj = (FairyUIManager)o;
            System.Collections.Generic.Stack <FairyUI> arg0 = (System.Collections.Generic.Stack <FairyUI>)ToLua.CheckObject <System.Collections.Generic.Stack <FairyUI> >(L, 2);
            obj.stackPages = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index stackPages on a nil value"));
        }
    }
Esempio n. 12
0
    static int get_commonDlgStack(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UIManager obj = (UIManager)o;
            System.Collections.Generic.Stack <UILayer> ret = obj.commonDlgStack;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index commonDlgStack on a nil value" : e.Message));
        }
    }
Esempio n. 13
0
    static int get_m_pageNeedBackPool(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            XPageMgr obj = (XPageMgr)o;
            System.Collections.Generic.Stack <XPage> ret = obj.m_pageNeedBackPool;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_pageNeedBackPool on a nil value" : e.Message));
        }
    }
Esempio n. 14
0
    static int set_m_pageNeedBackPool(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            XPageMgr obj = (XPageMgr)o;
            System.Collections.Generic.Stack <XPage> arg0 = (System.Collections.Generic.Stack <XPage>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Stack <XPage>));
            obj.m_pageNeedBackPool = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_pageNeedBackPool on a nil value" : e.Message));
        }
    }
    public static System.Collections.Generic.Stack <string> Info(System.Collections.Generic.Stack <string> aStack, string newItem, string search)
    {
        int  sizeStack     = aStack.Count;
        bool containSearch = false;
        int  indexSearch   = 0;

        Console.WriteLine("Number of items: {0}", sizeStack);

        if (sizeStack == 0)
        {
            Console.WriteLine("Stack is empty");
        }
        else
        {
            Console.WriteLine("Top item: {0}", aStack.Peek());
        }

        foreach (string item in aStack)
        {
            if (item == search)
            {
                containSearch = true;
                break;
            }
            indexSearch++;
        }

        Console.WriteLine("Stack contains \"{0}\": {1}", search, containSearch? "True": "False");

        if (containSearch)
        {
            for (var i = 0; i <= indexSearch; i++)
            {
                aStack.Pop();
            }
        }
        aStack.Push(newItem);
        return(aStack);
    }
Esempio n. 16
0
    static int _CreateSystem_Collections_Generic_Stack_FairyGUI_GComponent(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                System.Collections.Generic.Stack <FairyGUI.GComponent> obj = new System.Collections.Generic.Stack <FairyGUI.GComponent>();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <System.Collections.Generic.IEnumerable <FairyGUI.GComponent> >(L, 1))
            {
                System.Collections.Generic.IEnumerable <FairyGUI.GComponent> arg0 = (System.Collections.Generic.IEnumerable <FairyGUI.GComponent>)ToLua.ToObject(L, 1);
                System.Collections.Generic.Stack <FairyGUI.GComponent>       obj  = new System.Collections.Generic.Stack <FairyGUI.GComponent>(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <int>(L, 1))
            {
                int arg0 = (int)LuaDLL.lua_tonumber(L, 1);
                System.Collections.Generic.Stack <FairyGUI.GComponent> obj = new System.Collections.Generic.Stack <FairyGUI.GComponent>(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Collections.Generic.Stack<FairyGUI.GComponent>.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 17
0
 void Start()
 {
     HelpText  = HelpCanvas.GetComponentInChildren <TMPro.TextMeshProUGUI>();
     dialogues = new System.Collections.Generic.Stack <HelpText>();
 }
Esempio n. 18
0
 public void Init(float slack, System.Collections.Generic.Stack <Vector2> rotationPoints, System.Collections.Generic.Stack <Vector2> ropeNorms)
 {
     Slack = slack; RotationPoints = rotationPoints; RopeNorms = ropeNorms;
 }
    static int get__stackAsset(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            MyFrameWork.ResourceMgr obj = (MyFrameWork.ResourceMgr)o;
            System.Collections.Generic.Stack <System.Collections.Generic.List <string> > ret = obj._stackAsset;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index _stackAsset on a nil value" : e.Message));
        }
    }
    static int set__stackAsset(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            MyFrameWork.ResourceMgr obj = (MyFrameWork.ResourceMgr)o;
            System.Collections.Generic.Stack <System.Collections.Generic.List <string> > arg0 = (System.Collections.Generic.Stack <System.Collections.Generic.List <string> >)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.Stack <System.Collections.Generic.List <string> >));
            obj._stackAsset = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index _stackAsset on a nil value" : e.Message));
        }
    }
Esempio n. 21
0
    private void Teleport(StateMachine st)
    {
        //Get a random starting spot.
        Location jumpPos = new Location(Random.Range(0, level.Map.GetLength(0)),
                                        Random.Range(0, level.Map.GetLength(1)));

        //Find the nearest free spot. Use depth-first level traversal.

        System.Collections.Generic.Stack <Location> searchSpace = new System.Collections.Generic.Stack <Location>();
        searchSpace.Push(jumpPos);
        System.Collections.Generic.Dictionary <Location, bool> searchedYet = new System.Collections.Generic.Dictionary <Location, bool>();
        searchedYet.Add(jumpPos, true);

        while (level.Map[jumpPos.X, jumpPos.Y])
        {
            //Use depth-first traversal.

            jumpPos = searchSpace.Pop();

            if (!level.Map[jumpPos.X, jumpPos.Y])
            {
                break;
            }
            else
            {
                //Add the four adjacent sides in random order.

                int      start = Random.Range(0, 4);
                Location loc   = new Location();

                for (int i = 0; i < 4; ++i)
                {
                    int index = (start + i) % 4;

                    switch (index)
                    {
                    case 0:
                        loc.X = jumpPos.X + 1;
                        loc.Y = jumpPos.Y;
                        break;

                    case 1:
                        loc.X = jumpPos.X - 1;
                        loc.Y = jumpPos.Y;
                        break;

                    case 2:
                        loc.X = jumpPos.X;
                        loc.Y = jumpPos.Y + 1;
                        break;

                    case 3:
                        loc.X = jumpPos.X;
                        loc.Y = jumpPos.Y - 1;
                        break;

                    default: throw new System.NotImplementedException();
                    }

                    if (loc.X >= 0 && loc.X < level.Map.GetLength(0) &&
                        loc.Y >= 0 && loc.Y < level.Map.GetLength(1) &&
                        !searchedYet.ContainsKey(loc))
                    {
                        searchSpace.Push(loc);
                        searchedYet[loc] = true;
                    }
                }
            }

            continue;
        }

        st.transform.position = new Vector3(jumpPos.X, jumpPos.Y, st.transform.position.z);
    }
Esempio n. 22
0
 /// <summary>
 /// Used for debugging purposes, prints the traversal of the behavior tree
 /// </summary>
 /// <param name="stack">The child nodes of each composite node in the BT traversal</param>
 /// <returns></returns>
 public virtual string PrintTreeTraversal(System.Collections.Generic.Stack <int> stack, Entity entity)
 {
     return(gameObject.name);
 }