From 1aeb815836d84ecfddf761a47862efebbba0ad03 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 12 二月 2019 21:55:16 +0800
Subject: [PATCH] 3335 配置表读取重构。
---
Core/GameEngine/Model/Config/MapConfig.cs | 106 +++++++++++++++++++++++++++--------------------------
1 files changed, 54 insertions(+), 52 deletions(-)
diff --git a/Core/GameEngine/Model/Config/MapConfig.cs b/Core/GameEngine/Model/Config/MapConfig.cs
index 76ee7d7..8f8eb5d 100644
--- a/Core/GameEngine/Model/Config/MapConfig.cs
+++ b/Core/GameEngine/Model/Config/MapConfig.cs
@@ -1,82 +1,84 @@
-锘�//--------------------------------------------------------
-// [Author]: 绗簩涓栫晫
-// [ Date ]: Friday, May 25, 2018
-//--------------------------------------------------------
-
-using UnityEngine;
-using System;
-
-namespace TableConfig {
-
-
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Tuesday, February 12, 2019
+//--------------------------------------------------------
+
+using UnityEngine;
+using System;
+
+namespace TableConfig {
+
+
public partial class MapConfig : ConfigBase {
- public int MapID { get ; private set ; }
- public string Name { get ; private set; }
- public int LV { get ; private set ; }
- public int MapFBType { get ; private set ; }
- public int LocalReborn { get ; private set ; }
- public int SkillReborn { get ; private set ; }
- public int CanRide { get ; private set ; }
- public int CanOutPet { get ; private set ; }
- public int TeamLimit { get ; private set ; }
+ public int MapID;
+ public string Name;
+ public int LV;
+ public int MapFBType;
+ public int LocalReborn;
+ public int SkillReborn;
+ public int CanRide;
+ public int CanOutPet;
+ public int TeamLimit;
public Vector3[] BornPoints;
- public int MainTaskID { get ; private set ; }
- public string MapTaskText { get ; private set; }
- public int Camp { get ; private set ; }
- public int AtkType { get ; private set ; }
-
+ public int MainTaskID;
+ public string MapTaskText;
+ public int Camp;
+ public int AtkType;
+
public override string getKey()
{
return MapID.ToString();
- }
-
- public override void Parse() {
+ }
+
+ public override void Parse(string content) {
try
{
- MapID=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0;
+ var contents = content.Split('\t');
+
+ int.TryParse(contents[0],out MapID);
- Name = rawContents[1].Trim();
+ Name = contents[1];
- LV=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0;
+ int.TryParse(contents[2],out LV);
- MapFBType=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0;
+ int.TryParse(contents[3],out MapFBType);
- LocalReborn=IsNumeric(rawContents[4]) ? int.Parse(rawContents[4]):0;
+ int.TryParse(contents[4],out LocalReborn);
- SkillReborn=IsNumeric(rawContents[5]) ? int.Parse(rawContents[5]):0;
+ int.TryParse(contents[5],out SkillReborn);
- CanRide=IsNumeric(rawContents[6]) ? int.Parse(rawContents[6]):0;
+ int.TryParse(contents[6],out CanRide);
- CanOutPet=IsNumeric(rawContents[7]) ? int.Parse(rawContents[7]):0;
+ int.TryParse(contents[7],out CanOutPet);
- TeamLimit=IsNumeric(rawContents[8]) ? int.Parse(rawContents[8]):0;
+ int.TryParse(contents[8],out TeamLimit);
- string[] BornPointsStringArray = rawContents[9].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ var BornPointsStringArray = contents[9].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
BornPoints = new Vector3[BornPointsStringArray.Length];
for (int i=0;i<BornPointsStringArray.Length;i++)
{
BornPoints[i]=BornPointsStringArray[i].Vector3Parse();
}
- MainTaskID=IsNumeric(rawContents[10]) ? int.Parse(rawContents[10]):0;
+ int.TryParse(contents[10],out MainTaskID);
- MapTaskText = rawContents[11].Trim();
+ MapTaskText = contents[11];
- Camp=IsNumeric(rawContents[12]) ? int.Parse(rawContents[12]):0;
+ int.TryParse(contents[12],out Camp);
- AtkType=IsNumeric(rawContents[13]) ? int.Parse(rawContents[13]):0;
+ int.TryParse(contents[13],out AtkType);
}
catch (Exception ex)
{
DebugEx.Log(ex);
- }
- }
-
- }
-
-}
-
-
-
-
+ }
+ }
+
+ }
+
+}
+
+
+
+
--
Gitblit v1.8.0