93 lines
3.0 KiB
C#
93 lines
3.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class BuildingTechManager : MonoBehaviour
|
|
{
|
|
[System.Serializable]
|
|
public class BuildingTechCost
|
|
{
|
|
public int 信仰;
|
|
public int 木材;
|
|
public int 团子;
|
|
}
|
|
|
|
|
|
public static BuildingTechManager Instance { get; private set; }
|
|
|
|
public Dictionary<string, List<BuildingTechCost>> techCostDictionary;
|
|
|
|
public List<BuildingTechCost> 高速磕头 = new List<BuildingTechCost>();
|
|
public List<BuildingTechCost> 信仰压缩 = new List<BuildingTechCost>();
|
|
public List<BuildingTechCost> 一心虔诚 = new List<BuildingTechCost>();
|
|
public List<BuildingTechCost> 小祭司 = new List<BuildingTechCost>();
|
|
public List<BuildingTechCost> 铸造太阳神之眼 = new List<BuildingTechCost>();
|
|
public List<BuildingTechCost> 撑杆练习 = new List<BuildingTechCost>();
|
|
public List<BuildingTechCost> 木像升级 = new List<BuildingTechCost>();
|
|
public List<BuildingTechCost> 大团工匠 = new List<BuildingTechCost>();
|
|
|
|
|
|
|
|
void Awake()
|
|
{
|
|
if (Instance == null)
|
|
{
|
|
Instance = this;
|
|
techCostDictionary = new Dictionary<string, List<BuildingTechCost>>();
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
//伐木背包需要手动调
|
|
techCostDictionary["高速磕头"] = 高速磕头;
|
|
techCostDictionary["信仰压缩"] = 信仰压缩;
|
|
techCostDictionary["一心虔诚"] = 一心虔诚;
|
|
techCostDictionary["小祭司"] = 小祭司;
|
|
techCostDictionary["铸造太阳神之眼"] = 铸造太阳神之眼;
|
|
techCostDictionary["撑杆练习"] = 撑杆练习;
|
|
techCostDictionary["木像升级"] = 木像升级;
|
|
techCostDictionary["大团工匠"] = 大团工匠;
|
|
|
|
|
|
}
|
|
|
|
public void CreateUpdates(SpecailBuff_Buildings sb, string UpName,Action action)
|
|
{
|
|
if (techCostDictionary.ContainsKey(UpName))
|
|
{
|
|
BuildingTechCost btcc = techCostDictionary[UpName][techCostDictionary[UpName].Count-1];
|
|
bool containsValue = (UpName == "高速磕头" || UpName == "撑杆练习" || UpName == "木像升级" || UpName == "一心虔诚") ;
|
|
SpecailBuff_Buildings.BuildingTechItem btc = sb.CreateTechItem(null, action, UpName,
|
|
btcc.信仰,
|
|
btcc.木材,
|
|
btcc.团子, false,containsValue?techCostDictionary[UpName].Count-1:-1);
|
|
|
|
for (int i = techCostDictionary[UpName].Count-2; i >=0; i--)
|
|
{
|
|
btcc = techCostDictionary[UpName][i];
|
|
SpecailBuff_Buildings.BuildingTechItem bt = sb.CreateTechItem(btc, action , UpName,
|
|
btcc.信仰,
|
|
btcc.木材,
|
|
btcc.团子, i==0,containsValue?i:-1);
|
|
btc = bt;
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
Debug.LogWarning("没有对应升级项目!");
|
|
}
|
|
}
|
|
|
|
}
|