示例#1
0
 private void InitBuffItem(CUIFormScript formScript, SLevelContext curLevelContext)
 {
     this.m_iLevelID        = curLevelContext.m_mapID;
     this.m_CurDifficulType = curLevelContext.m_levelDifficulty;
     for (int i = 0; i < 3; i++)
     {
         string     name       = "buffInfoPanel/buffItem" + i;
         GameObject gameObject = this.m_form.transform.Find(name).gameObject;
         this.UpdateBuffItemChooseStat(i, i == (int)this.m_iSelectedBuffItem);
         uint num = curLevelContext.m_reviveInfo[curLevelContext.m_levelDifficulty].ReviveBuff[i];
         this.m_WishBuffId[i] = num;
         ResSkillCombineCfgInfo dataByKey = GameDataMgr.skillCombineDatabin.GetDataByKey(num);
         if (dataByKey != null)
         {
             if (dataByKey.szIconPath.get_Chars(0) != '\0')
             {
                 Image      component    = gameObject.transform.Find("imageIcon").GetComponent <Image>();
                 string     prefebPath   = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Skill_Dir, Utility.UTF8Convert(dataByKey.szIconPath));
                 GameObject spritePrefeb = CUIUtility.GetSpritePrefeb(prefebPath, true, true);
                 component.SetSprite(spritePrefeb, false);
             }
             Text component2 = gameObject.transform.Find("buffNameText").GetComponent <Text>();
             component2.text = StringHelper.UTF8BytesToString(ref dataByKey.szSkillCombineDesc);
         }
     }
 }
示例#2
0
        public void OpenStartAwakeForm()
        {
            CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm(s_heroAwakeFormPath, false, true);

            if (script != null)
            {
                Image      component = script.transform.Find("Panel/PanelLeft/HeroCell/Hero").GetComponent <Image>();
                Text       text      = script.transform.Find("Panel/PanelLeft/lblContent").GetComponent <Text>();
                Text       text2     = script.transform.Find("Panel/PanelLeft/panelRewards/award1/lblDesc").GetComponent <Text>();
                Text       text3     = script.transform.Find("Panel/PanelLeft/panelRewards/award2/lblDesc").GetComponent <Text>();
                GameObject prefab    = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_BustHero_Dir + StringHelper.UTF8BytesToString(ref this.m_heroInfo.cfgInfo.szImagePath), true, true);
                component.SetSprite(prefab);
                text.text = StringHelper.UTF8BytesToString(ref this.m_heroInfo.cfgInfo.szWakeDesc);
                ResTalentLib dataByKey = GameDataMgr.talentLib.GetDataByKey(this.m_heroInfo.cfgInfo.dwWakeTalentID);
                if (dataByKey != null)
                {
                    text2.text = StringHelper.UTF8BytesToString(ref dataByKey.szDesc);
                }
                ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(this.m_heroInfo.cfgInfo.dwWakeSkinID);
                if (heroSkin != null)
                {
                    string[] args = new string[] { StringHelper.UTF8BytesToString(ref heroSkin.szSkinName) };
                    text3.text = Singleton <CTextManager> .instance.GetText("HeroAwake_Tips3", args);
                }
            }
        }
示例#3
0
    private void SetHonorImage(Transform imgTransform, COMDT_HONORINFO honorInfo)
    {
        string honorImagePath = this.GetHonorImagePath(honorInfo.iHonorID, honorInfo.iHonorLevel);
        Image  component      = imgTransform.GetComponent <Image>();

        component.SetSprite(CUIUtility.GetSpritePrefeb(honorImagePath, false, false), false);
    }
示例#4
0
        private void BuildMenuList()
        {
            this.m_IDIPItemList = new List <IDIPSys.IDIPItem>();
            int count = this.m_IDIPDataList.get_Count();

            this.m_uiListMenu.SetElementAmount(count);
            for (int i = 0; i < count; i++)
            {
                IDIPSys.IDIPData     iDIPData = this.m_IDIPDataList.get_Item(i);
                CUIListElementScript elemenet = this.m_uiListMenu.GetElemenet(i);
                IDIPSys.IDIPItem     iDIPItem = new IDIPSys.IDIPItem(elemenet.gameObject);
                iDIPItem.name.text = iDIPData.title;
                if (iDIPItem.glow)
                {
                    iDIPItem.glow.gameObject.CustomSetActive(false);
                }
                if (iDIPData.bNoticeLabelType == 1)
                {
                    iDIPItem.flag.SetSprite(CUIUtility.GetSpritePrefeb("UGUI/Sprite/Dynamic/Activity/RES_WEAL_COLORBAR_TYPE_NOTICE", false, false), false);
                    iDIPItem.TypeText.text = "公告";
                }
                else if (iDIPData.bNoticeLabelType == 2)
                {
                    iDIPItem.flag.SetSprite(CUIUtility.GetSpritePrefeb("UGUI/Sprite/Dynamic/Activity/RES_WEAL_COLORBAR_TYPE_LIMIT", false, false), false);
                    iDIPItem.TypeText.text = "活动";
                }
                else if (iDIPData.bNoticeLabelType == 3)
                {
                    iDIPItem.flag.SetSprite(CUIUtility.GetSpritePrefeb("UGUI/Sprite/Dynamic/Activity/RES_WEAL_COLORBAR_TYPE_HOT", false, false), false);
                    iDIPItem.TypeText.text = "赛事";
                }
                this.m_IDIPItemList.Add(iDIPItem);
            }
        }
示例#5
0
        public static void InitLevelList(CUIFormScript form, int currentChapter, int levelNo, int difficulty)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo != null)
            {
                ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey(currentChapter);
                DebugHelper.Assert(dataByKey != null);
                bool flag = Singleton <CFunctionUnlockSys> .instance.ChapterIsUnlock(dataByKey.dwChapterId);

                PVE_ADV_COMPLETE_INFO     pve_adv_complete_info     = masterRoleInfo.pveLevelDetail[difficulty - 1];
                PVE_CHAPTER_COMPLETE_INFO pve_chapter_complete_info = pve_adv_complete_info.ChapterDetailList[currentChapter - 1];
                PVE_LEVEL_COMPLETE_INFO[] levelDetailList           = pve_chapter_complete_info.LevelDetailList;
                CUIListScript             component = form.transform.FindChild("LevelList").GetComponent <CUIListScript>();
                component.SetElementAmount(levelDetailList.Length);
                CUIListElementScript elemenet = null;
                Sprite     sprite             = CUIUtility.GetSpritePrefeb(GetLevelFramePath(difficulty), false, false).GetComponent <SpriteRenderer>().sprite;
                GameObject prefab             = CUIUtility.GetSpritePrefeb(GetLevelSelectFramePath(difficulty), false, false);
                for (int i = 0; i < levelDetailList.Length; i++)
                {
                    elemenet = component.GetElemenet(i);
                    ResLevelCfgInfo info3        = GameDataMgr.levelDatabin.GetDataByKey(levelDetailList[i].iLevelID);
                    object[]        inParameters = new object[] { levelDetailList[i].iLevelID };
                    DebugHelper.Assert(info3 != null, "Can't find LevelConfig = {0}", inParameters);
                    bool bActive = (levelDetailList[i].levelStatus == 0) || !flag;
                    bool flag3   = (levelDetailList[i].levelStatus == 1) && flag;
                    int  starNum = CAdventureSys.GetStarNum(levelDetailList[i].bStarBits);
                    elemenet.transform.FindChild("Unlock/star1").GetComponent <Image>().color   = (starNum < 1) ? CUIUtility.s_Color_GrayShader : Color.white;
                    elemenet.transform.FindChild("Unlock/star2").GetComponent <Image>().color   = (starNum < 2) ? CUIUtility.s_Color_GrayShader : Color.white;
                    elemenet.transform.FindChild("Unlock/star3").GetComponent <Image>().color   = (starNum < 3) ? CUIUtility.s_Color_GrayShader : Color.white;
                    elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().text = Utility.UTF8Convert(info3.szName);
                    if ((levelNo == (i + 1)) && !bActive)
                    {
                        elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[0];
                    }
                    else if (!bActive)
                    {
                        elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[1];
                    }
                    else
                    {
                        elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[2];
                    }
                    elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().color        = s_Adv_Difficult_Color[difficulty - 1];
                    elemenet.transform.FindChild("SelectedFrame/Image1").GetComponent <Image>().color = s_Adv_Difficult_Color[((s_Adv_Difficult_Color.Length / 2) + difficulty) - 1];
                    elemenet.transform.FindChild("SelectedFrame/Image2").GetComponent <Image>().color = s_Adv_Difficult_Color[((s_Adv_Difficult_Color.Length / 2) + difficulty) - 1];
                    elemenet.transform.FindChild("SelectedFrame/SelectedFrame").GetComponent <Image>().SetSprite(prefab);
                    elemenet.transform.FindChild("New").gameObject.CustomSetActive(flag3);
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventID         = enUIEventID.Adv_SelectLevel;
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1;
                    elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(!bActive);
                    elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(bActive);
                    elemenet.m_selectedSprite = sprite;
                    elemenet.GetComponent <Image>().SetSprite(((levelNo - 1) != i) ? elemenet.m_defaultSprite : sprite, elemenet.m_selectedLayout);
                }
                component.SelectElement(levelNo - 1, true);
            }
        }
