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.
103 lines
2.3 KiB
103 lines
2.3 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System;
|
|
|
|
namespace DisComputer
|
|
{
|
|
/*
|
|
* @func 零件容器
|
|
* @author lz
|
|
* @date 2020/07/06
|
|
* */
|
|
public class SpareContainer : MonoBehaviour
|
|
{
|
|
//模型配置
|
|
public SpareModelConfig config;
|
|
|
|
//85295053
|
|
[HideInInspector]
|
|
//当前模型控制
|
|
public SpareItemControl curSpareControl;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示当前零件模型
|
|
/// </summary>
|
|
public void ShowSpareGo()
|
|
{
|
|
if (GameDataConfig.Instance.pcId == 0)
|
|
{
|
|
curSpareControl = config.spareModels[0].modelGo.GetComponent<SpareItemControl>();
|
|
config.spareModels[0].modelGo.SetActive(true);
|
|
config.spareModels[1].modelGo.SetActive(false);
|
|
|
|
}
|
|
else
|
|
{
|
|
curSpareControl = config.spareModels[1].modelGo.GetComponent<SpareItemControl>();
|
|
config.spareModels[1].modelGo.SetActive(true);
|
|
config.spareModels[0].modelGo.SetActive(false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 设置当前零件控件
|
|
/// </summary>
|
|
/// <param name="info"></param>
|
|
public void SelectSpareControl(SpareInfo info)
|
|
{
|
|
for (int i = 0; i < config.spareModels.Count; i++)
|
|
{
|
|
if (config.spareModels[i].name == info.name)
|
|
{
|
|
SpareItemControl spareItem = config.spareModels[i].modelGo.GetComponent<SpareItemControl>();
|
|
spareItem.spareInfo = info;
|
|
curSpareControl = spareItem;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 隐藏当前零件控件
|
|
/// </summary>
|
|
public void HideCurSpareControl()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
[Serializable]
|
|
public class SpareModelConfig
|
|
{
|
|
public SpareType type;
|
|
|
|
public List<SpareModel> spareModels;
|
|
}
|
|
|
|
|
|
|
|
[Serializable]
|
|
public class SpareModel
|
|
{
|
|
//名字
|
|
public string name;
|
|
//模型
|
|
public GameObject modelGo;
|
|
}
|
|
}
|
|
|