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/RedPackConfig.cs | 110 ++++++++++++++++++++++++++++---------------------------
1 files changed, 56 insertions(+), 54 deletions(-)
diff --git a/Core/GameEngine/Model/Config/RedPackConfig.cs b/Core/GameEngine/Model/Config/RedPackConfig.cs
index 997e80b..29f91c8 100644
--- a/Core/GameEngine/Model/Config/RedPackConfig.cs
+++ b/Core/GameEngine/Model/Config/RedPackConfig.cs
@@ -1,62 +1,64 @@
-锘�//--------------------------------------------------------
-// [Author]: 绗簩涓栫晫
-// [ Date ]: Monday, January 28, 2019
-//--------------------------------------------------------
-
-using UnityEngine;
-using System;
-
-namespace TableConfig {
-
-
- public partial class RedPackConfig : ConfigBase {
-
- public int id { get ; private set ; }
- public int RedEnvelopeType { get ; private set ; }
- public int RedEnvelopeAmount { get ; private set ; }
- public int MoneyType { get ; private set ; }
- public int PacketCnt { get ; private set ; }
- public int LeaderOwn { get ; private set ; }
- public string content { get ; private set; }
- public string PacketOpenTime { get ; private set; }
- public int ValidMinutes { get ; private set ; }
-
- public override string getKey()
- {
- return id.ToString();
- }
-
- public override void Parse() {
- try
- {
- id=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0;
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Tuesday, February 12, 2019
+//--------------------------------------------------------
+
+using UnityEngine;
+using System;
+
+namespace TableConfig {
+
+
+ public partial class RedPackConfig : ConfigBase {
+
+ public int id;
+ public int RedEnvelopeType;
+ public int RedEnvelopeAmount;
+ public int MoneyType;
+ public int PacketCnt;
+ public int LeaderOwn;
+ public string content;
+ public string PacketOpenTime;
+ public int ValidMinutes;
+
+ public override string getKey()
+ {
+ return id.ToString();
+ }
+
+ public override void Parse(string content) {
+ try
+ {
+ var contents = content.Split('\t');
+
+ int.TryParse(contents[0],out id);
- RedEnvelopeType=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0;
+ int.TryParse(contents[1],out RedEnvelopeType);
- RedEnvelopeAmount=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0;
+ int.TryParse(contents[2],out RedEnvelopeAmount);
- MoneyType=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0;
+ int.TryParse(contents[3],out MoneyType);
- PacketCnt=IsNumeric(rawContents[4]) ? int.Parse(rawContents[4]):0;
+ int.TryParse(contents[4],out PacketCnt);
- LeaderOwn=IsNumeric(rawContents[5]) ? int.Parse(rawContents[5]):0;
+ int.TryParse(contents[5],out LeaderOwn);
- content = rawContents[6].Trim();
+ content = contents[6];
- PacketOpenTime = rawContents[7].Trim();
+ PacketOpenTime = contents[7];
- ValidMinutes=IsNumeric(rawContents[8]) ? int.Parse(rawContents[8]):0;
- }
- catch (Exception ex)
- {
- DebugEx.Log(ex);
- }
- }
-
- }
-
-}
-
-
-
-
+ int.TryParse(contents[8],out ValidMinutes);
+ }
+ catch (Exception ex)
+ {
+ DebugEx.Log(ex);
+ }
+ }
+
+ }
+
+}
+
+
+
+
--
Gitblit v1.8.0