Exemplo n.º 1
0
 public Column(ColumnStruct column)
 {
     this.Id        = column.Id;
     this.name      = column.Name;
     this.Limit     = column.Limit;
     this.tasksList = Task.GetTasksByColumnID(column.Id);
 }
Exemplo n.º 2
0
        private string ColumnCommand(ColumnStruct colStrunct)
        {
            var required = colStrunct.Required;

            if (pkeys.Where(t => t.Equals(colStrunct.Name, StringComparison.InvariantCultureIgnoreCase)).Any())
            {
                required = true;
            }

            var command = String.Empty;

            if (colStrunct.ColType == KCore.C.Database.ColumnType.Text)
            {
                command = $@" [{colStrunct.Name}] {Clients.MSQLClient.GetColumnType(colStrunct.ColType)}({colStrunct.Size}) {(required ? "not" : "")} null";
            }
            else
            {
                command = $@" [{colStrunct.Name}] {Clients.MSQLClient.GetColumnType(colStrunct.ColType)} {(required ? "not" : "")} null";
            }

            if (colStrunct.Default != null)
            {
                command += $" DEFAULT('{colStrunct.Default}')";
            }

            return(command);
        }
    /**
     * 建造整圈柱子
     * 若 eaveColRadInflate (簷柱半徑膨脹值) 為 0 則為一般
     * 否則計算 簷柱半徑膨脹列表 後製造柱子
     */
    public List <ColumnStruct> CreateRingColumn(GameObject parentObj, List <Vector3> posList, float columnTopRadius, float columnDownRadius, float columnHeight, float fundationRadius, float fundationHeight, string columnName)
    {
        List <ColumnStruct> columnList = new List <ColumnStruct>();

        for (int i = 0; i < posList.Count; i++)
        {
            ColumnStruct newColumn = CreateColumn(parentObj, posList[i], columnTopRadius, columnDownRadius, columnHeight, fundationRadius, fundationHeight, columnName, this.eaveColRadList);
            columnList.Add(newColumn);
        }
        return(columnList);
    }
Exemplo n.º 4
0
            public static ColumnStruct[] Structure(string dbase, string table)
            {
                var list = new List <ColumnStruct>();

                using (var client = Connection.GetClient(dbase))
                {
                    var dbaseType = client.DataInfo.DBaseType;
                    if (dbaseType != KCore.C.Database.DBaseType.MSQL)
                    {
                        throw new NotImplementedException($"It need to implement to {dbaseType.ToString()}");
                    }

                    if (!client.DoQuery(Content.queries_msql.LOCAL_COLUMNS_4_DBASE_TABLE, dbase, table))
                    {
                        return(null);
                    }
                    else
                    {
                        while (client.Next())
                        {
                            ColumnStruct column;

                            switch (client.DataInfo.DBaseType)
                            {
                            case KCore.C.Database.DBaseType.MSQL:
                                column = new ColumnStruct(
                                    client.Field("DBase").ToString(),
                                    client.Field("Table").ToString(),
                                    client.Field("Name").ToString(),
                                    MSQLClient.GetColumnType(client.Field("Type").ToString()),
                                    client.Field("Request").ToBool(),
                                    null,
                                    client.Field("Size").ToInt(),
                                    client.Field("PK").ToBool());
                                break;

                            default:
                                throw new NotImplementedException();
                            }
                            list.Add(column);
                        }


                        return(list.ToArray());
                    }
                }
            }
    /**
     * 製作單一柱子 (包誇柱子與柱基)
     * 輸入 : 1. parentObj , 2. 位置 , 3. topRadius : 上半徑 , 4. downRadius : 下半徑
     *        5. height : 柱高 ,  6. fundationRadius : 柱基半徑 , 7. fundationHeight : 柱基高
     *        8. name : 物件名稱 , 9. 柱子膨脹半徑比例列表
     *
     */
    public ColumnStruct CreateColumn(GameObject parentObj, Vector3 pos, float topRadius, float downRadius, float height, float fundationRadius, float fundationHeight, string name = "Column", List <float> RadRateList = null)
    {
        GameObject   col          = new GameObject(name);
        ColumnStruct columnStruct = new ColumnStruct();

        Vector3 topPos    = pos + (height / 2.0f) * Vector3.up;
        Vector3 bottomPos = pos - (height / 2.0f - fundationHeight) * Vector3.up;

        col.transform.parent = parentObj.transform;
        col.AddComponent <CylinderMesh>();
        col.GetComponent <CylinderMesh>().CylinderInitSetting(pos, topPos, bottomPos, topRadius, downRadius);
        if (this.eaveColBotOffset != 0 || this.eaveColTopOffset != 0 || RadRateList != null)
        {
            col.GetComponent <CylinderMesh>().SetMesh(RadRateList);
        }
        else
        {
            col.GetComponent <CylinderMesh>().SetMesh();
        }

        columnStruct.columnObj  = col;
        columnStruct.columnMesh = col.GetComponent <CylinderMesh>();
        columnStruct.topPos     = topPos;
        columnStruct.bottomPos  = pos - (height / 2.0f) * Vector3.up;

        //*** Fundation 柱杵
        GameObject fun = new GameObject(name + "Fundation");

        //fun.transform.position = pos - new Vector3(0, height / 2.0f, 0);
        fun.transform.parent = col.transform;
        fun.AddComponent <CylinderMesh>();

        topPos    = pos + (fundationHeight) * Vector3.up - (height / 2.0f) * Vector3.up;
        bottomPos = pos - (height / 2.0f) * Vector3.up;


        fun.GetComponent <CylinderMesh>().CylinderInitSetting(pos - new Vector3(0, height / 2.0f, 0), topPos, bottomPos, fundationRadius, fundationRadius);
        fun.GetComponent <CylinderMesh>().SetMesh();
        columnStruct.fundation = fun.GetComponent <CylinderMesh>();

        return(columnStruct);
    }