85 lines
1.9 KiB
C#
85 lines
1.9 KiB
C#
|
//This code create by CodeEngine ,don't modify
|
||
|
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Collections;
|
||
|
using Module.Log;
|
||
|
|
||
|
namespace GCGame.Table
|
||
|
{
|
||
|
|
||
|
public class Tab_ItemDecomposition{
|
||
|
|
||
|
public const string TAB_FILE_DATA = "ItemDecomposition";
|
||
|
private const int _varCount = 10;
|
||
|
|
||
|
public int GetId()
|
||
|
{
|
||
|
return Id;
|
||
|
}
|
||
|
|
||
|
public static bool Validate(string line)
|
||
|
{
|
||
|
var segments = 0;
|
||
|
foreach (char c in line)
|
||
|
if (c == '\t')
|
||
|
segments++;
|
||
|
// Note: skip the 2nd column as it's the description;
|
||
|
var result = segments == _varCount;
|
||
|
if (!result)
|
||
|
LogModule.ErrorLog(string.Format("Load {0} error as CodeSize:{1} not Equal DataSize:{2}", TAB_FILE_DATA, _varCount, segments));
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
public Tab_ItemDecomposition()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public Tab_ItemDecomposition(string line)
|
||
|
{
|
||
|
var segments = line.Split('\t');
|
||
|
Id = int.Parse(segments[0]);
|
||
|
Type[0] = int.Parse(segments[2]);
|
||
|
Type[1] = int.Parse(segments[5]);
|
||
|
Type[2] = int.Parse(segments[8]);
|
||
|
SubType[0] = int.Parse(segments[3]);
|
||
|
SubType[1] = int.Parse(segments[6]);
|
||
|
SubType[2] = int.Parse(segments[9]);
|
||
|
Num[0] = int.Parse(segments[4]);
|
||
|
Num[1] = int.Parse(segments[7]);
|
||
|
Num[2] = int.Parse(segments[10]);
|
||
|
|
||
|
}
|
||
|
|
||
|
public int Id { get; private set; }
|
||
|
|
||
|
public readonly int[] Type = new int[3];
|
||
|
public int getTypeCount() { return Type.Length; }
|
||
|
public int GetTypebyIndex(int idx)
|
||
|
{
|
||
|
if(idx >= 0 && idx < Type.Length)
|
||
|
return Type[idx];
|
||
|
return default(int);
|
||
|
}
|
||
|
|
||
|
public readonly int[] SubType = new int[3];
|
||
|
public int getSubTypeCount() { return SubType.Length; }
|
||
|
public int GetSubTypebyIndex(int idx)
|
||
|
{
|
||
|
if(idx >= 0 && idx < SubType.Length)
|
||
|
return SubType[idx];
|
||
|
return default(int);
|
||
|
}
|
||
|
|
||
|
public readonly int[] Num = new int[3];
|
||
|
public int getNumCount() { return Num.Length; }
|
||
|
public int GetNumbyIndex(int idx)
|
||
|
{
|
||
|
if(idx >= 0 && idx < Num.Length)
|
||
|
return Num[idx];
|
||
|
return default(int);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|