Ejemplo n.º 1
0
        /// <summary>
        /// 新增配置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFileName.Text.Trim()))
            {
                MessageBox.Show("请输入配置文件名称");
                txtFileName.Focus();
                return;
            }

            AssetsConfig config = new AssetsConfig();

            config.FileName = txtFileName.Text.Trim();
            if (!string.IsNullOrEmpty(txtKeys.Text.Trim()))
            {
                config.Keys = txtKeys.Text.Trim();
            }

            if (mConfigLst == null)
            {
                mConfigLst = new List <AssetsConfig>();
            }
            mConfigLst.Add(config);

            refreshRow();
            ConfigUtils.SaveUserConfig(mConfigLst);

            txtFileName.Text = "";
            txtKeys.Text     = "";
        }
Ejemplo n.º 2
0
        public void OnEnable()
        {
            envCube            = FindProperty(x => x.envCube);
            skyMat             = FindProperty(x => x.SkyBoxMat);
            hdrScale           = FindProperty(x => x.hdrScale);
            hdrPow             = FindProperty(x => x.hdrPow);
            hdrAlpha           = FindProperty(x => x.hdrAlpha);
            iblLevel           = FindProperty(x => x.iblLevel);
            iblLevel.intValue  = 1;
            lightmapShadowMask = FindParameter(x => x.lightmapShadowMask);
            shadowIntensity    = FindParameter(x => x.shadowIntensity);
            fogEnable          = FindProperty(x => x.fogEnable);

            roleLight0 = FindProperty(x => x.roleLight0);
            roleLight1 = FindProperty(x => x.roleLight1);

            shadowMapLevel    = FindProperty(x => x.shadowMapLevel);
            shadowBound       = FindProperty(x => x.shadowBound);
            lookTarget        = FindProperty(x => x.lookTarget);
            drawShadowLighing = FindProperty(x => x.drawShadowLighing);
            showObjects       = FindProperty(x => x.showObjects);
            debugMode         = FindProperty(x => x.debugContext.debugMode);
            debugDisplayType  = FindProperty(x => x.debugContext.debugDisplayType);
            splitAngle        = FindParameter(x => x.debugContext.splitAngle);
            splitPos          = FindProperty(x => x.debugContext.splitPos);

            AssetsConfig.RefreshShaderDebugNames();
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            AssetsConfig ac = target as AssetsConfig;

            if (ac != null)
            {
                ConstValuesGUI(ac);
                TextureProcessGUI(ac);
                ShaderGroupGUI(ac);
                AssetsConfig.GetGroupedShaderFeatureList(groupedShaderFeatures);
                ShaderFeatureGUI(ac);
                ShaderInfoGUI(ac);
                OnEventProcessGUI(ac);
            }
            serializedObject.ApplyModifiedProperties();
            switch (opType)
            {
            case OpType.OpGenMat:
                GenMat();
                break;

            case OpType.OpRefreshMat:
                RefreshMat();
                break;
            }
            opType = OpType.None;
        }
Ejemplo n.º 4
0
        private void OnEventProcessGUI(AssetsConfig ac)
        {
            var e = Event.current;

            if (e.type == EventType.MouseDown)
            {
                if (DragEffect(ref groupRect, e, 0, ac.ShaderGroupInfo.Count))
                {
                    dragName = ac.ShaderGroupInfo[dragIndex];
                }
                else if (DragEffect(ref shaderFeatureRect, e, 1, ac.ShaderFeatures))
                {
                }
                else if (DragEffect(ref dummyMaterialsRect, e, 2, ac.roleMaterials))
                {
                }
                Repaint();
            }
            else if (e.type == EventType.MouseDrag)
            {
                if (dragType >= 0)
                {
                    Repaint();
                }
            }
            else if (e.type == EventType.MouseUp)
            {
                int lastDragIndex = dragIndex;
                if (dragType == 0)
                {
                    if (DragEffect(ref groupRect, e, 0, ac.ShaderGroupInfo.Count) && lastDragIndex != dragIndex)
                    {
                        bool insertUp = CalcDragIndex(ref groupRect, e, ac.ShaderGroupInfo.Count);
                        ReRange(ac.ShaderGroupInfo, insertUp, dragName, dragIndex, lastDragIndex);
                    }
                }
                else if (dragType == 1)
                {
                    DragEffectEnd(ref shaderFeatureRect, e, ac.ShaderFeatures, lastDragIndex);
                }
                else if (dragType == 2)
                {
                    DragEffectEnd(ref dummyMaterialsRect, e, ac.roleMaterials, lastDragIndex);
                }
                dragType  = -1;
                dragName  = "";
                dragIndex = -1;
                Repaint();
            }
            if (e.type == EventType.Repaint)
            {
                if (dragType >= 0)
                {
                    Handles.Label(e.mousePosition, dragName);
                }
            }
        }
Ejemplo n.º 5
0
        public CustomLevelLoader(string path)
        {
            AssetsConfig config = new AssetsConfig()
            {
                RootFileProvider = new BundleFileProvider(path, false),
                AssetsPath       = path.GetDirectoryFwdSlash()
            };

            Engine = new AssetsEngine(config, "NONE");
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            string bundleFile;

            if (args.Length == 2)
            {
                bundleFile = args[1];
            }
            else
            {
                Console.WriteLine("Enter the path to your unity3d file or drag and drop your unity3d file into this window and press enter...");
                Console.WriteLine("THIS PATH MUST HAVE NO SPACES!");
                bundleFile = Console.ReadLine();
            }
            bundleFile = bundleFile.Replace("\"", "");
            try
            {
                AssetsConfig config = new AssetsConfig()
                {
                    RootFileProvider = new BundleFileProvider(bundleFile, false),
                    AssetsPath       = bundleFile.GetDirectoryFwdSlash()
                };
                Engine = new AssetsEngine(config, "NONE");
                Console.WriteLine("Press (1) for dumps (2) for parse");
                Console.WriteLine("Dumps will be created in: dumps/ and raws/");
                var key = Console.ReadKey();
                switch (key.KeyChar)
                {
                case '1':
                    DumpKnowns();
                    break;

                case '2':
                    LoadDumps();
                    Engine.Save();
                    break;

                default:
                    throw new InvalidOperationException("Must press either 1 or 2!");
                }
            } catch (Exception e)
            {
                Console.Write(e);
            } finally
            {
                Console.WriteLine("\nPress enter to close...");
                Console.ReadLine();
            }
        }
Ejemplo n.º 7
0
        public static AssetsConfig SelectAssetUniqueCaptions(Guid organizationId, int DepartmentId)
        {
            DataRow      drAssetConfig = SelectRecord("sp_SelectAssetUniqueCaptions", new SqlParameter[] { new SqlParameter("@DepartmentId", DepartmentId) }, organizationId);
            AssetsConfig assetsConfig;

            if (drAssetConfig != null)
            {
                assetsConfig = new AssetsConfig(drAssetConfig["AssetsUnique1Caption"].ToString(), drAssetConfig["AssetsUnique2Caption"].ToString(), drAssetConfig["AssetsUnique3Caption"].ToString(), drAssetConfig["AssetsUnique4Caption"].ToString(), drAssetConfig["AssetsUnique5Caption"].ToString(), drAssetConfig["AssetsUnique6Caption"].ToString(), drAssetConfig["AssetsUnique7Caption"].ToString());
            }
            else
            {
                assetsConfig = new AssetsConfig();
            }
            return(assetsConfig);
        }