示例#6
0
        public static void InitExloreList(CUIFormScript form)
        {
            if (form != null)
            {
                int length = s_eventIDs.Length;
                CUIListElementScript elemenet  = null;
                CUIStepListScript    component = form.transform.Find("ExploreList").gameObject.GetComponent <CUIStepListScript>();
                component.SetElementAmount(length);
                for (int i = 0; i < length; i++)
                {
                    elemenet = component.GetElemenet(i);
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventID = s_eventIDs[i];
                    elemenet.gameObject.transform.Find("TitleBg/ExlporeNameText").GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText(s_exploreTypes[i]);

                    elemenet.gameObject.transform.Find("TitleBg/Image").GetComponent <Image>().color = s_exploreColors[i];
                    Image      image  = elemenet.gameObject.transform.Find("Icon").gameObject.GetComponent <Image>();
                    GameObject prefab = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_Adventure_Dir + (i + 1), false, false);
                    if (prefab != null)
                    {
                        image.SetSprite(prefab);
                    }
                    GameObject gameObject           = elemenet.transform.FindChild("Lock").gameObject;
                    GameObject obj4                 = elemenet.transform.FindChild("Unlock").gameObject;
                    RES_SPECIALFUNCUNLOCK_TYPE type = s_unlockTypes[i];
                    if (Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(type))
                    {
                        image.color = CUIUtility.s_Color_White;
                        gameObject.CustomSetActive(false);
                    }
                    else
                    {
                        image.color = CUIUtility.s_Color_GrayShader;
                        gameObject.CustomSetActive(true);
                        ResSpecialFucUnlock dataByKey = GameDataMgr.specialFunUnlockDatabin.GetDataByKey((uint)type);
                        if (dataByKey != null)
                        {
                            gameObject.GetComponentInChildren <Text>().text = Utility.UTF8Convert(dataByKey.szLockedTip);
                        }
                    }
                    if (s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_NONE)
                    {
                        int            lastChapter = CAdventureSys.GetLastChapter(1);
                        ResChapterInfo info        = GameDataMgr.chapterInfoDatabin.GetDataByKey(lastChapter);
                        if (info != null)
                        {
                            obj4.CustomSetActive(true);
                            obj4.GetComponentInChildren <Text>().text = string.Format(Singleton <CTextManager> .instance.GetText("Adventure_Chapter_Max_Tips"), Utility.UTF8Convert(info.szChapterName));
                        }
                    }
                    else
                    {
                        obj4.CustomSetActive(false);
                    }
                }
                component.SelectElementImmediately(1);
            }
        }
示例#7
0
        private void OnTrophyEnable(CUIEvent uiEvent)
        {
            int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

            if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= this.m_CurTrophies.Count)
            {
                return;
            }
            CUIListElementScript cUIListElementScript = uiEvent.m_srcWidgetScript as CUIListElementScript;

            if (cUIListElementScript == null)
            {
                DebugHelper.Assert(false, "achievement selector sery enable elementscript is null");
                return;
            }
            CAchieveItem2 cAchieveItem = this.m_CurTrophies[srcWidgetIndexInBelongedList];
            GameObject    widget       = cUIListElementScript.GetWidget(0);
            GameObject    widget2      = cUIListElementScript.GetWidget(1);
            GameObject    widget3      = cUIListElementScript.GetWidget(2);
            GameObject    widget4      = cUIListElementScript.GetWidget(3);
            GameObject    widget5      = cUIListElementScript.GetWidget(4);

            if (Array.IndexOf <CAchieveItem2>(this.SelectedTrophies, cAchieveItem) >= 0)
            {
                widget2.CustomSetActive(true);
            }
            else
            {
                widget2.CustomSetActive(false);
            }
            Image component  = widget.GetComponent <Image>();
            Image component2 = widget5.GetComponent <Image>();
            Text  component3 = widget3.GetComponent <Text>();
            Text  component4 = widget4.GetComponent <Text>();

            if (component == null || component2 == null || component3 == null || component4 == null)
            {
                return;
            }
            CAchieveItem2 cAchieveItem2 = cAchieveItem.TryToGetMostRecentlyDoneItem();

            if (cAchieveItem2 == null)
            {
                component.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem.GetAchieveImagePath(), false, false), false);
                CAchievementSystem.SetAchieveBaseIcon(widget5.transform, cAchieveItem, null);
                component3.set_text(cAchieveItem.Cfg.szName);
                component4.set_text(cAchieveItem.GetGotTimeText(false, false));
            }
            else
            {
                component.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem2.GetAchieveImagePath(), false, false), false);
                CAchievementSystem.SetAchieveBaseIcon(widget5.transform, cAchieveItem2, null);
                component3.set_text(cAchieveItem2.Cfg.szName);
                component4.set_text(cAchieveItem2.GetGotTimeText(false, false));
            }
        }
示例#8
0
 private void UpdateShowBuff()
 {
     if (!this.m_BuffSkillPanel)
     {
         return;
     }
     for (int i = 0; i < 5; i++)
     {
         string     path       = string.Format("BuffSkillBtn_{0}", i);
         GameObject gameObject = Utility.FindChild(this.m_BuffSkillPanel, path);
         if (gameObject == null)
         {
             return;
         }
         if (i < this.m_CurShowBuffCount)
         {
             if (this.m_ArrShowBuffSkill[i].stBuffSkill && this.m_ArrShowBuffSkill[i].stBuffSkill.get_handle().cfgData != null && !string.IsNullOrEmpty(this.m_ArrShowBuffSkill[i].stBuffSkill.get_handle().cfgData.szIconPath))
             {
                 Image      component    = Utility.FindChild(gameObject, "BuffImg").GetComponent <Image>();
                 string     prefebPath   = string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Skill_Dir, Utility.UTF8Convert(this.m_ArrShowBuffSkill[i].stBuffSkill.get_handle().cfgData.szIconPath));
                 GameObject spritePrefeb = CUIUtility.GetSpritePrefeb(prefebPath, true, true);
                 component.SetSprite(spritePrefeb, false);
                 Image component2 = Utility.FindChild(gameObject, "BuffImgMask").GetComponent <Image>();
                 component2.SetSprite(spritePrefeb, false);
                 component2.CustomFillAmount(0f);
                 GameObject gameObject2 = Utility.FindChild(gameObject, "OverlyingNumTxt");
                 if (gameObject2 != null)
                 {
                     Text component3 = gameObject2.GetComponent <Text>();
                     if (this.m_ArrShowBuffSkill[i].stBuffSkill.get_handle().cfgData.bOverlayMax > 1)
                     {
                         component3.text = this.m_ArrShowBuffSkill[i].stBuffSkill.get_handle().GetOverlayCount().ToString();
                         gameObject2.CustomSetActive(true);
                     }
                     else
                     {
                         gameObject2.CustomSetActive(false);
                     }
                 }
             }
             gameObject.CustomSetActive(true);
         }
         else
         {
             gameObject.CustomSetActive(false);
         }
     }
 }
示例#9
0
 private void UpdateShowBuff()
 {
     if (this.m_BuffSkillPanel != null)
     {
         for (int i = 0; i < 5; i++)
         {
             string     path = string.Format("BuffSkillBtn_{0}", i);
             GameObject p    = Utility.FindChild(this.m_BuffSkillPanel, path);
             if (p == null)
             {
                 return;
             }
             if (i < this.m_CurShowBuffCount)
             {
                 if (((this.m_ArrShowBuffSkill[i].stBuffSkill != 0) && (this.m_ArrShowBuffSkill[i].stBuffSkill.handle.cfgData != null)) && !string.IsNullOrEmpty(this.m_ArrShowBuffSkill[i].stBuffSkill.handle.cfgData.szIconPath))
                 {
                     Image      component = Utility.FindChild(p, "BuffImg").GetComponent <Image>();
                     GameObject prefab    = CUIUtility.GetSpritePrefeb(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Skill_Dir, Utility.UTF8Convert(this.m_ArrShowBuffSkill[i].stBuffSkill.handle.cfgData.szIconPath)), true, true);
                     component.SetSprite(prefab);
                     Image image = Utility.FindChild(p, "BuffImgMask").GetComponent <Image>();
                     image.SetSprite(prefab);
                     image.CustomFillAmount(0f);
                     GameObject obj4 = Utility.FindChild(p, "OverlyingNumTxt");
                     if (obj4 != null)
                     {
                         Text text = obj4.GetComponent <Text>();
                         if (this.m_ArrShowBuffSkill[i].stBuffSkill.handle.cfgData.dwOverlayMax > 1)
                         {
                             text.text = this.m_ArrShowBuffSkill[i].stBuffSkill.handle.GetOverlayCount().ToString();
                             obj4.CustomSetActive(true);
                         }
                         else
                         {
                             obj4.CustomSetActive(false);
                         }
                     }
                 }
                 p.CustomSetActive(true);
             }
             else
             {
                 p.CustomSetActive(false);
             }
         }
     }
 }
