public static void RefreshSymbolItem(ResSymbolInfo symbolInfo, GameObject widget, CUIFormScript form)
        {
            if ((symbolInfo != null) && (widget != null))
            {
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                if (masterRoleInfo != null)
                {
                    CUseable useableByBaseID = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM).GetUseableByBaseID(COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL, symbolInfo.dwID);
                    Image    component       = widget.transform.Find("iconImage").GetComponent <Image>();
                    Text     text            = widget.transform.Find("countText").GetComponent <Text>();
                    Text     text2           = widget.transform.Find("nameText").GetComponent <Text>();
                    Text     text3           = widget.transform.Find("descText").GetComponent <Text>();
                    component.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, symbolInfo.dwIcon), form, true, false, false);
                    text.text  = (useableByBaseID == null) ? string.Empty : useableByBaseID.m_stackCount.ToString();
                    text2.text = symbolInfo.szName;
                    text3.text = CSymbolSystem.GetSymbolAttString(symbolInfo.dwID, true);
                    CUIEventScript script = widget.GetComponent <CUIEventScript>();
                    if (script != null)
                    {
                        stUIEventParams eventParams = new stUIEventParams();
                        eventParams.symbolTransParam.symbolCfgInfo = symbolInfo;
                        script.SetUIEvent(enUIEventType.Click, enUIEventID.SymbolMake_ListItemClick, eventParams);
                    }
                    if (useableByBaseID != null)
                    {
                        CUICommonSystem.PlayAnimator(widget, "Symbol_Normal");
                    }
                    else
                    {
                        CUICommonSystem.PlayAnimator(widget, "Symbol_Disabled");
                    }
                }
            }
        }
        private void RefreshSymbolTransformForm()
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_symbolTransformPath);

            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (((form != null) && (this.m_curTransformSymbol != null)) && (masterRoleInfo != null))
            {
                GameObject gameObject = form.transform.Find("Panel_SymbolTranform/Panel_Content").gameObject;
                gameObject.transform.Find("iconImage").GetComponent <Image>().SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, this.m_curTransformSymbol.dwIcon), form, true, false, false);
                gameObject.transform.Find("nameText").GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref this.m_curTransformSymbol.szName);
                Text component = gameObject.transform.Find("countText").GetComponent <Text>();
                component.text = string.Empty;
                int useableStackCount = 0;
                CUseableContainer useableContainer = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM);
                if (useableContainer != null)
                {
                    useableStackCount = useableContainer.GetUseableStackCount(COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL, this.m_curTransformSymbol.dwID);
                    CTextManager instance = Singleton <CTextManager> .GetInstance();

                    component.text = (useableStackCount <= 0) ? instance.GetText("Symbol_Not_Own") : string.Format(instance.GetText("Symbol_Own_Cnt"), useableStackCount);
                }
                CSymbolSystem.RefreshSymbolPropContent(gameObject.transform.Find("symbolPropPanel").gameObject, this.m_curTransformSymbol.dwID);
                gameObject.transform.Find("makeCoinText").GetComponent <Text>().text  = this.m_curTransformSymbol.dwMakeCoin.ToString();
                gameObject.transform.Find("breakCoinText").GetComponent <Text>().text = this.m_curTransformSymbol.dwBreakCoin.ToString();
                GameObject obj4 = gameObject.transform.Find("btnBreak").gameObject;
                obj4.GetComponent <Button>().interactable    = useableStackCount > 0;
                obj4.GetComponent <CUIEventScript>().enabled = useableStackCount > 0;
            }
        }