Ejemplo n.º 8
0
 private void ConstValuesGUI(AssetsConfig ac)
 {
     ac.commonFolder = EditorGUILayout.Foldout(ac.commonFolder, "Const");
     if (ac.commonFolder)
     {
         if (constPropertyList != null)
         {
             for (int i = 0; i < constPropertyList.Count; ++i)
             {
                 SerializedProperty sp = constPropertyList[i];
                 EditorGUI.BeginChangeCheck();
                 var str = EditorGUILayout.TextField(sp.displayName, sp.stringValue);
                 if (EditorGUI.EndChangeCheck())
                 {
                     Undo.RecordObject(target, sp.name);
                     sp.stringValue = str;
                 }
             }
         }
         if (constListPropertyList != null)
         {
             for (int i = 0; i < constListPropertyList.Count; ++i)
             {
                 SerializedProperty sp = constListPropertyList[i];
                 EditorGUILayout.PropertyField(sp, true);
             }
         }
         if (commonPropertyList != null)
         {
             for (int i = 0; i < commonPropertyList.Count; ++i)
             {
                 SerializedProperty sp = commonPropertyList[i];
                 EditorGUILayout.PropertyField(sp, true);
             }
         }
     }
 }
Ejemplo n.º 9
0
        public static string GetAssetsByFilterSQLQuery(Guid organizationId, int departmentId, ref Filter filter, ref ColumnsSetting colsetting, bool isRealDates, bool isForExport, string customSort, string customGroupSort, int? UserId, Config cfg, bool? Active)
        {
            string sqlQuery = "";

            string _sql = string.Empty;
            string _static_order = string.Empty;
            string _having = string.Empty;
            string _groupby = string.Empty;
            int _custom_property_count = 0;
            string _select_list = string.Empty;

            AssetsConfig assetsConfig;
            if (filter != null && !string.IsNullOrEmpty(filter.SerialNumber))
                assetsConfig = Companies.SelectAssetUniqueCaptions(organizationId, departmentId);
            else
                assetsConfig = new AssetsConfig();

            bool accountManager = true;
            if (cfg != null && !cfg.AccountManager)
            {
                accountManager = false;
            }

            string default_sort = String.Empty;
            if (!isForExport)
            {
                if (filter == null) _sql += "SELECT TOP 0 ";
                else _sql += "SELECT ";

                _select_list = "Assets.Id, ";

                _select_list += " Assets.CategoryId as AssetCategoryId, AssetCategories.Name as AssetCategoryName, ";
                _select_list += " Assets.TypeId as AssetTypeId, AssetTypes.Name as AssetTypeName, ";
                _select_list += " Assets.MakeId as AssetMakeId, AssetMakes.Make as AssetMakeName, ";
                _select_list += " Assets.ModelId as AssetModelId, AssetModels.Model as AssetModelName, ";
                _select_list += " Assets.AccountId as AccountId, ";
                if (accountManager)
                {
                    _select_list += " ISNULL(Accounts.vchName,'(Internal)') AccountName, ";
                }
                _select_list += " Assets.AssetGUID, Assets.SerialNumber, Assets.Unique1, Assets.Unique2, Assets.Unique3, Assets.Unique4, Assets.Unique5, Assets.Unique6, Assets.Unique7, CASE WHEN LEN(Assets.SerialNumber)>0 THEN Assets.SerialNumber END AS AssetIdentifyCode, ";

                if (colsetting != null)
                {
                    string _sql_custom = string.Empty;

                    _sql_custom += GetColumnName(departmentId, ColumnTypeInfo.Table, colsetting.Column1, true, isRealDates);
                    _sql_custom += GetColumnName(departmentId, ColumnTypeInfo.Table, colsetting.Column2, true, isRealDates);
                    _sql_custom += GetColumnName(departmentId, ColumnTypeInfo.Table, colsetting.Column3, true, isRealDates);
                    _sql_custom += GetColumnName(departmentId, ColumnTypeInfo.Table, colsetting.Column4, true, isRealDates);
                    _sql_custom += GetColumnName(departmentId, ColumnTypeInfo.Table, colsetting.Column5, true, isRealDates);
                    _sql_custom += GetColumnName(departmentId, ColumnTypeInfo.Table, colsetting.Column6, true, isRealDates);
                    _sql_custom += GetColumnName(departmentId, ColumnTypeInfo.Table, colsetting.Column7, true, isRealDates);
                    _sql_custom += GetColumnName(departmentId, ColumnTypeInfo.Table, colsetting.Column8, true, isRealDates);

                    _select_list += _sql_custom;
                }

                _select_list += " dbo.fxGetUserName(lo_checkout.FirstName, lo_checkout.LastName, lo_checkout.Email) as CheckoutName, AssetStatus.vchStatus as StatusName, Assets.dtUpdated AS UpdatedDate, dbo.fxGetUserName2(lo_updated.FirstName, lo_updated.LastName, lo_updated.Email) AS UpdatedByName";

                _static_order = " ORDER BY ";

                if (String.IsNullOrEmpty(customGroupSort))
                {
                    bool FirstOrder = true;
                    string[] DefGroupSort = new string[] { "AssetCategoryName", "AssetTypeName", "AssetMakeName", "AssetModelName" };
                    foreach (string s in DefGroupSort)
                    {
                        if (!customSort.Contains(s))
                        {
                            default_sort += (FirstOrder ? "" : ",") + s;
                            FirstOrder = false;
                        }
                    }
                }
            }
            else
            {
                _sql += "SELECT ";
                _select_list += " 0 as GroupId, 0 as AssetId, (CASE WHEN EXISTS(select TOP 1 * from AssetTypeProperties where AssetTypeProperties.DId=Assets.DepartmentId and AssetTypeProperties.AssetTypeId=Assets.TypeId) THEN 1 ELSE 0 END) AS IsHaveCustomPropertiesId, Assets.DepartmentId, Assets.Id, ";
                _select_list += " Assets.CategoryId as AssetCategoryId, AssetCategories.Name as AssetCategoryName, ";
                _select_list += " Assets.TypeId as AssetTypeId, AssetTypes.Name as AssetTypeName, ";
                _select_list += " Assets.MakeId as AssetMakeId, AssetMakes.Make as AssetMakeName, ";
                _select_list += " Assets.ModelId as AssetModelId, AssetModels.Model as AssetModelName, ";
                _select_list += " Assets.AssetGUID, Assets.SerialNumber, Assets.Unique1, Assets.Unique2, Assets.Unique3, Assets.Unique4, Assets.Unique5, Assets.Unique6, Assets.Unique7, Assets.StatusID as StatusId, AssetStatus.vchStatus as StatusName, ";
                _select_list += " Assets.Name as AssetName, Assets.Description as AssetDescription";
                _select_list += ", Assets.AccountId as AccountId";
                if (accountManager)
                {
                    _select_list += ", ISNULL(Accounts.vchName,'(Internal)') AccountName";
                }
                _select_list += ", Assets.LocationId as LocationId, dbo.fxGetUserLocationName(" + departmentId.ToString() + ", Assets.LocationId) as LocationName";
                _select_list += ", Assets.OwnerId as OwnerId, lo_owner.FirstName as OwnerFirstName, lo_owner.LastName as OwnerLastName, lo_owner.EMail as OwnerMail, Assets.CheckedOutId as CheckedOutId, lo_checkout.FirstName as CheckedOutFirstName, lo_checkout.LastName as CheckedOutLastName, lo_checkout.EMail as CheckoutMail, Assets.VendorID as VendorId, Vendors.Name as VendorName, Assets.WarrantyVendor as WarrantyVendorId, WarrantyVendors.Name as WarrantyVendorName, Assets.PONumber, Assets.DateAquired, Assets.DateDeployed, Assets.DateDisposed, Assets.DateEntered, Assets.DateOutOfService, Assets.DatePurchased, Assets.DateReceived, Assets.LaborWarrantyLength, Assets.PartsWarrantyLength, Assets.Value, Assets.ValueCurrent, Assets.ValueDepreciated, Assets.ValueReplacement, Assets.ValueSalvage, Assets.DisposalCost, Assets.AssetSort, Assets.FundingCode, Assets.FundingSource, CONVERT(nvarchar(4000), Assets.Notes) as Notes, Assets.dtUpdated AS UpdatedDate, dbo.fxGetUserName2(lo_updated.FirstName, lo_updated.LastName, lo_updated.Email) AS UpdatedByName ";

                _static_order = " ORDER BY IsHaveCustomPropertiesId asc, AssetCategories.Name asc, AssetTypes.Name asc, AssetMakes.Make asc, AssetModels.Model asc ";
            };

            if (colsetting != null)
            {
                string _dynamic_order = "";

                string _sort_1 = GetColumnName(departmentId, ColumnTypeInfo.Field, colsetting.SortColumn1, false, isRealDates);
                string _sort_2 = GetColumnName(departmentId, ColumnTypeInfo.Field, colsetting.SortColumn2, false, isRealDates);
                string _sort_3 = GetColumnName(departmentId, ColumnTypeInfo.Field, colsetting.SortColumn3, false, isRealDates);

                if (_sort_1.Length > 0 && (String.IsNullOrEmpty(customGroupSort) || _sort_1.ToLower() != customGroupSort.ToLower()))
                {
                    if (colsetting.SortColumnDesc1)
                        _dynamic_order = _dynamic_order + _sort_1 + " DESC";
                    else
                        _dynamic_order = _dynamic_order + _sort_1 + " ASC";
                }

                if (_sort_2.Length > 0 && (String.IsNullOrEmpty(customGroupSort) || _sort_2.ToLower() != customGroupSort.ToLower()))
                {
                    if (_dynamic_order.Length > 0)
                        _dynamic_order += ",";

                    if (colsetting.SortColumnDesc2)
                        _dynamic_order = _dynamic_order + _sort_2 + " DESC";
                    else
                        _dynamic_order = _dynamic_order + _sort_2 + " ASC";
                }

                if (_sort_3.Length > 0 && (String.IsNullOrEmpty(customGroupSort) || _sort_3.ToLower() != customGroupSort.ToLower()))
                {
                    if (_dynamic_order.Length > 0)
                        _dynamic_order += ",";

                    if (colsetting.SortColumnDesc3)
                        _dynamic_order = _dynamic_order + _sort_3 + " DESC";
                    else
                        _dynamic_order = _dynamic_order + _sort_3 + " ASC";
                }

                if (!isForExport)
                {
                    if (!String.IsNullOrEmpty(customGroupSort))
                        _static_order += customGroupSort;

                    if (!String.IsNullOrEmpty(customSort) && (String.IsNullOrEmpty(customGroupSort) || customGroupSort.ToLower() != customSort.ToLower()))
                        _static_order +=  (!String.IsNullOrEmpty(customGroupSort) ? ", " : String.Empty) + customSort;
                    else if (!String.IsNullOrEmpty(_dynamic_order))
                        _static_order += (!String.IsNullOrEmpty(customGroupSort) ? ", " : String.Empty) + _dynamic_order;
                    else if (!String.IsNullOrEmpty(default_sort))
                        _static_order += (!String.IsNullOrEmpty(customGroupSort) ? ", " : String.Empty) + default_sort;
                }
            }

            _sql += _select_list;

            _sql += " FROM Assets ";
            _sql = _sql + " INNER JOIN AssetCategories ON AssetCategories.DepartmentId=" + departmentId.ToString() + " and Assets.CategoryId = AssetCategories.Id ";
            _sql = _sql + " INNER JOIN AssetTypes ON AssetTypes.DepartmentId=" + departmentId.ToString() + " and Assets.TypeId = AssetTypes.Id ";
            _sql = _sql + " INNER JOIN AssetMakes ON AssetMakes.DepartmentId=" + departmentId.ToString() + " and Assets.MakeId = AssetMakes.Id ";
            _sql = _sql + " INNER JOIN AssetModels ON AssetModels.DepartmentId=" + departmentId.ToString() + " and Assets.ModelId = AssetModels.Id ";
            _sql = _sql + " INNER JOIN AssetStatus ON (AssetStatus.DId is NULL OR AssetStatus.DId=" + departmentId.ToString() + ") and Assets.StatusId = AssetStatus.Id ";//now statuses use for all departments
            _sql = _sql + " LEFT OUTER JOIN Accounts ON Accounts.DId=" + departmentId.ToString() + " and Assets.AccountId = Accounts.Id ";
            _sql = _sql + " LEFT OUTER JOIN Locations ON Locations.DId=" + departmentId.ToString() + " and Assets.LocationId = Locations.Id ";
            _sql = _sql + " LEFT OUTER JOIN tbl_vendors Vendors ON Vendors.company_id=" + departmentId.ToString() + " and Assets.VendorId = Vendors.Id ";
            _sql = _sql + " LEFT OUTER JOIN tbl_vendors WarrantyVendors ON WarrantyVendors.company_id=" + departmentId.ToString() + " and Assets.WarrantyVendor = WarrantyVendors.Id ";
            _sql = _sql + " LEFT OUTER JOIN tbl_LoginCompanyJunc tlj_owner ON tlj_owner.company_id=" + departmentId.ToString() + " and Assets.OwnerId=tlj_owner.id LEFT OUTER JOIN tbl_Logins lo_owner ON lo_owner.id=tlj_owner.login_id ";
            _sql = _sql + " LEFT OUTER JOIN tbl_LoginCompanyJunc tlj_checkout ON tlj_checkout.company_id=" + departmentId.ToString() + " and Assets.CheckedOutId=tlj_checkout.id LEFT OUTER JOIN tbl_Logins lo_checkout ON lo_checkout.id=tlj_checkout.login_id ";
            _sql = _sql + " LEFT OUTER JOIN tbl_LoginCompanyJunc tlj_updated ON tlj_updated.company_id=" + departmentId.ToString() + " and Assets.intUpdatedBy=tlj_updated.id LEFT OUTER JOIN tbl_Logins lo_updated ON lo_updated.id=tlj_updated.login_id ";
            _sql = _sql + " LEFT OUTER JOIN AssetStatusCompany ON AssetStatusCompany.DId=" + departmentId.ToString() + " and AssetStatusCompany.AssetStatusID=Assets.StatusId ";

            if (filter == null)
            {
                string _DefWhere = " WHERE Assets.StatusId<>17 AND Assets.DepartmentId=" + departmentId.ToString();

                if (Active == true) _DefWhere += " AND (AssetStatusCompany.NonActive=0 OR (AssetStatusCompany.NonActive IS NULL)) ";
                else if (Active == false) _DefWhere += " AND AssetStatusCompany.NonActive=1 ";

                return _sql + _DefWhere + _static_order;
            }

            string DeptCriteria = "Assets.DepartmentId = " + departmentId.ToString();
            string AssetStatusCriteria = String.Empty;
            if (filter.StatusID > 0)
                AssetStatusCriteria = " AND Assets.StatusID=" + filter.StatusID.ToString();
            else if (filter.StatusID == 0)
            {
                AssetStatusCriteria = " AND Assets.StatusId<>17";
                if (Active == true)
                    AssetStatusCriteria += " AND (AssetStatusCompany.NonActive=0 OR (AssetStatusCompany.NonActive IS NULL)) ";
                else if (Active == false)
                    AssetStatusCriteria += " AND AssetStatusCompany.NonActive=1 ";
            }
            else if (filter.StatusID == -1)
                AssetStatusCriteria = " AND Assets.StatusId<>17"; // All except deleted
            else if (filter.StatusID == -2)
                AssetStatusCriteria = String.Empty; // All + deleted
            else if (filter.StatusID == -3)
                AssetStatusCriteria = " AND Assets.StatusId<>17 AND (AssetStatusCompany.NonActive=0 OR (AssetStatusCompany.NonActive IS NULL))"; // All Active statuses
            else if (filter.StatusID == -4)
                AssetStatusCriteria = " AND Assets.StatusId<>17 AND AssetStatusCompany.NonActive=1 ";

            string _where = " WHERE " + DeptCriteria + AssetStatusCriteria;

            if (filter.CategoryID != 0) _where += " AND Assets.CategoryID=" + filter.CategoryID.ToString();
            if (filter.TypeID != 0) _where += " AND Assets.TypeID=" + filter.TypeID.ToString();
            if (filter.MakeID != 0) _where += " AND Assets.MakeID=" + filter.MakeID.ToString();
            if (filter.ModelID != 0) _where += " AND Assets.ModelID=" + filter.ModelID.ToString();

            //Check Global Filters
            if (UserId != null && cfg != null)
            {
                GlobalFilters _gf = new GlobalFilters(organizationId, departmentId, (int)UserId);
                string _gfAccWhere = string.Empty;
                if (cfg.AccountManager && _gf.IsFilterEnabled(GlobalFilters.FilterState.EnabledGlobalFilters) && _gf.IsFilterEnabled(GlobalFilters.FilterType.Accounts))
                {
                    string _strAcc = GlobalFilters.SelectFilterByTypeToString(organizationId, departmentId, (int)UserId, GlobalFilters.FilterType.Accounts);
                    if (_strAcc.Length > 0)
                        _gfAccWhere = " ISNULL(Assets.AccountId, -1) IN (" + _strAcc + ")";
                }
                string _gfLocWhere = string.Empty;
                if (cfg.LocationTracking && _gf.IsFilterEnabled(GlobalFilters.FilterState.EnabledGlobalFilters) && _gf.IsFilterEnabled(GlobalFilters.FilterType.Locations))
                {
                    string _strLoc = GlobalFilters.SelectFilterByTypeToString(organizationId, departmentId, (int)UserId, GlobalFilters.FilterType.Locations);
                    if (_strLoc.Length > 0)
                        _gfLocWhere = " Assets.LocationID IN (SELECT Id FROM dbo.fxGetAllChildLocationsFromList(" + departmentId.ToString() + ", '" + _strLoc + "'))";
                    else
                        _gfLocWhere = " Assets.LocationID IS NULL";
                }

                if (!String.IsNullOrEmpty(_gfAccWhere))
                     _where += " AND " + _gfAccWhere;
                if (!String.IsNullOrEmpty(_gfLocWhere))
                     _where += " AND " + _gfLocWhere;
            }

            if (filter.AccountID != 0)
            {
                if ((filter.AccountID == -1) || (filter.AccountID == int.MinValue))
                    _where += " AND Assets.AccountId IS NULL";
                else
                    _where += " AND Assets.AccountId = " + filter.AccountID.ToString();
            }

            if (!string.IsNullOrEmpty(filter.CustomWhere)) _where += " AND (" + filter.CustomWhere + ")";

            int CurLocationID = filter.LocationID;
            if (CurLocationID > 0) _where += " AND Assets.LocationID IN (SELECT Id FROM dbo.fxGetAllChildLocations(" + departmentId.ToString() + ", " + CurLocationID.ToString() + "))";
            else if (CurLocationID == int.MinValue) _where += " AND Assets.LocationID IS NULL";
            else if (CurLocationID < 0)
            {
                CurLocationID = (-1) * CurLocationID;
                _where += " AND ((Assets.LocationID IN (SELECT Id FROM dbo.fxGetAllChildLocations(" + departmentId.ToString() + ", " + CurLocationID.ToString() + "))) OR Assets.LocationID IS NULL)";
            }
            if (filter.OwnerID > 0) _where += " AND Assets.OwnerID=" + filter.OwnerID.ToString();
            else if (filter.OwnerID == int.MinValue) _where += " AND Assets.OwnerID IS NULL";
            if (filter.CheckedOutID > 0) _where += " AND Assets.CheckedOutID=" + filter.CheckedOutID.ToString();
            else if (filter.CheckedOutID == int.MinValue) _where += " AND Assets.CheckedOutID IS NULL";
            if (filter.VendorID > 0) _where += " AND Assets.VendorID=" + filter.VendorID.ToString();
            else if ((filter.VendorID == int.MinValue) || (filter.VendorID == -1)) _where += " AND Assets.VendorID IS NULL";
            if (filter.WarrantyVendorID > 0) _where += " AND Assets.WarrantyVendor=" + filter.WarrantyVendorID.ToString();
            else if ((filter.WarrantyVendorID == int.MinValue) || (filter.WarrantyVendorID == -1)) _where += " AND Assets.WarrantyVendor IS NULL";
            // #1 Serial Number
            string CurValue = filter.SerialNumber;
            if (CurValue.Length > 0)
            {
                _where += " AND ( " + GetWildcardSearch("Assets.SerialNumber", CurValue, false);

                if (!string.IsNullOrEmpty(assetsConfig.Unique1Caption))
                    _where += " OR " + GetWildcardSearch("Assets.Unique1", CurValue, false);
                if (!string.IsNullOrEmpty(assetsConfig.Unique2Caption))
                    _where += " OR " + GetWildcardSearch("Assets.Unique2", CurValue, false);
                if (!string.IsNullOrEmpty(assetsConfig.Unique3Caption))
                    _where += " OR " + GetWildcardSearch("Assets.Unique3", CurValue, false);
                if (!string.IsNullOrEmpty(assetsConfig.Unique4Caption))
                    _where += " OR " + GetWildcardSearch("Assets.Unique4", CurValue, false);
                if (!string.IsNullOrEmpty(assetsConfig.Unique5Caption))
                    _where += " OR " + GetWildcardSearch("Assets.Unique5", CurValue, false);
                if (!string.IsNullOrEmpty(assetsConfig.Unique6Caption))
                    _where += " OR " + GetWildcardSearch("Assets.Unique6", CurValue, false);
                if (!string.IsNullOrEmpty(assetsConfig.Unique7Caption))
                    _where += " OR " + GetWildcardSearch("Assets.Unique7", CurValue, false);

                _where += " )";
            }

            // #3 Asset Name
            CurValue = filter.AssetName;
            if (CurValue.Length > 0)
            {
                _where += " AND " + GetWildcardSearch("Assets.Name", CurValue, true);
            }
            // #4 PO Number
            CurValue = filter.PONumber;
            if (CurValue.Length > 0)
            {
                _where += " AND " + GetWildcardSearch("Assets.PONumber", CurValue, true);
            }
            // #5 Funding Code
            CurValue = filter.FundingCode;
            if (CurValue.Length > 0)
            {
                _where += " AND " + GetWildcardSearch("Assets.FundingCode", CurValue, true);
            }

            if (filter.AssetDateStart != DateTime.MinValue && filter.AssetDateEnd != DateTime.MinValue)
            {
                if (filter.CheckDateAquired) _where += " AND (Assets.DateAquired BETWEEN '" + Functions.FormatSQLDateTime(filter.AssetDateStart) + "' AND '" + Functions.FormatSQLDateTime(filter.AssetDateEnd) + "') ";
                if (filter.CheckDateDeployed) _where += " AND (Assets.DateDeployed BETWEEN '" + Functions.FormatSQLDateTime(filter.AssetDateStart) + "' AND '" + Functions.FormatSQLDateTime(filter.AssetDateEnd) + "') ";
                if (filter.CheckDateDisposed) _where += " AND (Assets.DateDisposed BETWEEN '" + Functions.FormatSQLDateTime(filter.AssetDateStart) + "' AND '" + Functions.FormatSQLDateTime(filter.AssetDateEnd) + "') ";
                if (filter.CheckDateEntered) _where += " AND (Assets.DateEntered BETWEEN '" + Functions.FormatSQLDateTime(filter.AssetDateStart) + "' AND '" + Functions.FormatSQLDateTime(filter.AssetDateEnd) + "') ";
                if (filter.CheckDateOutOfService) _where += " AND (Assets.DateOutOfService BETWEEN '" + Functions.FormatSQLDateTime(filter.AssetDateStart) + "' AND '" + Functions.FormatSQLDateTime(filter.AssetDateEnd) + "') ";
                if (filter.CheckDatePurchased) _where += " AND (Assets.DatePurchased BETWEEN '" + Functions.FormatSQLDateTime(filter.AssetDateStart) + "' AND '" + Functions.FormatSQLDateTime(filter.AssetDateEnd) + "') ";
                if (filter.CheckDateReceived) _where += " AND (Assets.DateReceived BETWEEN '" + Functions.FormatSQLDateTime(filter.AssetDateStart) + "' AND '" + Functions.FormatSQLDateTime(filter.AssetDateEnd) + "') ";
                if (filter.CheckDateUpdated) _where += " AND (Assets.dtUpdated BETWEEN '" + Functions.FormatSQLDateTime(filter.AssetDateStart) + "' AND '" + Functions.FormatSQLDateTime(filter.AssetDateEnd) + "') ";
            }
            //#1
            CurValue = filter.ValueCurrentExpression;
            if (CurValue.Length > 0)
            {
                if (CurValue.Contains("NULL"))
                {
                    if (CurValue == "NULL") _where += " AND Assets.ValueCurrent IS NULL";
                    else
                    {
                        CurValue = CurValue.Substring(4, CurValue.Length - 4);
                        _where += " AND (Assets.ValueCurrent IS NULL OR Assets.ValueCurrent" + Security.SQLInjectionBlock(CurValue.Replace("'", "''")) + ")";
                    }
                }
                else
                {
                    _where += " AND Assets.ValueCurrent" + Security.SQLInjectionBlock(CurValue.Replace("'", "''"));
                }
            }
            //#2
            CurValue = filter.ValueDepreciatedExpression;
            if (CurValue.Length > 0)
            {
                if (CurValue.Contains("NULL"))
                {
                    if (CurValue == "NULL") _where += " AND Assets.ValueDepreciated IS NULL";
                    else
                    {
                        CurValue = CurValue.Substring(4, CurValue.Length - 4);
                        _where += " AND (Assets.ValueDepreciated IS NULL OR Assets.ValueDepreciated" + Security.SQLInjectionBlock(CurValue.Replace("'", "''")) + ")";
                    }
                }
                else
                {
                    _where += " AND Assets.ValueDepreciated" + Security.SQLInjectionBlock(CurValue.Replace("'", "''"));
                }
            }
            //#3
            CurValue = filter.ValueReplacementExpression;
            if (CurValue.Length > 0)
            {
                if (CurValue.Contains("NULL"))
                {
                    if (CurValue == "NULL") _where += " AND Assets.ValueReplacement IS NULL";
                    else
                    {
                        CurValue = CurValue.Substring(4, CurValue.Length - 4);
                        _where += " AND (Assets.ValueReplacement IS NULL OR Assets.ValueReplacement" + Security.SQLInjectionBlock(CurValue.Replace("'", "''")) + ")";
                    }
                }
                else
                {
                    _where += " AND Assets.ValueReplacement" + Security.SQLInjectionBlock(CurValue.Replace("'", "''"));
                }
            }
            //#4
            CurValue = filter.ValueSalvageExpression;
            if (CurValue.Length > 0)
            {
                if (CurValue.Contains("NULL"))
                {
                    if (CurValue == "NULL") _where += " AND Assets.ValueSalvage IS NULL";
                    else
                    {
                        CurValue = CurValue.Substring(4, CurValue.Length - 4);
                        _where += " AND (Assets.ValueSalvage IS NULL OR Assets.ValueSalvage" + Security.SQLInjectionBlock(CurValue.Replace("'", "''")) + ")";
                    }
                }
                else
                {
                    _where += " AND Assets.ValueSalvage" + Security.SQLInjectionBlock(CurValue.Replace("'", "''"));
                }
            }
            //#5
            CurValue = filter.DisposalCostExpression;
            if (CurValue.Length > 0)
            {
                if (CurValue.Contains("NULL"))
                {
                    if (CurValue == "NULL") _where += " AND Assets.DisposalCost IS NULL";
                    else
                    {
                        CurValue = CurValue.Substring(4, CurValue.Length - 4);
                        _where += " AND (Assets.DisposalCost IS NULL OR Assets.DisposalCost" + Security.SQLInjectionBlock(CurValue.Replace("'", "''")) + ")";
                    }
                }
                else
                {
                    _where += " AND Assets.DisposalCost" + Security.SQLInjectionBlock(CurValue.Replace("'", "''"));
                }
            }

            _having = GetAssetCustomPropertiesByFilterSQLQuery(ref filter, ref _custom_property_count);
            if (!string.IsNullOrEmpty(_having))
            {
                _having = "having ((Select count(*) from AssetPropertyValues apv1 where apv1.DId = " + departmentId.ToString() + " AND apv1.AssetId=Assets.Id " +
                    _having + ")=" + _custom_property_count + ") ";
                _groupby = "Assets.DepartmentId,Assets.Id,Assets.OwnerId,Assets.CheckedOutId,Assets.TypeId,Assets.MakeId,Assets.ModelId," +
                    "Assets.location_id,Assets.LocationId,Assets.VendorId,Assets.WarrantyVendor,Assets.Name,Assets.SerialNumber,Assets.Description,Assets.Value," +
                    "Assets.DateAquired,Assets.LaborWarrantyLength,Assets.PartsWarrantyLength,CONVERT(nvarchar(max),Assets.Notes),Assets.Room,Assets.PONumber,Assets.Active,Assets.FundingCode," +
                    "Assets.CategoryId,Assets.StatusId,Assets.AssetSort,Assets.DatePurchased,Assets.DateDeployed,Assets.DateOutOfService,Assets.DateEntered," +
                    "Assets.DateReceived,Assets.DateDisposed,Assets.ValueCurrent,Assets.ValueReplacement,Assets.ValueDepreciated,Assets.ValueSalvage,Assets.DisposalCost," +
                    "Assets.FundingSource,Assets.dtUpdated,Assets.intUpdatedBy,Assets.AccountId,Accounts.vchName,Assets.AssetNumber,Assets.AssetGUID," +
                    "Assets.Unique1,Assets.Unique2,Assets.Unique3,Assets.Unique4,Assets.Unique5,Assets.Unique6,Assets.Unique7," +
                    "lo_owner.LastName,lo_owner.FirstName,Vendors.Name,WarrantyVendors.NameAssetStatus.vchStatus,lo_checkout.LastName,lo_checkout.FirstName,lo_owner.Email,lo_checkout.Email,WarrantyVendors.name,AssetStatus.vchStatus," +
                    "AssetCategories.Name,AssetTypes.Name,AssetMakes.Make,AssetModels.Model,dbo.fxGetUserName2(lo_updated.FirstName, lo_updated.LastName, lo_updated.Email),AuditNote";
                string[] Groups = _groupby.Split(',');
                _groupby = string.Empty;
                string LowSql = _sql.ToLower();
                foreach (string Group in Groups) if (LowSql.Contains(Group.ToLower())) _groupby += "," + Group;
                _groupby = " GROUP BY " + _groupby.Substring(1) + " ";
            }

            if (colsetting != null)
                sqlQuery = _sql + _where + _groupby + _having + _static_order;

            return sqlQuery;
        }
