SONIC3D
6/10/2014 - 4:45 PM

ForeverGame用 角色属性表_数值属性表从Excel工作表自动生成C++代码的宏

ForeverGame用 角色属性表_数值属性表从Excel工作表自动生成C++代码的宏

Sub btnGenerateCppSrc_Clicked()
    For i = 8 To 146 Step 1
        'ActiveSheet.Cells(i, 12).Interior.Color = ColorConstants.vbWhite
        
        If ActiveSheet.Cells(i, 3).Interior.Color = ActiveSheet.Cells(5, 2).Interior.Color Then
            ' 跳过对灰色行的处理
        ElseIf IsEmpty(ActiveSheet.Cells(i, 3)) Then
            ' 跳过空行
        Else
            Dim cellString, minValueStr, maxValueStr, commentStr, finalString As String
            cellString = ActiveSheet.Cells(i, 3).Text
            minValueStr = ActiveSheet.Cells(i, 6).Text
            maxValueStr = ActiveSheet.Cells(i, 7).Text
            commentStr = ActiveSheet.Cells(i, 5).Text
            'Debug.Print cellString
            
            Dim typeStr As String
            If ("float" = LCase(ActiveSheet.Cells(i, 11).Text)) Then
                typeStr = "float"
            Else
                typeStr = "int"
            End If
            finalString = "FG_ATTR_CLAMP_SYNTHESIZE(" & typeStr & ", m_" & cellString & ", " & cellString & ", " & minValueStr & ", " & maxValueStr & ");" & "    // " & commentStr
            ActiveSheet.Cells(i, 12).Value = finalString
        End If
    Next
End Sub