Exemplo n.º 1
0
    private void SetType(PropType type)
    {
                #if UNITY_EDITOR
        if (Image == null)
        {
            Image = GetComponent <PropImage>();
        }

        Type            = type;
        _currentImgType = type;

        var imgName        = type.ToString().ToLower();
        var imgAssetAtPath = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Sprites/props/" + imgName + ".png");
        Image.texture = imgAssetAtPath;
        Image.enabled = true;

        if (transform.parent == null && transform.childCount > 0)
        {
            foreach (Transform t in transform)
            {
                if (t.tag == "Prop")
                {
                    t.GetComponent <ArchetypeProp>().SetType(type);
                }
            }
        }
                #endif
    }
Exemplo n.º 2
0
    internal override void Swipe_In()
    {
        base.Swipe_In();

        show_box_mesh.transform.localScale = Vector3.one;



        mPropType = TouchPlay.Instance.GetCurrentProp();
        Debug.Log("PropType : " + mPropType.ToString());
        switch (mPropType)
        {
        case PropType.PoTao:
            Current_attach_prop = new Prop_PoTao();
            break;

        case PropType.Watermeion:
            Current_attach_prop = new Prop_Watermeion();
            break;

        case PropType.Remove:
            Current_attach_prop = new Prop_Remove();
            break;

        case PropType.Inversion:
            Current_attach_prop = new Prop_Inversion();
            break;

        default:
            break;
        }
    }
Exemplo n.º 3
0
 public Prop(PropName _name)
 {
     idCount++;
     name   = _name;
     propID = idCount;
     type   = aSongUI_Controller.Instance.GetPropType(_name);
     pic    = Resources.Load <Sprite>(type.ToString() + "/" + _name.ToString());
     weight = aSongUI_Controller.Instance.GetWeight(_name);
     num    = aSongUI_Controller.Instance.GetNum(_name);
     maxNum = aSongUI_Controller.Instance.GetMaxNum(_name);
 }
