示例#1
0
    public static void SetEuler(int id, float x, float y, float z)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            go.transform.rotation = Quaternion.Euler(x, y, z);
        }
    }
示例#2
0
    public static void SetActive(int id, int active)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            go.SetActive(active == 1);
        }
    }
示例#3
0
    public static void SetText(int id, string text)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            SetText(go.transform, text);
        }
    }
示例#4
0
    public static void SetSiblingIndex(int id, int index)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            go.transform.SetSiblingIndex(index);
        }
    }
示例#5
0
    public static void SetLayer(int id, int layer)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            NGUITools.SetLayer(go, layer);
        }
    }
示例#6
0
    public static void SetSprite(int id, string spriteName, bool native)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            SetSprite(go.transform, spriteName, native);
        }
    }
示例#7
0
    public static void LookAt(int id, float x, float y, float z)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            go.transform.LookAt(new Vector3(x, y, z));
        }
    }
示例#8
0
    public static void Translate(int id, float x, float y, float z)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            go.transform.Translate(x, y, z);
        }
    }
示例#9
0
    public static void DontDestroyOnLoad(int id)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            UnityEngine.Object.DontDestroyOnLoad(go);
        }
    }
示例#10
0
    public static void SetAsLastSibling(int id)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            go.transform.SetAsLastSibling();
        }
    }
示例#11
0
    public static void DestroyImmediate(int id)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            UnityEngine.Object.DestroyImmediate(go);
            LuaReference.Remove(id);
        }
    }
示例#12
0
    public static int GetParent(int id)
    {
        var go = LuaReference.Get(id);

        if (go && go.transform.parent)
        {
            return(LuaReference.Add(go.transform.parent.gameObject));
        }
        return(LuaReference.INVALID_GAMEOBJECT_ID);
    }
示例#13
0
    public static int GetChildCount(int id)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            return(go.transform.childCount);
        }
        return(0);
    }
示例#14
0
    private static T FindChildWithComponent <T>(int id) where T : Component
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            return(go.GetComponentInChildren <T>());
        }
        return(null);
    }
示例#15
0
    public static int Instantiate(int id)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            return(LuaReference.Add(UnityEngine.Object.Instantiate(go)));
        }
        return(LuaReference.INVALID_GAMEOBJECT_ID);
    }
示例#16
0
    public static int IsActive(int id)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            return(go.activeInHierarchy ? 1 : 0);
        }
        return(0);
    }
示例#17
0
    public static int GetSiblingIndex(int id)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            return(go.transform.GetSiblingIndex());
        }
        return(-1);
    }
示例#18
0
    public static int AddComponent(int id, int type)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            go.AddComponent(LuaReference.GetComponentType(type));
            return(id);
        }
        return(LuaReference.INVALID_GAMEOBJECT_ID);
    }
示例#19
0
    public static void SetParent(int id, int parent)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            var p = LuaReference.Get(parent);

            go.transform.SetParent(p != null?p.transform:null);
        }
    }
示例#20
0
    public static void AddClick(int id, SLua.LuaFunction function)
    {
        var go = LuaReference.Get(id);

        if (go == null)
        {
            return;
        }

        AddClick(go.transform, function);
    }
示例#21
0
    public static void SetRotation(int id, float x, float y, float z, float w)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            Quaternion q = go.transform.rotation;
            q.Set(x, y, z, w);
            go.transform.rotation = q;
        }
    }
示例#22
0
    public static void GetEuler(int id, float x, float y, float z)
    {
        var go = LuaReference.Get(id);

        x = y = z = 0;
        if (go)
        {
            x = go.transform.eulerAngles.x;
            y = go.transform.eulerAngles.y;
            z = go.transform.eulerAngles.z;
        }
    }
示例#23
0
    public static void GetForward(int id, out float x, out float y, out float z)
    {
        var go = LuaReference.Get(id);

        x = y = z = 0;
        if (go)
        {
            x = go.transform.forward.x;
            y = go.transform.forward.y;
            z = go.transform.forward.z;
        }
    }
示例#24
0
    public static void SetWidgetDepth(int id, int depth)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            UIWidget widget = go.GetComponent <UIWidget>();
            if (widget)
            {
                widget.depth = depth;
            }
        }
    }
示例#25
0
    public static void ResizeCollider(int id)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            UIWidget widget = go.GetComponent <UIWidget>();
            if (widget)
            {
                widget.ResizeCollider();
            }
        }
    }
示例#26
0
    public static void SetPanelDepth(int id, int depth)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            UIPanel panel = go.GetComponent <UIPanel>();
            if (panel)
            {
                panel.depth = depth;
            }
        }
    }
示例#27
0
    public static void SetLocalPosition(int id, float x, float y, float z)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            Vector3 position = go.transform.localPosition;
            position.x = x;
            position.y = y;
            position.z = z;
            go.transform.localPosition = position;
        }
    }
示例#28
0
    public static void SetPanelAlpha(int id, float alpha)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            UIPanel panel = go.GetComponent <UIPanel>();
            if (panel)
            {
                panel.alpha = alpha;
            }
        }
    }
示例#29
0
    public static void SetCameraCullingMask(int id, int mask)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            Camera camera = go.GetComponent <Camera>();
            if (camera)
            {
                camera.cullingMask = mask;
            }
        }
    }
示例#30
0
    public static void SetCameraDepth(int id, int depth)
    {
        var go = LuaReference.Get(id);

        if (go)
        {
            Camera camera = go.GetComponent <Camera>();
            if (camera)
            {
                camera.depth = depth;
            }
        }
    }