public APIRequestTask SaveStockFarmObjectPosition(int userFacilityId, Action <int> complated) { RequestFA_FacilityStock request = new RequestFA_FacilityStock { SetSendData = delegate(FacilityStock param) { param.userFacilityId = userFacilityId; param.stockFlg = 0; }, OnReceived = delegate(FacilityStockResult response) { UserFacility userStockFacility = Singleton <UserDataMng> .Instance.GetUserStockFacility(userFacilityId); Singleton <UserDataMng> .Instance.DeleteUserStockFacility(userFacilityId); Singleton <UserDataMng> .Instance.AddUserFacility(userStockFacility); } }; RequestFA_FacilityMoving request2 = new RequestFA_FacilityMoving { SetSendData = delegate(FacilityMoving param) { FarmRoot instance = FarmRoot.Instance; FarmField field = instance.Field; FarmObjectSetting component = this.GetComponent <FarmObjectSetting>(); FarmGrid.GridPosition gridPosition = field.Grid.GetGridPosition(component.farmObject.GetBaseGridPosition3D()); param.userFacilityId = userFacilityId; param.positionX = gridPosition.x; param.positionY = gridPosition.y; }, OnReceived = delegate(WebAPI.ResponseData response) { FarmRoot instance = FarmRoot.Instance; FarmField field = instance.Field; FarmObjectSetting component = this.GetComponent <FarmObjectSetting>(); FarmGrid.GridPosition gridPosition = field.Grid.GetGridPosition(component.farmObject.GetBaseGridPosition3D()); UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(userFacilityId); userFacility.positionX = gridPosition.x; userFacility.positionY = gridPosition.y; this.SaveResponseToStockToFarmFacility(userFacilityId); if (complated != null) { complated(userFacilityId); } } }; APIRequestTask apirequestTask = new APIRequestTask(request, true); APIRequestTask task = new APIRequestTask(request2, true); apirequestTask.Add(task); return(apirequestTask); }
private APIRequestTask RequestStock() { RequestFA_FacilityStock request = new RequestFA_FacilityStock { SetSendData = delegate(FacilityStock param) { param.userFacilityId = this.farmObject.userFacilityID; param.stockFlg = 1; } }; return(new APIRequestTask(request, true)); }