Ejemplo n.º 10
0
        public static AssetsConfig SelectAssetUniqueCaptions(Guid organizationId, int DepartmentId)
        {
            DataRow drAssetConfig = SelectRecord("sp_SelectAssetUniqueCaptions", new SqlParameter[] { new SqlParameter("@DepartmentId", DepartmentId) }, organizationId);
            AssetsConfig assetsConfig;

            if (drAssetConfig != null)
                assetsConfig = new AssetsConfig(drAssetConfig["AssetsUnique1Caption"].ToString(), drAssetConfig["AssetsUnique2Caption"].ToString(), drAssetConfig["AssetsUnique3Caption"].ToString(), drAssetConfig["AssetsUnique4Caption"].ToString(), drAssetConfig["AssetsUnique5Caption"].ToString(), drAssetConfig["AssetsUnique6Caption"].ToString(), drAssetConfig["AssetsUnique7Caption"].ToString());
            else
                assetsConfig = new AssetsConfig();
            return assetsConfig;
        }
Ejemplo n.º 11
0
        protected virtual void FindProperties(MaterialProperty[] props)
        {
            baseColorMp          = null;
            shaderPropertyGroups = new List <ShaderGroupInstance>();
            hasDepency.Clear();
            for (int i = 0; i < AssetsConfig.GlobalAssetsConfig.ShaderGroupInfo.Count; ++i)
            {
                string groupName = AssetsConfig.GlobalAssetsConfig.ShaderGroupInfo[i];
                shaderPropertyGroups.Add(new ShaderGroupInstance()
                {
                    name = groupName
                });
            }

            Shader shader           = m_Material.shader;
            var    shaderFeatureMap = AssetsConfig.GetShaderFeatureList();

            for (int i = 0; i < AssetsConfig.GlobalAssetsConfig.ShaderInfos.Count; ++i)
            {
                var si = AssetsConfig.GlobalAssetsConfig.ShaderInfos[i];
                if (si.shader != null && si.shader.name == shader.name)
                {
                    for (int j = 0; j < si.shaderFeatures.Count; ++j)
                    {
                        string featurename = si.shaderFeatures[j];
                        AssetsConfig.ShaderFeature sf;
                        if (shaderFeatureMap.TryGetValue(featurename, out sf))
                        {
                            MaterialProperty mp = null;
                            if (!string.IsNullOrEmpty(sf.propertyName))
                            {
                                mp = FindProperty(sf.propertyName, props, false);
                            }
                            if (sf.type == AssetsConfig.ShaderPropertyType.CustomGroup)
                            {
                                for (int k = 0; k < sf.customProperty.Length; ++k)
                                {
                                    var cp = sf.customProperty[k];
                                    if (cp.valid && !string.IsNullOrEmpty(cp.desc))
                                    {
                                        ShaderGroupInstance sgi = null;
                                        if (string.IsNullOrEmpty(cp.subGroup))
                                        {
                                            sgi = shaderPropertyGroups[shaderPropertyGroups.Count - 1];
                                        }
                                        else
                                        {
                                            sgi = shaderPropertyGroups.Find((param) => { return(param.name == cp.subGroup); });
                                        }

                                        if (sgi == null)
                                        {
                                            sgi = new ShaderGroupInstance()
                                            {
                                                name = cp.subGroup
                                            };
                                            sgi.hasCustomGroup = true;
                                            shaderPropertyGroups.Add(sgi);
                                        }
                                        ShaderPropertyInstance spi = new ShaderPropertyInstance();
                                        spi.shaderFeature = sf;
                                        spi.property      = mp;
                                        spi.scp           = cp;
                                        spi.customIndex   = k;
                                        sgi.spiList.Add(spi);
                                    }
                                }
                            }
                            else
                            {
                                ShaderPropertyInstance spi = new ShaderPropertyInstance();
                                spi.shaderFeature = sf;
                                spi.property      = mp;
                                ShaderGroupInstance sgi = shaderPropertyGroups.Find((param) => { return(param.name == sf.shaderGroupName); });
                                if (sgi == null)
                                {
                                    sgi = shaderPropertyGroups[shaderPropertyGroups.Count - 1];
                                }
                                sgi.spiList.Add(spi);
                                if (sf.name == "Color")
                                {
                                    baseColorMp = spi.property;
                                }
                            }

                            if (sf.type == AssetsConfig.ShaderPropertyType.Keyword &&
                                !hasDepency.Contains(sf.name) &&
                                m_Material.IsKeywordEnabled(sf.propertyName))
                            {
                                hasDepency.Add(sf.name);
                            }
                        }
                    }
                    break;
                }
            }
            customFunc.Clear();
            customFunc.Add("BlendMode", BlendModePopup);
            customFunc.Add("Debug", DoDebugArea);
            AssetsConfig.RefreshShaderDebugNames();
            GameObject go = Selection.activeGameObject;

            if (go != null)
            {
                dd = go.GetComponent <DebugData>();
            }
            Update();
        }
