Exemple #1
0
        public string GetFields(List <string> dataName, List <string> dataType)
        {
            int           len = Math.Min(dataName.Count, dataType.Count);
            StringBuilder s   = new StringBuilder();

            for (int i = 0; i < len; i++)
            {
                s.Append(CDataType.ChangeToDataType(dataType[i]) + " m_" + dataName[i] + ";");
                if (i == len - 1)
                {
                    continue;
                }
                s.Append("\n");
                s.Append("        ");
            }
            return(s.ToString());
        }
Exemple #2
0
        public string GetPropertiess(List <string> dataName, List <string> dataType)
        {
            int           len = Math.Min(dataName.Count, dataType.Count);
            StringBuilder s   = new StringBuilder();

            s.Append("public override int Version { get { return TableInfoVer; } }\n        ");
            for (int i = 0; i < len; i++)
            {
                if (i == 0 && CDataType.ChangeToDataType(dataType[i]) == "int")
                {
                    s.Append("public int UniqueID { get { return " + dataName[i] + "; } set { " + dataName[i] + " = value; } }\n        ");
                }
                s.Append("public " + CDataType.ChangeToDataType(dataType[i]) + " " + dataName[i] + " { get { return m_" + dataName[i] + "; } private set { m_" + dataName[i] + " = value; }}");
                if (i == len - 1)
                {
                    continue;
                }
                s.Append("\n");
                s.Append("        ");
            }
            return(s.ToString());
        }
Exemple #3
0
        public string GetTableRowInfoInit(List <string> dataName, List <string> dataType)
        {
            int           len = Math.Min(dataName.Count, dataType.Count);
            StringBuilder s   = new StringBuilder();

            for (int i = 0; i < len; i++)
            {
                string equalsValue = string.Empty;
                switch (CDataType.ChangeToDataType(dataType[i]).ToLower())
                {
                case CDataType.DataType_INT: equalsValue = "0"; break;

                case CDataType.DataType_FLOAT: equalsValue = "0"; break;

                case CDataType.DataType_STRING: equalsValue = "string.Empty"; break;

                case CDataType.DataType_BOOL: equalsValue = "false"; break;

                case CDataType.DataType_VECTOR2: equalsValue = "new Vector2(0,0)"; break;

                case CDataType.DataType_VECTOR3: equalsValue = "new Vector3(0,0,0)"; break;

                default:
                    equalsValue = string.Empty;
                    break;
                }
                s.Append(dataName[i] + " = " + equalsValue + ";");
                if (i == len - 1)
                {
                    continue;
                }
                s.Append("\n");
                s.Append("            ");
            }
            return(s.ToString());
        }