Exemple #3
0
        public void SwitchToSymbolRcmdPanel(CUIFormScript form)
        {
            if (form == null || form.IsClosed())
            {
                return;
            }
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                DebugHelper.Assert(false, "SwitchToSymbolRcmdPanel role is null");
                return;
            }
            this.m_curHeroId       = masterRoleInfo.m_symbolInfo.m_selSymbolRcmdHeroId;
            this.m_symbolRcmdLevel = masterRoleInfo.m_symbolInfo.m_selSymbolRcmdLevel;
            this.m_symbolRcmdLevel = (ushort)Math.Max(1, Math.Min((int)this.m_symbolRcmdLevel, CSymbolInfo.s_maxSymbolLevel));
            CSymbolSystem.RefreshSymbolCntText(true);
            this.RefreshSymbolRcmdPanel();
            string[] titleList = new string[]
            {
                "1",
                "2",
                "3",
                "4",
                "5"
            };
            GameObject listObj = Utility.FindChild(form.gameObject, "SymbolRecommend/Panel_SymbolRecommend/Panel_SymbolLevel/levelList");

            CUICommonSystem.InitMenuPanel(listObj, titleList, (int)(this.m_symbolRcmdLevel - 1), true);
        }
Exemple #4
0
 public static void UpdateSymbolItem(CSymbolItem symbol, GameObject element, CUIFormScript form)
 {
     if (((symbol != null) && (element != null)) && (form != null))
     {
         Image component = element.transform.Find("iconImage").GetComponent <Image>();
         Text  text      = element.transform.Find("countText").GetComponent <Text>();
         Text  text2     = element.transform.Find("nameText").GetComponent <Text>();
         Text  text3     = element.transform.Find("descText").GetComponent <Text>();
         component.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, symbol.m_SymbolData.dwIcon), form, true, false, false);
         text.text  = string.Format("x{0}", symbol.m_stackCount.ToString());
         text2.text = symbol.m_SymbolData.szName;
         text3.text = CSymbolSystem.GetSymbolAttString(symbol.m_baseID, true);
     }
 }
Exemple #5
0
        private void OnRcmdListItemEnable(CUIEvent uiEvent)
        {
            if (this.m_rcmdSymbolList == null || this.m_rcmdSymbolList[(int)(this.m_symbolRcmdLevel - 1)] == null)
            {
                return;
            }
            if (uiEvent.m_srcWidgetIndexInBelongedList < 0 || uiEvent.m_srcWidgetIndexInBelongedList >= this.m_rcmdSymbolList[(int)(this.m_symbolRcmdLevel - 1)].get_Count())
            {
                DebugHelper.Assert(false, "OnRcmdListItemEnable index out of range");
                return;
            }
            ResSymbolInfo dataByKey = GameDataMgr.symbolInfoDatabin.GetDataByKey(this.m_rcmdSymbolList[(int)(this.m_symbolRcmdLevel - 1)].get_Item(uiEvent.m_srcWidgetIndexInBelongedList));

            CSymbolSystem.RefreshSymbolItem(dataByKey, uiEvent.m_srcWidget, uiEvent.m_srcFormScript, enSymbolMakeSource.SymbolManage);
        }
        public void Init(CSymbolSystem symbolSys)
        {
            this.m_symbolSys = symbolSys;
            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolRcmd_OpenChangeHeroForm, new CUIEventManager.OnUIEventHandler(this.OnOpenChangeHeroForm));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolRcmd_HeroListItemClick, new CUIEventManager.OnUIEventHandler(this.OnHeroListElementClick));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolRcmd_LevelListIndexChange, new CUIEventManager.OnUIEventHandler(this.OnSymbolRcmdLevelChange));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolRcmd_HeroTypeChange, new CUIEventManager.OnUIEventHandler(this.OnHeroTypeListSelect));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolRcmd_HeroOwnFlagChange, new CUIEventManager.OnUIEventHandler(this.OnHeroOwnFlagChange));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolRcmd_HeroListItemEnable, new CUIEventManager.OnUIEventHandler(this.OnHeroListElementEnable));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolRcmd_RcmdListItemEnable, new CUIEventManager.OnUIEventHandler(this.OnRcmdListItemEnable));
        }
