Exemplo n.º 1
0
		public virtual int init(TabFileReader reader, int row, int column)
		{
			if (false == int.TryParse(reader.Index(row, column), out _id))
				_strId = reader.Index(row, column).ToString();

			return ++column;
		}
Exemplo n.º 2
0
	public static Dictionary<int, BaseConfig> LoadConfig(string path, Type type)
	{
		int jsonStartIndex = 4;
		int columnStartIndex = 1;

		var ta = Resources.Load(path) as TextAsset;
		string RawJson = ta.text;

		Dictionary<int, BaseConfig> dic = new Dictionary<int, BaseConfig>();
		TabFileReader tabReader = new TabFileReader();
		tabReader.Load(RawJson);
		int JsonNodeCount = tabReader.RowCount;
		for (int i = jsonStartIndex; i < JsonNodeCount; i++)
		{
			try
			{
				System.Reflection.ConstructorInfo conInfo = type.GetConstructor(Type.EmptyTypes);
				BaseConfig t = conInfo.Invoke(null) as BaseConfig;

				t.init(tabReader, i, columnStartIndex);
				if (0 != t.id)
				{
					if (!dic.ContainsKey(t.id))
						dic.Add(t.id, t);
					else
						Log.LogError("Config Data Ready Exist, TableName: " + t.GetType().Name + " ID:" + t.id);
				}
			}
			catch (Exception)
			{
				Log.LogError(type.ToString() + " ERROR!!! line " + (i + 2).ToString());
			}
		}
		return dic;
	}
Exemplo n.º 3
0
		public override int init(TabFileReader reader, int row, int column)
		{
			column = base.init(reader, row, column);

			_hp = 0;
			int.TryParse(reader.Index(row, column), out _hp);
			column++;

			_speed = 1;
			float.TryParse(reader.Index(row, column), out _speed);
			column++;

			_attack = 0;
			int.TryParse(reader.Index(row, column), out _attack);
			column++;

			_sightDist = 0;
			float.TryParse(reader.Index(row, column), out _sightDist);
			column++;

			_sightAngle = 0;
			int.TryParse(reader.Index(row, column), out _sightAngle);
			column++;

			_attackDist = 0;
			float.TryParse(reader.Index(row, column), out _attackDist);
			column++;

			_attackInterval = 1;
			float.TryParse(reader.Index(row, column), out _attackInterval);
			column++;

			for(int i=0; i<10; i++)
				_skills[i] = 0;
			string[] skillsArray = reader.Index(row, column).Split(',');
			int skillsCount = skillsArray.Length;
			for(int i=0; i<10; i++)
			{
				if(i < skillsCount)
					int.TryParse(skillsArray[i], out _skills[i]);
				else
					_skills[i] = 0;
			}
			column++;

			_bevTree = 0;
			int.TryParse(reader.Index(row, column), out _bevTree);
			column++;

			_model = 0;
			int.TryParse(reader.Index(row, column), out _model);
			column++;

			return column;
		}
Exemplo n.º 4
0
		public override int init(TabFileReader reader, int row, int column)
		{
			column = base.init(reader, row, column);

			_pooled = 0;
			int.TryParse(reader.Index(row, column), out _pooled);
			column++;

			_pos = 0;
			int.TryParse(reader.Index(row, column), out _pos);
			column++;

			if(reader.Index(row, column) == null)
				_path = "";
			else
				_path = reader.Index(row, column);
			column++;

			return column;
		}
Exemplo n.º 5
0
		public override int init(TabFileReader reader, int row, int column)
		{
			column = base.init(reader, row, column);

			if(reader.Index(row, column) == null)
				_sourcePath = "";
			else
				_sourcePath = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_destPath = "";
			else
				_destPath = reader.Index(row, column);
			column++;

			_radius = 0;
			float.TryParse(reader.Index(row, column), out _radius);
			column++;

			_height = 0;
			float.TryParse(reader.Index(row, column), out _height);
			column++;

			if(reader.Index(row, column) == null)
				_weaponBone1 = "";
			else
				_weaponBone1 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_weaponBone2 = "";
			else
				_weaponBone2 = reader.Index(row, column);
			column++;

			return column;
		}
