コード例 #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;
            }
        }
    }