| | |
| | | {
|
| | | if (isOk)
|
| | | {
|
| | | int noBindNum = 0;
|
| | | List<int> indexs = null;
|
| | | List<int> nums = null;
|
| | | if (CheckIsNoBindDrug(itemId, out noBindNum, out indexs, out nums))
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("BlastFurnace115", noBindNum, UIHelper.AppendStringColor(itemConfig.ItemColor, itemConfig.ItemName)),
|
| | | (bool isRecycle) =>
|
| | | {
|
| | | if (isRecycle)
|
| | | {
|
| | | SendRecycleDrugQuest(indexs, nums);
|
| | | }
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | SendRecycleDrugQuest(indexs, nums);
|
| | | }
|
| | | var drugs = GetDrugs(itemId);
|
| | | SendRecycleDrugQuest(drugs);
|
| | | }
|
| | | isOpenPrompting = !isToggle;
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | int noBindNum = 0;
|
| | | List<int> indexs = null;
|
| | | List<int> nums = null;
|
| | | if (CheckIsNoBindDrug(itemId, out noBindNum, out indexs, out nums))
|
| | | {
|
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("BlastFurnace115", noBindNum, UIHelper.AppendStringColor(itemConfig.ItemColor, itemConfig.ItemName)),
|
| | | (bool isRecycle) =>
|
| | | {
|
| | | if (isRecycle)
|
| | | {
|
| | | SendRecycleDrugQuest(indexs, nums);
|
| | | }
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | SendRecycleDrugQuest(indexs, nums);
|
| | | }
|
| | | var drugs = GetDrugs(itemId);
|
| | | SendRecycleDrugQuest(drugs);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private bool CheckIsNoBindDrug(int itemId, out int nobindNums, out List<int> indexs, out List<int> nums)
|
| | | private Dictionary<int, int> GetDrugs(int itemId)
|
| | | {
|
| | | indexs = new List<int>();
|
| | | nums = new List<int>();
|
| | | nobindNums = 0;
|
| | | SinglePack singlePack = playerPack.GetSinglePack(PackType.Item);
|
| | | if (singlePack == null) return false;
|
| | |
|
| | | var items = singlePack.GetItemsById(itemId);
|
| | | for (int i = 0; i < items.Count; i++)
|
| | | var drugs = new Dictionary<int, int>();
|
| | | var items = playerPack.GetItemsById(PackType.Item, itemId);
|
| | | if (!items.IsNullOrEmpty())
|
| | | {
|
| | | indexs.Add(items[i].itemPlace);
|
| | | nums.Add(items[i].count);
|
| | | if (items[i].isBind == 0)
|
| | | for (int i = 0; i < items.Count; i++)
|
| | | {
|
| | | nobindNums += items[i].count;
|
| | | var item = items[i];
|
| | | drugs[item.itemPlace] = item.count;
|
| | | }
|
| | | }
|
| | | if (nobindNums > 0)
|
| | | {
|
| | | return true;
|
| | | }
|
| | |
|
| | | return false;
|
| | | return drugs;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | }
|
| | | }
|
| | | #endregion
|
| | | SendRecycleDrugQuest(recycleDanDict.Keys.ToList(), recycleDanDict.Values.ToList());
|
| | |
|
| | | SendRecycleDrugQuest(recycleDanDict);
|
| | | }
|
| | |
|
| | | public void SendRecycleDrugQuest(List<int> indexs, List<int> nums)
|
| | | public void SendRecycleDrugQuest(Dictionary<int, int> drugs)
|
| | | {
|
| | | var recycleAttrFruit = new CA32A_tagCMRecycleAttrFruit();
|
| | | recycleAttrFruit.IndexCount = (byte)indexs.Count;
|
| | | byte[] indexByte = new byte[indexs.Count];
|
| | | ushort[] numShort = new ushort[indexs.Count];
|
| | | for (int i = 0; i < indexs.Count; i++)
|
| | | recycleAttrFruit.IndexCount = (byte)drugs.Count;
|
| | | byte[] indexByte = new byte[drugs.Count];
|
| | | ushort[] numShort = new ushort[drugs.Count];
|
| | |
|
| | | var index = 0;
|
| | | foreach (var drug in drugs)
|
| | | {
|
| | | indexByte[i] = (byte)indexs[i];
|
| | | numShort[i] = (ushort)nums[i];
|
| | | indexByte[index] = (byte)drug.Key;
|
| | | numShort[index] = (ushort)drug.Value;
|
| | | index++;
|
| | | }
|
| | |
|
| | | recycleAttrFruit.IndexList = indexByte;
|
| | | recycleAttrFruit.RecycleCountList = numShort;
|
| | | GameNetSystem.Instance.SendInfo(recycleAttrFruit);
|