Пример #1
0
    static int RemoveComponent(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        PrefabText obj = (PrefabText)LuaScriptMgr.GetUnityObjectSelf(L, 1, "PrefabText");

        obj.RemoveComponent();
        return(0);
    }
Пример #2
0
    static int SetToOriginColor(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        PrefabText obj = (PrefabText)LuaScriptMgr.GetUnityObjectSelf(L, 1, "PrefabText");

        obj.SetToOriginColor();
        return(0);
    }
Пример #3
0
    static int SetTextColor(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        PrefabText obj  = (PrefabText)LuaScriptMgr.GetUnityObjectSelf(L, 1, "PrefabText");
        Color      arg0 = LuaScriptMgr.GetColor(L, 2);

        obj.SetTextColor(arg0);
        return(0);
    }
Пример #4
0
    public static void ConvertAllTextToPrefabText()
    {
        GameObject obj = Selection.activeGameObject;

        if (obj != null)
        {
            Transform          trans = obj.transform;
            Action <Transform> func  = null;
            func = (Transform nxt) =>
            {
                Text text = nxt.GetComponent <Text>();
                if (text && text.GetType() != typeof(PrefabText))
                {
                    DestroyImmediate(text);

                    PrefabText prefabText = nxt.gameObject.AddComponent <PrefabText>();
                    prefabText                      = nxt.GetComponent <PrefabText>();
                    prefabText.usePrefab            = false;
                    prefabText.text                 = text.text;
                    prefabText.font                 = text.font;
                    prefabText.fontStyle            = text.fontStyle;
                    prefabText.fontSize             = text.fontSize;
                    prefabText.lineSpacing          = text.lineSpacing;
                    prefabText.supportRichText      = text.supportRichText;
                    prefabText.alignment            = text.alignment;
                    prefabText.horizontalOverflow   = text.horizontalOverflow;
                    prefabText.verticalOverflow     = text.verticalOverflow;
                    prefabText.resizeTextForBestFit = text.resizeTextForBestFit;
                    prefabText.color                = text.color;
                    prefabText.material             = text.material;
                }

                for (int i = 0; i < nxt.childCount; i++)
                {
                    var child = nxt.GetChild(i);
                    func(child);
                }
            };
            func.Invoke(trans);
        }
    }
Пример #5
0
    static int set_usePrefab(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        PrefabText obj = (PrefabText)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name usePrefab");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index usePrefab on a nil value");
            }
        }

        obj.usePrefab = LuaScriptMgr.GetBoolean(L, 3);
        return(0);
    }
Пример #6
0
    static int get_prefabText(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        PrefabText obj = (PrefabText)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name prefabText");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index prefabText on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.prefabText);
        return(1);
    }