示例#10
0
            public void Validate()
            {
                this.name.text = this.activity.Name;
                RES_WEAL_COLORBAR_TYPE flagType = this.activity.FlagType;

                if (flagType != null)
                {
                    this.flag.gameObject.CustomSetActive(true);
                    string text = flagType.ToString();
                    this.flag.SetSprite(CUIUtility.GetSpritePrefeb("UGUI/Sprite/Dynamic/Activity/" + text, false, false), false);
                    this.flagText.text = Singleton <CTextManager> .GetInstance().GetText(text);
                }
                else
                {
                    this.flag.gameObject.CustomSetActive(false);
                }
                this.hotspot.gameObject.CustomSetActive(this.activity.ReadyForDot);
            }
示例#11
0
        private void SelectMenuItem(int index)
        {
            if (index < 0 || index >= this._actvMenuList.get_Count())
            {
                this._titleImage.gameObject.CustomSetActive(false);
                this._titleText.gameObject.CustomSetActive(true);
                this._titleText.text = Singleton <CTextManager> .GetInstance().GetText("activityEmptyTitle");

                this._view.SetActivity(null);
                return;
            }
            if (index != this._selectedIndex)
            {
                this._selectedIndex = index;
                CampaignForm.ActivityMenuItem activityMenuItem = this._actvMenuList.get_Item(this._selectedIndex);
                string title = activityMenuItem.activity.Title;
                if (string.IsNullOrEmpty(title))
                {
                    this._title.CustomSetActive(false);
                }
                else
                {
                    this._title.CustomSetActive(true);
                    if (activityMenuItem.activity.IsImageTitle)
                    {
                        this._titleText.gameObject.CustomSetActive(false);
                        this._titleImage.gameObject.CustomSetActive(true);
                        this._titleImage.SetSprite(CUIUtility.GetSpritePrefeb(ActivitySys.SpriteRootDir + title, false, false), false);
                        this._titleImage.SetNativeSize();
                    }
                    else
                    {
                        this._titleImage.gameObject.CustomSetActive(false);
                        this._titleText.gameObject.CustomSetActive(true);
                        this._titleText.text = title;
                    }
                }
                this._view.SetActivity(activityMenuItem.activity);
                this._viewScroll.verticalNormalizedPosition = 1f;
                this.Update();
                activityMenuItem.activity.Visited = true;
            }
        }
示例#12
0
 private void InitBuffItem(CUIFormScript formScript, SLevelContext curLevelContext, ResLevelCfgInfo lInfo)
 {
     this.m_iLevelID        = curLevelContext.iLevelID;
     this.m_CurDifficulType = curLevelContext.difficulty;
     for (int i = 0; i < 3; i++)
     {
         string     name       = "buffInfoPanel/buffItem" + i;
         GameObject gameObject = this.m_form.transform.Find(name).gameObject;
         this.UpdateBuffItemChooseStat(i, i == this.m_iSelectedBuffItem);
         uint key = lInfo.astReviveInfo[curLevelContext.difficulty].ReviveBuff[i];
         this.m_WishBuffId[i] = key;
         ResSkillCombineCfgInfo dataByKey = GameDataMgr.skillCombineDatabin.GetDataByKey(key);
         if (dataByKey != null)
         {
             if (dataByKey.szIconPath[0] != '\0')
             {
                 Image      component = gameObject.transform.Find("imageIcon").GetComponent <Image>();
                 GameObject prefab    = CUIUtility.GetSpritePrefeb(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Skill_Dir, Utility.UTF8Convert(dataByKey.szIconPath)), true, true);
                 component.SetSprite(prefab);
             }
             gameObject.transform.Find("buffNameText").GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref dataByKey.szSkillCombineDesc);
         }
     }
 }
示例#13
0
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, uint discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true);

            if (null != formScript)
            {
                this._root     = formScript.gameObject;
                this._usb      = CUseableManager.CreateUseable(type, id, 0);
                this._count    = 1;
                this._maxCount = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._discount         = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem item = new CItem(0L, id, 0, 0);
                    uint  key  = (uint)item.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randowmRewardDB.GetDataByKey(key);
                    ListView <CUseable>  view      = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (useable != null)
                            {
                                view.Add(useable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.text = item.m_description;
                    }
                    for (int j = 0; j < 10; j++)
                    {
                        GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject;
                        if (j < view.Count)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false);
                            Transform transform = gameObject.transform.Find("HaveItemFlag");
                            transform.gameObject.CustomSetActive(false);
                            if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                            {
                                CHeroItem item2          = view[j] as CHeroItem;
                                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item2.m_heroData.dwCfgID))
                                {
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                            else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                            {
                                CHeroSkin skin  = view[j] as CHeroSkin;
                                CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false))
                                {
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    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));
                    }
                }
                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));

                this.ValidateDynamic();
            }
        }
示例#14
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);
        }
