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/DialogConfig.cs | 80 ++++++++++++++++++++-------------------
1 files changed, 41 insertions(+), 39 deletions(-)
diff --git a/Core/GameEngine/Model/Config/DialogConfig.cs b/Core/GameEngine/Model/Config/DialogConfig.cs
index ed4ce45..8415d8f 100644
--- a/Core/GameEngine/Model/Config/DialogConfig.cs
+++ b/Core/GameEngine/Model/Config/DialogConfig.cs
@@ -1,56 +1,58 @@
-锘�//--------------------------------------------------------
-// [Author]: 绗簩涓栫晫
-// [ Date ]: Friday, June 29, 2018
-//--------------------------------------------------------
-
-using UnityEngine;
-using System;
-
-namespace TableConfig {
-
-
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Tuesday, February 12, 2019
+//--------------------------------------------------------
+
+using UnityEngine;
+using System;
+
+namespace TableConfig {
+
+
public partial class DialogConfig : ConfigBase {
- public int id { get ; private set ; }
- public int npcId { get ; private set ; }
- public string icon { get ; private set; }
- public string name { get ; private set; }
- public string content { get ; private set; }
- public int nextID { get ; private set ; }
- public int TalkID { get ; private set ; }
-
+ public int id;
+ public int npcId;
+ public string icon;
+ public string name;
+ public string content;
+ public int nextID;
+ public int TalkID;
+
public override string getKey()
{
return id.ToString();
- }
-
- public override void Parse() {
+ }
+
+ public override void Parse(string content) {
try
{
- id=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0;
+ var contents = content.Split('\t');
+
+ int.TryParse(contents[0],out id);
- npcId=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0;
+ int.TryParse(contents[1],out npcId);
- icon = rawContents[2].Trim();
+ icon = contents[2];
- name = rawContents[3].Trim();
+ name = contents[3];
- content = rawContents[4].Trim();
+ content = contents[4];
- nextID=IsNumeric(rawContents[5]) ? int.Parse(rawContents[5]):0;
+ int.TryParse(contents[5],out nextID);
- TalkID=IsNumeric(rawContents[6]) ? int.Parse(rawContents[6]):0;
+ int.TryParse(contents[6],out TalkID);
}
catch (Exception ex)
{
DebugEx.Log(ex);
- }
- }
-
- }
-
-}
-
-
-
-
+ }
+ }
+
+ }
+
+}
+
+
+
+
--
Gitblit v1.8.0