/**************************************************************************** * 2022.1 SK-20211220VCWK ****************************************************************************/ using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using QFramework; using UniRx; using System.Collections; using System.IO; namespace QFramework.MREditor { public partial class UIAddMaterial : UIElement { private void Awake() { } protected override void OnBeforeDestroy() { } public void Close() { gameObject.SetActive(false); } private CompositeMaterialValue selectObj; /// /// 根据传进来的Json文件 生成对应数据(主要是 用户自己上传的数据) /// public void Initialized( List localMaterials ,List upLocalMaterials ,SingleMaterial material ) { selectObj = null; UCBtn.onClick.AddListener(() => { if (LocalView.gameObject.activeSelf) return; LocalView.gameObject.SetActive(true); UpLoadView.gameObject.SetActive(false); }); TicBtn.onClick.AddListener(() => { if (UpLoadView.gameObject.activeSelf) return; LocalView.gameObject.SetActive(false); UpLoadView.gameObject.SetActive(true); }); ADDBtn.onClick.AddListener(() => { //Debug.Log(selectObj.name +" ?????????"); // 添加选中素材 //if (selectObj==null) // return; SendMsg(new OnAddNewMaterial(selectObj)); }); CloseBtn.onClick.AddListener(() => { selectObj = null; Debug.Log("Close" + "@@@@"); SendMsg(new OnUIOpenElenemt(true)); }); LocalContent.GetComponent().sizeDelta += new Vector2(0, (localMaterials.Count / 3 + 1) * 140 + 25); localMaterials.ForEach(item => { material.Instantiate() .Parent(LocalContent) .Identity() .ApplySelfTo(SelfObj => { SelfObj.Name.text = item.name; SelfObj.GetComponent