示例#15
0
        public void RefreshAwakeTaskForm()
        {
            CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_heroAwakeTaskFormPath);

            if (form != null)
            {
                Image      component  = form.transform.Find("Panel/PanelLeft/HeroCell/Hero").GetComponent <Image>();
                Text       text       = form.transform.Find("Panel/PanelLeft/lblTitle").GetComponent <Text>();
                Transform  transform  = form.transform.Find("Panel/PanelLeft/lblState");
                Text       text2      = form.transform.Find("Panel/PanelLeft/lblContent").GetComponent <Text>();
                Button     btn        = form.transform.Find("Panel/PanelLeft/btnReciveTask").GetComponent <Button>();
                Transform  transform2 = form.transform.Find("Panel/PanelLeft/panelType1");
                Text       text3      = transform2.Find("lblTaskDesc").GetComponent <Text>();
                Transform  transform3 = transform2.Find("itemInfo/itemCell");
                Text       text4      = transform2.Find("itemInfo/lblName").GetComponent <Text>();
                Text       text5      = transform2.Find("itemInfo/lblProce").GetComponent <Text>();
                Button     button2    = transform2.Find("itemInfo/btnReciveTask").GetComponent <Button>();
                Button     button3    = transform2.Find("getInfo/btnReciveTask").GetComponent <Button>();
                Transform  transform4 = form.transform.Find("Panel/PanelLeft/panelType2");
                Text       text6      = transform4.Find("taskInfo/lblTaskDesc").GetComponent <Text>();
                Text       text7      = transform4.Find("taskInfo/lblProce").GetComponent <Text>();
                GameObject prefab     = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_BustHero_Dir + StringHelper.UTF8BytesToString(ref this.m_heroInfo.cfgInfo.szImagePath), true, true);
                component.SetSprite(prefab);
                ResHeroWakeInfo dataByKey = GameDataMgr.heroAwakDatabin.GetDataByKey(GameDataMgr.GetDoubleKey(this.m_heroInfo.cfgInfo.dwCfgID, this.m_heroInfo.m_awakeStepID));
                if (dataByKey != null)
                {
                    text.text  = StringHelper.UTF8BytesToString(ref dataByKey.szWakeTitle);
                    text2.text = StringHelper.UTF8BytesToString(ref dataByKey.szWakeDesc);
                    CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                    if (masterRoleInfo != null)
                    {
                        if (dataByKey.bOptType == 1)
                        {
                            transform2.gameObject.CustomSetActive(true);
                            transform4.gameObject.CustomSetActive(false);
                            CUseable        itemUseable       = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, (uint)dataByKey.OptParam[1], 0);
                            int             useableStackCount = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM).GetUseableStackCount(itemUseable.m_type, itemUseable.m_baseID);
                            stUIEventParams eventParams       = new stUIEventParams {
                                iconUseable = itemUseable
                            };
                            itemUseable.m_stackCount = dataByKey.OptParam[2];
                            string[] args = new string[] { itemUseable.m_stackCount.ToString(), itemUseable.m_name };
                            text3.text = Singleton <CTextManager> .instance.GetText("HeroAwake_Tips4", args);

                            text4.text = itemUseable.m_name;
                            CUICommonSystem.SetItemCell(form, transform3.gameObject, itemUseable, true, false);
                            if (useableStackCount >= itemUseable.m_stackCount)
                            {
                                button2.gameObject.CustomSetActive(false);
                                transform.gameObject.CustomSetActive(true);
                                CUICommonSystem.SetButtonEnable(btn, true, true, true);
                                text5.text = string.Format("{0}/{1}", useableStackCount, itemUseable.m_stackCount);
                            }
                            else
                            {
                                button2.gameObject.CustomSetActive(true);
                                transform.gameObject.CustomSetActive(false);
                                CUICommonSystem.SetButtonEnable(btn, false, false, true);
                                text5.text = string.Format("<color=red>{0}</color>/{1}", useableStackCount, itemUseable.m_stackCount);
                                CUIEventScript script2 = button2.GetComponent <CUIEventScript>();
                                if (script2 != null)
                                {
                                    script2.SetUIEvent(enUIEventType.Click, enUIEventID.HeroInfo_Material_Direct_Buy, eventParams);
                                }
                            }
                            CUIEventScript script3 = button3.GetComponent <CUIEventScript>();
                            if (script3 != null)
                            {
                                script3.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemSourceInfoOpen, eventParams);
                            }
                        }
                        else
                        {
                            transform2.gameObject.CustomSetActive(false);
                            transform4.gameObject.CustomSetActive(true);
                            int   num2 = dataByKey.OptParam[0];
                            CTask task = Singleton <CTaskSys> .instance.model.GetTask((uint)num2);

                            if (task == null)
                            {
                                task = TaskUT.Create_Task((uint)num2);
                                if (task == null)
                                {
                                    return;
                                }
                                task.SetState(CTask.State.None);
                            }
                            if (task != null)
                            {
                                text6.text = UT.Bytes2String(task.m_resTask.szTaskDesc);
                                string str = "    ";
                                for (int i = 0; i < task.m_prerequisiteInfo.Length; i++)
                                {
                                    if (task.m_prerequisiteInfo[i].m_valueTarget > 0)
                                    {
                                        string str2;
                                        if (!this.m_heroInfo.m_isStepFinish)
                                        {
                                            str2 = str;
                                            object[] objArray1 = new object[] { str2, task.m_prerequisiteInfo[i].m_value, "/", task.m_prerequisiteInfo[i].m_valueTarget, " " };
                                            str = string.Concat(objArray1);
                                        }
                                        else
                                        {
                                            str2 = str;
                                            object[] objArray2 = new object[] { str2, task.m_prerequisiteInfo[i].m_valueTarget, "/", task.m_prerequisiteInfo[i].m_valueTarget, " " };
                                            str = string.Concat(objArray2);
                                        }
                                        break;
                                    }
                                }
                                text7.text = str;
                            }
                            if (this.m_heroInfo.m_isStepFinish || (task.m_taskState == 3))
                            {
                                transform.gameObject.CustomSetActive(true);
                                CUICommonSystem.SetButtonEnable(btn, true, true, true);
                            }
                            else
                            {
                                transform.gameObject.CustomSetActive(false);
                                CUICommonSystem.SetButtonEnable(btn, false, false, 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();
            }
        }
示例#17
0
        private void OnTrophyEnable(CUIEvent uiEvent)
        {
            int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;

            if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= this.m_CurAchieveSeries.Count)
            {
                return;
            }
            CUIListElementScript cUIListElementScript = uiEvent.m_srcWidgetScript as CUIListElementScript;

            if (cUIListElementScript == null)
            {
                DebugHelper.Assert(false, "achievement sery enable elementscript is null");
                return;
            }
            CAchieveItem2  cAchieveItem = this.m_CurAchieveSeries[srcWidgetIndexInBelongedList];
            CUIEventScript component    = cUIListElementScript.GetComponent <CUIEventScript>();

            component.SetUIEvent(enUIEventType.Click, enUIEventID.Achievement_Trophy_Click, new stUIEventParams
            {
                commonUInt32Param1 = cAchieveItem.Cfg.dwID
            });
            GameObject widget  = cUIListElementScript.GetWidget(0);
            GameObject widget2 = cUIListElementScript.GetWidget(1);
            GameObject widget3 = cUIListElementScript.GetWidget(2);
            GameObject widget4 = cUIListElementScript.GetWidget(3);
            GameObject widget5 = cUIListElementScript.GetWidget(4);
            GameObject widget6 = cUIListElementScript.GetWidget(5);

            widget2.CustomSetActive(false);
            Image component2 = widget.GetComponent <Image>();
            Image component3 = widget5.GetComponent <Image>();
            Text  component4 = widget3.GetComponent <Text>();
            Text  component5 = widget4.GetComponent <Text>();

            if (component2 == null || component3 == null || component4 == null || component5 == null)
            {
                return;
            }
            CAchieveItem2 cAchieveItem2 = cAchieveItem.TryToGetMostRecentlyDoneItem();

            if (cAchieveItem2 == null)
            {
                component2.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem.GetAchieveImagePath(), false, false), false);
                CAchievementSystem.SetAchieveBaseIcon(widget5.transform, cAchieveItem, null);
                component4.set_text(cAchieveItem.Cfg.szName);
                component5.set_text(cAchieveItem.GetGotTimeText(false, false));
                widget6.CustomSetActive(true);
            }
            else
            {
                component2.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem2.GetAchieveImagePath(), false, false), false);
                CAchievementSystem.SetAchieveBaseIcon(widget5.transform, cAchieveItem2, null);
                component4.set_text(cAchieveItem2.Cfg.szName);
                if (cAchieveItem == cAchieveItem2)
                {
                    component5.set_text(cAchieveItem.GetGotTimeText(false, false));
                }
                else
                {
                    component5.set_text(cAchieveItem2.GetGotTimeText(false, true));
                }
                widget6.CustomSetActive(false);
            }
        }
        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);
        }
示例#19
0
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true);

            if (null != formScript)
            {
                this._root                 = formScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0;
                this._maxCount             = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                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");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem item = new CItem(0L, id, 0, 0);
                    uint  key  = (uint)item.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  view      = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (useable != null)
                            {
                                view.Add(useable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.text = item.m_description;
                    }
                    uint num3 = 0;
                    int  num4 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem item2 = (CItem)this._usb;
                        if (((item2 != null) && (item2.m_itemData != null)) && (item2.m_itemData.bType == 4))
                        {
                            this._bDynamicCorrectPrice = item2.m_itemData.EftParam[3] > 0f;
                        }
                    }
                    for (int j = 0; j < 10; j++)
                    {
                        GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject;
                        if (j < view.Count)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false);
                            Transform transform = gameObject.transform.Find("HaveItemFlag");
                            transform.gameObject.CustomSetActive(false);
                            if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                            {
                                this._bHeroSkinGift = true;
                                CHeroItem item3          = view[j] as CHeroItem;
                                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item3.m_heroData.dwCfgID))
                                {
                                    num3 += CHeroInfo.GetHeroCost(item3.m_heroData.dwCfgID, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                            else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                            {
                                this._bHeroSkinGift = true;
                                CHeroSkin skin  = view[j] as CHeroSkin;
                                CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false))
                                {
                                    num3 += CSkinInfo.GetHeroSkinCost(skin.m_heroId, skin.m_skinId, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    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));
                    }
                    Text componetInChild = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild.text = string.Empty;
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice = this._usb.GetBuyPrice(coinType);
                        Button btn      = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num4 >= view.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, false, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip");

                            this._heroSkinGiftCost = 0;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, true, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip");

                            uint num7 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num3, this._realDiscount);
                            if ((buyPrice >= num3) && (num7 >= (buyPrice / 10)))
                            {
                                this._heroSkinGiftCost = num7;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                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));

                this.ValidateDynamic();
            }
        }
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, BuyPickDialog.OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, BuyPickDialog.OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null, bool bfromFactoyShop = false)
        {
            this.m_bShowBigIcon = (callContext != null && callContext.GetSpecialIconPath() != null);
            CUIFormScript cUIFormScript;

            if (this.m_bShowBigIcon)
            {
                cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Big_Icon_Form_Path, false, true);
            }
            else
            {
                cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Form_Path, false, true);
            }
            if (null != cUIFormScript)
            {
                this._root                 = cUIFormScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1u;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0u;
                this._maxCount             = maxCount;
                if (this._maxCount == 0u)
                {
                    this._maxCount = 999u;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                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");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem cItem = new CItem(0uL, id, 0, 0);
                    uint  key   = (uint)cItem.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  listView  = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable cUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (cUseable != null)
                            {
                                listView.Add(cUseable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.set_text(string.IsNullOrEmpty(cItem.m_mallDescription) ? cItem.m_description : cItem.m_mallDescription);
                    }
                    uint num  = 0u;
                    int  num2 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem cItem2 = (CItem)this._usb;
                        if (cItem2 != null && cItem2.m_itemData != null && cItem2.m_itemData.bType == 4)
                        {
                            this._bDynamicCorrectPrice = (cItem2.m_itemData.EftParam[3] > 0f);
                        }
                    }
                    CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(cUIFormScript.gameObject, "Panel/itemGroup");
                    componetInChild.SetElementAmount(listView.Count);
                    for (int j = 0; j < listView.Count; j++)
                    {
                        CUIListElementScript elemenet = componetInChild.GetElemenet(j);
                        this.UpdateElement(elemenet, listView[j], this.m_bShowBigIcon);
                        if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                        {
                            this._bHeroSkinGift = true;
                            CHeroItem cHeroItem      = listView[j] as CHeroItem;
                            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo != null && masterRoleInfo.IsOwnHero(cHeroItem.m_heroData.dwCfgID))
                            {
                                num += CHeroInfo.GetHeroCost(cHeroItem.m_heroData.dwCfgID, coinType);
                                num2++;
                            }
                        }
                        else if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                        {
                            this._bHeroSkinGift = true;
                            CHeroSkin cHeroSkin       = listView[j] as CHeroSkin;
                            CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo2 != null && masterRoleInfo2.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false))
                            {
                                num += CSkinInfo.GetHeroSkinCost(cHeroSkin.m_heroId, cHeroSkin.m_skinId, coinType);
                                num2++;
                            }
                        }
                    }
                    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);
                    }
                    Text componetInChild2 = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild2.set_text(string.Empty);
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice         = this._usb.GetBuyPrice(coinType);
                        Button componetInChild3 = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num2 >= listView.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(componetInChild3, false, true);
                            componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip"));
                            this._heroSkinGiftCost = 0u;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(componetInChild3, true, true);
                            componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip"));
                            uint num3 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num, this._realDiscount);
                            if (buyPrice >= num && num3 >= buyPrice / 10u)
                            {
                                this._heroSkinGiftCost = num3;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10u;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                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();
            }
        }
