Пример #1
0
 // Update is called once per frame
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.S))
     {
         text.text = ChineseStringUtility.ToSimplified(txt_tra);
     }
     if (Input.GetKeyDown(KeyCode.T))
     {
         text.text = ChineseStringUtility.ToTraditional(txt_simple);
     }
 }
Пример #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            var inputfileName  = textBox1.Text;
            var outputfileName = textBox2.Text;
            var encodingstr1   = comboBox1.Text;
            var encodingstr2   = comboBox2.Text;

            if (!File.Exists(inputfileName))
            {
                MessageBox.Show(@"请选择需要转换的文件", @"错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                if (!Directory.Exists(Path.GetDirectoryName(outputfileName)))
                {
                    MessageBox.Show(@"输出文件路径出错", @"错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(@"输出文件路径出错", @"错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                var    origin = File.ReadAllText(inputfileName, TextEncoding.GetEncoding(encodingstr1));
                string output;
                if (radioButton1.Checked)
                {
                    output = ChineseStringUtility.ToSimplified(origin);
                }
                else if (radioButton2.Checked)
                {
                    output = ChineseStringUtility.ToTraditional(origin);
                }
                else
                {
                    output = origin;
                }
                File.WriteAllText(outputfileName, output, TextEncoding.GetEncoding(encodingstr2));
                MessageBox.Show(@"转换成功!", @"成功!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"转换出错!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
    public void loadStartData(string path)
    {
        FileStream fs = File.OpenRead(path);

        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);
        fs.Close();

        int index = 0;

        for (int i = 0; i < GameDefine.MAX_STAGE; i++)
        {
            startData[i]       = new GameBattleStart();
            startData[i].Music = BitConverter.ToInt16(bytes, index); index += 2;
            startData[i].NameT = Encoding.GetEncoding("big5").GetString(bytes, index, 24); index += 24;
            startData[i].NameS = ChineseStringUtility.ToSimplified(startData[i].NameT);
        }
    }
Пример #4
0
        public static List <WordPair> cut(string str, CutTool tool = CutTool.jieba)
        {
            try
            {
                str = ChineseStringUtility.ToSimplified(str);
                str = removeBlanks(str);
                List <WordPair> res = new List <WordPair>();
                List <Pair>     tmp = new List <Pair>();
                switch (tool)
                {
                case CutTool.jieba:
                    //jieba分词
                    PosSegmenter p = new PosSegmenter();
                    tmp = p.Cut(str).ToList();
                    break;

                case CutTool.nlpir:
                    //NLPIR-ICTCLAS分词
                    tmp = cutByICTCLAS(str);
                    break;

                default:
                    break;
                }
                foreach (var p in tmp)
                {
                    res.Add(new WordPair(p));
                }

                return(res);
            }
            catch
            {
                return(new List <WordPair>());
            }
        }
Пример #5
0
    public void load(string path)
    {
        FileStream fs = File.OpenRead(path);

        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);

        data = new GameItem[bytes.Length / 182];

        int index = 0;

        for (int i = 0; i < data.Length; ++i)
        {
            GameItem item = new GameItem();
            item.ID = (short)i;

            item.ItemType = (GameItemType)BitConverter.ToInt16(bytes, index); index += 2;
            for (int j = 0; j < 16; j++)
            {
                item.EquipUnit[j] = BitConverter.ToInt16(bytes, index); index += 2;
            }

            item.AttackRangeType = (GameAttackRangeType)BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackRange     = BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackRangeMin  = BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackRangeMax  = BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackHit       = BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackMiss      = BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackCritical  = BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackDouble    = BitConverter.ToInt16(bytes, index); index += 2;

            item.AttackAddType       = (GameAttackAddType)BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackAddRatio      = BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackAttributeType = (GameAttributeType)BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackAddTime       = BitConverter.ToInt16(bytes, index); index += 2;
            item.AttackAddCost       = BitConverter.ToInt16(bytes, index); index += 2;
            item.Unknown3            = BitConverter.ToInt16(bytes, index); index += 2;

            item.Attack   = BitConverter.ToInt16(bytes, index); index += 2;
            item.Defence  = BitConverter.ToInt16(bytes, index); index += 2;
            item.Unknown4 = BitConverter.ToInt16(bytes, index); index += 2;

            for (int j = 0; j <= (int)GameAttributeType.Dark; j++)
            {
                item.AttributeDefence[j] = BitConverter.ToInt16(bytes, index); index += 2;
            }

            item.UseMPCost = BitConverter.ToInt16(bytes, index); index += 2;

            int tt = BitConverter.ToInt16(bytes, index); index += 2;

            if (tt > 0)
            {
                tt--;
            }

            item.UseTargetType = (GameTargetType)tt;

            item.UseRangeType = (GameAttackRangeType)BitConverter.ToInt16(bytes, index); index += 2;
            item.UseRange     = BitConverter.ToInt16(bytes, index); index += 2;
            item.UseRangeMin  = BitConverter.ToInt16(bytes, index); index += 2;
            item.UseRangeMax  = BitConverter.ToInt16(bytes, index); index += 2;
            item.Unknown5     = BitConverter.ToInt16(bytes, index); index += 2;
            item.UseBasePower = BitConverter.ToInt16(bytes, index); index += 2;
            item.TimeCost     = BitConverter.ToInt16(bytes, index); index += 2;
            item.IsConsumable = BitConverter.ToInt16(bytes, index); index += 2;

            item.Price         = BitConverter.ToInt16(bytes, index); index += 2;
            item.UseType       = (GameItemUseType)BitConverter.ToInt16(bytes, index); index += 2;
            item.UseEffectType = (GameItemEffectType)BitConverter.ToInt16(bytes, index); index += 2;
            item.UseSkillID    = BitConverter.ToInt16(bytes, index); index += 2;

            item.SynthesizeItem1 = BitConverter.ToInt16(bytes, index); index += 2;
            item.SynthesizeItem2 = BitConverter.ToInt16(bytes, index); index += 2;

            item.NameT        = Encoding.GetEncoding("big5").GetString(bytes, index, 10).Replace(" ", ""); index += 10;
            item.DescriptionT = Encoding.GetEncoding("big5").GetString(bytes, index, 60); index += 60;

            item.NameS        = ChineseStringUtility.ToSimplified(item.NameT);
            item.DescriptionS = ChineseStringUtility.ToSimplified(item.DescriptionT);

            data[i] = item;
        }

        Debug.Log("GameItemData loaded.");
    }
Пример #6
0
    void loadEMSG(int stage)
    {
        string path    = stage < 10 ? "0" + stage.ToString() : stage.ToString();
        string pathDir = Application.dataPath + "/Objects/DAT/Stage/Stage" + path + "/";

        string pathEMSG = pathDir + "EMSG_" + path + ".MSG";

        FileStream fs = File.OpenRead(pathEMSG);

        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);
        fs.Close();


        int index = 0;
        int c     = BitConverter.ToInt32(bytes, index); index += 4;
        int size  = BitConverter.ToInt32(bytes, index); index += 4;

        int[] pos     = new int[c];
        int[] count   = new int[c];
        int[] unknow3 = new int[c];
        int[] len     = new int[c];

        data[stage].EMSG = new GameBattleEMSG[c];

        for (int ii = 0; ii < c; ii++)
        {
            pos[ii]     = BitConverter.ToInt32(bytes, index); index += 4;
            count[ii]   = BitConverter.ToInt32(bytes, index); index += 4;
            unknow3[ii] = BitConverter.ToInt32(bytes, index); index += 4;
            len[ii]     = BitConverter.ToInt32(bytes, index); index += 4;
        }

        for (int ii = 0; ii < c; ii++)
        {
            index = pos[ii] + 4;

            int[] pos1 = new int[count[ii]];
            int[] pos2 = new int[count[ii]];

            for (int i = 0; i < count[ii]; i++)
            {
                pos1[i] = BitConverter.ToInt32(bytes, index); index += 4;
            }

            len[ii] -= 4 + count[ii] * 4;

            for (int i = 0; i < count[ii]; i++)
            {
                if (i == count[ii] - 1)
                {
                    pos2[i] = len[ii];
                }
                else
                {
                    pos2[i]  = pos1[i + 1] - pos1[i];
                    len[ii] -= pos2[i];
                }
            }

            data[stage].EMSG[ii]      = new GameBattleEMSG();
            data[stage].EMSG[ii].MsgT = new string[count[ii]];
            data[stage].EMSG[ii].MsgS = new string[count[ii]];

            for (int i = 0; i < count[ii]; i++)
            {
                string str = "";

                int l1 = pos1[i];
                int l2 = 0;
                for (int j = pos1[i]; j < pos1[i] + pos2[i]; j++)
                {
                    if (bytes[j] == 0)
                    {
                        l2 = j - l1;

                        string m = Encoding.GetEncoding("big5").GetString(bytes, l1, l2);
                        str += m;

                        int n = 1;
                        while (true)
                        {
                            if (bytes[j + n] == 0)
                            {
                                n++;
                            }
                            else if (bytes[j + n] == 1)
                            {
                                l1   = j + n + 1;
                                j    = l1;
                                str += "\n";
                                break;
                            }
                            else if (bytes[j + n] == 2)
                            {
                                l1 = j + n + 1;
                                j  = l1;
                                break;
                            }
                            else
                            {
                                Debug.LogError("eeeeeeeeeeee " + bytes[j + n]);
                                break;
                            }
                        }
                    }
                }

                data[stage].EMSG[ii].MsgT[i] = str;
                data[stage].EMSG[ii].MsgS[i] = ChineseStringUtility.ToSimplified(str);
            }
        }
    }
Пример #7
0
    public void loadSDESData(int stage)
    {
        string path    = stage < 10 ? "0" + stage.ToString() : stage.ToString();
        string pathDir = Application.dataPath + "/Objects/DAT/Stage/Stage" + path + "/";

        string pathSDES = pathDir + "SDES_" + path + ".DAT";

        FileStream fs = File.OpenRead(pathSDES);

        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);
        fs.Close();

        data[stage].SDES.TitleT = Encoding.GetEncoding("big5").GetString(bytes, 0, 23);
        data[stage].SDES.WinT   = Encoding.GetEncoding("big5").GetString(bytes, 0x18, 52);
        data[stage].SDES.LoseT  = Encoding.GetEncoding("big5").GetString(bytes, 0x4C, 52);

        if (stage == 11)
        {
            data[stage].SDES.TitleT = "第十一幕  故人";
        }

        data[stage].SDES.TitleS = ChineseStringUtility.ToSimplified(data[stage].SDES.TitleT);
        data[stage].SDES.WinS   = ChineseStringUtility.ToSimplified(data[stage].SDES.WinT);
        data[stage].SDES.LoseS  = ChineseStringUtility.ToSimplified(data[stage].SDES.LoseT);

        switch (stage)
        {
        case 0:
            data[stage].SDES.ProficiencyS = "获得燧石";
            break;

        case 1:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 2:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 3:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 4:
            data[stage].SDES.ProficiencyS = "敌全灭+1";
            break;

        case 5:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 6:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 7:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 8:
            data[stage].SDES.ProficiencyS = "不让不净散人攻击朱慎";
            break;

        case 9:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 10:
            data[stage].SDES.ProficiencyS = "击败夏候仪";
            break;

        case 11:
            data[stage].SDES.ProficiencyS = "不让天玄门弟子阵亡";
            break;

        case 12:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 13:
            data[stage].SDES.ProficiencyS = "同时击败高世津和灵山老人";
            break;

        case 14:
            data[stage].SDES.ProficiencyS = "获得全部宝物";
            break;

        case 15:
            data[stage].SDES.ProficiencyS = "二十回合内击倒夏侯仪并四回合内击倒鬼魄尸王";
            break;

        case 16:
            data[stage].SDES.ProficiencyS = "救下至少九名禁军士兵";
            break;

        case 17:
            data[stage].SDES.ProficiencyS = "三十五回合内敌全灭";
            break;

        case 18:
            data[stage].SDES.ProficiencyS = "无";
            break;

        case 19:
            data[stage].SDES.ProficiencyS = "击杀敌人数小于8";
            break;

        case 20:
            data[stage].SDES.ProficiencyS = "除韩无砂外的敌全灭";
            break;

        case 21:
            data[stage].SDES.ProficiencyS = "二十回合内结束本关";
            break;

        case 22:
            data[stage].SDES.ProficiencyS = "不让封寒月攻击韩无砂+1";
            break;

        case 23:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 24:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 25:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 26:
            data[stage].SDES.ProficiencyS = "十五回合以上结束本关+1";
            break;

        case 27:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 28:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 29:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 30:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 31:
            data[stage].SDES.ProficiencyS = "无";
            break;

        case 32:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 33:
            data[stage].SDES.ProficiencyS = "获得全部宝物+1";
            break;

        case 34:
            data[stage].SDES.ProficiencyS = "无";
            break;

        case 35:
            data[stage].SDES.ProficiencyS = "无";
            break;
        }

        data[stage].SDES.ProficiencyT = ChineseStringUtility.ToTraditional(data[stage].SDES.ProficiencyS);
    }
Пример #8
0
    public void load(string path)
    {
        FileStream fs = File.OpenRead(path);

        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);

        data = new GameSkill[bytes.Length / 144];

        int index = 0;

        for (int i = 0; i < data.Length; ++i)
        {
            GameSkill skill = new GameSkill();

            skill.ID              = (short)i;
            skill.MoveAttackType  = (GameSkillMoveAttackType)BitConverter.ToInt16(bytes, index); index += 2;
            skill.TargetType      = (GameTargetType)BitConverter.ToInt16(bytes, index); index += 2;
            skill.AttackRangeType = (GameAttackRangeType)BitConverter.ToInt16(bytes, index); index += 2;
            skill.AttackRange     = BitConverter.ToInt16(bytes, index); index += 2;
            skill.AttackRangeMin  = BitConverter.ToInt16(bytes, index); index += 2;
            skill.AttackRangeMax  = BitConverter.ToInt16(bytes, index); index += 2;
            skill.HitAdd          = BitConverter.ToInt16(bytes, index); index += 2;
            skill.MPCost          = BitConverter.ToInt16(bytes, index); index += 2;
            skill.MoveCost        = BitConverter.ToInt16(bytes, index); index += 2;
            skill.BasePower       = BitConverter.ToInt16(bytes, index); index += 2;
            skill.Hit             = BitConverter.ToInt16(bytes, index); index += 2;
            skill.AttributeType   = (GameAttributeType)BitConverter.ToInt16(bytes, index); index += 2;
            skill.ResultType      = (GameSkillResutlType)BitConverter.ToInt16(bytes, index); index += 2;
            skill.ResultEffect    = (GameSkillResutlEffect)BitConverter.ToInt16(bytes, index); index += 2;
            skill.OtherType       = (GameSkillOtherType)BitConverter.ToInt16(bytes, index); index += 2;
            skill.OtherEffect     = (GameSkillOtherEffect)BitConverter.ToInt16(bytes, index); index += 2;

            for (int j = 0; j < (int)GameSpiritType.Count; j++)
            {
                skill.addition[j]         = new GameSkillSpiritAddition();
                skill.addition[j].Type    = (GameSkillAdditionType)BitConverter.ToInt16(bytes, index); index += 2;
                skill.addition[j].Request = BitConverter.ToInt16(bytes, index); index += 2;
                skill.addition[j].Plus    = BitConverter.ToInt16(bytes, index); index += 2;
            }

            skill.AnimationID  = BitConverter.ToInt16(bytes, index); index += 2;
            skill.HasMovie     = BitConverter.ToInt16(bytes, index); index += 2;
            skill.BattleType   = (GameSkillBattleType)BitConverter.ToInt16(bytes, index); index += 2;
            skill.BattleRanged = (GameSkillBattleRanged)BitConverter.ToInt16(bytes, index); index += 2;
            skill.BattleSprite = BitConverter.ToInt16(bytes, index); index += 2;
            skill.Unknown4     = BitConverter.ToInt16(bytes, index); index += 2;

            //             if ( skill.BattleType != GameSkillBattleType.None )
            //             {
            //                 if ( skill.ResultEffect != GameSkillResutlEffect.None )
            //                 {
            //                     Debug.Log( i );
            //                 }
            //             }


//            Debug.Log( "hit " + skill.ID + " " + skill.Hit + " " + skill.HitAdd );

            skill.Type = GameSkillType.Magic;

            if (skill.BattleType == GameSkillBattleType.UI)
            {
                skill.Type = GameSkillType.Physical;
            }

            if (skill.OtherEffect == GameSkillOtherEffect.AttackX2 ||
                skill.OtherEffect == GameSkillOtherEffect.AttackX3 ||
                skill.OtherEffect == GameSkillOtherEffect.AttackX4 ||
                skill.OtherEffect == GameSkillOtherEffect.AttackPalsy ||
                skill.OtherEffect == GameSkillOtherEffect.AttackPoison ||
                skill.OtherEffect == GameSkillOtherEffect.AttackHP ||
                skill.OtherEffect == GameSkillOtherEffect.AttackFetter)
            {
                skill.Type = GameSkillType.Physical;
            }

            skill.NameT        = Encoding.GetEncoding("big5").GetString(bytes, index, 10); index += 10;
            skill.DescriptionT = Encoding.GetEncoding("big5").GetString(bytes, index, 60); index += 60;

            skill.NameS        = ChineseStringUtility.ToSimplified(skill.NameT);
            skill.DescriptionS = ChineseStringUtility.ToSimplified(skill.DescriptionT);

            data[i] = skill;
        }


        Debug.Log("GameSkillData loaded.");
    }
