Пример #1
0
        private void OnTips_ItemSourceElementClick(CUIEvent uiEvent)
        {
            stItemGetInfoParams itemGetInfoParams = uiEvent.m_eventParams.itemGetInfoParams;

            if (!itemGetInfoParams.isCanDo)
            {
                Singleton <CUIManager> .GetInstance().OpenTips(itemGetInfoParams.errorStr, false, 1f, null, new object[0]);
            }
            else
            {
                if (itemGetInfoParams.getType == 1)
                {
                    CUIEvent event2 = new CUIEvent {
                        m_eventID = enUIEventID.Adv_OpenLevelForm
                    };
                    event2.m_eventParams.tag = itemGetInfoParams.levelInfo.iCfgID;
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(event2);
                }
                else if (itemGetInfoParams.getType != 2)
                {
                    if (itemGetInfoParams.getType == 3)
                    {
                        Singleton <CMallSystem> .instance.CurTab = CMallSystem.Tab.Boutique;
                        CUIEvent event4 = new CUIEvent {
                            m_eventID = enUIEventID.Mall_OpenForm
                        };
                        event4.m_eventParams.tag = 1;
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(event4);
                    }
                }
                else
                {
                    RES_SHOP_TYPE tag    = (RES_SHOP_TYPE)uiEvent.m_eventParams.tag;
                    CUIEvent      event3 = new CUIEvent();
                    switch (tag)
                    {
                    case RES_SHOP_TYPE.RES_SHOPTYPE_ARENA:
                        event3.m_eventID = enUIEventID.Shop_OpenArenaShop;
                        break;

                    case RES_SHOP_TYPE.RES_SHOPTYPE_BURNING:
                        event3.m_eventID = enUIEventID.Shop_OpenBurningShop;
                        break;
                    }
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(event3);
                }
                Singleton <CUIManager> .GetInstance().CloseForm(s_itemGetSourceFormPath);
            }
        }
Пример #2
0
        public static void SetGetInfoToList(CUIFormScript formScript, CUIListScript list, CUseable itemUseable)
        {
            ResDT_ItemSrc_Info[] astSrcInfo = null;
            if (itemUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
            {
                astSrcInfo = ((CItem)itemUseable).m_itemData.astSrcInfo;
            }
            else if (itemUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMEQUIP)
            {
                astSrcInfo = ((CEquip)itemUseable).m_equipData.astSrcInfo;
            }
            else if (itemUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL)
            {
                astSrcInfo = ((CSymbolItem)itemUseable).m_SymbolData.astSrcInfo;
            }
            else
            {
                return;
            }
            int amount = 0;

            for (int i = 0; i < astSrcInfo.Length; i++)
            {
                if (astSrcInfo[i].bType == 0)
                {
                    break;
                }
                amount++;
            }
            if (list != null)
            {
                list.SetElementAmount(amount);
                for (int j = 0; j < amount; j++)
                {
                    Transform           transform   = list.GetElemenet(j).transform.Find("sourceCell");
                    Text                component   = transform.Find("lblName").GetComponent <Text>();
                    Text                text2       = transform.Find("lblLevel").GetComponent <Text>();
                    Button              button      = transform.Find("lblOpen").GetComponent <Button>();
                    Text                text3       = transform.Find("lblClose").GetComponent <Text>();
                    Text                text4       = transform.Find("Elite").GetComponent <Text>();
                    byte                bType       = astSrcInfo[j].bType;
                    int                 dwID        = (int)astSrcInfo[j].dwID;
                    bool                bActive     = false;
                    stUIEventParams     eventParams = new stUIEventParams();
                    stItemGetInfoParams params2     = new stItemGetInfoParams();
                    eventParams.itemGetInfoParams         = params2;
                    eventParams.itemGetInfoParams.getType = bType;
                    if (bType == 1)
                    {
                        ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey(dwID);
                        bActive = Singleton <CAdventureSys> .GetInstance().IsLevelOpen(dataByKey.iCfgID);

                        eventParams.itemGetInfoParams.levelInfo = dataByKey;
                        eventParams.itemGetInfoParams.isCanDo   = bActive;
                        if (!bActive)
                        {
                            eventParams.itemGetInfoParams.errorStr = Singleton <CTextManager> .instance.GetText("Hero_Level_Not_Open");
                        }
                        component.text = StringHelper.UTF8BytesToString(ref dataByKey.szName);
                        text2.text     = dataByKey.iChapterId + "-" + dataByKey.bLevelNo;
                        if (text4 != null)
                        {
                            text4.gameObject.CustomSetActive(dataByKey.bLevelDifficulty == 2);
                        }
                    }
                    button.gameObject.CustomSetActive(bActive);
                    text3.gameObject.CustomSetActive(!bActive);
                    CUIEventScript script = button.gameObject.GetComponent <CUIEventScript>();
                    if (script == null)
                    {
                        script = transform.gameObject.AddComponent <CUIEventScript>();
                        script.Initialize(formScript);
                    }
                    script.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemSourceElementClick, eventParams);
                }
                list.gameObject.CustomSetActive(true);
            }
        }