示例#1
0
        /// <summary>
        /// Gets the count internal.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="method">The method.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        private int GetCountInternal(string text, FillMethod method, IList parameters)
        {
            if (Connection == null)
            {
                throw new InvalidOperationException("must set connection before calling GetCount()");
            }

            DbCommand command;

            switch (method)
            {
            case FillMethod.FilterText:
                command = CommandBuilder.GetCountCommand(text);
                DataManager.AddParamsToCommand(command, SqlDialect, parameters, ParameterPrefix);
                break;

            case FillMethod.FilterArray:
                command = CommandBuilder.GetCountCommand((SqlFilter[])parameters);
                break;

            default:
                throw new NotSupportedException("this fill method is not supported by GetCount");
            }

            return((int)command.ExecuteScalar());
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vertRect"></param>
        /// <param name="uvRect"></param>
        /// <param name="method"></param>
        /// <param name="amount"></param>
        /// <param name="origin"></param>
        /// <param name="clockwise"></param>
        public void DrawRectWithFillMethod(Rect vertRect, Rect uvRect, Color fillColor,
                                           FillMethod method, float amount, int origin, bool clockwise)
        {
            amount = Mathf.Clamp01(amount);
            switch (method)
            {
            case FillMethod.Horizontal:
                Alloc(4);
                FillUtils.FillHorizontal((OriginHorizontal)origin, amount, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Vertical:
                Alloc(4);
                FillUtils.FillVertical((OriginVertical)origin, amount, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial90:
                Alloc(4);
                FillUtils.FillRadial90((Origin90)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial180:
                Alloc(8);
                FillUtils.FillRadial180((Origin180)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial360:
                Alloc(12);
                FillUtils.FillRadial360((Origin360)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;
            }

            FillColors(fillColor);
            FillTriangles();
        }
示例#3
0
文件: NGraphics.cs 项目: mengtest/u1
        public void Fill(FillMethod method, float amount, int origin, bool clockwise, Rect vertRect, Rect uvRect)
        {
            amount = Mathf.Clamp01(amount);
            switch (method)
            {
            case FillMethod.Horizontal:
                Alloc(4);
                FillUtils.FillHorizontal((OriginHorizontal)origin, amount, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Vertical:
                Alloc(4);
                FillUtils.FillVertical((OriginVertical)origin, amount, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial90:
                Alloc(4);
                FillUtils.FillRadial90((Origin90)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial180:
                Alloc(8);
                FillUtils.FillRadial180((Origin180)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial360:
                Alloc(12);
                FillUtils.FillRadial360((Origin360)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;
            }
        }
示例#4
0
        private DbCommand PrepCommandForSelect(string text, FillMethod method, IList parameters)
        {
            DbCommand command = null;

            switch (method)
            {
            case FillMethod.StoredProcedure:
                command             = Connection.CreateCommand();
                command.CommandText = text;
                command.CommandType = CommandType.StoredProcedure;
                DataManager.AddParamsToCommand(command, SqlDialect, parameters, ParameterPrefix);

                break;

            case FillMethod.Unfiltered:
                command = CommandBuilder.GetSelectCommand(String.Empty, _sortStr);

                break;

            case FillMethod.FilterText:
                command = CommandBuilder.GetSelectCommand(text, _sortStr);
                DataManager.AddParamsToCommand(command, SqlDialect, parameters, ParameterPrefix);

                break;

            case FillMethod.FilterArray:
                command = CommandBuilder.GetSelectCommand((SqlFilter[])parameters, _sortStr);

                break;
            }

            return(command);
        }
示例#5
0
文件: ImageSpec.cs 项目: thurn/sagan
        public void SetParams(Image image)
        {
            image.type           = Image.Type.Filled;
            image.fillAmount     = FillAmount;
            image.fillClockwise  = FillClockwise;
            image.preserveAspect = PreserveAspectRatio;

            FillMethod.SetParams(image);
        }
示例#6
0
 protected override void OnValidate()
 {
     base.OnValidate();
     if (cachedInverse != inverse || cachedFillMethod != fillMethod)
     {
         cachedInverse    = inverse;
         cachedFillMethod = fillMethod;
         GenerateBlockSequence();
     }
 }
示例#7
0
        private DataClassReader <T> OpenReaderInternal(string text, FillMethod method, IList parameters)
        {
            if (Connection == null)
            {
                throw new InvalidOperationException("must set connection before calling OpenReader()");
            }

            DbCommand    command = PrepCommandForSelect(text, method, parameters);
            DbDataReader reader  = ExecuteReaderInternal(command, CommandBehavior.SingleResult);

            return(new DataClassReader <T>(reader, _dataMap));
        }
示例#8
0
 public Matrix(int rows, int cells, FillMethod method)
 {
     Rows  = rows;
     Cells = cells;
     arr   = new T[rows, cells];
     for (int i = 0; i < rows; i++)
     {
         for (int j = 0; j < cells; j++)
         {
             arr[i, j] = method.Invoke();
         }
     }
 }
示例#9
0
        private int FillInternal(ICollection <T> collection, string text, FillMethod method, IList parameters)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }

            if (Connection == null)
            {
                throw new InvalidOperationException("must set connection before calling Fill()");
            }

            DbCommand command = PrepCommandForSelect(text, method, parameters);

            using (DbDataReader reader = ExecuteReaderInternal(command, CommandBehavior.SingleResult))
                return(PopulateCollection(collection, reader));
        }
示例#10
0
        public static void ConvertToUIImage(MenuCommand command)
        {
            if (command.context is UIImage)
            {
                return;
            }

            var        image        = (Image)command.context;
            GameObject targetObject = image.gameObject;

            Color      color          = image.color;
            bool       raycastTarget  = image.raycastTarget;
            Sprite     sprite         = image.sprite;
            Type       type           = image.type;
            bool       preserveAspect = image.preserveAspect;
            float      fillAmount     = image.fillAmount;
            bool       fillCenter     = image.fillCenter;
            FillMethod fillMethod     = image.fillMethod;
            bool       fillClockwise  = image.fillClockwise;
            int        fillOrigin     = image.fillOrigin;
            float      alphaHitTestMinimumThreshold = image.alphaHitTestMinimumThreshold;

            DestroyImmediate(image);

            var uiImage = targetObject.AddComponent <UIImage>();

            uiImage.color         = color;
            uiImage.raycastTarget = raycastTarget;
            if (sprite != null)
            {
                uiImage.sprite = sprite;
            }
            uiImage.type           = type;
            uiImage.preserveAspect = preserveAspect;
            uiImage.fillAmount     = fillAmount;
            uiImage.fillCenter     = fillCenter;
            uiImage.fillMethod     = fillMethod;
            uiImage.fillClockwise  = fillClockwise;
            uiImage.fillOrigin     = fillOrigin;
            uiImage.alphaHitTestMinimumThreshold = alphaHitTestMinimumThreshold;
            uiImage.UpdateRenderCanvasShaderChannels();
            uiImage.Init();

            SceneView.RepaintAll();
        }
示例#11
0
        /// <summary>
        /// 填充 DataSet 对象
        /// </summary>
        /// <param name="command">IDbCommand 对象</param>
        /// <param name="dataSet">DataSet 对象</param>
        //[Obsolete("不再使用该方法,请使用 ExecuteXReader", false)]
        public void FillDataSet(IDbCommand command, DataSet dataSet)
        {
            IDbDataAdapter dataAdapter = this.driver.CreateDbDataAdapter();

            dataAdapter.SelectCommand = command;

            string tableName = "Table";

            for (int index = 0; index < dataSet.Tables.Count; index++)
            {
                dataAdapter.TableMappings.Add(tableName, dataSet.Tables[index].TableName);
                tableName += (index + 1).ToString();
            }

            FillMethod method = dataAdapter.Fill;

            this.driver.ExecuteDbCommand <int>(method, dataSet);
        }
        private static void RecordPointAddFlame()
        {
            string[] ids = AssetDatabase.FindAssets("t:Prefab", new string[] { "Assets/AssetRes/UI" });
            for (int i = 0; i < ids.Length; i++)
            {
                string path = AssetDatabase.GUIDToAssetPath(ids[i]);

                GameObject originTwoCube = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;
                string     assetPath     = AssetDatabase.GetAssetPath(originTwoCube);

                GameObject newGo  = GameObject.Instantiate(originTwoCube);
                Image[]    images = newGo.GetComponentsInChildren <Image>(true);
                for (int j = images.Length - 1; j >= 0; j--)
                {
                    Image      image      = images[j];
                    GameObject go         = image.gameObject;
                    Sprite     sprite     = image.sprite;
                    Color      color      = image.color;
                    Material   material   = image.material;
                    bool       raycast    = image.raycastTarget;
                    FillMethod fillMethod = image.fillMethod;
                    Image.Type type       = image.type;

                    GameObject.DestroyImmediate(image);
                    UIImage uIImage = go.AddComponent <UIImage>();
                    uIImage.sprite        = sprite;
                    uIImage.color         = color;
                    uIImage.material      = material;
                    uIImage.raycastTarget = raycast;
                    uIImage.fillMethod    = fillMethod;
                    uIImage.type          = type;
                }
                if (images.Length > 0)
                {
                    PrefabUtility.SaveAsPrefabAsset(newGo, assetPath);
                }

                GameObject.DestroyImmediate(newGo);

                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }
示例#13
0
        public static void ReplaceWithImage(MenuCommand command)
        {
            if (!(command.context is UIImage))
            {
                return;
            }

            var        uiImage      = (UIImage)command.context;
            GameObject targetObject = uiImage.gameObject;

            Color      color          = uiImage.color;
            bool       raycastTarget  = uiImage.raycastTarget;
            Sprite     sprite         = uiImage.sprite;
            Type       type           = uiImage.type;
            bool       preserveAspect = uiImage.preserveAspect;
            float      fillAmount     = uiImage.fillAmount;
            bool       fillCenter     = uiImage.fillCenter;
            FillMethod fillMethod     = uiImage.fillMethod;
            bool       fillClockwise  = uiImage.fillClockwise;
            int        fillOrigin     = uiImage.fillOrigin;
            float      alphaHitTestMinimumThreshold = uiImage.alphaHitTestMinimumThreshold;

            DestroyImmediate(uiImage);

            var image = targetObject.AddComponent <Image>();

            image.color         = color;
            image.raycastTarget = raycastTarget;
            if (sprite != null)
            {
                image.sprite = sprite;
            }
            image.type           = type;
            image.preserveAspect = preserveAspect;
            image.fillAmount     = fillAmount;
            image.fillCenter     = fillCenter;
            image.fillMethod     = fillMethod;
            image.fillClockwise  = fillClockwise;
            image.fillOrigin     = fillOrigin;
            image.alphaHitTestMinimumThreshold = alphaHitTestMinimumThreshold;

            SceneView.RepaintAll();
        }
示例#14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="method"></param>
        /// <param name="amount"></param>
        /// <param name="origin"></param>
        /// <param name="clockwise"></param>
        /// <param name="vertRect"></param>
        /// <param name="uvRect"></param>
        public void Fill(FillMethod method, float amount, int origin, bool clockwise, Rect vertRect, Rect uvRect)
        {
            amount = Mathf.Clamp01(amount);
            switch (method)
            {
                case FillMethod.Horizontal:
                    Alloc(4);
                    FillUtils.FillHorizontal((OriginHorizontal)origin, amount, vertRect, uvRect, vertices, uv);
                    break;

                case FillMethod.Vertical:
                    Alloc(4);
                    FillUtils.FillVertical((OriginVertical)origin, amount, vertRect, uvRect, vertices, uv);
                    break;

                case FillMethod.Radial90:
                    Alloc(4);
                    FillUtils.FillRadial90((Origin90)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                    break;

                case FillMethod.Radial180:
                    Alloc(8);
                    FillUtils.FillRadial180((Origin180)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                    break;

                case FillMethod.Radial360:
                    Alloc(12);
                    FillUtils.FillRadial360((Origin360)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                    break;
            }
        }
示例#15
0
        /// <summary>
        /// Fills the range internal.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="start">The start.</param>
        /// <param name="length">The length.</param>
        /// <param name="text">The text.</param>
        /// <param name="method">The method.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        private int FillRangeInternal(ICollection <T> collection, int start, int length, string text, FillMethod method, IList parameters)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }

            if (Connection == null)
            {
                throw new InvalidOperationException("must set connection before calling Fill()");
            }

            if (string.IsNullOrEmpty(_sortStr))
            {
                throw new InvalidOperationException("must set OrderBy before using FillRange");
            }

            if (!SqlDialect.SupportsLimit)
            {
                throw new InvalidOperationException("this database dialect does not support using FillRange");
            }

            DbCommand command;

            switch (method)
            {
            case FillMethod.FilterText:
                command = CommandBuilder.GetSelectRangeCommand(text, _sortStr, start, length);
                DataManager.AddParamsToCommand(command, SqlDialect, parameters, ParameterPrefix);
                break;

            case FillMethod.FilterArray:
                command = CommandBuilder.GetSelectRangeCommand((SqlFilter[])parameters, _sortStr, start, length);
                break;

            default:
                throw new NotSupportedException("this fill method is not supported by FillRange");
            }

            using (DbDataReader reader = ExecuteReaderInternal(command, CommandBehavior.SingleResult))
                return(PopulateCollection(collection, reader));
        }
示例#16
0
 public void SetFillMethod(FillMethod fillMethod)
 {
     _fillMethod = fillMethod;
 }