Exemplo n.º 6
0
		public override int init(TabFileReader reader, int row, int column)
		{
			column = base.init(reader, row, column);

			if(reader.Index(row, column) == null)
				_name = "";
			else
				_name = reader.Index(row, column);
			column++;

			_flyType = 0;
			int.TryParse(reader.Index(row, column), out _flyType);
			column++;

			_targetingType = 0;
			int.TryParse(reader.Index(row, column), out _targetingType);
			column++;

			_speed = 0;
			int.TryParse(reader.Index(row, column), out _speed);
			column++;

			_castDistance = 0;
			int.TryParse(reader.Index(row, column), out _castDistance);
			column++;

			for(int i=0; i<3; i++)
				_buff1[i] = 0;
			string[] buff1Array = reader.Index(row, column).Split(',');
			int buff1Count = buff1Array.Length;
			for(int i=0; i<3; i++)
			{
				if(i < buff1Count)
					int.TryParse(buff1Array[i], out _buff1[i]);
				else
					_buff1[i] = 0;
			}
			column++;

			for(int i=0; i<3; i++)
				_buff2[i] = 0;
			string[] buff2Array = reader.Index(row, column).Split(',');
			int buff2Count = buff2Array.Length;
			for(int i=0; i<3; i++)
			{
				if(i < buff2Count)
					int.TryParse(buff2Array[i], out _buff2[i]);
				else
					_buff2[i] = 0;
			}
			column++;

			for(int i=0; i<3; i++)
				_buff3[i] = 0;
			string[] buff3Array = reader.Index(row, column).Split(',');
			int buff3Count = buff3Array.Length;
			for(int i=0; i<3; i++)
			{
				if(i < buff3Count)
					int.TryParse(buff3Array[i], out _buff3[i]);
				else
					_buff3[i] = 0;
			}
			column++;

			if(reader.Index(row, column) == null)
				_effectBegin = "";
			else
				_effectBegin = reader.Index(row, column);
			column++;

			_effectFly = 0;
			int.TryParse(reader.Index(row, column), out _effectFly);
			column++;

			if(reader.Index(row, column) == null)
				_effectHit = "";
			else
				_effectHit = reader.Index(row, column);
			column++;

			return column;
		}
Exemplo n.º 7
0
		public override int init(TabFileReader reader, int row, int column)
		{
			column = base.init(reader, row, column);

			_logicId = 0;
			int.TryParse(reader.Index(row, column), out _logicId);
			column++;

			if(reader.Index(row, column) == null)
				_skillName = "";
			else
				_skillName = reader.Index(row, column);
			column++;

			_skillClassify = 0;
			int.TryParse(reader.Index(row, column), out _skillClassify);
			column++;

			_pileId = 0;
			int.TryParse(reader.Index(row, column), out _pileId);
			column++;

			_target = 0;
			int.TryParse(reader.Index(row, column), out _target);
			column++;

			_castDistance = 0;
			int.TryParse(reader.Index(row, column), out _castDistance);
			column++;

			_CD = 0;
			float.TryParse(reader.Index(row, column), out _CD);
			column++;

			for(int i=0; i<3; i++)
				_buff1[i] = 0;
			string[] buff1Array = reader.Index(row, column).Split(',');
			int buff1Count = buff1Array.Length;
			for(int i=0; i<3; i++)
			{
				if(i < buff1Count)
					int.TryParse(buff1Array[i], out _buff1[i]);
				else
					_buff1[i] = 0;
			}
			column++;

			for(int i=0; i<3; i++)
				_buff2[i] = 0;
			string[] buff2Array = reader.Index(row, column).Split(',');
			int buff2Count = buff2Array.Length;
			for(int i=0; i<3; i++)
			{
				if(i < buff2Count)
					int.TryParse(buff2Array[i], out _buff2[i]);
				else
					_buff2[i] = 0;
			}
			column++;

			for(int i=0; i<3; i++)
				_buff3[i] = 0;
			string[] buff3Array = reader.Index(row, column).Split(',');
			int buff3Count = buff3Array.Length;
			for(int i=0; i<3; i++)
			{
				if(i < buff3Count)
					int.TryParse(buff3Array[i], out _buff3[i]);
				else
					_buff3[i] = 0;
			}
			column++;

			for(int i=0; i<5; i++)
				_effect1[i] = 0;
			string[] effect1Array = reader.Index(row, column).Split(',');
			int effect1Count = effect1Array.Length;
			for(int i=0; i<5; i++)
			{
				if(i < effect1Count)
					int.TryParse(effect1Array[i], out _effect1[i]);
				else
					_effect1[i] = 0;
			}
			column++;

			for(int i=0; i<5; i++)
				_effect2[i] = 0;
			string[] effect2Array = reader.Index(row, column).Split(',');
			int effect2Count = effect2Array.Length;
			for(int i=0; i<5; i++)
			{
				if(i < effect2Count)
					int.TryParse(effect2Array[i], out _effect2[i]);
				else
					_effect2[i] = 0;
			}
			column++;

			return column;
		}
