public static AssetBundleServerInfo GetValue(SerializedProperty property)
        {
            AssetBundleServerInfo serverInfo = new AssetBundleServerInfo();

            serverInfo.Platform   = (Platform)property.FindPropertyRelative("Platform").intValue;
            serverInfo.ServerType = (AssetBundleServerType)property.FindPropertyRelative("ServerType").intValue;
            serverInfo.Url        = property.FindPropertyRelative("Url").stringValue;
            return(serverInfo);
        }
        public static void PlatformDropDown(Rect rect, List <AssetBundleServerInfo> list, AssetBundleServerType serverType, System.Action <AssetBundleServerInfo> block)
        {
            Platform[] allPlatforms;
            allPlatforms = (
                PlatformUtil
                .AllPlatforms
                .ToArray()
                );

            Platform[] existingPlatforms;
            existingPlatforms = (
                list
                .Where(value => value.ServerType.Equals(serverType))
                .Select(value => value.Platform)
                .ToArray()
                );

            GenericMenu menu;

            menu = new GenericMenu();

            for (int index = 0; index < allPlatforms.Length; index++)
            {
                Platform platform;
                platform = allPlatforms[index];

                GenericMenu.MenuFunction callback;
                callback = () => {
                    AssetBundleServerInfo value;
                    value            = new AssetBundleServerInfo();
                    value.Platform   = platform;
                    value.ServerType = serverType;

                    block(value);
                };

                GUIContent content;
                content = new GUIContent(GetPlaformName(platform));

                if (System.Array.IndexOf(existingPlatforms, platform) != -1)
                {
                    menu.AddDisabledItem(content);
                }
                else
                {
                    menu.AddItem(content, false, callback);
                }
            }

            menu.DropDown(rect);
        }
        public static List <AssetBundleServerInfo> NormalizeList(List <AssetBundleServerInfo> list)
        {
            List <AssetBundleServerInfo> normalized = list.GetRange(0, list.Count);

            AssetBundleServerType[] serverTypes = (
                System.Enum.GetValues(typeof(AssetBundleServerType))
                .OfType <AssetBundleServerType>()
                .Where(serverType => serverType != AssetBundleServerType.Unknown)
                .ToArray()
                );

            foreach (AssetBundleServerType serverType in serverTypes)
            {
                if (normalized.Where(info => info.ServerType.Equals(serverType) && info.Platform.Equals(Platform.Unknown)).Count() == 0)
                {
                    AssetBundleServerInfo value = new AssetBundleServerInfo();
                    value.Platform   = Platform.Unknown;
                    value.ServerType = serverType;
                    normalized.Add(value);
                }
            }

            return(normalized);
        }
 public static void SetValue(SerializedProperty property, AssetBundleServerInfo serverInfo)
 {
     property.FindPropertyRelative("Platform").intValue   = (int)serverInfo.Platform;
     property.FindPropertyRelative("ServerType").intValue = (int)serverInfo.ServerType;
     property.FindPropertyRelative("Url").stringValue     = serverInfo.Url;
 }