hch
3 天以前 e33b8deea8413bcbc74998122ad91e6c17504729
Main/System/ItemTip/BoxGetItemModel.cs
@@ -10,75 +10,22 @@
public class BoxGetItemModel : GameSystemManager<BoxGetItemModel>
{
    List<string> commonShowAwardEvents = new List<string>();    //获取奖励的展示事件
    public override void Init()
    {
        var config = FuncConfigConfig.Get("CommonShowAwards");
        commonShowAwardEvents = JsonMapper.ToObject<List<string>>(config.Numerical1);
    }
    // void OnBeforePlayerDataInitialize()
    // {
    //     getItems = null;
    //     getCoinsType = 0;
    //     getCoinsCnt = 0;
    // }
    #region 处理服务器数据
    // public BoxGetItemInfo[] getItems { get; private set; }
    // public int getCoinsType { get; private set; }
    // public long getCoinsCnt { get; private set; }
    // public event Action<int, int, BoxGetItemInfo[]> RefreshGetItemAct;
    // public void SetGetBoxItemInfo(HA810_tagMCNotifyUseItemGetItem boxItemInfo)
    // {
    //     getItems = JsonMapper.ToObject<BoxGetItemInfo[]>(boxItemInfo.GetItemData);
    //     getCoinsType = boxItemInfo.MoneyType;
    //     getCoinsCnt = boxItemInfo.MoneyCount;
    //     if (!NewBieCenter.Instance.inGuiding)
    //     {
    //         List<Item> items = new List<Item>();
    //         for (int i = 0; i < getItems.Length; i++)
    //         {
    //             BoxGetItemInfo info = getItems[i];
    //             Dictionary<int, List<int>> useDataDic = ConfigParse.Analysis(info.UserData);
    //             if (useDataDic != null && useDataDic.TryGetValue((int)ItemUseDataKey.itemCount, out List<int> list) && list != null && list.Count > 0)
    //             {
    //                 int count = list[0];
    //                 items.Add(new Item(info.ItemID, count));
    //             }
    //             else
    //             {
    //                 items.Add(new Item(info.ItemID, info.Count));
    //             }
    //         }
    //         ItemLogicUtility.Instance.ShowGetItem(items, seconds: 0);
    //     }
    //     if (RefreshGetItemAct != null)
    //     {
    //         RefreshGetItemAct((int)boxItemInfo.UseItemID, (int)boxItemInfo.UseCount, getItems);
    //     }
    // }
    //获得奖励展示
    public void ReceiveAwardNotify(HA801_tagMCGiveAwardInfo netPack)
    {
        var eventName = UIHelper.ServerStringTrim(netPack.EventName);
        // 仙盟攻城战
        // if (eventName == "FamilyGCZSQGrid" || eventName == "FamilyGCZSQPass" || eventName == "FamilyGCZSQPassAll" ||
        //     eventName == "FamilyGCZContiribution" || eventName == "FamilyGCZAtk")
        // {
        //     ModelCenter.Instance.GetModel<FairySiegeActModel>()?.OnUpdateAwardInfoAction(netPack);
        //     return;
        // }
        // if (!commonShowAwardEvents.Contains(eventName))
        //     return;
        if (string.IsNullOrEmpty(eventName))
        {
            Debug.Log("获得物品展示 无事件名");
@@ -132,173 +79,11 @@
        ItemLogicUtility.Instance.ShowGetItem(showItems, eventName, isMergeItem:isMergeItem);
    }
    // public int GetUseCntByID(int itemId)
    // {
    //     return PackManager.Instance.GetItemUsedTimesToday(itemId);
    // }
    #endregion
    // #region 消耗材料货币开启的宝箱
    // public void SetModel(string guid, int itemId)
    // {
    //     ChestsConfig chestsConfig = ChestsConfig.Get(itemId);
    //     this.guid = guid;
    //     this.itemId = itemId;
    //     if (guid == "" || chestsConfig == null) return;
    //     ItemConfig boxConfig = ItemConfig.Get(itemId);
    //     if (PlayerDatas.Instance.baseData.LV < boxConfig.UseLV)
    //     {
    //         ServerTipDetails.DisplayNormalTip(Language.Get("MakeUseItem101", boxConfig.UseLV));
    //         return;
    //     }
    //     CheckOpenBoxCondi(guid, itemId);
    // }
    // public void CheckOpenBoxCondi(string guid, int itemId, int useCnt = 1)
    // {
    //     ChestsConfig chestsConfig = ChestsConfig.Get(itemId);
    //     if (chestsConfig == null) return;
    //     ItemConfig boxConfig = ItemConfig.Get(itemId);
    //     if (chestsConfig.ExpendItemID != 0)
    //     {
    //         ItemConfig itemConfig = ItemConfig.Get(chestsConfig.ExpendItemID);
    //         ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("OpenBoxTool", itemConfig.ItemName), (bool isOk) =>
    //         {
    //             if (isOk)
    //             {
    //                 if (!IsEnoughTools(chestsConfig.ExpendItemID, chestsConfig.ExpendCount * useCnt))
    //                 {
    //                     SysNotifyMgr.Instance.ShowTip("OpenBoxToolNoEnough", itemConfig.ItemName);
    //                     return;
    //                 }
    //                 else
    //                 {
    //                     CheckOpenMoney(chestsConfig, boxConfig, useCnt);
    //                 }
    //             }
    //         });
    //     }
    //     else
    //     {
    //         CheckOpenMoney(chestsConfig, boxConfig, useCnt);
    //     }
    // }
    // public void CheckOpenMoney(ChestsConfig chestsConfig, ItemConfig boxConfig, int useCnt)
    // {
    //     if (!IsEnoughMoney(chestsConfig.OpenMoney * useCnt))
    //     {
    //         SysNotifyMgr.Instance.ShowTip("BoxOpenCostMoney", 1);
    //         return;
    //     }
    //     else
    //     {
    //         if (chestsConfig.OpenMoney > 0)
    //         {
    //             ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("OpenBoxGold", chestsConfig.OpenMoney * useCnt), (bool isOk) =>
    //                 {
    //                     if (isOk)
    //                     {
    //                         CheckOtherCondi(chestsConfig, boxConfig, useCnt);
    //                     }
    //                 });
    //         }
    //         else
    //         {
    //             CheckOtherCondi(chestsConfig, boxConfig, useCnt);
    //         }
    //     }
    // }
    // public void CheckOtherCondi(ChestsConfig chestsConfig, ItemConfig boxConfig, int useCnt)
    // {
    //     if (boxConfig.MaxSkillCnt > 0 && GetUseCntByID(itemId) >= boxConfig.MaxSkillCnt)
    //     {
    //         SysNotifyMgr.Instance.ShowTip("UseCntLimit");
    //         return;
    //     }
    //     if (IsSelectItemByID(itemId))
    //     {
    //         UIManager.Instance.OpenWindow<ChooseItemsWin>();
    //         return;
    //     }
    //     ItemLogicUtility.Instance.UseItem(guid, useCnt);
    // }
    // public bool CheckOpenBoxCondition(int itemId, out bool isBox)
    // {
    //     isBox = false;
    //     ChestsConfig chestsConfig = ChestsConfig.Get(itemId);
    //     if (chestsConfig == null) return false;
    //     isBox = true;
    //     bool isCanOpen = true;
    //     ItemConfig boxConfig = ItemConfig.Get(itemId);
    //     if (PlayerDatas.Instance.baseData.LV < boxConfig.UseLV)
    //     {
    //         isCanOpen = false;
    //         return isCanOpen;
    //     }
    //     if (chestsConfig.ExpendItemID != 0)
    //     {
    //         ItemConfig itemConfig = ItemConfig.Get(chestsConfig.ExpendItemID);
    //         if (!IsEnoughTools(chestsConfig.ExpendItemID, chestsConfig.ExpendCount))
    //         {
    //             isCanOpen = false;
    //             return isCanOpen;
    //         }
    //     }
    //     if (!IsEnoughMoney(chestsConfig.OpenMoney))
    //     {
    //         isCanOpen = false;
    //         return isCanOpen;
    //     }
    //     if (boxConfig.MaxSkillCnt > 0 && GetUseCntByID(itemId) >= boxConfig.MaxSkillCnt)
    //     {
    //         isCanOpen = false;
    //         return isCanOpen;
    //     }
    //     return isCanOpen;
    // }
    // private bool IsEnoughMoney(int moneyCnt)
    // {
    //     ulong haveMoney = UIHelper.GetMoneyCnt(1);
    //     if (haveMoney >= (ulong)moneyCnt)
    //     {
    //         return true;
    //     }
    //     else
    //     {
    //         return false;
    //     }
    // }
    // private bool IsEnoughTools(int itemId, int toolCnt)
    // {
    //     int count = PackManager.Instance.GetItemCountByID(PackType.Item, itemId);
    //     if (count >= toolCnt)
    //     {
    //         return true;
    //     }
    //     else
    //     {
    //         return false;
    //     }
    // }
    // #endregion
    //宝箱预览物品 (随机获得)
    public List<Item> GetBoxItems(int boxID)
@@ -535,14 +320,6 @@
}
public class BoxGetItemInfo
{
    public int ItemID;
    public int Count;
    public int IsBind;
    public int IsSuite;
    public string UserData;
}
public class ChooseItems
{