コード例 #1
0
        public override void OnDeserialization()
        {
            popupLabel = "Replace Another Property";
            typeHash   = new Dictionary <Type, ReplaceItem>();

            if (objID == null)
            {
                objID = new ObjectID();
            }
            objID.OnDeserialization();
            if (searchProperty == null)
            {
                searchProperty = new PropertyPopupData();
            }
            searchProperty.label = "Property:";

            searchProperty.SetType(objID.obj);
            initializationContext = new InitializationContext(searchProperty.fieldData, objID.obj);
            initSubItem <ReplaceItemString>(new List <Type>()
            {
                typeof(string)
            }, ref replaceItemString);
            initSubItem <ReplaceItemFloat>(new List <Type>()
            {
                typeof(float)
            }, ref replaceItemFloat);
            initSubItem <ReplaceItemObject>(new List <Type>()
            {
                typeof(UnityEngine.Object)
            }, ref replaceItemObject);
            initSubItem <ReplaceItemInt>(new List <Type>()
            {
                typeof(int), typeof(uint), typeof(short), typeof(ushort), typeof(byte), typeof(sbyte),
            }, ref replaceItemInt);
            initSubItem <ReplaceItemDouble>(new List <Type>()
            {
                typeof(double)
            }, ref replaceItemDouble);
            initSubItem <ReplaceItemBool>(new List <Type>()
            {
                typeof(bool)
            }, ref replaceItemBool);
            initSubItem <ReplaceItemChar>(new List <Type>()
            {
                typeof(char)
            }, ref replaceItemChar);
            initSubItem <ReplaceItemVector2>(new List <Type>()
            {
                typeof(Vector2)
            }, ref replaceItemVector2);
            initSubItem <ReplaceItemVector3>(new List <Type>()
            {
                typeof(Vector3)
            }, ref replaceItemVector3);
            initSubItem <ReplaceItemVector4>(new List <Type>()
            {
                typeof(Vector4)
            }, ref replaceItemVector4);
            initSubItem <ReplaceItemRect>(new List <Type>()
            {
                typeof(Rect)
            }, ref replaceItemRect);
            initSubItem <ReplaceItemColor>(new List <Type>()
            {
                typeof(Color), typeof(Color32)
            }, ref replaceItemColor);
            initSubItem <ReplaceItemQuaternion>(new List <Type>()
            {
                typeof(Quaternion)
            }, ref replaceItemQuaternion);
            initSubItem <ReplaceItemEnum>(new List <Type>()
            {
                typeof(Enum)
            }, ref replaceItemEnum);

            type = null;
            if (objID.obj != null)
            {
                setType(initializationContext.fieldData.fieldType);
            }
        }
コード例 #2
0
 public override void OnSelect(InitializationContext ic)
 {
     base.OnSelect(ic);
     isSearchByName = ic.fieldData.displayName.ToLowerInvariant().Contains("specific");
 }