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/NPCConfig.cs | 240 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 121 insertions(+), 119 deletions(-)
diff --git a/Core/GameEngine/Model/Config/NPCConfig.cs b/Core/GameEngine/Model/Config/NPCConfig.cs
index 1f5e09b..93d7710 100644
--- a/Core/GameEngine/Model/Config/NPCConfig.cs
+++ b/Core/GameEngine/Model/Config/NPCConfig.cs
@@ -1,6 +1,6 @@
锘�//--------------------------------------------------------
// [Author]: 绗簩涓栫晫
-// [ Date ]: Thursday, November 01, 2018
+// [ Date ]: Tuesday, February 12, 2019
//--------------------------------------------------------
using UnityEngine;
@@ -11,196 +11,198 @@
public partial class NPCConfig : ConfigBase {
- public int NPCID { get ; private set ; }
- public int NPCType { get ; private set ; }
- public string MODE { get ; private set; }
- public string charName { get ; private set; }
- public int NPCLV { get ; private set ; }
- public float ModleHeight { get ; private set; }
- public float ModelRadius { get ; private set; }
- public float ModeProportion { get ; private set; }
- public Vector3 UIModeLOffset { get ; private set; }
- public float UIModeLProportion { get ; private set; }
- public Vector3 UIModelRotation { get ; private set; }
- public int CanDeadFly { get ; private set ; }
- public int Country { get ; private set ; }
- public int MinAtk { get ; private set ; }
- public int MaxAtk { get ; private set ; }
- public int Def { get ; private set ; }
- public int Realm { get ; private set ; }
- public int PoisionAtk { get ; private set ; }
- public int FireAtk { get ; private set ; }
- public int IceAtk { get ; private set ; }
- public int PoisionDef { get ; private set ; }
- public int IceDef { get ; private set ; }
- public int AtkInterval { get ; private set ; }
- public int Hit { get ; private set ; }
- public int MissRate { get ; private set ; }
- public int SuperHiteRate { get ; private set ; }
- public int OrgSpeed { get ; private set ; }
- public int MoveType { get ; private set ; }
- public int AtkDist { get ; private set ; }
- public int Skill1 { get ; private set ; }
- public int Skill2 { get ; private set ; }
- public int Skill3 { get ; private set ; }
- public int Skill4 { get ; private set ; }
- public int Skill5 { get ; private set ; }
- public int Skill6 { get ; private set ; }
- public int Skill7 { get ; private set ; }
- public int Skill8 { get ; private set ; }
- public int AtkType { get ; private set ; }
- public int Sight { get ; private set ; }
- public int MoveArea { get ; private set ; }
- public int DHP { get ; private set ; }
- public int MaxHPEx { get ; private set ; }
- public int IsBoss { get ; private set ; }
- public int SP { get ; private set ; }
- public int AIType { get ; private set ; }
- public int CanAttack { get ; private set ; }
- public float weight { get ; private set; }
- public string HeadPortrait { get ; private set; }
- public int Show { get ; private set ; }
- public int AtkFeedback { get ; private set ; }
- public int hurtFeedback { get ; private set ; }
- public int AutomaticFace { get ; private set ; }
- public int Dig { get ; private set ; }
+ public int NPCID;
+ public int NPCType;
+ public string MODE;
+ public string charName;
+ public int NPCLV;
+ public float ModleHeight;
+ public float ModelRadius;
+ public float ModeProportion;
+ public Vector3 UIModeLOffset;
+ public float UIModeLProportion;
+ public Vector3 UIModelRotation;
+ public int CanDeadFly;
+ public int Country;
+ public int MinAtk;
+ public int MaxAtk;
+ public int Def;
+ public int Realm;
+ public int PoisionAtk;
+ public int FireAtk;
+ public int IceAtk;
+ public int PoisionDef;
+ public int IceDef;
+ public int AtkInterval;
+ public int Hit;
+ public int MissRate;
+ public int SuperHiteRate;
+ public int OrgSpeed;
+ public int MoveType;
+ public int AtkDist;
+ public int Skill1;
+ public int Skill2;
+ public int Skill3;
+ public int Skill4;
+ public int Skill5;
+ public int Skill6;
+ public int Skill7;
+ public int Skill8;
+ public int AtkType;
+ public int Sight;
+ public int MoveArea;
+ public int DHP;
+ public int MaxHPEx;
+ public int IsBoss;
+ public int SP;
+ public int AIType;
+ public int CanAttack;
+ public float weight;
+ public string HeadPortrait;
+ public int Show;
+ public int AtkFeedback;
+ public int hurtFeedback;
+ public int AutomaticFace;
+ public int Dig;
public int[] Sounds;
- public int LifeBarCount { get ; private set ; }
- public int NPCEffect { get ; private set ; }
- public int NPCSpeakID { get ; private set ; }
- public int ClientRealm { get ; private set ; }
- public string Equips { get ; private set; }
+ public int LifeBarCount;
+ public int NPCEffect;
+ public int NPCSpeakID;
+ public int ClientRealm;
+ public string Equips;
public override string getKey()
{
return NPCID.ToString();
}
- public override void Parse() {
+ public override void Parse(string content) {
try
{
- NPCID=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0;
+ var contents = content.Split('\t');
+
+ int.TryParse(contents[0],out NPCID);
- NPCType=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0;
+ int.TryParse(contents[1],out NPCType);
- MODE = rawContents[2].Trim();
+ MODE = contents[2];
- charName = rawContents[3].Trim();
+ charName = contents[3];
- NPCLV=IsNumeric(rawContents[4]) ? int.Parse(rawContents[4]):0;
+ int.TryParse(contents[4],out NPCLV);
- ModleHeight=IsNumeric(rawContents[5]) ? float.Parse(rawContents[5]):0;
+ float.TryParse(contents[5],out ModleHeight);
- ModelRadius=IsNumeric(rawContents[6]) ? float.Parse(rawContents[6]):0;
+ float.TryParse(contents[6],out ModelRadius);
- ModeProportion=IsNumeric(rawContents[7]) ? float.Parse(rawContents[7]):0;
+ float.TryParse(contents[7],out ModeProportion);
- UIModeLOffset=rawContents[8].Vector3Parse();
+ UIModeLOffset=contents[8].Vector3Parse();
- UIModeLProportion=IsNumeric(rawContents[9]) ? float.Parse(rawContents[9]):0;
+ float.TryParse(contents[9],out UIModeLProportion);
- UIModelRotation=rawContents[10].Vector3Parse();
+ UIModelRotation=contents[10].Vector3Parse();
- CanDeadFly=IsNumeric(rawContents[11]) ? int.Parse(rawContents[11]):0;
+ int.TryParse(contents[11],out CanDeadFly);
- Country=IsNumeric(rawContents[12]) ? int.Parse(rawContents[12]):0;
+ int.TryParse(contents[12],out Country);
- MinAtk=IsNumeric(rawContents[13]) ? int.Parse(rawContents[13]):0;
+ int.TryParse(contents[13],out MinAtk);
- MaxAtk=IsNumeric(rawContents[14]) ? int.Parse(rawContents[14]):0;
+ int.TryParse(contents[14],out MaxAtk);
- Def=IsNumeric(rawContents[15]) ? int.Parse(rawContents[15]):0;
+ int.TryParse(contents[15],out Def);
- Realm=IsNumeric(rawContents[16]) ? int.Parse(rawContents[16]):0;
+ int.TryParse(contents[16],out Realm);
- PoisionAtk=IsNumeric(rawContents[17]) ? int.Parse(rawContents[17]):0;
+ int.TryParse(contents[17],out PoisionAtk);
- FireAtk=IsNumeric(rawContents[18]) ? int.Parse(rawContents[18]):0;
+ int.TryParse(contents[18],out FireAtk);
- IceAtk=IsNumeric(rawContents[19]) ? int.Parse(rawContents[19]):0;
+ int.TryParse(contents[19],out IceAtk);
- PoisionDef=IsNumeric(rawContents[20]) ? int.Parse(rawContents[20]):0;
+ int.TryParse(contents[20],out PoisionDef);
- IceDef=IsNumeric(rawContents[21]) ? int.Parse(rawContents[21]):0;
+ int.TryParse(contents[21],out IceDef);
- AtkInterval=IsNumeric(rawContents[22]) ? int.Parse(rawContents[22]):0;
+ int.TryParse(contents[22],out AtkInterval);
- Hit=IsNumeric(rawContents[23]) ? int.Parse(rawContents[23]):0;
+ int.TryParse(contents[23],out Hit);
- MissRate=IsNumeric(rawContents[24]) ? int.Parse(rawContents[24]):0;
+ int.TryParse(contents[24],out MissRate);
- SuperHiteRate=IsNumeric(rawContents[25]) ? int.Parse(rawContents[25]):0;
+ int.TryParse(contents[25],out SuperHiteRate);
- OrgSpeed=IsNumeric(rawContents[26]) ? int.Parse(rawContents[26]):0;
+ int.TryParse(contents[26],out OrgSpeed);
- MoveType=IsNumeric(rawContents[27]) ? int.Parse(rawContents[27]):0;
+ int.TryParse(contents[27],out MoveType);
- AtkDist=IsNumeric(rawContents[28]) ? int.Parse(rawContents[28]):0;
+ int.TryParse(contents[28],out AtkDist);
- Skill1=IsNumeric(rawContents[29]) ? int.Parse(rawContents[29]):0;
+ int.TryParse(contents[29],out Skill1);
- Skill2=IsNumeric(rawContents[30]) ? int.Parse(rawContents[30]):0;
+ int.TryParse(contents[30],out Skill2);
- Skill3=IsNumeric(rawContents[31]) ? int.Parse(rawContents[31]):0;
+ int.TryParse(contents[31],out Skill3);
- Skill4=IsNumeric(rawContents[32]) ? int.Parse(rawContents[32]):0;
+ int.TryParse(contents[32],out Skill4);
- Skill5=IsNumeric(rawContents[33]) ? int.Parse(rawContents[33]):0;
+ int.TryParse(contents[33],out Skill5);
- Skill6=IsNumeric(rawContents[34]) ? int.Parse(rawContents[34]):0;
+ int.TryParse(contents[34],out Skill6);
- Skill7=IsNumeric(rawContents[35]) ? int.Parse(rawContents[35]):0;
+ int.TryParse(contents[35],out Skill7);
- Skill8=IsNumeric(rawContents[36]) ? int.Parse(rawContents[36]):0;
+ int.TryParse(contents[36],out Skill8);
- AtkType=IsNumeric(rawContents[37]) ? int.Parse(rawContents[37]):0;
+ int.TryParse(contents[37],out AtkType);
- Sight=IsNumeric(rawContents[38]) ? int.Parse(rawContents[38]):0;
+ int.TryParse(contents[38],out Sight);
- MoveArea=IsNumeric(rawContents[39]) ? int.Parse(rawContents[39]):0;
+ int.TryParse(contents[39],out MoveArea);
- DHP=IsNumeric(rawContents[40]) ? int.Parse(rawContents[40]):0;
+ int.TryParse(contents[40],out DHP);
- MaxHPEx=IsNumeric(rawContents[41]) ? int.Parse(rawContents[41]):0;
+ int.TryParse(contents[41],out MaxHPEx);
- IsBoss=IsNumeric(rawContents[42]) ? int.Parse(rawContents[42]):0;
+ int.TryParse(contents[42],out IsBoss);
- SP=IsNumeric(rawContents[43]) ? int.Parse(rawContents[43]):0;
+ int.TryParse(contents[43],out SP);
- AIType=IsNumeric(rawContents[44]) ? int.Parse(rawContents[44]):0;
+ int.TryParse(contents[44],out AIType);
- CanAttack=IsNumeric(rawContents[45]) ? int.Parse(rawContents[45]):0;
+ int.TryParse(contents[45],out CanAttack);
- weight=IsNumeric(rawContents[46]) ? float.Parse(rawContents[46]):0;
+ float.TryParse(contents[46],out weight);
- HeadPortrait = rawContents[47].Trim();
+ HeadPortrait = contents[47];
- Show=IsNumeric(rawContents[48]) ? int.Parse(rawContents[48]):0;
+ int.TryParse(contents[48],out Show);
- AtkFeedback=IsNumeric(rawContents[49]) ? int.Parse(rawContents[49]):0;
+ int.TryParse(contents[49],out AtkFeedback);
- hurtFeedback=IsNumeric(rawContents[50]) ? int.Parse(rawContents[50]):0;
+ int.TryParse(contents[50],out hurtFeedback);
- AutomaticFace=IsNumeric(rawContents[51]) ? int.Parse(rawContents[51]):0;
+ int.TryParse(contents[51],out AutomaticFace);
- Dig=IsNumeric(rawContents[52]) ? int.Parse(rawContents[52]):0;
+ int.TryParse(contents[52],out Dig);
- string[] SoundsStringArray = rawContents[53].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ var SoundsStringArray = contents[53].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
Sounds = new int[SoundsStringArray.Length];
for (int i=0;i<SoundsStringArray.Length;i++)
{
int.TryParse(SoundsStringArray[i],out Sounds[i]);
}
- LifeBarCount=IsNumeric(rawContents[54]) ? int.Parse(rawContents[54]):0;
+ int.TryParse(contents[54],out LifeBarCount);
- NPCEffect=IsNumeric(rawContents[55]) ? int.Parse(rawContents[55]):0;
+ int.TryParse(contents[55],out NPCEffect);
- NPCSpeakID=IsNumeric(rawContents[56]) ? int.Parse(rawContents[56]):0;
+ int.TryParse(contents[56],out NPCSpeakID);
- ClientRealm=IsNumeric(rawContents[57]) ? int.Parse(rawContents[57]):0;
+ int.TryParse(contents[57],out ClientRealm);
- Equips = rawContents[58].Trim();
+ Equips = contents[58];
}
catch (Exception ex)
{
--
Gitblit v1.8.0