Tanoda
pb_MetaData.cs
Go to the documentation of this file.
1using UnityEngine;
2using System.Runtime.Serialization;
4
5namespace GILES
6{
10 [System.Serializable()]
11 public class pb_MetaData : ISerializable
12 {
13
14 public const string GUID_NOT_FOUND = "MetaData_NoGUIDPresent";
15 public const string ASSET_BUNDLE = "MetaData_BundleAsset";
16 public const string ASSET_INSTANCE = "MetaData_InstanceAsset";
17
18 [SerializeField] private string _fileId = GUID_NOT_FOUND;
19 [SerializeField] private pb_AssetBundlePath _assetBundlePath;
20 [SerializeField] private AssetType _assetType = AssetType.Instance;
21
22 // Tags can be used to organize objects in the resource browser.
23 public string[] tags = new string[0];
24
25 // If target is a prefab, this stores a diff of component values.
27
31 public void GetObjectData(SerializationInfo info, StreamingContext context)
32 {
33 //info.AddValue("_fileId", _fileId, typeof(string));
34 //info.AddValue("_assetBundlePath", _assetBundlePath, typeof(pb_AssetBundlePath));
35 //info.AddValue("_assetType", _assetType, typeof(AssetType));
36 info.AddValue("componentDiff", componentDiff, typeof(pb_ComponentDiff));
37 }
38
42 public pb_MetaData(SerializationInfo info, StreamingContext context)
43 {
44 //_fileId = (string) info.GetValue("_fileId", typeof(string));
45 _assetBundlePath = (pb_AssetBundlePath) info.GetValue("_assetBundlePath", typeof(pb_AssetBundlePath));
46 //_assetType = (AssetType) info.GetValue("_assetType", typeof(AssetType));
47 componentDiff = (pb_ComponentDiff) info.GetValue( "componentDiff", typeof(pb_ComponentDiff));
48 }
49
53 public pb_MetaData()
54 {
55 _assetType = AssetType.Instance;
56 _fileId = GUID_NOT_FOUND;
57 _assetBundlePath = null;
58
60 }
61
65 public string fileId
66 {
67 get { return _fileId; }
68 }
69
75 {
76 get { return _assetBundlePath; }
77 }
78
83 {
84 get { return _assetType; }
85 }
86
90 public void SetAssetBundleData(string bundleName, string assetPath)
91 {
92 _fileId = ASSET_BUNDLE;
93 _assetType = AssetType.Bundle;
94 _assetBundlePath = new pb_AssetBundlePath(bundleName, assetPath);
95 }
96
100 public void SetFileId(string id)
101 {
102 _assetType = AssetType.Resource;
103 _assetBundlePath = null;
104 _fileId = id;
105 }
106 }
107}
const string ASSET_BUNDLE
Definition: pb_MetaData.cs:15
pb_ComponentDiff componentDiff
Definition: pb_MetaData.cs:26
const string GUID_NOT_FOUND
Definition: pb_MetaData.cs:14
pb_MetaData(SerializationInfo info, StreamingContext context)
Definition: pb_MetaData.cs:42
pb_AssetBundlePath assetBundlePath
Definition: pb_MetaData.cs:75
const string ASSET_INSTANCE
Definition: pb_MetaData.cs:16
void SetFileId(string id)
Definition: pb_MetaData.cs:100
void GetObjectData(SerializationInfo info, StreamingContext context)
Definition: pb_MetaData.cs:31
AssetType assetType
Definition: pb_MetaData.cs:83
void SetAssetBundleData(string bundleName, string assetPath)
Definition: pb_MetaData.cs:90
AssetType
Definition: pb_Enum.cs:69