Exemple #7
0
        public static void ShopBuyRsp(CSPkg msg)
        {
            switch (msg.stPkgData.stShopBuyRsp.iBuyType)
            {
            case 1:
            case 2:
            case 3:
            case 8:
            case 10:
            case 11:
                Singleton <EventRouter> .instance.BroadCastEvent <CSPkg>("ShopBuyDraw", msg);

                break;

            case 4:
            case 5:
                Singleton <EventRouter> .instance.BroadCastEvent <CSPkg>("ShopBuyPurchase", msg);

                Singleton <CSoundManager> .instance.PostEvent("UI_Add_Physical", null);

                break;

            case 6:
                Singleton <EventRouter> .instance.BroadCastEvent <CSPkg>("ShopBuyLvlChallengeTime", msg);

                break;

            case 7:
                CSymbolSystem.OnSymbolBuySuccess(msg.stPkgData.stShopBuyRsp.iChgValue, msg.stPkgData.stShopBuyRsp.iBuySubType);
                break;

            case 9:
                Singleton <CArenaSystem> .GetInstance().ResetFightTimes(msg.stPkgData.stShopBuyRsp.iBuySubType, msg.stPkgData.stShopBuyRsp.iChgValue);

                break;

            case 12:
                CSymbolSystem.OnSymbolGridBuySuccess(msg.stPkgData.stShopBuyRsp.iChgValue);
                break;

            case 13:
                Singleton <CHeroSelectSystem> .instance.OnHeroCountBought();

                break;
            }
        }
        public void SwitchToSymbolMakePanel(CUIEvent uiEvent)
        {
            this.ClearSymbolMakeData();
            this.RefreshSymbolMakeForm();
            CSymbolSystem.RefreshSymbolCntText();
            CUseable        useable     = CUseableManager.CreateVirtualUseable(enVirtualItemType.enSymbolCoin, 0);
            stUIEventParams eventParams = new stUIEventParams {
                iconUseable = useable,
                tag         = 3
            };
            CUIEventScript component = uiEvent.m_srcFormScript.GetWidget(8).GetComponent <CUIEventScript>();

            if (component != null)
            {
                component.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, eventParams);
                component.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
                component.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, eventParams);
                component.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
            }
        }
        public void Init(CSymbolSystem symbolSys)
        {
            this.m_symbolSys = symbolSys;
            this.InitSymbolCfgList();
            this.InitBreakSymbolList();
            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_TypeMenuSelect, new CUIEventManager.OnUIEventHandler(this.OnSymbolTypeMenuSelect));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_LevelMenuSelect, new CUIEventManager.OnUIEventHandler(this.OnSymbolLevelMenuSelect));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_ListItemEnable, new CUIEventManager.OnUIEventHandler(this.OnSymbolMakeListEnable));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_ListItemClick, new CUIEventManager.OnUIEventHandler(this.OnSymbolMakeListClick));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_OnItemMakeClick, new CUIEventManager.OnUIEventHandler(this.OnMakeSymbolClick));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_OnItemMakeConfirm, new CUIEventManager.OnUIEventHandler(this.OnItemMakeConfirm));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_OnItemBreakClick, new CUIEventManager.OnUIEventHandler(this.OnBreakSymbolClick));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_OnItemBreakConfirm, new CUIEventManager.OnUIEventHandler(this.OnBreakSymbolConfirm));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_OnBreakExcessSymbolClick, new CUIEventManager.OnUIEventHandler(this.OnBreakExcessSymbolClick));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_SelectBreakLvlItem, new CUIEventManager.OnUIEventHandler(this.OnSelectBreakLvlItem));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_OnBreakExcessSymbolConfirm, new CUIEventManager.OnUIEventHandler(this.OnBreakExcessSymbolClickConfirm));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_ItemBreakAnimatorEnd, new CUIEventManager.OnUIEventHandler(this.OnItemBreakAnimatorEnd));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Symbol_BreakItemEnable, new CUIEventManager.OnUIEventHandler(this.OnBreakListItemEnable));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Symbol_BreakListItemSelToggle, new CUIEventManager.OnUIEventHandler(this.OnBreakListItemSelToggle));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Symbol_OpenBreakDetailForm, new CUIEventManager.OnUIEventHandler(this.OnOpenBreakDetailForm));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Symbol_BreakDetailFormConfirm, new CUIEventManager.OnUIEventHandler(this.OnBreakDetailFormConfirm));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Symbol_BreakDetailFormCancle, new CUIEventManager.OnUIEventHandler(this.OnBreakDetailFormCancle));

            Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.SymbolMake_CoinNotEnoughGotoSymbolMall, new CUIEventManager.OnUIEventHandler(this.OnCoinNotEnoughGotoSymbolMall));
        }
        public void SwitchToSymbolRcmdPanel(CUIEvent uiEvent)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                DebugHelper.Assert(false, "SwitchToSymbolRcmdPanel role is null");
            }
            else
            {
                this.m_curHeroId       = masterRoleInfo.m_symbolInfo.m_selSymbolRcmdHeroId;
                this.m_symbolRcmdLevel = masterRoleInfo.m_symbolInfo.m_selSymbolRcmdLevel;
                this.m_symbolRcmdLevel = (ushort)Math.Max(1, Math.Min(this.m_symbolRcmdLevel, CSymbolInfo.s_maxSymbolLevel));
                CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CSymbolSystem.s_symbolFormPath);

                if (null != form)
                {
                    CSymbolSystem.RefreshSymbolCntText();
                    this.RefreshSymbolRcmdPanel();
                    string[] titleList = new string[] { "1", "2", "3", "4", "5" };
                    CUICommonSystem.InitMenuPanel(form.GetWidget(11), titleList, this.m_symbolRcmdLevel - 1);
                }
            }
        }
        public static void UpdateSymbolItem(CSymbolItem symbol, GameObject element, CUIFormScript form)
        {
            if (symbol == null)
            {
                return;
            }
            if (element == null)
            {
                return;
            }
            if (form == null)
            {
                return;
            }
            Image component  = element.transform.Find("iconImage").GetComponent <Image>();
            Text  component2 = element.transform.Find("countText").GetComponent <Text>();
            Text  component3 = element.transform.Find("nameText").GetComponent <Text>();
            Text  component4 = element.transform.Find("descText").GetComponent <Text>();

            component.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, symbol.m_SymbolData.dwIcon), form, true, false, false, false);
            component2.set_text(string.Format("x{0}", symbol.m_stackCount.ToString()));
            component3.set_text(symbol.m_SymbolData.szName);
            component4.set_text(CSymbolSystem.GetSymbolAttString(symbol.m_baseID, true));
        }
        public CSymbolBuyPickDialog(ResSymbolInfo symbolInfo, RES_SHOPBUY_COINTYPE coinType, float discount, CSymbolBuyPickDialog.OnConfirmBuyDelegate onConfirm, CSymbolBuyPickDialog.OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                return;
            }
            CUseableContainer useableContainer = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM);

            this._usb = (useableContainer.GetUseableByBaseID(5, symbolInfo.dwID) as CSymbolItem);
            if (this._usb == null)
            {
                this._usb = (CUseableManager.CreateUseable(5, symbolInfo.dwID, 0) as CSymbolItem);
            }
            if (this._usb == null)
            {
                return;
            }
            CUIFormScript cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(CSymbolBuyPickDialog.s_Form_Path, false, true);

            if (null != cUIFormScript)
            {
                this._root        = cUIFormScript.gameObject;
                this._itemCell    = Utility.FindChild(this._root, "Panel/itemCell");
                this._callContext = symbolInfo;
                this._count       = 1u;
                if ((long)this._usb.m_stackCount >= 10L)
                {
                    this._maxCount = 1u;
                }
                else
                {
                    this._maxCount = (uint)(10 - this._usb.m_stackCount);
                }
                this._onConfirm        = onConfirm;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    CUICommonSystem.SetItemCell(cUIFormScript, this._itemCell, this._usb, true, false, false, false);
                    this._descText = Utility.GetComponetInChild <Text>(this._root, "Panel/itemCell/SymbolDesc");
                    if (this._descText != null)
                    {
                        this._descText.text = CSymbolSystem.GetSymbolAttString(symbolInfo.dwID, true);
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false), false);
                        Utility.GetComponetInChild <Text>(this._root, "Panel/Price").text = this._usb.GetBuyPrice(this._coinType).ToString();
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_CloseForm, new CUIEventManager.OnUIEventHandler(this.OnCloseForm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_ConfirmFactoryShopBuy, new CUIEventManager.OnUIEventHandler(this.OnConfirmFactoryShopBuy));

                this.ValidateDynamic();
            }
        }