Пример #9
0
    public void load(string path)
    {
        FileStream fs = File.OpenRead(path);

        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);
        fs.Close();


        int index = 0;
        int c     = BitConverter.ToInt32(bytes, index); index += 4;
        int size  = BitConverter.ToInt32(bytes, index); index += 4;

        int[] pos     = new int[c];
        int[] count   = new int[c];
        int[] unknow3 = new int[c];
        int[] len     = new int[c];

        GameMessage message = new GameMessage();

        data.Add(message);

        message.message = new GameMessageString[c];

        for (int ii = 0; ii < c; ii++)
        {
            pos[ii]     = BitConverter.ToInt32(bytes, index); index += 4;
            count[ii]   = BitConverter.ToInt32(bytes, index); index += 4;
            unknow3[ii] = BitConverter.ToInt32(bytes, index); index += 4;
            len[ii]     = BitConverter.ToInt32(bytes, index); index += 4;
        }

        for (int ii = 0; ii < c; ii++)
        {
            index = pos[ii] + 4;

            int[] pos1 = new int[count[ii]];
            int[] pos2 = new int[count[ii]];

            for (int i = 0; i < count[ii]; i++)
            {
                pos1[i] = BitConverter.ToInt32(bytes, index); index += 4;
            }

            len[ii] -= 4 + count[ii] * 4;

            for (int i = 0; i < count[ii]; i++)
            {
                if (i == count[ii] - 1)
                {
                    pos2[i] = len[ii];
                }
                else
                {
                    pos2[i]  = pos1[i + 1] - pos1[i];
                    len[ii] -= pos2[i];
                }
            }

            message.message[ii]      = new GameMessageString();
            message.message[ii].MsgT = new string[count[ii]];
            message.message[ii].MsgS = new string[count[ii]];

            for (int i = 0; i < count[ii]; i++)
            {
                string str = "";

                int l1 = pos1[i];
                int l2 = 0;
                for (int j = pos1[i]; j < pos1[i] + pos2[i]; j++)
                {
                    if (bytes[j] == 0)
                    {
                        l2 = j - l1;

                        if (l2 == 1)
                        {
                            int cccc = 0;

                            while (bytes[j + cccc] == 0)
                            {
                                cccc++;
                            }

                            j   += cccc;
                            l1   = j;
                            str += "0";
                            continue;
                        }

                        string m = Encoding.GetEncoding("big5").GetString(bytes, l1, l2);
                        str += m;
//                        l1 = j + 2;

                        int n = 1;
                        while (true)
                        {
                            if (bytes[j + n] == 0)
                            {
                                n++;
                            }
                            else if (bytes[j + n] == 1)
                            {
                                l1   = j + n + 1;
                                j    = l1;
                                str += "\n";
                                break;
                            }
                            else if (bytes[j + n] == 2)
                            {
                                l1 = j + n + 1;
                                j  = l1;
                                break;
                            }
                            else
                            {
                                Debug.LogError("eeeeeeeeeeee " + bytes[j + n]);
                                break;
                            }
                        }
                    }
                }

                str = str.Replace("00", "0");

                message.message[ii].MsgT[i] = str;
                message.message[ii].MsgS[i] = ChineseStringUtility.ToSimplified(str);
            }
        }


        Debug.Log("GameMessageData loaded.");
    }
