Beispiel #1
0
    /// <summary>
    /// 创建图片按钮
    /// </summary>
    /// <param name="data"></param>
    public DialogueBoxWeChatImageBtnItem CreationImageBtn(ChapterDialogueTextDefine data)
    {
        RectTransform itemTra = GameObject.Instantiate(_imageBtnItem.gameObject, _ImagBoxRect).GetComponent <RectTransform>();
        DialogueBoxWeChatImageBtnItem dialogueBoxWeChatImageBtnItem = new DialogueBoxWeChatImageBtnItem();

        dialogueBoxWeChatImageBtnItem.Initial(itemTra, data, ClickItem);
        LayoutRebuilder.ForceRebuildLayoutImmediate(_ImagBoxRect);
        return(dialogueBoxWeChatImageBtnItem);
    }
Beispiel #2
0
    /// <summary>
    /// 创建图片按钮
    /// </summary>
    /// <param name="data"></param>
    public async void CreationImageBtn(List <ChapterDialogueTextDefine> datas)
    {
        ClearItemBtn();
        for (int i = 0; i < datas.Count; i++)
        {
            DialogueBoxWeChatImageBtnItem item = CreationImageBtn(datas[i]);
            _currImageBtns.Add(item);
            await UniTask.DelayFrame(1);
        }
        LayoutRebuilder.ForceRebuildLayoutImmediate(_ImagBoxRect);
        await UniTask.DelayFrame(1);

        Debug.Log("图片按钮Box尺寸:" + _ImagBoxRect.sizeDelta);
        await RefreshPanel(1);
    }