示例#21
0
        public static void AddRedDot(GameObject target, enRedDotPos dotPos = enRedDotPos.enTopRight, int alertNum = 0)
        {
            if (target == null || target.transform == null)
            {
                return;
            }
            CUIRedDotSystem.DelRedDot(target);
            GameObject gameObject;

            if (alertNum == 0)
            {
                gameObject = (Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/redDot", false, false)) as GameObject);
            }
            else
            {
                gameObject = (Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/redDotBig", false, false)) as GameObject);
            }
            Transform transform = gameObject.transform;

            transform.gameObject.name = CUIRedDotSystem.s_redDotName;
            CUIMiniEventScript component = transform.GetComponent <CUIMiniEventScript>();

            component.m_onDownEventParams.tag = 0;
            if (alertNum != 0 && transform.Find("Text") != null)
            {
                Text component2 = transform.Find("Text").GetComponent <Text>();
                component2.text = alertNum.ToString();
            }
            transform.SetParent(target.transform, false);
            transform.SetAsLastSibling();
            RectTransform rectTransform = transform as RectTransform;
            Vector2       anchorMin     = default(Vector2);
            Vector2       anchorMax     = default(Vector2);
            Vector2       pivot         = default(Vector2);

            switch (dotPos)
            {
            case enRedDotPos.enTopLeft:
                anchorMin.x = 0f;
                anchorMin.y = 1f;
                anchorMax.x = 0f;
                anchorMax.y = 1f;
                pivot.x     = 0f;
                pivot.y     = 1f;
                break;

            case enRedDotPos.enTopCenter:
                anchorMin.x = 0.5f;
                anchorMin.y = 1f;
                anchorMax.x = 0.5f;
                anchorMax.y = 1f;
                pivot.x     = 0.5f;
                pivot.y     = 1f;
                break;

            case enRedDotPos.enTopRight:
                anchorMin.x = 1f;
                anchorMin.y = 1f;
                anchorMax.x = 1f;
                anchorMax.y = 1f;
                pivot.x     = 1f;
                pivot.y     = 1f;
                break;

            case enRedDotPos.enMiddleLeft:
                anchorMin.x = 0f;
                anchorMin.y = 0.5f;
                anchorMax.x = 0f;
                anchorMax.y = 0.5f;
                pivot.x     = 0f;
                pivot.y     = 0.5f;
                break;

            case enRedDotPos.enMiddleCenter:
                anchorMin.x = 0.5f;
                anchorMin.y = 0.5f;
                anchorMax.x = 0.5f;
                anchorMax.y = 0.5f;
                pivot.x     = 0.5f;
                pivot.y     = 0.5f;
                break;

            case enRedDotPos.enMiddleRight:
                anchorMin.x = 1f;
                anchorMin.y = 0.5f;
                anchorMax.x = 1f;
                anchorMax.y = 0.5f;
                pivot.x     = 1f;
                pivot.y     = 0.5f;
                break;

            case enRedDotPos.enBottomLeft:
                anchorMin.x = 0f;
                anchorMin.y = 0f;
                anchorMax.x = 0f;
                anchorMax.y = 0f;
                pivot.x     = 0f;
                pivot.y     = 0f;
                break;

            case enRedDotPos.enBottomCenter:
                anchorMin.x = 0.5f;
                anchorMin.y = 0f;
                anchorMax.x = 0.5f;
                anchorMax.y = 0f;
                pivot.x     = 0.5f;
                pivot.y     = 0f;
                break;

            case enRedDotPos.enBottomRight:
                anchorMin.x = 1f;
                anchorMin.y = 0f;
                anchorMax.x = 1f;
                anchorMax.y = 0f;
                pivot.x     = 1f;
                pivot.y     = 0f;
                break;
            }
            rectTransform.pivot            = pivot;
            rectTransform.anchorMin        = anchorMin;
            rectTransform.anchorMax        = anchorMax;
            rectTransform.anchoredPosition = default(Vector2);
        }
        public static void InitExloreList(CUIFormScript form)
        {
            if (form == null)
            {
                return;
            }
            int num = CExploreView.s_eventIDs.Length;
            CUIStepListScript component = form.transform.Find("ExploreList").gameObject.GetComponent <CUIStepListScript>();

            component.SetElementAmount(num);
            for (int i = 0; i < num; i++)
            {
                CUIListElementScript elemenet   = component.GetElemenet(i);
                CUIEventScript       component2 = elemenet.GetComponent <CUIEventScript>();
                component2.m_onClickEventID = CExploreView.s_eventIDs[i];
                Text component3 = elemenet.gameObject.transform.Find("TitleBg/ExlporeNameText").GetComponent <Text>();
                component3.set_text(Singleton <CTextManager> .instance.GetText(CExploreView.s_exploreTypes[i]));
                Image component4 = elemenet.gameObject.transform.Find("TitleBg/Image").GetComponent <Image>();
                component4.set_color(CExploreView.s_exploreColors[i]);
                Image      component5   = elemenet.gameObject.transform.Find("Icon").gameObject.GetComponent <Image>();
                GameObject spritePrefeb = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_Adventure_Dir + (i + 1), false, false);
                if (spritePrefeb != null)
                {
                    component5.SetSprite(spritePrefeb, false);
                }
                GameObject gameObject  = elemenet.transform.FindChild("Lock").gameObject;
                GameObject gameObject2 = elemenet.transform.FindChild("Unlock").gameObject;
                RES_SPECIALFUNCUNLOCK_TYPE rES_SPECIALFUNCUNLOCK_TYPE = CExploreView.s_unlockTypes[i];
                if (Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(rES_SPECIALFUNCUNLOCK_TYPE))
                {
                    component5.set_color(CUIUtility.s_Color_White);
                    gameObject.CustomSetActive(false);
                }
                else
                {
                    component5.set_color(CUIUtility.s_Color_GrayShader);
                    gameObject.CustomSetActive(true);
                    ResSpecialFucUnlock dataByKey = GameDataMgr.specialFunUnlockDatabin.GetDataByKey((uint)rES_SPECIALFUNCUNLOCK_TYPE);
                    if (dataByKey != null)
                    {
                        gameObject.GetComponentInChildren <Text>().set_text(Utility.UTF8Convert(dataByKey.szLockedTip));
                    }
                }
                if (CExploreView.s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_NONE)
                {
                    int            lastChapter = CAdventureSys.GetLastChapter(1);
                    ResChapterInfo dataByKey2  = GameDataMgr.chapterInfoDatabin.GetDataByKey((long)lastChapter);
                    if (dataByKey2 != null)
                    {
                        gameObject2.CustomSetActive(true);
                        gameObject2.GetComponentInChildren <Text>().set_text(string.Format(Singleton <CTextManager> .instance.GetText("Adventure_Chapter_Max_Tips"), Utility.UTF8Convert(dataByKey2.szChapterName)));
                    }
                }
                else if (CExploreView.s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_ARENA)
                {
                    if (Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList == null || Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList.stArenaInfo.dwSelfRank == 0u)
                    {
                        gameObject2.CustomSetActive(false);
                    }
                    else
                    {
                        string text = string.Empty;
                        text = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreArenaRankText"), Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList.stArenaInfo.dwSelfRank);
                        gameObject2.gameObject.transform.FindChild("Text").gameObject.GetComponent <Text>().set_text(text);
                        gameObject2.CustomSetActive(true);
                    }
                }
                else if (CExploreView.s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_LIUGUOYUANZHENG)
                {
                    BurnExpeditionModel model = Singleton <BurnExpeditionController> .GetInstance().model;

                    if (model._data == null)
                    {
                        gameObject2.CustomSetActive(false);
                    }
                    else
                    {
                        string text2 = string.Empty;
                        if (model.IsAllCompelte())
                        {
                            text2 = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreBurnFinishText"), new object[0]);
                        }
                        else
                        {
                            text2 = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreBurnText"), Math.Max(1, model.Get_LastUnlockLevelIndex(model.curDifficultyType) + 1));
                        }
                        gameObject2.gameObject.transform.FindChild("Text").gameObject.GetComponent <Text>().set_text(text2);
                        gameObject2.CustomSetActive(true);
                    }
                }
            }
            component.SelectElementImmediately(1);
            Text  component6 = form.gameObject.transform.FindChild("AwardGroup/Name1").gameObject.GetComponent <Text>();
            Text  component7 = form.gameObject.transform.FindChild("AwardGroup/Name2").gameObject.GetComponent <Text>();
            Image component8 = form.gameObject.transform.FindChild("AwardGroup/Icon1").gameObject.GetComponent <Image>();
            Image component9 = form.gameObject.transform.FindChild("AwardGroup/Icon2").gameObject.GetComponent <Image>();

            component6.gameObject.CustomSetActive(false);
            component7.gameObject.CustomSetActive(false);
            component8.gameObject.CustomSetActive(false);
            component9.gameObject.CustomSetActive(false);
            uint   num2  = 0u;
            string empty = string.Empty;

            try
            {
                num2 = uint.Parse(Singleton <CTextManager> .GetInstance().GetText("ArenaAwardHeroId"));
            }
            catch (Exception)
            {
            }
            if (num2 != 0u)
            {
                ResHeroCfgInfo dataByKey3 = GameDataMgr.heroDatabin.GetDataByKey(num2);
                if (!Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().IsHaveHero(num2, false) && dataByKey3 != null)
                {
                    component6.gameObject.CustomSetActive(true);
                    component6.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("ArenaAwardHero"), dataByKey3.szName));
                    component8.gameObject.CustomSetActive(true);
                    component8.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(num2, 0u)), form, true, false, false, false);
                }
            }
            num2 = 0u;
            try
            {
                num2 = uint.Parse(Singleton <CTextManager> .GetInstance().GetText("BurningAwardHeroId"));
            }
            catch (Exception)
            {
            }
            if (num2 != 0u)
            {
                ResHeroCfgInfo dataByKey4 = GameDataMgr.heroDatabin.GetDataByKey(num2);
                if (!Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().IsHaveHero(num2, false) && dataByKey4 != null)
                {
                    component7.gameObject.CustomSetActive(true);
                    component7.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("BurningAwardHero"), dataByKey4.szName));
                    component9.gameObject.CustomSetActive(true);
                    component9.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(num2, 0u)), form, true, false, false, false);
                }
            }
            if (CSysDynamicBlock.bLobbyEntryBlocked)
            {
                Transform transform = form.transform.FindChild("AwardGroup");
                if (transform)
                {
                    transform.gameObject.CustomSetActive(false);
                }
            }
        }