Пример #10
0
    public void load(string path)
    {
        FileStream fs = File.OpenRead(path);

        byte[] bytes = new byte[fs.Length];
        fs.Read(bytes, 0, (int)fs.Length);

        data = new GameUnit[bytes.Length / 58];

        int index = 0;

        for (int i = 0; i < data.Length; ++i)
        {
            GameUnit unit = new GameUnit();

            unit.UnitID = (short)i;

            unit.AttributeDefenceID = BitConverter.ToInt16(bytes, index); index += 2;
            unit.MoveType           = (GameUnitMoveType)BitConverter.ToInt16(bytes, index); index += 2;
            unit.UnitCampType       = (GameUnitCampType)BitConverter.ToInt16(bytes, index); index += 2;
            unit.HP      = BitConverter.ToUInt16(bytes, index); index += 2;
            unit.HPGrow  = BitConverter.ToUInt16(bytes, index); index += 2;
            unit.MP      = BitConverter.ToUInt16(bytes, index); index += 2;
            unit.MPGrow  = BitConverter.ToUInt16(bytes, index); index += 2;
            unit.Move    = BitConverter.ToInt16(bytes, index); index += 2;
            unit.Str     = BitConverter.ToInt16(bytes, index); index += 2;
            unit.StrGrow = BitConverter.ToInt16(bytes, index); index += 2;
            unit.Int     = BitConverter.ToInt16(bytes, index); index += 2;
            unit.IntGrow = BitConverter.ToInt16(bytes, index); index += 2;
            unit.Avg     = BitConverter.ToInt16(bytes, index); index += 2;
            unit.AvgGrow = BitConverter.ToInt16(bytes, index); index += 2;
            unit.Vit     = BitConverter.ToInt16(bytes, index); index += 2;
            unit.VitGrow = BitConverter.ToInt16(bytes, index); index += 2;
            unit.Luk     = BitConverter.ToInt16(bytes, index); index += 2;
            unit.LukGrow = BitConverter.ToInt16(bytes, index); index += 2;

            unit.Sprite  = BitConverter.ToInt16(bytes, index); index += 2;
            unit.unknow1 = BitConverter.ToInt16(bytes, index); index += 2;

            if (unit.unknow1 != 2)
            {
                UnityEngine.Debug.Log("i " + i);
            }

            unit.DefenceType = (GameUnitDefenceType)BitConverter.ToInt16(bytes, index); index += 2;
            unit.AttackType  = (GameUnitAttackType)BitConverter.ToInt16(bytes, index); index += 2;
            unit.BaseLv      = BitConverter.ToInt16(bytes, index); index += 2;
            unit.BaseExp     = BitConverter.ToInt16(bytes, index); index += 2;

            unit.NameT = Encoding.GetEncoding("big5").GetString(bytes, index, 10); index += 10;

            unit.NameS = ChineseStringUtility.ToSimplified(unit.NameT);

            data[i] = unit;
        }

        // fix hp grow bug.

        data[0].HPGrow = 4;
        data[1].HPGrow = 3;
        data[2].HPGrow = 4;
        data[3].HPGrow = 2;
        data[4].HPGrow = 5;
        data[5].HPGrow = 4;
        data[6].HPGrow = 3;
        data[7].HPGrow = 3;
        data[8].HPGrow = 3;
        data[9].HPGrow = 3;

        Debug.Log("GameUnitData loaded.");
    }