コード例 #1
0
 public void OpenAssetScene(string AssetPath, string SceneName)
 {
     if (EventTriggerEditorUtil._OnOpenSceneAsset != null)
     {
         EventTriggerEditorUtil._OnOpenSceneAsset(AssetPath);
         this.m_LoadComplete = true;
     }
     this.m_AssetPath    = AssetPath;
     this.m_SceneName    = SceneName;
     this.m_DownComplete = true;
 }
コード例 #2
0
    public void Add(UnityEngine.Object prefab, ModelInfo info)
    {
        if (this.m_ModelPrefabInfo == null)
        {
            this.m_ModelPrefabInfo = new List <ModelPrefabInfo>();
        }
        ModelPrefabInfo modelPrefabInfo = null;

        foreach (ModelPrefabInfo current in this.m_ModelPrefabInfo)
        {
            if (current.m_PrefabName.Equals(prefab.name))
            {
                modelPrefabInfo = current;
            }
        }
        if (modelPrefabInfo == null)
        {
            modelPrefabInfo = new ModelPrefabInfo();
            modelPrefabInfo.m_PrefabName      = prefab.name;
            modelPrefabInfo.m_PrefabAssetPath = EventTriggerEditorUtil._OnGetAssetPath(prefab);
            modelPrefabInfo.m_Prefab          = prefab;
            GameObject gameObject = UnityEngine.Object.Instantiate(prefab) as GameObject;
            modelPrefabInfo.m_PrefabScale = gameObject.transform.localScale;
            UnityEngine.Object.DestroyImmediate(gameObject);
            modelPrefabInfo.m_ModelInfoList = new List <ModelInfo>();
            this.m_ModelPrefabInfo.Add(modelPrefabInfo);
        }
        foreach (ModelInfo current2 in modelPrefabInfo.m_ModelInfoList)
        {
            if (current2.Model.Equals(info.Model))
            {
                return;
            }
        }
        modelPrefabInfo.m_ModelInfoList.Add(info);
        if (info.ChangeScale && !modelPrefabInfo.m_PrefabScale.Equals(info.Scale))
        {
            info.Model.transform.localScale = modelPrefabInfo.m_PrefabScale;
        }
        int childCount = info.Model.transform.childCount;

        for (int i = 0; i < childCount; i++)
        {
            Transform child = info.Model.transform.GetChild(0);
            if (!(child == null))
            {
                GameObject gameObject2 = child.gameObject;
                if (!(gameObject2 == null))
                {
                    UnityEngine.Object.DestroyImmediate(gameObject2);
                }
            }
        }
    }
コード例 #3
0
 public UnityEngine.Object GetObject()
 {
     if (!(this.m_Object != null))
     {
         if (this.m_LoadComplete)
         {
             return(this.m_Object);
         }
         if (EventTriggerEditorUtil._OnGetAsset != null)
         {
             this.m_Object = EventTriggerEditorUtil._OnGetAsset(this.m_AssetPath, typeof(UnityEngine.Object));
         }
     }
     return(this.m_Object);
 }
コード例 #4
0
 public void CreateBundle()
 {
     if (!string.IsNullOrEmpty(this.m_URL))
     {
         WWWItem wWWItem = Holder.TryGetOrCreateBundle(this.m_URL, null);
         wWWItem.SetItemType(ItemType.USER_ASSETB);
         wWWItem.SetCallback(new PostProcPerItem(this._OnCompleteDownload), null);
         TsImmortal.bundleService.RequestDownloadCoroutine(wWWItem, DownGroup.RUNTIME, this.UnLoad);
     }
     else
     {
         if (EventTriggerEditorUtil._OnGetAsset != null)
         {
             this.m_Object = EventTriggerEditorUtil._OnGetAsset(this.m_AssetPath, typeof(UnityEngine.Object));
             if (this.m_Object != null)
             {
                 this.m_LoadComplete = true;
             }
         }
         this.m_DownComplete = true;
     }
 }
コード例 #5
0
 public virtual void GetAssetList(ref List <UnityEngine.Object> ObjectList)
 {
     if (this.m_AssetDataList == null)
     {
         this.m_AssetDataList = new List <AssetData>();
     }
     this.m_AssetDataList.Clear();
     FieldInfo[] fields = base.GetType().GetFields();
     FieldInfo[] array  = fields;
     for (int i = 0; i < array.Length; i++)
     {
         FieldInfo fieldInfo = array[i];
         if (fieldInfo.FieldType.IsArray)
         {
             UnityEngine.Object[] array2 = fieldInfo.GetValue(this) as UnityEngine.Object[];
             if (array2 != null && array2.Length > 0)
             {
                 GameObject[] array3 = array2 as GameObject[];
                 Component[]  array4 = array2 as Component[];
                 if (array3 == null && array4 == null)
                 {
                     UnityEngine.Object[] array5 = array2;
                     for (int j = 0; j < array5.Length; j++)
                     {
                         UnityEngine.Object @object = array5[j];
                         if (!ObjectList.Contains(@object))
                         {
                             ObjectList.Add(@object);
                         }
                         AssetData assetData = new AssetData();
                         assetData.m_ArraySize = array2.Length;
                         assetData.m_ValueName = fieldInfo.Name;
                         assetData.m_AssetPath = EventTriggerEditorUtil._OnGetAssetPath(@object);
                         assetData.m_AssetPath = assetData.m_AssetPath.Substring("Assets/".Length, assetData.m_AssetPath.Length - "Assets/".Length);
                         assetData.m_TypeName  = @object.GetType().AssemblyQualifiedName;
                         this.m_AssetDataList.Add(assetData);
                     }
                     fieldInfo.SetValue(this, null);
                 }
             }
         }
         else
         {
             UnityEngine.Object object2 = fieldInfo.GetValue(this) as UnityEngine.Object;
             if (!(object2 == null))
             {
                 GameObject x  = object2 as GameObject;
                 Component  x2 = object2 as Component;
                 if (!(x != null) && !(x2 != null))
                 {
                     if (!ObjectList.Contains(object2))
                     {
                         ObjectList.Add(object2);
                     }
                     AssetData assetData2 = new AssetData();
                     assetData2.m_ArraySize = 0;
                     assetData2.m_ValueName = fieldInfo.Name;
                     assetData2.m_AssetPath = EventTriggerEditorUtil._OnGetAssetPath(object2);
                     assetData2.m_AssetPath = assetData2.m_AssetPath.Substring("Assets/".Length, assetData2.m_AssetPath.Length - "Assets/".Length);
                     assetData2.m_TypeName  = object2.GetType().AssemblyQualifiedName;
                     this.m_AssetDataList.Add(assetData2);
                     fieldInfo.SetValue(this, null);
                 }
             }
         }
     }
 }