예제 #1
0
    //服务器数据信息,临时数据
    override public bool Init(ItemObjInit initData)
    {
        if (!base.Init(initData))
        {
            return(false);
        }

        NormalObjInit normalData = initData as NormalObjInit;

        if (normalData == null)
        {
            return(false);
        }

        return(true);
    }
예제 #2
0
    public ItemObj CreateItem(Message.item_info createInfo)
    {
        if (createInfo == null)
        {
            return(null);
        }

        if (createInfo.baseinfo == null)
        {
            return(null);
        }

        switch (createInfo.itemtype)
        {
        case (int)ItemType.Defence:
        {
            GUID           itemguid  = createInfo.baseinfo.itemguid;
            DefenceObjInit paramInit = new DefenceObjInit();
            paramInit.mCount      = (ushort)createInfo.baseinfo.count;
            paramInit.mCreateTime = createInfo.baseinfo.createtime;
            paramInit.mItemGuid   = itemguid.ToULong();
            paramInit.mResId      = createInfo.baseinfo.resid;
            paramInit.mStarslevel = createInfo.equip_info.starslevel;
            paramInit.mStrenlevel = createInfo.equip_info.strenlevel;

            for (int i = 0; i < createInfo.equip_info.stoneinlays.Count; ++i)
            {
                paramInit.stoneinfo.Add(createInfo.equip_info.stoneinlays[i]);
            }
            return(CreateItem(paramInit));
        }

        case (int)ItemType.Normal:
        {
            GUID itemguid = createInfo.baseinfo.itemguid;

            NormalObjInit paramInit = new NormalObjInit();
            paramInit.mCount      = (ushort)createInfo.baseinfo.count;
            paramInit.mCreateTime = createInfo.baseinfo.createtime;
            paramInit.mItemGuid   = itemguid.ToULong();
            paramInit.mResId      = createInfo.baseinfo.resid;

            return(CreateItem(paramInit));
        }

        case (int)ItemType.Weapon:
        {
            GUID itemguid = createInfo.baseinfo.itemguid;

            WeaponObjInit paramInit = new WeaponObjInit();
            paramInit.mCount      = (ushort)createInfo.baseinfo.count;
            paramInit.mCreateTime = createInfo.baseinfo.createtime;
            paramInit.mItemGuid   = itemguid.ToULong();
            paramInit.mResId      = createInfo.baseinfo.resid;
            paramInit.mPromoteLv  = (ushort)createInfo.weapon_info.promotelv;

            return(CreateItem(paramInit));
        }

        case (int)ItemType.Stone:
        {
            GUID itemguid = createInfo.baseinfo.itemguid;

            StoneObjInit paramInit = new StoneObjInit();
            paramInit.mCount      = (ushort)createInfo.baseinfo.count;
            paramInit.mCreateTime = createInfo.baseinfo.createtime;
            paramInit.mItemGuid   = itemguid.ToULong();
            paramInit.mResId      = createInfo.baseinfo.resid;
            return(CreateItem(paramInit));
        }

        case (int)ItemType.Box:
        {
            GUID itemguid = createInfo.baseinfo.itemguid;

            BoxItemObjInit paramInit = new BoxItemObjInit();
            paramInit.mCount      = (ushort)createInfo.baseinfo.count;
            paramInit.mCreateTime = createInfo.baseinfo.createtime;
            paramInit.mItemGuid   = itemguid.ToULong();
            paramInit.mResId      = createInfo.baseinfo.resid;
            return(CreateItem(paramInit));
        }

        default:
            return(null);
        }
    }