示例#23
0
        private void OnAchievementEnable(CUIEvent uiEvent)
        {
            if (this.m_CurAchieveItem == null)
            {
                Singleton <CUIManager> .GetInstance().CloseForm("UGUI/Form/System/Achieve/Form_Trophy_Detail.prefab");

                return;
            }
            int           srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;
            int           achievementCnt = this.m_CurAchieveItem.GetAchievementCnt();
            CAchieveItem2 cAchieveItem   = this.m_CurAchieveItem;
            bool          bActive        = srcWidgetIndexInBelongedList != achievementCnt - 1;

            for (int i = 0; i < srcWidgetIndexInBelongedList; i++)
            {
                cAchieveItem = cAchieveItem.Next;
            }
            CUIListElementScript cUIListElementScript = uiEvent.m_srcWidgetScript as CUIListElementScript;
            GameObject           widget   = cUIListElementScript.GetWidget(0);
            GameObject           widget2  = cUIListElementScript.GetWidget(1);
            GameObject           widget3  = cUIListElementScript.GetWidget(2);
            GameObject           widget4  = cUIListElementScript.GetWidget(3);
            GameObject           widget5  = cUIListElementScript.GetWidget(4);
            GameObject           widget6  = cUIListElementScript.GetWidget(5);
            GameObject           widget7  = cUIListElementScript.GetWidget(6);
            GameObject           widget8  = cUIListElementScript.GetWidget(7);
            GameObject           widget9  = cUIListElementScript.GetWidget(8);
            GameObject           widget10 = cUIListElementScript.GetWidget(9);

            widget4.CustomSetActive(bActive);
            Image component  = widget.GetComponent <Image>();
            Image component2 = widget9.GetComponent <Image>();
            Text  component3 = widget2.GetComponent <Text>();
            Text  component4 = widget3.GetComponent <Text>();
            Text  component5 = widget10.GetComponent <Text>();
            Text  component6 = widget5.GetComponent <Text>();
            Text  component7 = widget6.GetComponent <Text>();

            if (component == null || component3 == null || component4 == null || component6 == null || component7 == null || component2 == null || component5 == null)
            {
                return;
            }
            component.SetSprite(CUIUtility.GetSpritePrefeb(cAchieveItem.GetAchieveImagePath(), false, false), false);
            CAchievementSystem.SetAchieveBaseIcon(widget9.transform, cAchieveItem, null);
            component3.set_text(cAchieveItem.Cfg.szName);
            component4.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Achievement_Score"), cAchieveItem.Cfg.dwPoint));
            if (cAchieveItem.IsFinish())
            {
                if (cAchieveItem.DoneTime == 0u)
                {
                    widget10.CustomSetActive(false);
                }
                else
                {
                    widget10.CustomSetActive(true);
                    component5.set_text(string.Format("{0:yyyy.M.d}", Utility.ToUtcTime2Local((long)((ulong)cAchieveItem.DoneTime))));
                }
                component6.set_text(cAchieveItem.GetAchievementDesc());
                component7.set_text(Singleton <CTextManager> .GetInstance().GetText("Achievement_Status_Done"));
                widget7.CustomSetActive(true);
                widget8.CustomSetActive(false);
            }
            else
            {
                widget10.CustomSetActive(false);
                component6.set_text(cAchieveItem.GetAchievementDesc());
                widget6.CustomSetActive(false);
                widget7.CustomSetActive(false);
                widget8.CustomSetActive(true);
            }
        }
