28 lines
1.0 KiB
C#
28 lines
1.0 KiB
C#
|
using System.Collections.Generic;
|
|||
|
|
|||
|
[System.Serializable]
|
|||
|
public class GameConfig
|
|||
|
{
|
|||
|
public List<CarConfig> Cars = new List<CarConfig>();
|
|||
|
}
|
|||
|
|
|||
|
class ExampleGame
|
|||
|
{
|
|||
|
private void Main()
|
|||
|
{
|
|||
|
var gameConfig = new GameConfig();
|
|||
|
var carConfig = new CarConfig();
|
|||
|
var componentConfig1 = new CarComponentConfig() { 部件类型名 = "前保险杠" };
|
|||
|
var componentConfig2 = new CarComponentConfig() { 部件类型名 = "大灯" };
|
|||
|
var componentConfig3 = new CarComponentConfig() { 部件类型名 = "尾灯" };
|
|||
|
var component1 = new ComponentConfig() { 部件名 = "TO2018" };
|
|||
|
var component2 = new ComponentConfig() { 部件名 = "TO2024" };
|
|||
|
|
|||
|
componentConfig1.车辆组件合集.Add(component1);
|
|||
|
componentConfig1.车辆组件合集.Add(component2);
|
|||
|
carConfig.车辆组件.Add(componentConfig1);
|
|||
|
carConfig.车辆组件.Add(componentConfig2);
|
|||
|
carConfig.车辆组件.Add(componentConfig3);
|
|||
|
gameConfig.Cars.Add(carConfig);
|
|||
|
}
|
|||
|
}
|