Exemple #13
0
        public static void OnRankGodDetailTab(int tabIndex, COMDT_RANKING_LIST_ITEM_EXTRA_MASTER_HERO masterHeroInfo, uint heroId)
        {
            CUIFormScript form = Singleton <CUIManager> .instance.GetForm(RankingSystem.s_rankingGodDetailForm);

            if (form != null)
            {
                GameObject widget = form.GetWidget(0);
                if (widget != null)
                {
                    ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);
                    if (dataByKey != null)
                    {
                        GameObject obj3   = Utility.FindChild(widget, "Panel_EquipInfo");
                        GameObject obj4   = Utility.FindChild(widget, "Panel_SymbolInfo");
                        string     str    = Utility.UTF8Convert(masterHeroInfo.stAcntInfo.szPlayerName);
                        string     szName = dataByKey.szName;
                        obj3.CustomSetActive(false);
                        obj4.CustomSetActive(false);
                        if (tabIndex == 0)
                        {
                            obj3.CustomSetActive(true);
                            CUIListScript componetInChild           = Utility.GetComponetInChild <CUIListScript>(obj3, "List");
                            int           bEquipNum                 = masterHeroInfo.stEquipList.bEquipNum;
                            ushort[]      defaultRecommendEquipInfo = new ushort[6];
                            if (bEquipNum > 0)
                            {
                                for (int j = 0; j < bEquipNum; j++)
                                {
                                    defaultRecommendEquipInfo[j] = (ushort)masterHeroInfo.stEquipList.EquipID[j];
                                }
                            }
                            else
                            {
                                defaultRecommendEquipInfo = Singleton <CEquipSystem> .instance.GetDefaultRecommendEquipInfo(heroId);

                                bEquipNum = defaultRecommendEquipInfo.Length;
                            }
                            componetInChild.SetElementAmount(bEquipNum);
                            for (int i = 0; i < bEquipNum; i++)
                            {
                                GameObject     gameObject = componetInChild.GetElemenet(i).gameObject;
                                CUIEventScript component  = gameObject.GetComponent <CUIEventScript>();
                                ushort         equipID    = defaultRecommendEquipInfo[i];
                                CEquipInfo     equipInfo  = Singleton <CEquipSystem> .instance.GetEquipInfo(equipID);

                                component.m_onClickEventParams.battleEquipPar.equipInfo = Singleton <CEquipSystem> .instance.GetEquipInfo(equipID);

                                component.m_onClickEventParams.tagStr  = str;
                                component.m_onClickEventParams.tagStr1 = szName;
                                CUICommonSystem.SetEquipIcon(equipID, gameObject, form);
                            }
                            if (bEquipNum > 0)
                            {
                                componetInChild.SelectElement(0, true);
                                componetInChild.GetElemenet(0).GetComponent <CUIEventScript>().OnPointerClick(null);
                                CUIEventScript script4 = componetInChild.GetElemenet(0).GetComponent <CUIEventScript>();
                                Singleton <CUIEventManager> .instance.DispatchUIEvent(script4.m_onClickEventID, script4.m_onClickEventParams);
                            }
                            else
                            {
                                componetInChild.SelectElement(-1, true);
                            }
                        }
                        else if (tabIndex == 1)
                        {
                            ListView <CSymbolItem> symbolList = new ListView <CSymbolItem>();
                            for (int k = 0; k < masterHeroInfo.stSymbolPageInfo.bSymbolPosNum; k++)
                            {
                                bool flag = false;
                                for (int n = 0; n < symbolList.Count; n++)
                                {
                                    if (symbolList[n].m_baseID == masterHeroInfo.stSymbolPageInfo.SymbolId[k])
                                    {
                                        CSymbolItem local1 = symbolList[n];
                                        local1.m_stackCount++;
                                        flag = true;
                                        break;
                                    }
                                }
                                if (!flag)
                                {
                                    CSymbolItem item = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL, masterHeroInfo.stSymbolPageInfo.SymbolId[k], 1) as CSymbolItem;
                                    symbolList.Add(item);
                                }
                            }
                            CSymbolWearController.SortSymbolList(ref symbolList);
                            obj4.CustomSetActive(true);
                            CUIListScript script5 = Utility.GetComponetInChild <CUIListScript>(obj4, "List");
                            script5.SetElementAmount(symbolList.Count);
                            int num7 = 0;
                            for (int m = 0; m < symbolList.Count; m++)
                            {
                                GameObject p = script5.GetElemenet(m).gameObject;
                                Utility.GetComponetInChild <Image>(p, "imgIcon").SetSprite(symbolList[m].GetIconPath(), form, true, false, false);
                                Utility.GetComponetInChild <Text>(p, "SymbolName").text = symbolList[m].m_name;
                                char[] trimChars = new char[] { '\n' };
                                Utility.GetComponetInChild <Text>(p, "SymbolDesc").text   = CSymbolSystem.GetSymbolAttString(symbolList[m], true).TrimEnd(trimChars);
                                Utility.GetComponetInChild <Text>(p, "lblIconCount").text = string.Format("x{0}", symbolList[m].m_stackCount);
                                num7 += symbolList[m].m_SymbolData.wLevel;
                            }
                            Utility.GetComponetInChild <Text>(obj4, "symbolPageLvlText").text = num7.ToString();
                            string[] args = new string[] { str, szName };
                            Utility.GetComponetInChild <Text>(obj4, "heroSymbolText").text = Singleton <CTextManager> .instance.GetText("RankGodHeroSymbolDesc", args);
                        }
                    }
                }
            }
        }
