You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.5 KiB
110 lines
2.5 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using LzFramework;
|
|
using System;
|
|
|
|
namespace DisComputer
|
|
{
|
|
public class GameDataConfig : Singleton<GameDataConfig>
|
|
{
|
|
|
|
[Header("零件配置信息")]
|
|
public List<SpareInfoConfig> infoConfig;
|
|
|
|
/// <summary>
|
|
/// 电脑id
|
|
/// </summary>
|
|
public int pcId = -1;
|
|
|
|
public List<SpareDetailData> spareDetailDatas;
|
|
|
|
/// <summary>
|
|
/// 返回计算机固定配置详细信息
|
|
/// </summary>
|
|
/// <param name="pcID">0商务 1游戏</param>
|
|
/// <returns></returns>
|
|
public List<SpareInfo> gameSpareInfos()
|
|
{
|
|
if (pcId == -1)
|
|
return null;
|
|
|
|
List<SpareInfo> infos = new List<SpareInfo>();
|
|
for (int i = 0; i < GameConfig.GetStoreItemInfos.Length; i++)
|
|
{
|
|
if (GameConfig.GetStoreItemInfos[i] == infoConfig[i].type)
|
|
{
|
|
infos.Add(infoConfig[i].infos[pcId]);
|
|
}
|
|
}
|
|
return infos;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 零件混合
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<SpareInfo> AllSpareInfos()
|
|
{
|
|
List<SpareInfo> infos = new List<SpareInfo>();
|
|
for (int i = 0; i < GameConfig.GetStoreItemInfos.Length; i++)
|
|
{
|
|
if (GameConfig.GetStoreItemInfos[i] == infoConfig[i].type)
|
|
{
|
|
int id = UnityEngine.Random.Range(0, 2);
|
|
infos.Add(infoConfig[i].infos[id]);
|
|
}
|
|
}
|
|
return infos;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 返回当前零件详细说明
|
|
/// </summary>
|
|
/// <param name="type"></param>
|
|
/// <returns></returns>
|
|
public SpareDetailData CurSpareDetailInfo(SpareType type)
|
|
{
|
|
foreach(var item in spareDetailDatas)
|
|
{
|
|
if (item.spareType == type)
|
|
return item;
|
|
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
[Serializable]
|
|
public class SpareInfoConfig
|
|
{
|
|
public SpareType type;
|
|
|
|
public List<SpareInfo> infos = new List<SpareInfo>();
|
|
}
|
|
|
|
|
|
[Serializable]
|
|
public class SpareInfo
|
|
{
|
|
public string name;
|
|
|
|
public string simpleInfoStr;
|
|
|
|
public string detailInfoStr;
|
|
|
|
public Texture2D texture;
|
|
|
|
public SpareType type;
|
|
|
|
//适配id
|
|
public int fitId;
|
|
}
|
|
}
|
|
|