123456789101112131415161718192021222324252627282930313233343536 |
- using ShadowStudio.Model;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace ShadowStudio.Model
- {
- /// <summary>
- /// Unity组件,例如Cube,Sphere,Cylinder等基本几何体
- /// </summary>
- public class UnityBaseHandler : ArtInstanceHandler
- {
- public override UnityEngine.Object LoadArt()
- {
- if (!LoadCache && Info != null)
- {
- int type;
- if (int.TryParse(Info.Url, out type))
- {
- var obj = GameObject.CreatePrimitive((PrimitiveType)type);
- if (obj)
- {
- obj.SetActive(false);
- }
- LoadCache = obj;
- }
- }
- return LoadCache;
- }
- public override void LoadArtAsyn(string path, Action<float> process, Action<UnityEngine.Object> loaded)
- {
- process?.Invoke(1);
- loaded?.Invoke(LoadArt());
- }
- }
- }
|