浏览代码

新增不同关卡不同的经验倍率

wgl 5 月之前
父节点
当前提交
d1dc9865f1

+ 4 - 0
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/Editor/GameMapEdPopup.cs

@@ -193,6 +193,7 @@ public class GameMapEdPopup : PopupWindowContent
 			ExcelEditor.RemoveExcelRows(package, gameMap.showIdent, 10, 500);
 			ExcelEditor.ModifyExcel(package, gameMap.showIdent, "D5", GameMapEditor.mapSize_w.ToString());
 			ExcelEditor.ModifyExcel(package, gameMap.showIdent, "D6", GameMapEditor.mapSize_h.ToString());
+			ExcelEditor.ModifyExcel(package, gameMap.showIdent, "F5", gameMap.expRatio.ToString());
 
 			int cell_row = 10;
 			float idFloat = 0f;
@@ -344,6 +345,7 @@ public class GameMapEdPopup : PopupWindowContent
 			ExcelEditor.RemoveExcelRows(package, gameMap.showIdent, 10, 500);
 			ExcelEditor.ModifyExcel(package, gameMap.showIdent, "D5", GameMapEditor.mapSize_w.ToString());
 			ExcelEditor.ModifyExcel(package, gameMap.showIdent, "D6", GameMapEditor.mapSize_h.ToString());
+			ExcelEditor.ModifyExcel(package, gameMap.showIdent, "F5", gameMap.expRatio.ToString());
 
 			int cell_row = 10;
 			int idInt = 0;
@@ -440,6 +442,7 @@ public class GameMapEdPopup : PopupWindowContent
 			gameMap.showIdent = gameMap.ident;
 			int.TryParse(ExcelEditor.GetCellData(package, excelWorksheets[mapIdx - 1], "D5"), out GameMapEditor.mapSize_w);
 			int.TryParse(ExcelEditor.GetCellData(package, excelWorksheets[mapIdx - 1], "D6"), out GameMapEditor.mapSize_h);
+			float.TryParse(ExcelEditor.GetCellData(package, excelWorksheets[mapIdx - 1], "F5"), out gameMap.expRatio);
 			gameMap.Resize(GameMapEditor.mapSize_w, GameMapEditor.mapSize_h);
 		}
 
@@ -555,6 +558,7 @@ public class GameMapEdPopup : PopupWindowContent
 			gameMap.showIdent = gameMap.ident;
 			int.TryParse(ExcelEditor.GetCellData(package, excelWorksheets[sheetId], "D5"), out GameMapEditor.mapSize_w);
 			int.TryParse(ExcelEditor.GetCellData(package, excelWorksheets[sheetId], "D6"), out GameMapEditor.mapSize_h);
+			float.TryParse(ExcelEditor.GetCellData(package, excelWorksheets[mapIdx - 1], "F5"), out gameMap.expRatio);
 			gameMap.Resize(GameMapEditor.mapSize_w, GameMapEditor.mapSize_h);
 			gameMap.isDynamic = true;
 		}

+ 1 - 0
ActionTowerDefense/Assets/GameLevelEditor/GameMap/CoreScripts/GameMap.cs

@@ -21,6 +21,7 @@ public class GameMap
 	public int height;
 
 	public bool isDynamic;
+	public float expRatio;
 	/// <summary> The grid/map. -1 is an empty tile, else a value related to GameMapTile.id will be present 
     /// This is also known as layer-0 or the default layer when there are movethan one layer in the map.
     /// </summary>

+ 1 - 1
ActionTowerDefense/Assets/Scripts/Characters/Enemy.cs

@@ -424,7 +424,7 @@ public class Enemy : MoveCharacter
                     if (killer.GetComponent<Demonic>())
                     {
                         SoldierType st = killer.GetComponent<Demonic>().soldierType;
-                        SoldierEXP.expInstance.AddEXP(st, exp);
+                        SoldierEXP.expInstance.AddEXP(st, (int)(exp * LevelSelect.EXPRatio + 0.5f));
                     }
                     gameObject.SetActive(false);
                     break;

+ 13 - 1
ActionTowerDefense/Assets/Scripts/Levels/LevelSelect.cs

@@ -26,6 +26,7 @@ public class LevelSelect : MonoBehaviour
 
     [Header("当前关卡序号")]
     public int curLevelID;
+    [ReadOnly] public static float EXPRatio;
 
     [DisplayOnly] public List<string> levels;
     [Button("-Reload-",ButtonSizes.Large)]
@@ -47,10 +48,21 @@ public class LevelSelect : MonoBehaviour
 
     //[Header("所有关卡配置")]
     //public Level[] levelConfig;
+    private void OnValidate()
+    {
+        List<string> sheets = new();
+        FileInfo fileInfo = new FileInfo("Luban/Config/Datas/出怪表.xlsx");
+        using (ExcelPackage package = new ExcelPackage(fileInfo))
+        {
+            sheets = ExcelEditor.ReadExcelSheetsInfo(package);
+            float.TryParse(ExcelEditor.GetCellData(package, sheets[curLevelID - 1], "F5"), out EXPRatio);
+        }
+    }
+
 
     private void Awake()
     {
-
         curLevel.text = levels[curLevelID - 1];
+
     }
 }

二进制
ActionTowerDefense/Luban/Config/Datas/出怪表.xlsx