示例#24
0
        public void AddNewFlag(GameObject obj, enNewFlagKey flagKey, enNewFlagPos newFlagPos = enNewFlagPos.enTopRight, float scale = 1f, float offsetX = 0f, float offsetY = 0f, enNewFlagType newFlagType = enNewFlagType.enNewFlag)
        {
            if (obj == null)
            {
                return;
            }
            Transform x   = obj.transform.Find("redDotNew");
            string    key = flagKey.ToString();

            if (x != null)
            {
                if (flagKey > enNewFlagKey.New_None && flagKey < enNewFlagKey.New_Count && !PlayerPrefs.HasKey(key))
                {
                    this.DelNewFlag(obj, flagKey, true);
                    return;
                }
            }
            else if (flagKey > enNewFlagKey.New_None && flagKey < enNewFlagKey.New_Count && !PlayerPrefs.HasKey(key))
            {
                string text = string.Empty;
                if (newFlagType == enNewFlagType.enNewFlag)
                {
                    text = "redDotNew";
                }
                else
                {
                    text = "redDot";
                }
                GameObject gameObject = Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/" + text, false, false)) as GameObject;
                if (gameObject == null)
                {
                    return;
                }
                gameObject.transform.SetParent(obj.transform, false);
                gameObject.transform.SetAsLastSibling();
                RectTransform rectTransform = gameObject.transform as RectTransform;
                Vector2       anchorMin     = default(Vector2);
                Vector2       anchorMax     = default(Vector2);
                Vector2       pivot         = default(Vector2);
                switch (newFlagPos)
                {
                case enNewFlagPos.enTopLeft:
                    anchorMin.x = 0f;
                    anchorMin.y = 1f;
                    anchorMax.x = 0f;
                    anchorMax.y = 1f;
                    pivot.x     = 0f;
                    pivot.y     = 1f;
                    break;

                case enNewFlagPos.enTopCenter:
                    anchorMin.x = 0.5f;
                    anchorMin.y = 1f;
                    anchorMax.x = 0.5f;
                    anchorMax.y = 1f;
                    pivot.x     = 0.5f;
                    pivot.y     = 1f;
                    break;

                case enNewFlagPos.enTopRight:
                    anchorMin.x = 1f;
                    anchorMin.y = 1f;
                    anchorMax.x = 1f;
                    anchorMax.y = 1f;
                    pivot.x     = 1f;
                    pivot.y     = 1f;
                    break;

                case enNewFlagPos.enMiddleLeft:
                    anchorMin.x = 0f;
                    anchorMin.y = 0.5f;
                    anchorMax.x = 0f;
                    anchorMax.y = 0.5f;
                    pivot.x     = 0f;
                    pivot.y     = 0.5f;
                    break;

                case enNewFlagPos.enMiddleCenter:
                    anchorMin.x = 0.5f;
                    anchorMin.y = 0.5f;
                    anchorMax.x = 0.5f;
                    anchorMax.y = 0.5f;
                    pivot.x     = 0.5f;
                    pivot.y     = 0.5f;
                    break;

                case enNewFlagPos.enMiddleRight:
                    anchorMin.x = 1f;
                    anchorMin.y = 0.5f;
                    anchorMax.x = 1f;
                    anchorMax.y = 0.5f;
                    pivot.x     = 1f;
                    pivot.y     = 0.5f;
                    break;

                case enNewFlagPos.enBottomLeft:
                    anchorMin.x = 0f;
                    anchorMin.y = 0f;
                    anchorMax.x = 0f;
                    anchorMax.y = 0f;
                    pivot.x     = 0f;
                    pivot.y     = 0f;
                    break;

                case enNewFlagPos.enBottomCenter:
                    anchorMin.x = 0.5f;
                    anchorMin.y = 0f;
                    anchorMax.x = 0.5f;
                    anchorMax.y = 0f;
                    pivot.x     = 0.5f;
                    pivot.y     = 0f;
                    break;

                case enNewFlagPos.enBottomRight:
                    anchorMin.x = 1f;
                    anchorMin.y = 0f;
                    anchorMax.x = 1f;
                    anchorMax.y = 0f;
                    pivot.x     = 1f;
                    pivot.y     = 0f;
                    break;
                }
                rectTransform.pivot     = pivot;
                rectTransform.anchorMin = anchorMin;
                rectTransform.anchorMax = anchorMax;
                if (scale != 1f)
                {
                    rectTransform.localScale = new Vector3(scale, scale, scale);
                }
                rectTransform.anchoredPosition = new Vector2(offsetX, offsetY);
            }
        }
示例#25
0
        public static void InitLevelList(CUIFormScript form, int currentChapter, int levelNo, int difficulty)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                return;
            }
            ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey((long)currentChapter);

            DebugHelper.Assert(dataByKey != null);
            bool flag = Singleton <CFunctionUnlockSys> .instance.ChapterIsUnlock(dataByKey.dwChapterId);

            PVE_ADV_COMPLETE_INFO     pVE_ADV_COMPLETE_INFO     = masterRoleInfo.pveLevelDetail[difficulty - 1];
            PVE_CHAPTER_COMPLETE_INFO pVE_CHAPTER_COMPLETE_INFO = pVE_ADV_COMPLETE_INFO.ChapterDetailList[currentChapter - 1];

            PVE_LEVEL_COMPLETE_INFO[] levelDetailList = pVE_CHAPTER_COMPLETE_INFO.LevelDetailList;
            CUIListScript             component       = form.transform.FindChild("LevelList").GetComponent <CUIListScript>();

            component.SetElementAmount(levelDetailList.Length);
            Sprite     sprite       = CUIUtility.GetSpritePrefeb(CAdventureView.GetLevelFramePath(difficulty), false, false).GetComponent <SpriteRenderer>().sprite;
            GameObject spritePrefeb = CUIUtility.GetSpritePrefeb(CAdventureView.GetLevelSelectFramePath(difficulty), false, false);

            for (int i = 0; i < levelDetailList.Length; i++)
            {
                CUIListElementScript elemenet   = component.GetElemenet(i);
                ResLevelCfgInfo      dataByKey2 = GameDataMgr.levelDatabin.GetDataByKey((long)levelDetailList[i].iLevelID);
                DebugHelper.Assert(dataByKey2 != null, "Can't find LevelConfig = {0}", new object[]
                {
                    levelDetailList[i].iLevelID
                });
                bool flag2   = levelDetailList[i].levelStatus == 0 || !flag;
                bool bActive = levelDetailList[i].levelStatus == 1 && flag;
                int  starNum = CAdventureSys.GetStarNum(levelDetailList[i].bStarBits);
                elemenet.transform.FindChild("Unlock/star1").GetComponent <Image>().set_color((starNum >= 1) ? Color.white : CUIUtility.s_Color_GrayShader);
                elemenet.transform.FindChild("Unlock/star2").GetComponent <Image>().set_color((starNum >= 2) ? Color.white : CUIUtility.s_Color_GrayShader);
                elemenet.transform.FindChild("Unlock/star3").GetComponent <Image>().set_color((starNum >= 3) ? Color.white : CUIUtility.s_Color_GrayShader);
                elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_text(Utility.UTF8Convert(dataByKey2.szName));
                if (levelNo == i + 1 && !flag2)
                {
                    elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[0]);
                }
                else if (!flag2)
                {
                    elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[1]);
                }
                else
                {
                    elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[2]);
                }
                elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[difficulty - 1]);
                elemenet.transform.FindChild("SelectedFrame/Image1").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[CAdventureView.s_Adv_Difficult_Color.Length / 2 + difficulty - 1]);
                elemenet.transform.FindChild("SelectedFrame/Image2").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[CAdventureView.s_Adv_Difficult_Color.Length / 2 + difficulty - 1]);
                elemenet.transform.FindChild("SelectedFrame/SelectedFrame").GetComponent <Image>().SetSprite(spritePrefeb, false);
                elemenet.transform.FindChild("New").gameObject.CustomSetActive(bActive);
                elemenet.GetComponent <CUIEventScript>().m_onClickEventID         = enUIEventID.Adv_SelectLevel;
                elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1;
                elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(!flag2);
                elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(flag2);
                elemenet.m_selectedSprite = sprite;
                elemenet.GetComponent <Image>().SetSprite((levelNo - 1 == i) ? sprite : elemenet.m_defaultSprite, elemenet.m_selectedLayout);
            }
            component.SelectElement(levelNo - 1, true);
        }