Exemplo n.º 4
0
    void OnGUI()
    {
        type = (PropType)EditorGUILayout.EnumPopup("Filter:", type);
        var path = "Assets/Resources/" + type.ToString() + "/";

        DirectoryInfo dirInfo = new DirectoryInfo(path);

        FileInfo[] fileInf = dirInfo.GetFiles("*.prefab");

        List <GameObject> allGOs = new List <GameObject>();

        foreach (FileInfo fileInfo in fileInf)
        {
            string     fullPath  = fileInfo.FullName.Replace(@"\", "/");
            string     assetPath = "Assets" + fullPath.Replace(Application.dataPath, "");
            GameObject prefab    = AssetDatabase.LoadAssetAtPath(assetPath, typeof(GameObject)) as GameObject;
            allGOs.Add(prefab);
        }


        if (allGOs.Any())
        {
            int i = 0;
            int rowNum;

            foreach (var prop in allGOs)
            {
                EditorGUILayout.BeginHorizontal();
                var preview = AssetPreview.GetAssetPreview(prop);
                if (GUILayout.Button(preview, GUILayout.Width(50), GUILayout.Height(50)))
                {
                    Selection.activeObject = GameObject.Instantiate(prop);
                }
            }
        }
    }
        public static Type TypeFromPropType(PropType propertyType, bool extractItemTypeInArray)
        {
            if (extractItemTypeInArray)
            {
                propertyType &= (PropType)(-12289);
            }
            PropType propType = propertyType;

            if (propType <= PropType.Binary)
            {
                if (propType <= PropType.String)
                {
                    switch (propType)
                    {
                    case PropType.Unspecified:
                        return(typeof(object));

                    case PropType.Null:
                        return(typeof(object));

                    case PropType.Short:
                        return(typeof(short));

                    case PropType.Int:
                        return(typeof(int));

                    case PropType.Float:
                        return(typeof(float));

                    case PropType.Double:
                        return(typeof(double));

                    case PropType.Currency:
                        return(typeof(long));

                    case PropType.AppTime:
                        return(typeof(double));

                    case (PropType)8:
                    case (PropType)9:
                    case (PropType)12:
                    case (PropType)14:
                    case (PropType)15:
                    case (PropType)16:
                    case (PropType)17:
                    case (PropType)18:
                    case (PropType)19:
                        break;

                    case PropType.Error:
                        return(typeof(int));

                    case PropType.Boolean:
                        return(typeof(bool));

                    case PropType.Object:
                        return(typeof(IntPtr));

                    case PropType.Long:
                        return(typeof(long));

                    default:
                        switch (propType)
                        {
                        case PropType.AnsiString:
                            return(typeof(string));

                        case PropType.String:
                            return(typeof(string));
                        }
                        break;
                    }
                }
                else
                {
                    if (propType == PropType.SysTime)
                    {
                        return(typeof(DateTime));
                    }
                    if (propType == PropType.Guid)
                    {
                        return(typeof(Guid));
                    }
                    if (propType == PropType.Binary)
                    {
                        return(typeof(byte[]));
                    }
                }
            }
            else if (propType <= PropType.StringArray)
            {
                switch (propType)
                {
                case PropType.ShortArray:
                    return(typeof(short[]));

                case PropType.IntArray:
                    return(typeof(int[]));

                case PropType.FloatArray:
                    return(typeof(float[]));

                case PropType.DoubleArray:
                    return(typeof(double[]));

                case PropType.CurrencyArray:
                    return(typeof(long[]));

                case PropType.AppTimeArray:
                    return(typeof(double[]));

                case (PropType)4104:
                case (PropType)4105:
                case (PropType)4106:
                case (PropType)4107:
                case (PropType)4108:
                    break;

                case PropType.ObjectArray:
                    return(typeof(object));

                default:
                    if (propType == PropType.LongArray)
                    {
                        return(typeof(long[]));
                    }
                    switch (propType)
                    {
                    case PropType.AnsiStringArray:
                        return(typeof(string[]));

                    case PropType.StringArray:
                        return(typeof(string[]));
                    }
                    break;
                }
            }
            else
            {
                if (propType == PropType.SysTimeArray)
                {
                    return(typeof(DateTime[]));
                }
                if (propType == PropType.GuidArray)
                {
                    return(typeof(Guid[]));
                }
                if (propType == PropType.BinaryArray)
                {
                    return(typeof(byte[][]));
                }
            }
            throw new NotSupportedException(Strings.ExceptionNoIdeaConvertPropType(propertyType.ToString()));
        }
        protected static void OnFailedPropertyTypeCheck(object key, PropType type, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, out bool createNewDefinition)
        {
            switch (typeCheckingFlag)
            {
            case NativeStorePropertyDefinition.TypeCheckingFlag.DoNotCreateInvalidType:
            case NativeStorePropertyDefinition.TypeCheckingFlag.AllowCompatibleType:
                createNewDefinition = false;
                return;

            case NativeStorePropertyDefinition.TypeCheckingFlag.DisableTypeCheck:
                createNewDefinition = true;
                return;
            }
            throw new InvalidPropertyTypeException(ServerStrings.ExInvalidPropertyType(key.ToString(), type.ToString()));
        }
Exemplo n.º 7
0
        public static object GetValue(object initialValue, PropType type)
        {
            object finalValue = null;

            switch (type)
            {
            case PropType.StringType:
                finalValue = TypeUtils.GetStringValue(initialValue);
                break;

            case PropType.IntType:
                finalValue = TypeUtils.GetIntValue(initialValue);
                break;

            case PropType.LongType:
                finalValue = TypeUtils.GetLongValue(initialValue);
                break;

            case PropType.DoubleType:
                finalValue = TypeUtils.GetDoubleValue(initialValue);
                break;

            case PropType.DateType:
                finalValue = TypeUtils.GetDateTimeValue(initialValue);
                break;

            case PropType.BoolType:
                finalValue = TypeUtils.GetBoolValue(initialValue);
                break;

            default:
                throw new ApplicationException("Unrecognized property type in SetValue:" + type.ToString());
            }

            return(finalValue);
        }