コード例 #1
0
        public static BaseItem ToBaseItem(SaveItemData d)
        {
            BaseItem t = TableItemIncidence.GetItemObjNo(d.it, d.on, false);

            QualifyInformation qi = TableQualify.GetValue(d.bnn);

            t.DisplayNameBeforeObjNo = qi.ObjNo;
            t.DisplayNameBefore      = qi.Name;
            t.StrengthValue          = d.sv;
            t.SortNo = d.sn;
            //t.IsBug = d.bb;
            t.IsEquip = d.be;

            if (t.IType == ItemType.Bag)
            {
                ((BagBase)t).MaxGap = d.cnt;
            }
            else if (t.IType == ItemType.Ball)
            {
                ((BallBase)t).RestCount = d.cnt;
            }

            //オプション
            if (CommonFunction.IsNull(d.ops) == false && d.ops.Length > 0)
            {
                List <BaseOption> ops = new List <BaseOption>();
                foreach (SaveOptionData o in d.ops)
                {
                    ops.Add(ToBaseOption(o));
                }
                t.Options = ops;
            }

            return(t);
        }
コード例 #2
0
        public static List <SaveItemData> ToListSaveItemData(List <BaseItem> list)
        {
            List <SaveItemData> result = new List <SaveItemData>();

            int index = 1;

            foreach (BaseItem b in list.OrderBy(i => i.SortNo))
            {
                SaveItemData sd = ToSaveItemData(b);
                //鞄だけ名前を格納
                if (b.IType == ItemType.Bag)
                {
                    sd.hnm = b.Name.GetHashCode();
                }
                sd.sn = index++;
                result.Add(sd);
            }

            return(result);
        }
コード例 #3
0
        public static SaveItemData ToSaveItemData(BaseItem d)
        {
            SaveItemData t = new SaveItemData();

            //t.hnm = d.Name.GetHashCode();
            t.bnn = d.DisplayNameBeforeObjNo;
            t.on  = d.ObjNo;
            t.it  = d.IType;
            t.sv  = d.StrengthValue;
            t.sn  = d.SortNo;
            //t.bb = d.IsBug;
            t.be = d.IsEquip;
            if (d.IsDrive)
            {
                t.ib = d.InDrive.Name.GetHashCode();
            }

            if (d.IType == ItemType.Bag)
            {
                t.cnt = ((BagBase)d).MaxGap;
            }
            else if (d.IType == ItemType.Ball)
            {
                t.cnt = ((BallBase)d).RestCount;
            }


            //オプション
            if (CommonFunction.IsNull(d.Options) == false && d.Options.Count > 0)
            {
                List <SaveOptionData> ops = new List <SaveOptionData>();
                foreach (BaseOption o in d.Options)
                {
                    ops.Add(ToSaveOptionData(o));
                }
                t.ops = ops.ToArray();
            }

            return(t);
        }