Пример #1
0
        private void SetItem(CUseable usable, GameObject uiNode, bool received, bool ready, uint vipLv)
        {
            SevenDayCheckHelper component = uiNode.GetComponent <SevenDayCheckHelper>();
            Image component2 = component.Icon.GetComponent <Image>();

            CUIUtility.SetImageSprite(component2, usable.GetIconPath(), this._form, true, false, false, false);
            component.ItemName.GetComponent <Text>().text = usable.m_name;
            if (vipLv > 0u)
            {
                component.NobeRoot.CustomSetActive(true);
                MonoSingleton <NobeSys> .GetInstance().SetNobeIcon(component.Nobe.GetComponent <Image>(), (int)vipLv, false);
            }
            else
            {
                component.NobeRoot.CustomSetActive(false);
            }
            if (usable.m_type == 4 || usable.m_type == 7 || (usable.m_type == 2 && CItem.IsHeroExperienceCard(usable.m_baseID)) || (usable.m_type == 2 && CItem.IsSkinExChangeCoupons(usable.m_baseID)))
            {
                component.IconBg.CustomSetActive(true);
            }
            else
            {
                component.IconBg.CustomSetActive(false);
            }
            Transform transform = component.Tiyan.transform;

            if (transform != null)
            {
                if (usable.m_type == 2 && CItem.IsHeroExperienceCard(usable.m_baseID))
                {
                    transform.gameObject.CustomSetActive(true);
                    transform.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false), false);
                }
                else if (usable.m_type == 2 && CItem.IsSkinExperienceCard(usable.m_baseID))
                {
                    transform.gameObject.CustomSetActive(true);
                    transform.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false), false);
                }
                else
                {
                    transform.gameObject.CustomSetActive(false);
                }
            }
            Transform transform2 = component.ItemNumText.transform;

            if (transform2 != null)
            {
                Text component3 = transform2.GetComponent <Text>();
                if (usable.m_stackCount < 10000)
                {
                    component3.text = usable.m_stackCount.ToString();
                }
                else
                {
                    component3.text = usable.m_stackCount / 10000 + "万";
                }
                CUICommonSystem.AppendMultipleText(component3, usable.m_stackMulti);
                if (usable.m_stackCount <= 1)
                {
                    component3.gameObject.CustomSetActive(false);
                    component.ItemNum.CustomSetActive(false);
                }
                else
                {
                    component.ItemNum.CustomSetActive(true);
                    component.ItemNumText.CustomSetActive(true);
                }
                if (usable.m_type == 5)
                {
                    if (((CSymbolItem)usable).IsGuildSymbol())
                    {
                        component3.text = string.Empty;
                    }
                    else
                    {
                        component3.text = usable.GetSalableCount().ToString();
                    }
                }
            }
            if (received)
            {
                component.GrayMask.CustomSetActive(true);
            }
            else
            {
                component.GrayMask.CustomSetActive(false);
            }
            if (ready)
            {
                component.Effect.CustomSetActive(true);
            }
            else
            {
                component.Effect.CustomSetActive(false);
            }
            CUIEventScript  component4  = uiNode.GetComponent <CUIEventScript>();
            stUIEventParams eventParams = new stUIEventParams
            {
                iconUseable = usable
            };

            component4.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, eventParams);
            component4.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
            component4.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, eventParams);
            component4.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
        }
        private void SetLeftItem(CUseable usable, Transform uiNode, bool received, bool ready, uint vipLv, int elemIdx)
        {
            Transform transform = uiNode.transform.FindChild("ItemIcon");

            if (transform != null)
            {
                CUIUtility.SetImageSprite(transform.GetComponent <Image>(), usable.GetIconPath(), this._form, true, false, false, false);
            }
            Transform transform2 = uiNode.transform.FindChild("GotCeck");

            if (transform2)
            {
                if (received)
                {
                    transform2.gameObject.CustomSetActive(true);
                }
                else
                {
                    transform2.gameObject.CustomSetActive(false);
                }
            }
            Transform transform3 = uiNode.transform.FindChild("TiyanMask");

            if (transform3 != null)
            {
                if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsHeroExperienceCard(usable.m_baseID))
                {
                    transform3.gameObject.CustomSetActive(true);
                    transform3.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false), false);
                }
                else if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsSkinExperienceCard(usable.m_baseID))
                {
                    transform3.gameObject.CustomSetActive(true);
                    transform3.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false), false);
                }
                else
                {
                    transform3.gameObject.CustomSetActive(false);
                }
            }
            Transform transform4 = uiNode.transform.FindChild("Bg");

            if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO || usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN || (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsHeroExperienceCard(usable.m_baseID)) || (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsSkinExChangeCoupons(usable.m_baseID)))
            {
                if (transform4)
                {
                    transform4.gameObject.CustomSetActive(true);
                }
            }
            else if (transform4)
            {
                transform4.gameObject.CustomSetActive(false);
            }
            Transform transform5 = uiNode.transform.FindChild("Name");

            if (transform5 != null)
            {
                transform5.GetComponent <Text>().set_text(usable.m_name);
            }
            Transform transform6 = uiNode.transform.FindChild("Num");

            if (transform6)
            {
                transform6.GetComponent <Text>().set_text((elemIdx + 1).ToString());
            }
            CUIEventScript  component   = uiNode.GetComponent <CUIEventScript>();
            stUIEventParams eventParams = new stUIEventParams
            {
                iconUseable = usable
            };

            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);
        }
