public override int Deserialize(string src) { // base.Deserialize(src); string[] a = src.Split(SPLIT); if (a.Length < 18) { Console.WriteLine(a.Length + "MasterWeapon Deserialize Error!"); return(-1); } // データ作成 id = Convert.ToInt32(a[0]); name = a[1]; desc = a[2]; type = (ItemType)Convert.ToInt32(a[3]); icon_id = Convert.ToInt32(a[4]); cost = Convert.ToInt32(a[5]); rank = Convert.ToInt32(a[6]); weight = (float)Convert.ToDouble(a[7]); group = (Group)Convert.ToInt32(a[8]); element = (ENElement)Convert.ToInt32(a[9]); atk = Convert.ToInt32(a[10]); matk = Convert.ToInt32(a[11]); def = Convert.ToInt32(a[12]); mdef = Convert.ToInt32(a[13]); hit = Convert.ToInt32(a[14]); crt = Convert.ToInt32(a[15]); eva = Convert.ToInt32(a[16]); isTwoHand = (a[17] == "1") ? true : false; // オプション if (a.Length > 18) { a[18] = a[18].Replace("\n", ""); a[18] = a[18].Replace("\r", ""); string[] op = a[18].Split(new char[] { SPLIT_OP_END }, StringSplitOptions.RemoveEmptyEntries); if (op.Length > 0) { options = new List <ENOption>(); for (int i = 0; i < op.Length; i++) { string[] str = op[i].Split(SPLIT_OP); if (str.Length != 3) { Console.WriteLine("武器オプション例外!"); continue; } ENOption option = new ENOption(); option.type = (ENOption.OptionType)Convert.ToInt32(str[0]); option.value1 = Convert.ToInt32(str[1]); option.value2 = Convert.ToInt32(str[2]); // オプション追加 options.Add(option); } } } return(0); }
/// <summary> /// オプションのゲーム内表示文字列を取得する /// 例)HP+100, ダメージ32%上昇 ...等 /// </summary> public static string GetDesc(this ENOption op) { switch (op.type) { case ENOption.OptionType.STATUS_ADD: return(string.Format(((Ability)op.value1).DispName() + "+{0}", op.value2)); default: return(string.Empty); } }