Esempio n. 1
0
    //全局事件处理
    public void GlobalEventHandler(int eventid, object data)
    {
        switch (eventid)
        {
        case (int)Client.GameEventID.UIEVENTEQUIPCOMPOUNDOPENRESULT:
        {
            if (null != data && data is uint)
            {
                uint openIndex = (uint)data;
                if (openIndex >= 1 && openIndex <= 3 &&
                    null != cardArray && cardArray.Length == 3)
                {
                    bool isOpen = false;
                    UICompoundSelectAttrGrid tempGrid = null;
                    for (int i = 0, max = cardArray.Length; i < max; i++)
                    {
                        tempGrid = cardArray[i];
                        if (null == tempGrid)
                        {
                            continue;
                        }
                        isOpen = emgr.IsEquipCompoundResultOpen(tempGrid.Index);
                        if (tempGrid.Index == openIndex)
                        {
                            if (emgr.CompoundSelectIndex == tempGrid.Index)
                            {
                                tempGrid.SetSelect(true);
                            }
                            tempGrid.OpenCard();
                        }
                        else if (!isOpen)
                        {
                            tempGrid.UpdateCloseCostStatus(false);
                        }
                    }
                }
            }
        }
        break;

        case (int)Client.GameEventID.UIEVENT_UPDATEITEM:
        {
            if (null != data && data is ItemDefine.UpdateItemPassData)
            {
                ItemDefine.UpdateItemPassData passData = (ItemDefine.UpdateItemPassData)data;
                if (passData.BaseId == m_assistID &&
                    null != cardArray)
                {
                    UpdateAssistData();
                    bool freeGet = emgr.CompoundSelectIndex == 0;
                    if (!freeGet)
                    {
                        UICompoundSelectAttrGrid tempGrid = null;
                        bool isOpen = false;
                        for (int i = 0, max = cardArray.Length; i < max; i++)
                        {
                            tempGrid = cardArray[i];
                            if (null == tempGrid)
                            {
                                continue;
                            }
                            isOpen = emgr.IsEquipCompoundResultOpen(tempGrid.Index);
                            if (isOpen)
                            {
                                continue;
                            }
                            tempGrid.UpdateCloseCostStatus(freeGet);
                        }
                    }
                }
            }
        }
        break;
        }
    }