Пример #3
0
        private void OnBag_OpenUseForm(CUIEvent uiEvent)
        {
            if (this.m_selectUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
            {
                CItem selectUseable = this.m_selectUseable as CItem;
                if ((selectUseable.m_itemData.bType == 4) && (selectUseable.m_itemData.EftParam[2] != 0f))
                {
                    this.PlayItemUseAnimation(this.m_selectUseable, 1);
                }
                else
                {
                    if (((selectUseable.m_itemData.bType == 1) || (selectUseable.m_itemData.bType == 7)) || (selectUseable.m_itemData.bType == 4))
                    {
                        if (this.CheckNameChangeCard(selectUseable))
                        {
                            return;
                        }
                        this.m_useCount = 1;
                        if (selectUseable.m_itemData.bIsBatchUse == 0)
                        {
                            SendItemUseMsgToServer(this.m_selectUseable.m_objID, 0, this.m_useCount);
                            return;
                        }
                        CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_bagUseFormPath, false, true);

                        GameObject gameObject = formScript.gameObject;
                        GameObject itemCell   = gameObject.transform.Find("Panel_Left/itemCell").gameObject;
                        Text       component  = gameObject.transform.Find("Panel_Left/lblName").GetComponent <Text>();
                        Text       text2      = gameObject.transform.Find("Panel_Left/lblCount").GetComponent <Text>();
                        Text       text3      = gameObject.transform.Find("Panel_Left/lblCount1").GetComponent <Text>();
                        CUICommonSystem.SetItemCell(formScript, itemCell, this.m_selectUseable, true, false);
                        component.text = this.m_selectUseable.m_name;
                        text2.text     = this.m_selectUseable.GetSalableCount().ToString();
                        if ((selectUseable.m_itemData.wBatchUseCnt > 0) && (selectUseable.m_itemData.wBatchUseCnt <= this.m_selectUseable.GetSalableCount()))
                        {
                            text3.text = this.m_useCount + "/" + selectUseable.m_itemData.wBatchUseCnt;
                        }
                        else
                        {
                            text3.text = this.m_useCount + "/" + this.m_selectUseable.GetSalableCount();
                        }
                    }
                    if (CItem.IsHeroExChangeCoupons(selectUseable.m_baseID))
                    {
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mall_GoToRecommendHeroTab);
                    }
                    else if (CItem.IsSkinExChangeCoupons(selectUseable.m_baseID))
                    {
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mall_GoToRecommendSkinTab);
                    }
                    else if (selectUseable.m_itemData.bType == 8)
                    {
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Union_Battle_ClickEntry);
                    }
                    else if (selectUseable.m_itemData.bType == 9)
                    {
                        stUIEventParams par = new stUIEventParams {
                            commonUInt32Param1 = selectUseable.m_itemData.dwID
                        };
                        Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Speaker_Form_Open, par);
                    }
                }
            }
            else if (this.m_selectUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL)
            {
                if (Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_SYMBOL))
                {
                    Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Symbol_OpenForm);
                }
                else
                {
                    Singleton <CUIManager> .GetInstance().OpenTips("Symbol_Lock_Tip", true, 1f, null, new object[0]);
                }
            }
        }
        private void SetItem(CUseable usable, Transform uiNode, bool received, bool ready, uint vipLv, int elemIdx)
        {
            Transform transform = uiNode.transform.FindChild("DayBg/DayText");

            if (transform != null)
            {
                transform.GetComponent <Text>().set_text(string.Format("第{0}天", Day14CheckSystem.GetDay(elemIdx)));
            }
            Transform transform2 = uiNode.transform.FindChild("ItemIcon");

            if (transform2 != null)
            {
                CUIUtility.SetImageSprite(transform2.GetComponent <Image>(), usable.GetIconPath(), this._form, true, false, false, false);
            }
            Transform transform3 = uiNode.transform.FindChild("ItemName");

            if (transform3 != null)
            {
                transform3.GetComponent <Text>().set_text(usable.m_name);
            }
            Transform transform4 = uiNode.transform.FindChild("Bg");

            if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO || usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN || (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsHeroExperienceCard(usable.m_baseID)) || (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsSkinExChangeCoupons(usable.m_baseID)))
            {
                if (transform4)
                {
                    transform4.gameObject.CustomSetActive(true);
                }
            }
            else if (transform4)
            {
                transform4.gameObject.CustomSetActive(false);
            }
            Transform transform5 = uiNode.transform.FindChild("TiyanMask");

            if (transform5 != null)
            {
                if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsHeroExperienceCard(usable.m_baseID))
                {
                    transform5.gameObject.CustomSetActive(true);
                    transform5.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false), false);
                }
                else if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP && CItem.IsSkinExperienceCard(usable.m_baseID))
                {
                    transform5.gameObject.CustomSetActive(true);
                    transform5.GetComponent <Image>().SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false), false);
                }
                else
                {
                    transform5.gameObject.CustomSetActive(false);
                }
            }
            Transform transform6 = uiNode.transform.FindChild("ItemNum/ItemNumText");

            if (transform6 != null)
            {
                Text component = transform6.GetComponent <Text>();
                if (usable.m_stackCount < 10000)
                {
                    component.set_text(usable.m_stackCount.ToString());
                }
                else
                {
                    component.set_text(usable.m_stackCount / 10000 + "万");
                }
                CUICommonSystem.AppendMultipleText(component, usable.m_stackMulti);
                if (usable.m_stackCount <= 1)
                {
                    component.gameObject.CustomSetActive(false);
                    uiNode.transform.FindChild("ItemNum").gameObject.CustomSetActive(false);
                }
                else
                {
                    uiNode.transform.FindChild("ItemNum").gameObject.CustomSetActive(true);
                    transform6.gameObject.CustomSetActive(true);
                }
                if (usable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL)
                {
                    if (((CSymbolItem)usable).IsGuildSymbol())
                    {
                        component.set_text(string.Empty);
                    }
                    else
                    {
                        component.set_text(usable.GetSalableCount().ToString());
                    }
                }
            }
            Transform transform7 = uiNode.transform.FindChild("LingQuGou");

            if (transform7)
            {
                if (received)
                {
                    transform7.gameObject.CustomSetActive(true);
                }
                else
                {
                    transform7.gameObject.CustomSetActive(false);
                }
            }
            Transform transform8 = uiNode.transform.FindChild("XiYou");

            if (transform8)
            {
                if (ready)
                {
                    transform8.gameObject.CustomSetActive(true);
                    Transform transform9 = transform8.transform.FindChild("Bg/Text");
                    if (transform9 != null)
                    {
                        transform9.GetComponent <Text>().set_text(string.Format("第{0}天", Day14CheckSystem.GetDay(elemIdx)));
                    }
                }
                else
                {
                    transform8.gameObject.CustomSetActive(false);
                }
            }
            CUIEventScript  component2  = uiNode.GetComponent <CUIEventScript>();
            stUIEventParams eventParams = new stUIEventParams
            {
                iconUseable = usable
            };

            component2.SetUIEvent(enUIEventType.Down, enUIEventID.Tips_ItemInfoOpen, eventParams);
            component2.SetUIEvent(enUIEventType.HoldEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
            component2.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemInfoClose, eventParams);
            component2.SetUIEvent(enUIEventType.DragEnd, enUIEventID.Tips_ItemInfoClose, eventParams);
        }