private void handleFromGround(string from, string to, ServerRoom room, FreeData fd) { if (from.StartsWith(Ground) && !to.StartsWith(Ground)) { SimpleItemInfo info = PickupItemUtil.GetGroundItemInfo(room, fd, from); if (info.cat > 0) { ItemInventory inv = fd.freeInventory.GetInventoryManager().GetInventory("ground"); if (inv != null) { inv.Clear(); FreeItem item = FreeItemManager.GetItem(room.FreeArgs, FreeItemConfig.GetItemKey(info.cat, info.id), info.count); item.GetParameters().AddPara(new IntPara("entityId", info.entityId)); inv.AddItem(room.FreeArgs, item, false); DragGroundOne(fd, room, to); } else { Debug.LogErrorFormat("inventory {0} not existed.", from); } } } }
public override void DoAction(IEventArgs args) { if (addtimePara == null) { addtimePara = new IntPara(ParaConstant.PARA_ITEM_ADD_TIME, 0); } FreeRuleEventArgs fr = (FreeRuleEventArgs)args; if (StringUtil.IsNullOrEmpty(count)) { count = INI_COUNT; } FreeItem fi = FreeItemManager.GetItem(fr, FreeUtil.ReplaceVar(key, args), FreeUtil.ReplaceInt(count, args)); if (StringUtil.IsNullOrEmpty(name)) { name = InventoryManager.DEFAULT; } IGameUnit player = GetPlayer(args); if (player != null) { FreeData fd = (FreeData)player; args.TempUse(ParaConstant.PARA_PLAYER_CURRENT, fd); args.TempUse(ParaConstant.PARA_ITEM, fi); args.TempUsePara(new StringPara("from", ChickenConstant.BagGround)); if (action != null) { action.Act(args); } if (fd.freeInventory.GetInventoryManager().GetInventory(FreeUtil.ReplaceVar(name, args)).AddItem((ISkillArgs)args, fi, true)) { //addtimePara.setValue(fr.room.getServerTime()); fi.GetParameters().AddPara(addtimePara); } else { if (failAction != null) { fr.TempUse(ParaConstant.PARA_ITEM, fi); failAction.Act(args); fr.Resume(ParaConstant.PARA_ITEM); } } fr.ResumePara("from"); fr.Resume(ParaConstant.PARA_PLAYER_CURRENT); fr.Resume(ParaConstant.PARA_ITEM); } }