示例#26
0
        public static void InitExloreList(CUIFormScript form)
        {
            if (form != null)
            {
                int length = s_eventIDs.Length;
                CUIListElementScript elemenet  = null;
                CUIStepListScript    component = form.transform.Find("ExploreList").gameObject.GetComponent <CUIStepListScript>();
                component.SetElementAmount(length);
                for (int i = 0; i < length; i++)
                {
                    elemenet = component.GetElemenet(i);
                    elemenet.GetComponent <CUIEventScript>().m_onClickEventID = s_eventIDs[i];
                    elemenet.gameObject.transform.Find("TitleBg/ExlporeNameText").GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText(s_exploreTypes[i]);

                    elemenet.gameObject.transform.Find("TitleBg/Image").GetComponent <Image>().color = s_exploreColors[i];
                    Image      image2 = elemenet.gameObject.transform.Find("Icon").gameObject.GetComponent <Image>();
                    GameObject prefab = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_Adventure_Dir + (i + 1), false, false);
                    if (prefab != null)
                    {
                        image2.SetSprite(prefab);
                    }
                    GameObject gameObject           = elemenet.transform.FindChild("Lock").gameObject;
                    GameObject obj4                 = elemenet.transform.FindChild("Unlock").gameObject;
                    RES_SPECIALFUNCUNLOCK_TYPE type = s_unlockTypes[i];
                    if (Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(type))
                    {
                        image2.color = CUIUtility.s_Color_White;
                        gameObject.CustomSetActive(false);
                    }
                    else
                    {
                        image2.color = CUIUtility.s_Color_GrayShader;
                        gameObject.CustomSetActive(true);
                        ResSpecialFucUnlock dataByKey = GameDataMgr.specialFunUnlockDatabin.GetDataByKey((uint)type);
                        if (dataByKey != null)
                        {
                            gameObject.GetComponentInChildren <Text>().text = Utility.UTF8Convert(dataByKey.szLockedTip);
                        }
                    }
                    if (s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_NONE)
                    {
                        int            lastChapter = CAdventureSys.GetLastChapter(1);
                        ResChapterInfo info        = GameDataMgr.chapterInfoDatabin.GetDataByKey((long)lastChapter);
                        if (info != null)
                        {
                            obj4.CustomSetActive(true);
                            obj4.GetComponentInChildren <Text>().text = string.Format(Singleton <CTextManager> .instance.GetText("Adventure_Chapter_Max_Tips"), Utility.UTF8Convert(info.szChapterName));
                        }
                    }
                    else if (s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_ARENA)
                    {
                        if ((Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList == null) || (Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList.stArenaInfo.dwSelfRank == 0))
                        {
                            obj4.CustomSetActive(false);
                        }
                        else
                        {
                            string str = string.Empty;
                            str = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreArenaRankText"), Singleton <CArenaSystem> .GetInstance().m_fightHeroInfoList.stArenaInfo.dwSelfRank);
                            obj4.gameObject.transform.FindChild("Text").gameObject.GetComponent <Text>().text = str;
                            obj4.CustomSetActive(true);
                        }
                    }
                    else if (s_unlockTypes[i] == RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_LIUGUOYUANZHENG)
                    {
                        BurnExpeditionModel model = Singleton <BurnExpeditionController> .GetInstance().model;

                        if (model._data == null)
                        {
                            obj4.CustomSetActive(false);
                        }
                        else
                        {
                            string str2 = string.Empty;
                            if (model.IsAllCompelte())
                            {
                                str2 = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreBurnFinishText"), new object[0]);
                            }
                            else
                            {
                                str2 = string.Format(Singleton <CTextManager> .GetInstance().GetText("ExploreBurnText"), Math.Max(1, model.Get_LastUnlockLevelIndex(model.curDifficultyType) + 1));
                            }
                            obj4.gameObject.transform.FindChild("Text").gameObject.GetComponent <Text>().text = str2;
                            obj4.CustomSetActive(true);
                        }
                    }
                }
                component.SelectElementImmediately(1);
                Text  text2  = form.gameObject.transform.FindChild("AwardGroup/Name1").gameObject.GetComponent <Text>();
                Text  text3  = form.gameObject.transform.FindChild("AwardGroup/Name2").gameObject.GetComponent <Text>();
                Image image  = form.gameObject.transform.FindChild("AwardGroup/Icon1").gameObject.GetComponent <Image>();
                Image image4 = form.gameObject.transform.FindChild("AwardGroup/Icon2").gameObject.GetComponent <Image>();
                text2.gameObject.CustomSetActive(false);
                text3.gameObject.CustomSetActive(false);
                image.gameObject.CustomSetActive(false);
                image4.gameObject.CustomSetActive(false);
                uint key = 0;
                try
                {
                    key = uint.Parse(Singleton <CTextManager> .GetInstance().GetText("ArenaAwardHeroId"));
                }
                catch (Exception)
                {
                }
                if (key != 0)
                {
                    ResHeroCfgInfo info2 = GameDataMgr.heroDatabin.GetDataByKey(key);
                    if (!Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().IsHaveHero(key, false) && (info2 != null))
                    {
                        text2.gameObject.CustomSetActive(true);
                        text2.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("ArenaAwardHero"), info2.szName);
                        image.gameObject.CustomSetActive(true);
                        image.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(key, 0)), form, true, false, false);
                    }
                }
                key = 0;
                try
                {
                    key = uint.Parse(Singleton <CTextManager> .GetInstance().GetText("BurningAwardHeroId"));
                }
                catch (Exception)
                {
                }
                if (key != 0)
                {
                    ResHeroCfgInfo info3 = GameDataMgr.heroDatabin.GetDataByKey(key);
                    if (!Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().IsHaveHero(key, false) && (info3 != null))
                    {
                        text3.gameObject.CustomSetActive(true);
                        text3.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("BurningAwardHero"), info3.szName);
                        image4.gameObject.CustomSetActive(true);
                        image4.SetSprite(string.Format("{0}{1}", CUIUtility.s_Sprite_Dynamic_Icon_Dir, CSkinInfo.GetHeroSkinPic(key, 0)), form, true, false, false);
                    }
                }
            }
        }
示例#27
0
        public static void AddRedDot(GameObject target, enRedDotPos dotPos = 2, int alertNum = 0)
        {
            if ((target != null) && (target.transform != null))
            {
                DelRedDot(target);
                Transform  transform = null;
                GameObject obj2      = null;
                if (alertNum == 0)
                {
                    obj2 = UnityEngine.Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/redDot", false, false)) as GameObject;
                }
                else
                {
                    obj2 = UnityEngine.Object.Instantiate(CUIUtility.GetSpritePrefeb("UGUI/Form/Common/redDotBig", false, false)) as GameObject;
                }
                transform = obj2.transform;
                transform.gameObject.name = s_redDotName;
                transform.GetComponent <CUIMiniEventScript>().m_onDownEventParams.tag = 0;
                if ((alertNum != 0) && (transform.Find("Text") != null))
                {
                    transform.Find("Text").GetComponent <Text>().text = alertNum.ToString();
                }
                transform.SetParent(target.transform, false);
                transform.SetAsLastSibling();
                RectTransform transform2 = transform as RectTransform;
                Vector2       vector     = new Vector2();
                Vector2       vector2    = new Vector2();
                Vector2       vector3    = new Vector2();
                switch (dotPos)
                {
                case enRedDotPos.enTopLeft:
                    vector.x  = 0f;
                    vector.y  = 1f;
                    vector2.x = 0f;
                    vector2.y = 1f;
                    vector3.x = 0f;
                    vector3.y = 1f;
                    break;

                case enRedDotPos.enTopCenter:
                    vector.x  = 0.5f;
                    vector.y  = 1f;
                    vector2.x = 0.5f;
                    vector2.y = 1f;
                    vector3.x = 0.5f;
                    vector3.y = 1f;
                    break;

                case enRedDotPos.enTopRight:
                    vector.x  = 1f;
                    vector.y  = 1f;
                    vector2.x = 1f;
                    vector2.y = 1f;
                    vector3.x = 1f;
                    vector3.y = 1f;
                    break;

                case enRedDotPos.enMiddleLeft:
                    vector.x  = 0f;
                    vector.y  = 0.5f;
                    vector2.x = 0f;
                    vector2.y = 0.5f;
                    vector3.x = 0f;
                    vector3.y = 0.5f;
                    break;

                case enRedDotPos.enMiddleCenter:
                    vector.x  = 0.5f;
                    vector.y  = 0.5f;
                    vector2.x = 0.5f;
                    vector2.y = 0.5f;
                    vector3.x = 0.5f;
                    vector3.y = 0.5f;
                    break;

                case enRedDotPos.enMiddleRight:
                    vector.x  = 1f;
                    vector.y  = 0.5f;
                    vector2.x = 1f;
                    vector2.y = 0.5f;
                    vector3.x = 1f;
                    vector3.y = 0.5f;
                    break;

                case enRedDotPos.enBottomLeft:
                    vector.x  = 0f;
                    vector.y  = 0f;
                    vector2.x = 0f;
                    vector2.y = 0f;
                    vector3.x = 0f;
                    vector3.y = 0f;
                    break;

                case enRedDotPos.enBottomCenter:
                    vector.x  = 0.5f;
                    vector.y  = 0f;
                    vector2.x = 0.5f;
                    vector2.y = 0f;
                    vector3.x = 0.5f;
                    vector3.y = 0f;
                    break;

                case enRedDotPos.enBottomRight:
                    vector.x  = 1f;
                    vector.y  = 0f;
                    vector2.x = 1f;
                    vector2.y = 0f;
                    vector3.x = 1f;
                    vector3.y = 0f;
                    break;
                }
                transform2.pivot            = vector3;
                transform2.anchorMin        = vector;
                transform2.anchorMax        = vector2;
                transform2.anchoredPosition = new Vector2();
            }
        }
示例#28
0
        public BuyPickDialog(COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm(s_Form_Path, false, true);

            if (null != script)
            {
                this._root                 = script.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0;
                this._count                = 1;
                this._maxCount             = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                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");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Desc/Image/Text");
                    if (this._descText != null)
                    {
                        this._descText.text = this._usb.m_description;
                    }
                    Utility.GetComponetInChild <Image>(this._root, "Panel/Slot/Icon").SetSprite(CUIUtility.GetSpritePrefeb(this._usb.GetIconPath(), false, false));
                    Utility.GetComponetInChild <Text>(this._root, "Panel/Name").text = this._usb.m_name;
                    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));
                        Utility.GetComponetInChild <Text>(this._root, "Panel/Price").text = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(this._usb.GetBuyPrice(coinType), this._realDiscount).ToString();
                    }
                    Image componetInChild = Utility.GetComponetInChild <Image>(this._root, "Panel/Slot/imgExperienceMark");
                    if (componetInChild != null)
                    {
                        if ((this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) && CItem.IsHeroExperienceCard(this._usb.m_baseID))
                        {
                            componetInChild.gameObject.CustomSetActive(true);
                            componetInChild.SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false));
                        }
                        else if ((this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) && CItem.IsSkinExperienceCard(this._usb.m_baseID))
                        {
                            componetInChild.gameObject.CustomSetActive(true);
                            componetInChild.SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false));
                        }
                        else
                        {
                            componetInChild.gameObject.CustomSetActive(false);
                        }
                    }
                }
                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));

                this.ValidateDynamic();
            }
        }
        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);
        }