|
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|
|
using System.IO;
|
|
using System.IO;
|
|
|
using TMPro;
|
|
using TMPro;
|
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
|
|
|
+using UnityEngine.SceneManagement;
|
|
|
using UnityEngine.UI;
|
|
using UnityEngine.UI;
|
|
|
using Spine.Unity;
|
|
using Spine.Unity;
|
|
|
public enum AttributeTag
|
|
public enum AttributeTag
|
|
@@ -50,13 +51,7 @@ public enum TargetType
|
|
|
public class GameManager : MonoBehaviour
|
|
public class GameManager : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
public static GameManager instance;
|
|
public static GameManager instance;
|
|
|
- [FoldoutGroup("士兵相关")][LabelText("技能树/属性")][SerializeField]public List<DemonicAttributes> demonicAttributes = new List<DemonicAttributes>
|
|
|
|
|
- {
|
|
|
|
|
- new DemonicAttributes(),
|
|
|
|
|
- new DemonicAttributes(),
|
|
|
|
|
- new DemonicAttributes()
|
|
|
|
|
- };
|
|
|
|
|
- [FoldoutGroup("士兵相关")][LabelText("等级间隔")]public int gradeInterval;
|
|
|
|
|
|
|
+
|
|
|
[FoldoutGroup("组件", order: -1)] public UIHP p1uiHP;
|
|
[FoldoutGroup("组件", order: -1)] public UIHP p1uiHP;
|
|
|
[FoldoutGroup("组件")] public UIHP p1uiMP;
|
|
[FoldoutGroup("组件")] public UIHP p1uiMP;
|
|
|
[FoldoutGroup("组件")] public Transform p1uiRush;
|
|
[FoldoutGroup("组件")] public Transform p1uiRush;
|
|
@@ -69,15 +64,28 @@ public class GameManager : MonoBehaviour
|
|
|
[FoldoutGroup("组件")] public TextMeshProUGUI moneyText;
|
|
[FoldoutGroup("组件")] public TextMeshProUGUI moneyText;
|
|
|
[FoldoutGroup("组件")] public PlayerController player;
|
|
[FoldoutGroup("组件")] public PlayerController player;
|
|
|
|
|
|
|
|
- [FoldoutGroup("金币结算", order: -1)][LabelText("限制时间")] public int rewardTime;
|
|
|
|
|
- [FoldoutGroup("金币结算")][LabelText("金币奖励")] public int totalMoney;
|
|
|
|
|
- [FoldoutGroup("金币结算")][LabelText("额外金币奖励")] public int extraMoney;
|
|
|
|
|
- [FoldoutGroup("金币结算")][LabelText("惩罚时间间隔")] public int deductMoneyTime;
|
|
|
|
|
- [FoldoutGroup("金币结算")][LabelText("每次惩罚扣除金币数量")] public int deductMoney;
|
|
|
|
|
|
|
+ [FoldoutGroup("场景")] public string bossSceneName;
|
|
|
|
|
+
|
|
|
|
|
+ [FoldoutGroup("士兵相关")]
|
|
|
|
|
+ [LabelText("技能树/属性")]
|
|
|
|
|
+ [SerializeField]
|
|
|
|
|
+ public List<DemonicAttributes> demonicAttributes = new List<DemonicAttributes>
|
|
|
|
|
+ {
|
|
|
|
|
+ new DemonicAttributes(),
|
|
|
|
|
+ new DemonicAttributes(),
|
|
|
|
|
+ new DemonicAttributes()
|
|
|
|
|
+ };
|
|
|
|
|
+ [FoldoutGroup("士兵相关")] [LabelText("等级间隔")] public int gradeInterval;
|
|
|
|
|
+
|
|
|
|
|
+ [FoldoutGroup("金币结算")] [LabelText("限制时间")] public int rewardTime;
|
|
|
|
|
+ [FoldoutGroup("金币结算")] [LabelText("金币奖励")] public int totalMoney;
|
|
|
|
|
+ [FoldoutGroup("金币结算")] [LabelText("额外金币奖励")] public int extraMoney;
|
|
|
|
|
+ [FoldoutGroup("金币结算")] [LabelText("惩罚时间间隔")] public int deductMoneyTime;
|
|
|
|
|
+ [FoldoutGroup("金币结算")] [LabelText("每次惩罚扣除金币数量")] public int deductMoney;
|
|
|
[Header("金币掉落")]
|
|
[Header("金币掉落")]
|
|
|
- [FoldoutGroup("金币结算")][LabelText("怪物掉落金币数量")] public int enemyGoldDrop;
|
|
|
|
|
- [FoldoutGroup("金币结算")][LabelText("金币掉落特效")] public GameObject dropGoldFX;
|
|
|
|
|
- [FoldoutGroup("金币结算")][LabelText("金币掉落字体")] public GameObject dropGoldText;
|
|
|
|
|
|
|
+ [FoldoutGroup("金币结算")] [LabelText("怪物掉落金币数量")] public int enemyGoldDrop;
|
|
|
|
|
+ [FoldoutGroup("金币结算")] [LabelText("金币掉落特效")] public GameObject dropGoldFX;
|
|
|
|
|
+ [FoldoutGroup("金币结算")] [LabelText("金币掉落字体")] public GameObject dropGoldText;
|
|
|
|
|
|
|
|
[FoldoutGroup("标签")] [LabelText("单属性解锁阈值")] public int singleAttributeUnlockThreshold = 5;
|
|
[FoldoutGroup("标签")] [LabelText("单属性解锁阈值")] public int singleAttributeUnlockThreshold = 5;
|
|
|
[FoldoutGroup("标签")] [LabelText("双属性解锁阈值")] public int dualAttributeUnlockThreshold = 10;
|
|
[FoldoutGroup("标签")] [LabelText("双属性解锁阈值")] public int dualAttributeUnlockThreshold = 10;
|
|
@@ -105,7 +113,7 @@ public class GameManager : MonoBehaviour
|
|
|
[FoldoutGroup("标签/雷")] [LabelText("感电攻速比值")] [PropertyRange(0, 1)] public float attackSpeedScale = 0.6f;
|
|
[FoldoutGroup("标签/雷")] [LabelText("感电攻速比值")] [PropertyRange(0, 1)] public float attackSpeedScale = 0.6f;
|
|
|
[FoldoutGroup("标签/雷")] [LabelText("易伤比值")] [PropertyRange(0, 2)] public float vulnerableRate = 0.5f;
|
|
[FoldoutGroup("标签/雷")] [LabelText("易伤比值")] [PropertyRange(0, 2)] public float vulnerableRate = 0.5f;
|
|
|
|
|
|
|
|
- [FoldoutGroup("标签/雷")] [LabelText("伤害")] public int thunderDamage =3;
|
|
|
|
|
|
|
+ [FoldoutGroup("标签/雷")] [LabelText("伤害")] public int thunderDamage = 3;
|
|
|
[FoldoutGroup("标签/雷")] [LabelText("感电效果时间")] public float electrifyTime;
|
|
[FoldoutGroup("标签/雷")] [LabelText("感电效果时间")] public float electrifyTime;
|
|
|
[FoldoutGroup("标签/雷")] [LabelText("标签作用比值")] public float thunderLabelEffectRatio;
|
|
[FoldoutGroup("标签/雷")] [LabelText("标签作用比值")] public float thunderLabelEffectRatio;
|
|
|
|
|
|
|
@@ -148,18 +156,18 @@ public class GameManager : MonoBehaviour
|
|
|
[FoldoutGroup("标签/天地")] [LabelText("标签作用比值")] public float skyGroundLabelEffectRatio;
|
|
[FoldoutGroup("标签/天地")] [LabelText("标签作用比值")] public float skyGroundLabelEffectRatio;
|
|
|
|
|
|
|
|
[Header("商店刷新")]
|
|
[Header("商店刷新")]
|
|
|
- [ValidateInput("CheckTagWeight","标签池子概率总和不是100%")]
|
|
|
|
|
|
|
+ [ValidateInput("CheckTagWeight", "标签池子概率总和不是100%")]
|
|
|
[FoldoutGroup("Rogue")] [LabelText("标签池子比重(%)")] [Tooltip("最高标签池;标签池;公共池")] public List<float> tagWeight;
|
|
[FoldoutGroup("Rogue")] [LabelText("标签池子比重(%)")] [Tooltip("最高标签池;标签池;公共池")] public List<float> tagWeight;
|
|
|
|
|
|
|
|
public static readonly Dictionary<string, TargetType> TagToTargetTypeMap = new Dictionary<string, TargetType>(StringComparer.Ordinal);
|
|
public static readonly Dictionary<string, TargetType> TagToTargetTypeMap = new Dictionary<string, TargetType>(StringComparer.Ordinal);
|
|
|
public bool CheckTagWeight(List<float> weights)
|
|
public bool CheckTagWeight(List<float> weights)
|
|
|
{
|
|
{
|
|
|
float num = 0;
|
|
float num = 0;
|
|
|
- for(int i = 0; i < 3; i++)
|
|
|
|
|
|
|
+ for (int i = 0; i < 3; i++)
|
|
|
{
|
|
{
|
|
|
num += weights[i];
|
|
num += weights[i];
|
|
|
}
|
|
}
|
|
|
- if(num == 100)
|
|
|
|
|
|
|
+ if (num == 100)
|
|
|
{
|
|
{
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -167,12 +175,12 @@ public class GameManager : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
[FoldoutGroup("Rogue")] [LabelText("第几关开始出现(%)")] public List<int> unlockLevel;
|
|
[FoldoutGroup("Rogue")] [LabelText("第几关开始出现(%)")] public List<int> unlockLevel;
|
|
|
[FoldoutGroup("Rogue")] [LabelText("基础几率(%)")] public List<float> baseChance;
|
|
[FoldoutGroup("Rogue")] [LabelText("基础几率(%)")] public List<float> baseChance;
|
|
|
[FoldoutGroup("Rogue")] [LabelText("每关增加的几率(%)")] public List<float> chanceIncreasePerLevel;
|
|
[FoldoutGroup("Rogue")] [LabelText("每关增加的几率(%)")] public List<float> chanceIncreasePerLevel;
|
|
|
- [FoldoutGroup("Rogue")] [LabelText("最大几率(%)")] public List<float> maximumChance ;
|
|
|
|
|
|
|
+ [FoldoutGroup("Rogue")] [LabelText("最大几率(%)")] public List<float> maximumChance;
|
|
|
[FoldoutGroup("Rogue")] public List<List<List<SingleTreasureConfig>>> treasuresList;
|
|
[FoldoutGroup("Rogue")] public List<List<List<SingleTreasureConfig>>> treasuresList;
|
|
|
[FoldoutGroup("Rogue")] [DisplayOnly] public List<float> trueRefreshChance;
|
|
[FoldoutGroup("Rogue")] [DisplayOnly] public List<float> trueRefreshChance;
|
|
|
[FoldoutGroup("Rogue")] [HideInInspector] public List<float> refreshChance;
|
|
[FoldoutGroup("Rogue")] [HideInInspector] public List<float> refreshChance;
|
|
@@ -209,7 +217,7 @@ public class GameManager : MonoBehaviour
|
|
|
public List<CreateEnemyConfig> createEnemyConfigs;
|
|
public List<CreateEnemyConfig> createEnemyConfigs;
|
|
|
[DisplayOnly] public GameType gameType;
|
|
[DisplayOnly] public GameType gameType;
|
|
|
[DisplayOnly] public float levelRatio = 1;
|
|
[DisplayOnly] public float levelRatio = 1;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
private JSONNode Loader(string fileName)
|
|
private JSONNode Loader(string fileName)
|
|
|
{
|
|
{
|
|
|
return JSON.Parse(File.ReadAllText("GenerateDatas/json/" + fileName + ".json"));
|
|
return JSON.Parse(File.ReadAllText("GenerateDatas/json/" + fileName + ".json"));
|
|
@@ -232,24 +240,25 @@ public class GameManager : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
private void Awake()
|
|
private void Awake()
|
|
|
{
|
|
{
|
|
|
- //选定本局游戏有哪些士兵,后面兵多了这里要改
|
|
|
|
|
- curSoldiers = new SoldierType[3];
|
|
|
|
|
- curSoldiers[0] = SoldierType.sword;
|
|
|
|
|
- curSoldiers[1] = SoldierType.shield;
|
|
|
|
|
- curSoldiers[2] = SoldierType.spear;
|
|
|
|
|
-
|
|
|
|
|
if (!instance)
|
|
if (!instance)
|
|
|
{
|
|
{
|
|
|
instance = this;
|
|
instance = this;
|
|
|
- GetAllExcel();
|
|
|
|
|
- ReloadCfgCreateEnemyData();
|
|
|
|
|
|
|
+ DontDestroyOnLoad(gameObject);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- DestroyImmediate(gameObject);
|
|
|
|
|
|
|
+ Destroy(gameObject);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- //leveType = LeveType.Introduction;
|
|
|
|
|
|
|
+ GetAllExcel();
|
|
|
|
|
+ ReloadCfgCreateEnemyData();
|
|
|
|
|
+ //选定本局游戏有哪些士兵,后面兵多了这里要改
|
|
|
|
|
+ curSoldiers = new SoldierType[3];
|
|
|
|
|
+ curSoldiers[0] = SoldierType.sword;
|
|
|
|
|
+ curSoldiers[1] = SoldierType.shield;
|
|
|
|
|
+ curSoldiers[2] = SoldierType.spear;
|
|
|
|
|
+
|
|
|
|
|
+ leveType = LeveType.Introduction;
|
|
|
myTreasures = new List<Treasure>();
|
|
myTreasures = new List<Treasure>();
|
|
|
treasuresList = new List<List<List<SingleTreasureConfig>>>();
|
|
treasuresList = new List<List<List<SingleTreasureConfig>>>();
|
|
|
refreshChance = new List<float>();
|
|
refreshChance = new List<float>();
|
|
@@ -257,7 +266,7 @@ public class GameManager : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
treasuresList.Add(new List<List<SingleTreasureConfig>>());
|
|
treasuresList.Add(new List<List<SingleTreasureConfig>>());
|
|
|
refreshChance.Add(baseChance[i]);
|
|
refreshChance.Add(baseChance[i]);
|
|
|
- for(int j = 0; j < 9; j++)
|
|
|
|
|
|
|
+ for (int j = 0; j < 9; j++)
|
|
|
{
|
|
{
|
|
|
treasuresList[i].Add(new List<SingleTreasureConfig>());
|
|
treasuresList[i].Add(new List<SingleTreasureConfig>());
|
|
|
}
|
|
}
|
|
@@ -269,11 +278,11 @@ public class GameManager : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
trueRefreshChance.Add(refreshChance[3]);
|
|
trueRefreshChance.Add(refreshChance[3]);
|
|
|
List<SingleTreasureConfig> cfgTreasureList = allCfgData.CfgTreasure.DataList;
|
|
List<SingleTreasureConfig> cfgTreasureList = allCfgData.CfgTreasure.DataList;
|
|
|
- for(int i = 0;i< cfgTreasureList.Count; i++)
|
|
|
|
|
|
|
+ for (int i = 0; i < cfgTreasureList.Count; i++)
|
|
|
{
|
|
{
|
|
|
SingleTreasureConfig singleTreasureConfig = cfgTreasureList[i];
|
|
SingleTreasureConfig singleTreasureConfig = cfgTreasureList[i];
|
|
|
treasuresList[singleTreasureConfig.Quality][0].Add(singleTreasureConfig);
|
|
treasuresList[singleTreasureConfig.Quality][0].Add(singleTreasureConfig);
|
|
|
- for(int j = 0; j < singleTreasureConfig.Tag.Count;j++)
|
|
|
|
|
|
|
+ for (int j = 0; j < singleTreasureConfig.Tag.Count; j++)
|
|
|
{
|
|
{
|
|
|
treasuresList[singleTreasureConfig.Quality][singleTreasureConfig.Tag[j]].Add(singleTreasureConfig);
|
|
treasuresList[singleTreasureConfig.Quality][singleTreasureConfig.Tag[j]].Add(singleTreasureConfig);
|
|
|
}
|
|
}
|
|
@@ -333,11 +342,11 @@ public class GameManager : MonoBehaviour
|
|
|
AddMoney(dropGold);
|
|
AddMoney(dropGold);
|
|
|
shopButton.SetActive(true);
|
|
shopButton.SetActive(true);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
public void AddMoney(int enemyDrop)
|
|
public void AddMoney(int enemyDrop)
|
|
|
{
|
|
{
|
|
|
int addMoney;
|
|
int addMoney;
|
|
|
- if(gameTime < rewardTime)
|
|
|
|
|
|
|
+ if (gameTime < rewardTime)
|
|
|
{
|
|
{
|
|
|
addMoney = totalMoney + extraMoney;
|
|
addMoney = totalMoney + extraMoney;
|
|
|
}
|
|
}
|
|
@@ -355,7 +364,7 @@ public class GameManager : MonoBehaviour
|
|
|
public void NextLevel()
|
|
public void NextLevel()
|
|
|
{
|
|
{
|
|
|
shopButton.SetActive(false);
|
|
shopButton.SetActive(false);
|
|
|
- if(nowLevel - 1 < ratioIncrease.Count)
|
|
|
|
|
|
|
+ if (nowLevel - 1 < ratioIncrease.Count)
|
|
|
{
|
|
{
|
|
|
levelRatio += ratioIncrease[nowLevel - 1];
|
|
levelRatio += ratioIncrease[nowLevel - 1];
|
|
|
}
|
|
}
|
|
@@ -375,17 +384,20 @@ public class GameManager : MonoBehaviour
|
|
|
case LeveType.Conclusion:
|
|
case LeveType.Conclusion:
|
|
|
leveType = LeveType.Boss;
|
|
leveType = LeveType.Boss;
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case LeveType.Boss:
|
|
|
|
|
+ SceneManager.LoadScene(bossSceneName);
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
PlayersInput.instance[0].PlayerRevive();
|
|
PlayersInput.instance[0].PlayerRevive();
|
|
|
- foreach(List<GameObject> objs in PoolManager.instance.activeObjs.Values)
|
|
|
|
|
|
|
+ foreach (List<GameObject> objs in PoolManager.instance.activeObjs.Values)
|
|
|
{
|
|
{
|
|
|
List<GameObject> newObjs = new List<GameObject>(objs);
|
|
List<GameObject> newObjs = new List<GameObject>(objs);
|
|
|
- for(int i = 0; i < newObjs.Count; i++)
|
|
|
|
|
|
|
+ for (int i = 0; i < newObjs.Count; i++)
|
|
|
{
|
|
{
|
|
|
newObjs[i].gameObject.SetActive(false);
|
|
newObjs[i].gameObject.SetActive(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- for(int i = 0; i < 3; i++)
|
|
|
|
|
|
|
+ for (int i = 0; i < 3; i++)
|
|
|
{
|
|
{
|
|
|
player.demonicDic[i] = new List<Demonic>();
|
|
player.demonicDic[i] = new List<Demonic>();
|
|
|
demonicNum[i].GetComponentInChildren<TextMeshProUGUI>().text = "0";
|
|
demonicNum[i].GetComponentInChildren<TextMeshProUGUI>().text = "0";
|
|
@@ -395,7 +407,7 @@ public class GameManager : MonoBehaviour
|
|
|
gameTime = 0;
|
|
gameTime = 0;
|
|
|
gameType = GameType.Gaming;
|
|
gameType = GameType.Gaming;
|
|
|
nowLevel += 1;
|
|
nowLevel += 1;
|
|
|
- ChangeRogueChance();
|
|
|
|
|
|
|
+ ChangeRogueChance();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void ShowShop()
|
|
public void ShowShop()
|
|
@@ -457,7 +469,7 @@ public class GameManager : MonoBehaviour
|
|
|
break;
|
|
break;
|
|
|
case "伤害":
|
|
case "伤害":
|
|
|
damage += (int)data;
|
|
damage += (int)data;
|
|
|
- foreach(DemonicAttributes demonicAttribute in demonicAttributes)
|
|
|
|
|
|
|
+ foreach (DemonicAttributes demonicAttribute in demonicAttributes)
|
|
|
{
|
|
{
|
|
|
demonicAttribute.ownDamage += (int)(data * demonicAttribute.damageGainEfficiency);
|
|
demonicAttribute.ownDamage += (int)(data * demonicAttribute.damageGainEfficiency);
|
|
|
}
|
|
}
|
|
@@ -556,12 +568,12 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
|
|
|
public void ChangeRogueChance()
|
|
public void ChangeRogueChance()
|
|
|
{
|
|
{
|
|
|
- for(int i = 0; i < 4; i++)
|
|
|
|
|
|
|
+ for (int i = 0; i < 4; i++)
|
|
|
{
|
|
{
|
|
|
- if(nowLevel >= unlockLevel[i])
|
|
|
|
|
|
|
+ if (nowLevel >= unlockLevel[i])
|
|
|
{
|
|
{
|
|
|
refreshChance[i] += chanceIncreasePerLevel[i];
|
|
refreshChance[i] += chanceIncreasePerLevel[i];
|
|
|
- if(refreshChance[i] > maximumChance[i])
|
|
|
|
|
|
|
+ if (refreshChance[i] > maximumChance[i])
|
|
|
{
|
|
{
|
|
|
refreshChance[i] = maximumChance[i];
|
|
refreshChance[i] = maximumChance[i];
|
|
|
}
|
|
}
|
|
@@ -578,7 +590,7 @@ public class GameManager : MonoBehaviour
|
|
|
[Serializable]
|
|
[Serializable]
|
|
|
public class DemonicAttributes
|
|
public class DemonicAttributes
|
|
|
{
|
|
{
|
|
|
- [ShowInInspector][SerializeField] public List<DemonicSkill> skillTree;
|
|
|
|
|
|
|
+ [ShowInInspector] [SerializeField] public List<DemonicSkill> skillTree;
|
|
|
public int levelCount;
|
|
public int levelCount;
|
|
|
public SkeletonDataAsset sda;
|
|
public SkeletonDataAsset sda;
|
|
|
|
|
|