Esempio n. 1
0
    /// <summary>
    /// 发挥功能
    /// </summary>
    private void BadgeOnOff()
    {
        if (seleObj.GetComponentInParent <ItemCell>().GetItemInfo() != null)
        {
            ItemCell father = seleObj.GetComponentInParent <ItemCell>();
            //最后一个是特殊,固有
            if (father.GetItemInfo().id == 60)
            {
                return;
            }

            //交给BadgeMgr判断
            BadgeMgr.Instance.BadgeOnOrOff(father.GetItemInfo());
            //判断现在所选中badge的状态
            if (BadgeMgr.Instance.EquipedJudge)
            {
                father.ItemOn();
            }
            else
            {
                father.ItemOff();
            }
            MusicMgr.Instance.PlaySound("UIBadge_Euqip", false);

            //发生改变,重写选择框路径字典,并且告诉其他三个栏目要更新信息
            if (BadgeMgr.Instance.ListChanged)
            {
                CreateBadgeGrid();
                CreateEquipedGrid();
                CreateGrooves();
                CreateSeleGrid();
                seleObj.GetComponent <Image>().enabled = true;
            }
            return;
        }
        if (seleObj.transform.parent.name == "ArrowLeft")
        {
            EventCenter.Instance.EventTrigger <int>("PanelChange", -1);
        }
        if (seleObj.transform.parent.name == "ArrowRight")
        {
            EventCenter.Instance.EventTrigger <int>("PanelChange", 1);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 检查自身位置,并触发更新事件
    /// </summary>
    private void CheckSeleObjPos()
    {
        //处理数字
        int rowMin = seleGrid.ContainsKey(-1) ? -1 : 0;
        int rowMax = 3;

        if (rowNum > rowMax)
        {
            rowNum = rowMax;
        }
        if (rowNum < rowMin)
        {
            rowNum = rowMin;
        }

        Transform father;

        if (coluNum < 0)
        {
            father = GetControl <Image>("ArrowLeft").gameObject.transform;
            seleObj.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(120, 240);
        }
        else if (coluNum > 9)
        {
            father = GetControl <Image>("ArrowRight").gameObject.transform;
            seleObj.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(120, 240);
        }
        else
        {
            father = seleGrid[rowNum][coluNum].transform;
            seleObj.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(140, 140);
        }
        seleObj.transform.SetParent(father);
        seleObj.transform.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;

        ItemCell cell = father.GetComponent <ItemCell>();

        EventCenter.Instance.EventTrigger <ItemInfo>("CurrentPosBadge", cell.GetItemInfo());
    }