Exemple #14
0
        public static void OnRankGodDetailTab(int tabIndex, COMDT_RANKING_LIST_ITEM_EXTRA_MASTER_HERO masterHeroInfo, uint heroId)
        {
            CUIFormScript form = Singleton <CUIManager> .get_instance().GetForm(RankingSystem.s_rankingGodDetailForm);

            if (form == null)
            {
                return;
            }
            GameObject widget = form.GetWidget(0);

            if (widget == null)
            {
                return;
            }
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);

            if (dataByKey == null)
            {
                return;
            }
            GameObject gameObject  = Utility.FindChild(widget, "Panel_EquipInfo");
            GameObject gameObject2 = Utility.FindChild(widget, "Panel_SymbolInfo");
            string     text        = Utility.UTF8Convert(masterHeroInfo.stAcntInfo.szPlayerName);
            string     szName      = dataByKey.szName;

            gameObject.CustomSetActive(false);
            gameObject2.CustomSetActive(false);
            if (tabIndex == 0)
            {
                gameObject.CustomSetActive(true);
                CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(gameObject, "List");
                int           num             = (int)masterHeroInfo.stEquipList.bEquipNum;
                ushort[]      array           = new ushort[6];
                if (num > 0)
                {
                    for (int i = 0; i < num; i++)
                    {
                        array[i] = (ushort)masterHeroInfo.stEquipList.EquipID[i];
                    }
                }
                else
                {
                    ResRecommendEquipInBattle defaultRecommendEquipInfo = Singleton <CEquipSystem> .get_instance().GetDefaultRecommendEquipInfo(heroId, 1u);

                    if (defaultRecommendEquipInfo != null)
                    {
                        array = defaultRecommendEquipInfo.RecommendEquipID;
                    }
                    num = array.Length;
                }
                componetInChild.SetElementAmount(num);
                for (int j = 0; j < num; j++)
                {
                    GameObject     gameObject3 = componetInChild.GetElemenet(j).gameObject;
                    CUIEventScript component   = gameObject3.GetComponent <CUIEventScript>();
                    ushort         num2        = array[j];
                    CEquipInfo     equipInfo   = CEquipSystem.GetEquipInfo(num2);
                    component.m_onClickEventParams.battleEquipPar.equipInfo = CEquipSystem.GetEquipInfo(num2);
                    component.m_onClickEventParams.tagStr  = text;
                    component.m_onClickEventParams.tagStr1 = szName;
                    CUICommonSystem.SetEquipIcon(num2, gameObject3, form);
                }
                if (num > 0)
                {
                    componetInChild.SelectElement(0, true);
                    componetInChild.GetElemenet(0).GetComponent <CUIEventScript>().OnPointerClick(null);
                    CUIEventScript component2 = componetInChild.GetElemenet(0).GetComponent <CUIEventScript>();
                    Singleton <CUIEventManager> .get_instance().DispatchUIEvent(component2.m_onClickEventID, component2.m_onClickEventParams);
                }
                else
                {
                    componetInChild.SelectElement(-1, true);
                }
            }
            else if (tabIndex == 1)
            {
                ListView <CSymbolItem> listView = new ListView <CSymbolItem>();
                for (int k = 0; k < (int)masterHeroInfo.stSymbolPageInfo.bSymbolPosNum; k++)
                {
                    bool flag = false;
                    for (int l = 0; l < listView.get_Count(); l++)
                    {
                        if (listView.get_Item(l).m_baseID == masterHeroInfo.stSymbolPageInfo.SymbolId[k])
                        {
                            listView.get_Item(l).m_stackCount++;
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        CSymbolItem cSymbolItem = CUseableManager.CreateUseable(5, masterHeroInfo.stSymbolPageInfo.SymbolId[k], 1) as CSymbolItem;
                        listView.Add(cSymbolItem);
                    }
                }
                CSymbolWearController.SortSymbolList(ref listView);
                gameObject2.CustomSetActive(true);
                CUIListScript componetInChild2 = Utility.GetComponetInChild <CUIListScript>(gameObject2, "List");
                componetInChild2.SetElementAmount(listView.get_Count());
                int num3 = 0;
                for (int m = 0; m < listView.get_Count(); m++)
                {
                    GameObject gameObject4      = componetInChild2.GetElemenet(m).gameObject;
                    Image      componetInChild3 = Utility.GetComponetInChild <Image>(gameObject4, "imgIcon");
                    componetInChild3.SetSprite(listView.get_Item(m).GetIconPath(), form, true, false, false, false);
                    Text componetInChild4 = Utility.GetComponetInChild <Text>(gameObject4, "SymbolName");
                    componetInChild4.text = listView.get_Item(m).m_name;
                    Text componetInChild5 = Utility.GetComponetInChild <Text>(gameObject4, "SymbolDesc");
                    componetInChild5.text = CSymbolSystem.GetSymbolAttString(listView.get_Item(m), true).TrimEnd(new char[]
                    {
                        '\n'
                    });
                    Text componetInChild6 = Utility.GetComponetInChild <Text>(gameObject4, "lblIconCount");
                    componetInChild6.text = string.Format("x{0}", listView.get_Item(m).m_stackCount);
                    num3 += (int)listView.get_Item(m).m_SymbolData.wLevel *listView.get_Item(m).m_stackCount;
                }
                Utility.GetComponetInChild <Text>(gameObject2, "symbolPageLvlText").text = num3.ToString();
                Utility.GetComponetInChild <Text>(gameObject2, "heroSymbolText").text    = Singleton <CTextManager> .get_instance().GetText("RankGodHeroSymbolDesc", new string[]
                {
                    text,
                    szName
                });
            }
        }