Ejemplo n.º 12
0
        private void ShaderInfoGUI(AssetsConfig ac)
        {
            ac.shaderInfoFolder = EditorGUILayout.Foldout(ac.shaderInfoFolder, "Shader Info");
            if (ac.shaderInfoFolder)
            {
                EditorGUI.indentLevel++;

                for (int i = 0; i < ac.ShaderInfos.Count; ++i)
                {
                    AssetsConfig.ShaderInfo si = ac.ShaderInfos[i];
                    si.folder = EditorGUILayout.Foldout(si.folder, si.shader != null ? si.shader.name : "empty");
                    if (si.folder)
                    {
                        EditorGUILayout.BeginHorizontal();
                        if (GUILayout.Button("Delete", GUILayout.MaxWidth(80)))
                        {
                            ac.ShaderInfos.RemoveAt(i);
                        }
                        if (GUILayout.Button("Clear", GUILayout.MaxWidth(80)))
                        {
                            si.shaderFeatures.Clear();
                        }
                        EditorGUILayout.EndHorizontal();
                        si.shader = EditorGUILayout.ObjectField(si.shader, typeof(Shader), false, GUILayout.MaxWidth(160)) as Shader;
                        bool featureDirty = false;
                        shaderFeatures.Clear();

                        var it = groupedShaderFeatures.GetEnumerator();
                        while (it.MoveNext())
                        {
                            var kvp = it.Current;
                            EditorGUILayout.LabelField(kvp.Key);
                            EditorGUI.indentLevel++;
                            var sfList = kvp.Value;
                            for (int j = 0; j < sfList.Count; j += 3)
                            {
                                EditorGUILayout.BeginHorizontal();
                                AssetsConfig.ShaderFeature sf = sfList[j];
                                ShaderFeatureInfoGUI(si, sf, ref featureDirty);
                                if (j + 1 < sfList.Count)
                                {
                                    sf = sfList[j + 1];
                                    ShaderFeatureInfoGUI(si, sf, ref featureDirty);
                                    if (j + 2 < sfList.Count)
                                    {
                                        sf = sfList[j + 2];
                                        ShaderFeatureInfoGUI(si, sf, ref featureDirty);
                                    }
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            EditorGUI.indentLevel--;
                            EditorGUILayout.Space();
                        }
                        if (featureDirty)
                        {
                            si.shaderFeatures.Clear();
                            si.shaderFeatures.AddRange(shaderFeatures);
                        }
                    }
                }
                EditorGUI.indentLevel--;
                if (GUILayout.Button("Add Shader Config", GUILayout.MaxWidth(180)))
                {
                    ac.ShaderInfos.Add(new AssetsConfig.ShaderInfo());
                }
                if (GUILayout.Button("Sort Shader Features", GUILayout.MaxWidth(180)))
                {
                    List <string> shaderFeatures = new List <string>();
                    for (int i = 0; i < ac.ShaderInfos.Count; ++i)
                    {
                        AssetsConfig.ShaderInfo si = ac.ShaderInfos[i];
                        if (si.shader != null)
                        {
                            shaderFeatures.Clear();
                            for (int j = 0; j < ac.ShaderFeatures.Count; ++j)
                            {
                                AssetsConfig.ShaderFeature sf = ac.ShaderFeatures[j];
                                bool hasFeature = si.shaderFeatures.Exists((x) => { return(sf.name == x); });
                                if (hasFeature)
                                {
                                    shaderFeatures.Add(sf.name);
                                }
                            }
                            si.shaderFeatures.Clear();
                            si.shaderFeatures.AddRange(shaderFeatures);
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
        private void ShaderFeatureGUI(AssetsConfig ac)
        {
            ac.shaderFeatureFolder = EditorGUILayout.Foldout(ac.shaderFeatureFolder, "Shader Feature");
            if (ac.shaderFeatureFolder)
            {
                int removeIndex = -1;
                for (int i = 0; i < ac.ShaderFeatures.Count; ++i)
                {
                    var sf = ac.ShaderFeatures[i];

                    EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(400));
                    EditorGUILayout.LabelField(sf.name, GUILayout.MaxWidth(150));
                    BeginRect(ref shaderFeatureRect, sf, i, 150);
                    if (GUILayout.Button("Edit", GUILayout.MaxWidth(80)))
                    {
                        sf.folder = !sf.folder;
                    }

                    if (GUILayout.Button("Delete", GUILayout.MaxWidth(80)))
                    {
                        removeIndex            = i;
                        shaderFeatureCopyIndex = -1;
                    }
                    if (shaderFeatureCopyIndex == -1 || shaderFeatureCopyIndex == i)
                    {
                        if (GUILayout.Button("Copy", GUILayout.MaxWidth(80)))
                        {
                            if (shaderFeatureCopyIndex == -1)
                            {
                                shaderFeatureCopyIndex = i;
                            }
                            else
                            {
                                shaderFeatureCopyIndex = -1;
                            }
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("Paste", GUILayout.MaxWidth(80)))
                        {
                            var src = ac.ShaderFeatures[shaderFeatureCopyIndex];
                            sf.Clone(src);
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                    if (sf.folder)
                    {
                        sf.name     = EditorGUILayout.TextField("Name", sf.name);
                        sf.hide     = EditorGUILayout.Toggle("hide", sf.hide);
                        sf.readOnly = EditorGUILayout.Toggle("readOnly", sf.readOnly);
                        sf.type     = (AssetsConfig.ShaderPropertyType)EditorGUILayout.EnumPopup("type", sf.type);

                        if (sf.type != AssetsConfig.ShaderPropertyType.CustomGroup)
                        {
                            GroupNameGUI(ref sf.shaderGroupIndex, ref sf.shaderGroupName);
                            sf.indexInGroup = EditorGUILayout.IntField("GroupIndex", sf.indexInGroup);
                        }
                        if (sf.type != AssetsConfig.ShaderPropertyType.RenderQueue)
                        {
                            GUILayout.Space(10);
                            sf.propertyName = EditorGUILayout.TextField("PropertyName", sf.propertyName);
                            EditorGUI.indentLevel++;
                            if (sf.type == AssetsConfig.ShaderPropertyType.Custom ||
                                sf.type == AssetsConfig.ShaderPropertyType.CustomGroup)
                            {
                                for (int j = 0; j < sf.customProperty.Length; ++j)
                                {
                                    var    scp  = sf.customProperty[j];
                                    string desc = string.IsNullOrEmpty(scp.desc) || !scp.valid ? "value" + j.ToString() : scp.desc;
                                    scp.folder = EditorGUILayout.Foldout(scp.folder, desc);
                                    if (scp.folder)
                                    {
                                        scp.valid        = EditorGUILayout.Toggle("valid", scp.valid);
                                        scp.desc         = EditorGUILayout.TextField("desc", scp.desc);
                                        scp.defaultValue = EditorGUILayout.Slider("default", scp.defaultValue, scp.min, scp.max);
                                        scp.min          = EditorGUILayout.FloatField("min", scp.min);
                                        scp.max          = EditorGUILayout.FloatField("max", scp.max);
                                        if (scp.max < scp.min)
                                        {
                                            scp.max = scp.min;
                                        }
                                        if (sf.type == AssetsConfig.ShaderPropertyType.CustomGroup)
                                        {
                                            GroupNameGUI(ref scp.shaderGroupIndex, ref scp.subGroup);
                                            scp.indexInGroup = EditorGUILayout.IntField("GroupIndex", scp.indexInGroup);
                                        }
                                    }
                                }
                            }
                            EditorGUI.indentLevel--;
                            GUILayout.Space(10);
                            EditorGUILayout.LabelField("Shader Dependency", GUILayout.MaxWidth(100));
                            sf.dependencyPropertys.isNor          = EditorGUILayout.Toggle("isNor", sf.dependencyPropertys.isNor);
                            sf.dependencyPropertys.dependencyType = (AssetsConfig.DependencyType)EditorGUILayout.EnumPopup("depType", sf.dependencyPropertys.dependencyType);
                            for (int j = 0; j < sf.dependencyPropertys.dependencyShaderProperty.Count; ++j)
                            {
                                EditorGUILayout.BeginHorizontal();
                                sf.dependencyPropertys.dependencyShaderProperty[j] = EditorGUILayout.TextField("Dep", sf.dependencyPropertys.dependencyShaderProperty[j]);
                                if (GUILayout.Button("Remove", GUILayout.MaxWidth(100)))
                                {
                                    sf.dependencyPropertys.dependencyShaderProperty.RemoveAt(j);
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            if (GUILayout.Button("Add Dep", GUILayout.MaxWidth(100)))
                            {
                                sf.dependencyPropertys.dependencyShaderProperty.Add("");
                            }
                        }
                    }
                }
                EndRect(ref shaderFeatureRect, 150);
                if (removeIndex != -1)
                {
                    ac.ShaderFeatures.RemoveAt(removeIndex);
                }
                if (GUILayout.Button("Add Shader Feature", GUILayout.MaxWidth(180)))
                {
                    ac.ShaderFeatures.Add(new AssetsConfig.ShaderFeature());
                }
            }
            else
            {
                shaderFeatureRect = Rect.zero;
            }
        }
Ejemplo n.º 14
0
 private void ShaderGroupGUI(AssetsConfig ac)
 {
     ac.groupFolder = EditorGUILayout.Foldout(ac.groupFolder, "Shader Group");
     if (ac.groupFolder)
     {
         groupName = EditorGUILayout.TextField(groupName);
         if (GUILayout.Button("Add Shader Gropu", GUILayout.MaxWidth(180)))
         {
             groupName = groupName.Trim();
             if (!string.IsNullOrEmpty(groupName))
             {
                 if (!ac.ShaderGroupInfo.Exists((param => { return(param == groupName); })))
                 {
                     ac.ShaderGroupInfo.Add(groupName);
                     shaderGroupDirty = true;
                 }
             }
         }
         for (int i = 0; i < ac.ShaderGroupInfo.Count; ++i)
         {
             string name = ac.ShaderGroupInfo[i];
             EditorGUILayout.BeginHorizontal();
             EditorGUILayout.LabelField(name, GUILayout.MaxWidth(100));
             if (GUILayout.Button("Delete", GUILayout.MaxWidth(80)))
             {
                 ac.ShaderGroupInfo.RemoveAt(i);
                 shaderGroupDirty = true;
             }
             EditorGUILayout.EndHorizontal();
             if (i == 0)
             {
                 BeginRect(ref groupRect);
             }
         }
         EndRect(ref groupRect, 100);
     }
     else
     {
         groupRect = Rect.zero;
     }
     if (shaderGroupDirty)
     {
         shaderGroupNames = ac.ShaderGroupInfo.ToArray();
         shaderGroupDirty = false;
         for (int i = 0; i < ac.ShaderFeatures.Count; ++i)
         {
             var sf = ac.ShaderFeatures[i];
             if (sf.type != AssetsConfig.ShaderPropertyType.CustomGroup)
             {
                 sf.shaderGroupIndex = ac.ShaderGroupInfo.IndexOf(sf.shaderGroupName);
             }
             else
             {
                 for (int j = 0; j < sf.customProperty.Length; ++j)
                 {
                     var scp = sf.customProperty[j];
                     scp.shaderGroupIndex = ac.ShaderGroupInfo.IndexOf(scp.subGroup);
                 }
             }
         }
     }
 }
Ejemplo n.º 15
0
        private void TextureProcessGUI(AssetsConfig ac)
        {
            ac.texCompressConfigFolder = EditorGUILayout.Foldout(ac.texCompressConfigFolder, "Texture Compress");
            if (ac.texCompressConfigFolder)
            {
                if (GUILayout.Button("Add", GUILayout.MaxWidth(80)))
                {
                    ac.texCompressConfig.Add(new TexCompressConfig());
                }
                int removeIndex = -1;
                for (int i = 0; i < ac.texCompressConfig.Count; ++i)
                {
                    var tcc = ac.texCompressConfig[i];
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(string.IsNullOrEmpty(tcc.name) ? "empty" : tcc.name, GUILayout.MaxWidth(150));
                    if (GUILayout.Button("Edit", GUILayout.MaxWidth(80)))
                    {
                        tcc.folder = !tcc.folder;
                    }

                    if (GUILayout.Button("Delete", GUILayout.MaxWidth(80)))
                    {
                        removeIndex = i;
                    }
                    EditorGUILayout.EndHorizontal();
                    if (tcc.folder)
                    {
                        tcc.vaild       = EditorGUILayout.Toggle("Valid", tcc.vaild);
                        tcc.name        = EditorGUILayout.TextField("Name", tcc.name);
                        tcc.priority    = EditorGUILayout.IntField("Priority", tcc.priority);
                        tcc.importType  = (TextureImporterType)EditorGUILayout.EnumPopup("Type", tcc.importType);
                        tcc.importShape = (TextureImporterShape)EditorGUILayout.EnumPopup("Shape", tcc.importShape);
                        tcc.sRGB        = EditorGUILayout.Toggle("sRGB", tcc.sRGB);
                        tcc.mipMap      = EditorGUILayout.Toggle("Mipmap", tcc.mipMap);
                        tcc.filterMode  = (FilterMode)EditorGUILayout.EnumPopup("Filter", tcc.filterMode);
                        tcc.wrapMode    = (TextureWrapMode)EditorGUILayout.EnumPopup("Wrap", tcc.wrapMode);
                        tcc.anisoLevel  = EditorGUILayout.IntSlider("AnisoLevel", tcc.anisoLevel, 0, 3);
                        EditorGUI.indentLevel++;
                        TexturePlatformConfigGUI(tcc.iosSetting, "iOS");
                        TexturePlatformConfigGUI(tcc.androidSetting, "Android");
                        TexturePlatformConfigGUI(tcc.standaloneSetting, "Standalone");
                        EditorGUI.indentLevel--;
                        EditorGUI.indentLevel++;
                        if (GUILayout.Button("AddFilter", GUILayout.MaxWidth(80)))
                        {
                            tcc.compressFilters.Add(new TexCompressFilter());
                        }
                        int subremoveIndex = -1;
                        for (int j = 0; j < tcc.compressFilters.Count; ++j)
                        {
                            var cf = tcc.compressFilters[j];
                            EditorGUILayout.BeginHorizontal();
                            cf.type = (TexFilterType)EditorGUILayout.EnumPopup("", cf.type, GUILayout.MaxWidth(100));
                            cf.str  = EditorGUILayout.TextField("", cf.str, GUILayout.MaxWidth(300));
                            if (GUILayout.Button("Delete", GUILayout.MaxWidth(80)))
                            {
                                subremoveIndex = j;
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                        EditorGUI.indentLevel--;
                        if (subremoveIndex >= 0)
                        {
                            tcc.compressFilters.RemoveAt(subremoveIndex);
                        }
                    }
                }
                if (removeIndex >= 0)
                {
                    ac.texCompressConfig.RemoveAt(removeIndex);
                }
            }
        }