Exemplo n.º 8
0
		public override int init(TabFileReader reader, int row, int column)
		{
			column = base.init(reader, row, column);

			_buffType = 1;
			int.TryParse(reader.Index(row, column), out _buffType);
			column++;

			for(int i=0; i<3; i++)
				_typePar1[i] = 1;
			string[] typePar1Array = reader.Index(row, column).Split(',');
			int typePar1Count = typePar1Array.Length;
			for(int i=0; i<3; i++)
			{
				if(i < typePar1Count)
					int.TryParse(typePar1Array[i], out _typePar1[i]);
				else
					_typePar1[i] = 1;
			}
			column++;

			for(int i=0; i<3; i++)
				_typePar2[i] = 0;
			string[] typePar2Array = reader.Index(row, column).Split(',');
			int typePar2Count = typePar2Array.Length;
			for(int i=0; i<3; i++)
			{
				if(i < typePar2Count)
					int.TryParse(typePar2Array[i], out _typePar2[i]);
				else
					_typePar2[i] = 0;
			}
			column++;

			_buffLast = 0;
			int.TryParse(reader.Index(row, column), out _buffLast);
			column++;

			_hitCount = 0;
			int.TryParse(reader.Index(row, column), out _hitCount);
			column++;

			for(int i=0; i<3; i++)
				_beginShow[i] = 0;
			string[] beginShowArray = reader.Index(row, column).Split(',');
			int beginShowCount = beginShowArray.Length;
			for(int i=0; i<3; i++)
			{
				if(i < beginShowCount)
					int.TryParse(beginShowArray[i], out _beginShow[i]);
				else
					_beginShow[i] = 0;
			}
			column++;

			for(int i=0; i<3; i++)
				_endShow[i] = 0;
			string[] endShowArray = reader.Index(row, column).Split(',');
			int endShowCount = endShowArray.Length;
			for(int i=0; i<3; i++)
			{
				if(i < endShowCount)
					int.TryParse(endShowArray[i], out _endShow[i]);
				else
					_endShow[i] = 0;
			}
			column++;

			return column;
		}
Exemplo n.º 9
0
		public override int init(TabFileReader reader, int row, int column)
		{
			column = base.init(reader, row, column);

			if(reader.Index(row, column) == null)
				_name = "";
			else
				_name = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_discribe = "";
			else
				_discribe = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_prefab = "";
			else
				_prefab = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component1 = "";
			else
				_component1 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam1 = "";
			else
				_componentParam1 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component2 = "";
			else
				_component2 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam2 = "";
			else
				_componentParam2 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component3 = "";
			else
				_component3 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam3 = "";
			else
				_componentParam3 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component4 = "";
			else
				_component4 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam4 = "";
			else
				_componentParam4 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component5 = "";
			else
				_component5 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam5 = "";
			else
				_componentParam5 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component6 = "";
			else
				_component6 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam6 = "";
			else
				_componentParam6 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component7 = "";
			else
				_component7 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam7 = "";
			else
				_componentParam7 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component8 = "";
			else
				_component8 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam8 = "";
			else
				_componentParam8 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component9 = "";
			else
				_component9 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam9 = "";
			else
				_componentParam9 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_component10 = "";
			else
				_component10 = reader.Index(row, column);
			column++;

			if(reader.Index(row, column) == null)
				_componentParam10 = "";
			else
				_componentParam10 = reader.Index(row, column);
			column++;

			return column;
		}