예제 #1
0
    public void OpenMailRes()
    {
        if (isOpenAllMail)
        {
            Dictionary <int, int> AllItemLst = new Dictionary <int, int>();
            for (int i = 0; i < LstGrid.transform.childCount; i++)
            {
                Transform       child = LstGrid.transform.GetChild(i);
                UI_MailItemUnit miu   = child.GetComponent <UI_MailItemUnit>();
                miu.ReadAndGet();

                /*foreach (KeyValuePair<int, int> pair in miu.CurMII.ItemLst)
                 * {
                 *  GameApp.SendMsg.GMOrder("AddItem " + pair.Key + " " + pair.Value);
                 * }*/
                foreach (KeyValuePair <int, int> pair in miu.CurMII.ItemLst)
                {
                    if (AllItemLst.ContainsKey(pair.Key))
                    {
                        AllItemLst[pair.Key] += pair.Value;
                    }
                    else
                    {
                        AllItemLst.Add(pair.Key, pair.Value);
                    }
                }
            }

            for (int k = 0; k < AwardItemLst.Count; k++)
            {
                if (AwardItemLst[k].gameObject.activeSelf)
                {
                    AwardItemLst[k].ShowGetSign(true);
                }
            }
            GetBtn.isEnabled = false;

            GameApp.Instance.GetItemsDlg.OpenGetItemsBox(AllItemLst);
        }
        else
        {
            CurShowMIU.ReadAndGet();

            /*foreach (KeyValuePair<int, int> pair in CurShowMIU.CurMII.ItemLst)
             * {
             *  GameApp.SendMsg.GMOrder("AddItem " + pair.Key + " " + pair.Value);
             * }*/
            for (int k = 0; k < AwardItemLst.Count; k++)
            {
                if (AwardItemLst[k].gameObject.activeSelf)
                {
                    AwardItemLst[k].ShowGetSign(true);
                }
            }
            GetBtn.isEnabled = false;

            GameApp.Instance.GetItemsDlg.OpenGetItemsBox(CurShowMIU.CurMII.ItemLst);
        }
    }
예제 #2
0
    public void ShowMailDetail(UI_MailItemUnit miu)
    {
        if (miu == null)
        {
            CurShowMIU       = null;
            Title.text       = "";
            ResidueTime.text = "";
            Details.text     = "";
            for (int k = 0; k < AwardItemLst.Count; k++)
            {
                AwardItemLst[k].gameObject.SetActive(false);
            }
            DeleteBtn.gameObject.SetActive(false);
            GetBtn.gameObject.SetActive(false);
            return;
        }

        if (CurShowMIU != null)
        {
            CurShowMIU.Select(false);
        }

        CurShowMIU = miu;

        Title.text       = CurShowMIU.CurMII.Name;
        ResidueTime.text = StringBuilderTool.ToString(CurShowMIU.CurMII.Residue, "天后自动删除");
        Details.text     = CurShowMIU.CurMII.Details;

        for (int k = 0; k < AwardItemLst.Count; k++)
        {
            AwardItemLst[k].ShowGetSign(false);
            AwardItemLst[k].gameObject.SetActive(false);
        }

        if (CurShowMIU.CurMII.ItemLst != null)
        {
            int i = 0;
            foreach (KeyValuePair <int, int> pair in CurShowMIU.CurMII.ItemLst)
            {
                AwardItemLst[i].ShowGetSign(CurShowMIU.CurMII.IsReadAndGet);
                AwardItemLst[i].SetItemData(pair.Key, pair.Value);
                AwardItemLst[i].gameObject.SetActive(true);
                i++;
            }
        }

        bool ShowGetBtn = (CurShowMIU.CurMII.IsHasItem() && !CurShowMIU.CurMII.IsReadAndGet);

        GetBtn.gameObject.SetActive(ShowGetBtn);
        GetBtn.isEnabled = ShowGetBtn;

        DeleteBtn.gameObject.SetActive(true);
    }
예제 #3
0
    /// <summary> 一键领取按钮 </summary>
    public void OnClick_GetAll()
    {
        GameApp.Instance.SoundInstance.PlaySe("button");
        Debug.Log("点击【一键领取】");

        isOpenAllMail = true;
        for (int i = 0; i < LstGrid.transform.childCount; i++)
        {
            Transform       child = LstGrid.transform.GetChild(i);
            UI_MailItemUnit miu   = child.GetComponent <UI_MailItemUnit>();

            GameApp.SendMsg.OpenMail(miu.CurMII.ID);
        }
    }
예제 #4
0
    void UpdateMailRedPoint()
    {
        bool hasNoRead = false;

        for (int i = 0; i < LstGrid.transform.childCount; i++)
        {
            Transform       child = LstGrid.transform.GetChild(i);
            UI_MailItemUnit miu   = child.GetComponent <UI_MailItemUnit>();
            if (!miu.CurMII.IsReadAndGet)
            {
                hasNoRead = true;
                break;
            }
        }
        //GameApp.Instance.UIHomePage.MailRedPoint.SetActive(hasNoRead);

        GetAllBtnObj.SetActive(hasNoRead);
    }