12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using ShadowStudio.Model;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.Util;
- public class TestModelLoader : MonoBehaviour
- {
- public ArtType artType;
- public int indexOfArt;
- // Start is called before the first frame update
- void Start()
- {
- ArtInfoMgr.Instance.OpenLocalData();
- StartCoroutine(Test1());
- }
- private IEnumerator Test1()
- {
- yield return Test2();
- print("Test1");
- }
- private IEnumerator Test2()
- {
- yield return new WaitForSeconds(2);
- print("Test2");
- }
- // Update is called once per frame
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.C))
- {
- CreateArt(artType, indexOfArt);
- }
- if (Input.GetKeyDown(KeyCode.F))
- {
- for (int i = 0; i < ArtInfoMgr.Instance.ArtInfoList.Count; i++)
- {
- CreateArt(ArtInfoMgr.Instance.ArtInfoList[i]);
- }
- }
- }
- private void CreateArt(ArtInfo info)
- {
- ArtHandler handler = ArtInfoMgr.Instance.CreateArtHandler(info);
- handler.CreateArt();
- }
- private void CreateArt(ArtType artType, int indexOfArt)
- {
- Debug.Log(artType);
- var list = ArtInfoMgr.Instance.GetArtInfoList(artType);
- if (list != null)
- {
- print(list.Count);
- if (indexOfArt >= 0 && indexOfArt < list.Count)
- {
- ArtInfo info = list[indexOfArt];
- //print(info.ArtName);
- ArtHandler handler = ArtInfoMgr.Instance.CreateArtHandler(info);
- //print(handler.GetIcon());
- var container = handler.CreateArt();
- container.Position = Vector3.zero;
- //gameObject.hideFlags = HideFlags.HideAndDontSave;
- }
- }
- else
- {
- UnityLog.LogError(artType.ToString() + " is null list!");
- }
- }
- }
|