Esempio n. 1
0
    // 移除已经选择的英雄
    public void RemoveSelectHero(int index, ObjectCard objHero, int lithCount)
    {
        for (int i = 0; i < _selectHeroList.Count; ++i)
        {
            SelectHeroList item = _selectHeroList[i];
            if (item.index == index)
            {
                _selectHeroList.Remove(item);
                DestroyImmediate(item.gameObject);
                break;
            }
        }
        UpdateSelectItem();
        _gainCount -= lithCount;
        UpdateShow(_selectHeroList.Count);

        for (int i = 0; i < _heroList.Count; ++i)
        {
            if (_heroList[i].card == objHero)
            {
                _heroList[i].isSelect = false;
                break;
            }
        }

        // 更新灰图显示
        if (_selectHeroList.Count == 12)
        {
            isAdd = false;
        }

        _curHeroLayout.UpdateCell();
    }
Esempio n. 2
0
    // 添加一个选择的英雄
    public bool AddSelectHero(int index, ObjectCard objHero, int lithCount)
    {
        GameObject     cell   = Instantiate(Resources.Load("UI/Prefabs/UI_Home/SelectHeroInfo")) as GameObject;
        SelectHeroList select = cell.AddComponent <SelectHeroList>();

        select.index   = index;
        select.tableId = objHero.GetHeroData().TableID;
        select.Initialize(objHero);
        cell.transform.parent     = _selectHeroItem.transform;
        cell.transform.localScale = new UnityEngine.Vector3(1, 1, 1);
        _selectHeroList.Add(select);
        UpdateSelectItem();

        _gainCount += lithCount;
        UpdateShow(_selectHeroList.Count);

        for (int i = 0; i < _heroList.Count; ++i)
        {
            if (_heroList[i].card == objHero)
            {
                _heroList[i].isSelect = true;
                break;
            }
        }

        // 更新灰图显示
        if (_selectHeroList.Count == 12)
        {
            isAdd = true;
        }
        _curHeroLayout.UpdateCell();
        return(true);
    }
Esempio n. 3
0
    // 熔灵按钮回调
    private void OnClickLitholysin()
    {
        // 是否已经选择物品
        if (_selectHeroList.Count <= 0)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("heromelt_bubble4"), selfTransform.transform.parent);
            return;
        }

        // 是否有高品质英雄
        for (int i = 0; i < _selectHeroList.Count; i++)
        {
            SelectHeroList item = _selectHeroList[i];
            if (item.m_heroStar >= 5 || isUpFront(item.objHero))
            {
                // 弹窗提示
                UI_RechargeBox box = UI_HomeControler.Inst.AddUI(UI_RechargeBox.UI_ResPath).GetComponent <UI_RechargeBox>();
                box.SetIsNeedDescription(false);
                box.SetDescription_text(GameUtils.getString("heromelt_window1"));
                box.SetLeftBtn_text(GameUtils.getString("common_button_ok"));
                box.SetLeftClick(OnClickConfirmBtn);
                box.SetRightBtn_text(GameUtils.getString("common_button_cancel"));
                box.SetRightClick(OnClickCancelBtn);
                return;
            }
        }

        SendMessage();
    }
Esempio n. 4
0
    void SendMessage()
    {
        _heroRune.Clear();

        LinkedList <int> heroKey = new LinkedList <int>();

        for (int i = 0; i < _selectHeroList.Count; ++i)
        {
            SelectHeroList item = _selectHeroList[i];
            heroKey.AddLast((int)item.objHero.GetHeroData().GUID.GUID_value);

            for (int j = 0; j < item.objHero.GetHeroData().GetEquipItems().Count; ++j)
            {
                if (item.objHero.GetHeroData().GetEquipItems()[j].IsValid())
                {
                    _heroRune.Add(item.objHero.GetHeroData().GetEquipItems()[j]);
                }
            }
        }

        CSplitHero proto = new CSplitHero();

        proto.herokeylist = heroKey;
        IOControler.GetInstance().SendProtocol(proto);
    }
Esempio n. 5
0
 void UpdateSelectItem()
 {
     for (int i = 0; i < _selectHeroList.Count; ++i)
     {
         SelectHeroList item = _selectHeroList[i];
         RectTransform  rect = item.GetComponent <RectTransform>();
         rect.anchoredPosition3D = _selectHeroExp.transform.GetChild(i).GetComponent <RectTransform>().anchoredPosition3D;
     }
 }