示例#1
0
    private void ProfileImgAdd()
    {
        var paths = ProfileImageLoader.GetImagePaths();

        foreach (var path in paths)
        {
            var go = new GameObject("ProfileImage", typeof(Image), typeof(Button));
            go.GetComponent <Image>().sprite = ProfileImageLoader.GetImageByPath(path);
            go.GetComponent <Button>().onClick.AddListener(
                delegate
            {
                RemoveAllOutLine();
                go.AddComponent <Outline>().effectDistance = new Vector2(7, 7);
                profileImgPath = path;
            });
            profileImageItemList.Add(go);
        }
        gridLayoutCtrl.SetItem(profileImageItemList);
    }