예제 #1
0
        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");
                    }
                }
            }
        }
예제 #2
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);
     }
 }
        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));
        }
예제 #4
0
        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();
            }
        }
예제 #5
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);
                        }
                    }
                }
            }
        }
예제 #6
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
                });
            }
        }