GuaProbablityPool.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using cfg;
  5. public class GuaProbablityPool : MonoBehaviour
  6. {
  7. [System.Serializable]
  8. //记录每个士兵每个种类当前所剩的卦象池
  9. public struct SoldierGuaPool
  10. {
  11. public SoldierType soldier;
  12. public int icon;
  13. public List<int> pool;
  14. }
  15. //public List<SingleGuaProbability> guaProbabilities;
  16. private SoldierType[] curSoldiers;
  17. [Header("卦象概率池")]
  18. [DisplayOnly]
  19. public List<SoldierGuaPool> guaPool;
  20. private List<SoldierGuaPool> origPool;
  21. private void Start()
  22. {
  23. //guaProbabilities = GameManager.instance.allCfgData.CfgGuaProbability.DataList;
  24. curSoldiers = GameManager.curSoldiers;
  25. //SetGuaPoolList();
  26. origPool = new List<SoldierGuaPool>(guaPool);
  27. }
  28. /*
  29. public void SetGuaPoolList()
  30. {
  31. int i = 0;
  32. foreach (SingleGuaProbability sgpro in guaProbabilities)
  33. {
  34. SoldierGuaPool sgp = new SoldierGuaPool();
  35. if (sgpro.SoldierType.Contains("Soul"))
  36. {
  37. sgp.icon = 1;
  38. }
  39. else
  40. {
  41. sgp.icon = 0;
  42. }
  43. foreach(SoldierType st in curSoldiers)
  44. {
  45. if (sgpro.SoldierType.Contains(st.ToString()))
  46. {
  47. sgp.soldier = st;
  48. break;
  49. }
  50. }
  51. List<int> tempPool = new List<int>();
  52. for (int j = 0; j < sgpro.Gua1; j++)
  53. {
  54. tempPool.Add(0);
  55. }
  56. for (int j = 0; j < sgpro.Gua2; j++)
  57. {
  58. tempPool.Add(1);
  59. }
  60. for (int j = 0; j < sgpro.Gua3; j++)
  61. {
  62. tempPool.Add(2);
  63. }
  64. for (int j = 0; j < sgpro.Gua4; j++)
  65. {
  66. tempPool.Add(3);
  67. }
  68. for (int j = 0; j < sgpro.Gua5; j++)
  69. {
  70. tempPool.Add(4);
  71. }
  72. for (int j = 0; j < sgpro.Gua6; j++)
  73. {
  74. tempPool.Add(5);
  75. }
  76. for (int j = 0; j < sgpro.Gua7; j++)
  77. {
  78. tempPool.Add(6);
  79. }
  80. for (int j = 0; j < sgpro.Gua8; j++)
  81. {
  82. tempPool.Add(7);
  83. }
  84. sgp.pool = new List<int>(tempPool);
  85. guaPool[i] = sgp;
  86. i += 1;
  87. }
  88. }
  89. */
  90. public void ResetGuaPool(int id)
  91. {
  92. guaPool[id] = origPool[id];
  93. }
  94. }