Пример #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;
            }
        }
    }