private void InitSysBtn(Button btn, RES_GAME_ENTRANCE_TYPE entryType, GameObject txtObj, GameObject coinTextObj)
        {
            RES_SPECIALFUNCUNLOCK_TYPE type = CUICommonSystem.EntryTypeToUnlockType(entryType);

            if (Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(type))
            {
                txtObj.CustomSetActive(false);
                coinTextObj.CustomSetActive(true);
                CUICommonSystem.SetButtonEnableWithShader(btn, true, true);
                btn.GetComponent <CUIEventScript>().m_onClickEventParams.tag = (int)entryType;
            }
            else
            {
                txtObj.CustomSetActive(true);
                coinTextObj.CustomSetActive(false);
                CUICommonSystem.SetButtonEnableWithShader(btn, false, true);
            }
        }
Beispiel #2
0
 private void SetBlockButtonBlocked(GameObject blockNode, bool bHasBlocked)
 {
     if (blockNode != null)
     {
         CUIEventScript component = blockNode.GetComponent <CUIEventScript>();
         if (component != null)
         {
             component.enabled = !bHasBlocked;
         }
         Button btn = blockNode.GetComponent <Button>();
         if (btn != null)
         {
             CUICommonSystem.SetButtonEnableWithShader(btn, !bHasBlocked, true);
         }
         string str  = !bHasBlocked ? "屏蔽" : "已屏蔽";
         Text   text = blockNode.transform.Find("Text").GetComponent <Text>();
         if (text != null)
         {
             text.text = str;
         }
     }
 }
Beispiel #3
0
 public void ShowinviteGuild(bool isShow, bool isEnable)
 {
     if (this.inviteGuildButton != null)
     {
         if (CSysDynamicBlock.bFriendBlocked && this.inviteGuildButton.gameObject.activeSelf)
         {
             this.inviteGuildButton.gameObject.SetActive(false);
         }
         else if (!isShow)
         {
             this.inviteGuildButton.gameObject.CustomSetActive(false);
         }
         else
         {
             this.inviteGuildButton.gameObject.CustomSetActive(true);
             CUICommonSystem.SetButtonEnableWithShader(this.inviteGuildButton, isEnable, true);
             if (this.inviteGuildBtn_eventScript != null)
             {
                 this.inviteGuildBtn_eventScript.SetUIEvent(enUIEventType.Click, enUIEventID.Friend_InviteGuild);
             }
         }
     }
 }
Beispiel #4
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();
            }
        }
Beispiel #5
0
    public void UpdateSelectedHonor(CUIFormScript form, COMDT_HONORINFO honorInfo)
    {
        CTextManager instance = Singleton <CTextManager> .GetInstance();

        string     text   = instance.GetText("Player_Info_Honor_Btn_Using");
        string     text2  = instance.GetText("Player_Info_Honor_Btn_Use");
        string     text3  = instance.GetText("Player_Info_Honor_Btn_Browse");
        GameObject widget = form.GetWidget(9);

        if (widget == null)
        {
            return;
        }
        Transform      transform   = form.transform.Find("pnlBg/pnlBody/pnlHonorInfo/pnlContainer/SelectedHonor/Button");
        Button         button      = (transform == null) ? null : transform.GetComponent <Button>();
        GameObject     gameObject  = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/SelectedHonor/CurrentHonor/normal");
        GameObject     gameObject2 = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/SelectedHonor/CurrentHonor/label");
        GameObject     gameObject3 = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/SelectedHonor/CurrentHonor/cnt");
        GameObject     gameObject4 = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/SelectedHonor/Text");
        CPlayerProfile profile     = Singleton <CPlayerInfoSystem> .GetInstance().GetProfile();

        int       selectedHonorId = profile.GetSelectedHonorId();
        CRoleInfo masterRoleInfo  = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

        bool flag = true;

        if (masterRoleInfo != null && masterRoleInfo.playerUllUID != profile.m_uuid)
        {
            flag = false;
        }
        if (honorInfo == null)
        {
            honorInfo = new COMDT_HONORINFO();
            if (button != null)
            {
                CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                CUICommonSystem.SetButtonName(transform.gameObject, text2);
            }
            if (gameObject != null)
            {
                this.SetHonorImage(gameObject.transform, honorInfo);
            }
            if (gameObject2 != null)
            {
                this.SetHonorName(gameObject2.transform, honorInfo);
            }
            if (gameObject3 != null)
            {
                this.SetHonorPoint(gameObject3.transform, honorInfo);
            }
            if (gameObject4 != null)
            {
                this.SetHonorDesc(gameObject4.transform, honorInfo);
            }
            if (!flag && button != null)
            {
                CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                CUICommonSystem.SetButtonName(transform.gameObject, text3);
                return;
            }
            return;
        }
        else
        {
            if (gameObject != null)
            {
                this.SetHonorImage(gameObject.transform, honorInfo);
            }
            if (gameObject2 != null)
            {
                this.SetHonorName(gameObject2.transform, honorInfo);
            }
            if (gameObject3 != null)
            {
                this.SetHonorPoint(gameObject3.transform, honorInfo);
            }
            if (gameObject4 != null)
            {
                this.SetHonorDesc(gameObject4.transform, honorInfo);
            }
            if (!flag && button != null)
            {
                CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                CUICommonSystem.SetButtonName(transform.gameObject, text3);
                return;
            }
            if (honorInfo.iHonorID == selectedHonorId && honorInfo.iHonorID != 0)
            {
                if (button != null)
                {
                    CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                    CUICommonSystem.SetButtonName(transform.gameObject, text);
                }
            }
            else if (honorInfo.iHonorLevel <= 0)
            {
                if (button != null)
                {
                    CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                    CUICommonSystem.SetButtonName(transform.gameObject, text2);
                }
            }
            else if (button != null)
            {
                CUICommonSystem.SetButtonEnableWithShader(button, true, true);
                CUICommonSystem.SetButtonName(transform.gameObject, text2);
            }
            return;
        }
    }
            public void Validate()
            {
                if (this.phase == null || this.uiItem == null)
                {
                    return;
                }
                this.uiItem.CustomSetActive(true);
                ResDT_PointExchange    config = this.phase.Config;
                PointsExchangeActivity pointsExchangeActivity = this.phase.Owner as PointsExchangeActivity;

                if (pointsExchangeActivity == null || pointsExchangeActivity.PointsConfig == null)
                {
                    return;
                }
                ResWealPointExchange pointsConfig = pointsExchangeActivity.PointsConfig;
                GameObject           gameObject   = this.uiItem.transform.FindChild("DuihuanBtn").gameObject;

                gameObject.GetComponent <CUIEventScript>().m_onClickEventParams.commonUInt32Param1 = (uint)this.index;
                uint      maxExchangeCount = pointsExchangeActivity.GetMaxExchangeCount(this.index);
                uint      exchangeCount    = pointsExchangeActivity.GetExchangeCount(this.index);
                uint      dwPointCnt       = config.dwPointCnt;
                CRoleInfo masterRoleInfo   = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                uint jiFen    = masterRoleInfo.JiFen;
                bool isEnable = jiFen >= dwPointCnt && (maxExchangeCount == 0u || exchangeCount < maxExchangeCount);

                if (this.owner.view.activity.timeState != Activity.TimeState.Going)
                {
                    CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                }
                else
                {
                    CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), isEnable, true);
                }
                CUseable   itemUseable = CUseableManager.CreateVirtualUseable(enVirtualItemType.enDianJuanJiFen, 1);
                GameObject gameObject2 = this.uiItem.transform.FindChild("Panel/PointsCell").gameObject;

                CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject2, itemUseable, true, false, false, false);
                CUseable   cUseable    = CUseableManager.CreateUseable((COM_ITEM_TYPE)config.wResItemType, config.dwResItemID, (int)config.wResItemCnt);
                GameObject gameObject3 = this.uiItem.transform.FindChild("Panel/GetItemCell").gameObject;

                if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                {
                    CItem cItem = cUseable as CItem;
                    if (cItem != null && cItem.m_itemData.bIsView > 0)
                    {
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject3, cUseable, true, false, false, true);
                    }
                    else
                    {
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject3, cUseable, true, false, false, false);
                        if (gameObject3 != null)
                        {
                            CUIEventScript component = gameObject3.GetComponent <CUIEventScript>();
                            if (component != null)
                            {
                                component.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                            }
                        }
                    }
                }
                else
                {
                    CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject3, cUseable, true, false, false, false);
                    if (gameObject3 != null)
                    {
                        CUIEventScript component2 = gameObject3.GetComponent <CUIEventScript>();
                        if (component2 != null)
                        {
                            component2.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                        }
                    }
                }
                bool bActive = false;

                if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                {
                    CHeroItem cHeroItem = (CHeroItem)cUseable;
                    if (cHeroItem != null)
                    {
                        CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                        if (masterRoleInfo2 != null)
                        {
                            bActive = masterRoleInfo2.IsHaveHero(cHeroItem.m_baseID, true);
                        }
                    }
                }
                else if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                {
                    CHeroSkin cHeroSkin = (CHeroSkin)cUseable;
                    if (cHeroSkin != null)
                    {
                        CRoleInfo masterRoleInfo3 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                        if (masterRoleInfo3 != null)
                        {
                            bActive = masterRoleInfo3.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false);
                        }
                    }
                }
                Transform transform = this.uiItem.transform.FindChild("Panel/GetItemCell/HaveItemFlag");

                if (transform != null && transform.gameObject != null)
                {
                    transform.gameObject.CustomSetActive(bActive);
                }
                Text component3 = this.uiItem.transform.FindChild("Panel/PointsCell/ItemCount").gameObject.GetComponent <Text>();

                if (jiFen < config.dwPointCnt)
                {
                    component3.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), jiFen, dwPointCnt));
                    CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                }
                else
                {
                    component3.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), jiFen, dwPointCnt));
                }
                GameObject gameObject4 = this.uiItem.transform.FindChild("ExchangeCount").gameObject;

                if (maxExchangeCount > 0u)
                {
                    gameObject4.CustomSetActive(true);
                    gameObject4.GetComponent <Text>().set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_TimeLimit"), exchangeCount, maxExchangeCount));
                }
                else
                {
                    gameObject4.CustomSetActive(false);
                }
            }
Beispiel #7
0
        public static void OnRankingArenaElementEnable(CUIEvent uiEvent)
        {
            int        srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;
            GameObject srcWidget = uiEvent.m_srcWidget;
            GameObject obj3      = Utility.FindChild(srcWidget, "addFriendBtn");
            GameObject obj4      = Utility.FindChild(srcWidget, "sendButton");

            if (Singleton <CArenaSystem> .instance.m_rankInfoList.astFigterDetail[srcWidgetIndexInBelongedList].stFigterData.bMemberType == 1)
            {
                COMDT_ARENA_MEMBER_OF_ACNT fighterInfo = CArenaSystem.GetFighterInfo(Singleton <CArenaSystem> .instance.m_rankInfoList.astFigterDetail[srcWidgetIndexInBelongedList].stFigterData);
                ulong ullUid       = fighterInfo.ullUid;
                uint  logicWorldID = (uint)MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID;

                COMDT_FRIEND_INFO comdt_friend_info = Singleton <CFriendContoller> .instance.model.GetInfo(CFriendModel.FriendType.GameFriend, ullUid, logicWorldID);

                COMDT_FRIEND_INFO comdt_friend_info2 = Singleton <CFriendContoller> .instance.model.GetInfo(CFriendModel.FriendType.SNS, ullUid, logicWorldID);

                bool flag  = comdt_friend_info != null;
                bool flag2 = comdt_friend_info2 != null;
                if (!flag && !flag2)
                {
                    ulong playerUllUID = (uint)Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo().playerUllUID;

                    obj3.CustomSetActive(playerUllUID != fighterInfo.ullUid);
                    obj4.CustomSetActive(false);
                    CUIEventScript componetInChild = Utility.GetComponetInChild <CUIEventScript>(obj3, "AddFriend");
                    componetInChild.m_onClickEventID         = enUIEventID.Ranking_ArenaAddFriend;
                    componetInChild.m_onClickEventParams.tag = (int)logicWorldID;
                    componetInChild.m_onClickEventParams.commonUInt64Param1 = fighterInfo.ullUid;
                }
                else
                {
                    COMDT_ACNT_UNIQ uniq = (comdt_friend_info != null) ? comdt_friend_info.stUin : comdt_friend_info2.stUin;
                    obj3.CustomSetActive(false);
                    obj4.CustomSetActive(true);
                    bool flag3 = Singleton <CFriendContoller> .instance.model.HeartData.BCanSendHeart(uniq, COM_FRIEND_TYPE.COM_FRIEND_TYPE_GAME);

                    bool flag4 = Singleton <CFriendContoller> .instance.model.HeartData.BCanSendHeart(uniq, COM_FRIEND_TYPE.COM_FRIEND_TYPE_SNS);

                    bool isEnable = flag3 && flag4;
                    CUICommonSystem.SetButtonEnableWithShader(obj4.GetComponent <Button>(), isEnable, true);
                    if (isEnable)
                    {
                        CUIEventScript component = obj4.GetComponent <CUIEventScript>();
                        if (flag)
                        {
                            component.m_onClickEventID = enUIEventID.Ranking_Friend_GAME_SendCoin;
                        }
                        else
                        {
                            component.m_onClickEventID = enUIEventID.Friend_SendCoin;
                        }
                        component.m_onClickEventParams.tag = srcWidgetIndexInBelongedList;
                        component.m_onClickEventParams.commonUInt64Param1 = uniq.ullUid;
                        component.m_onClickEventParams.commonUInt64Param2 = uniq.dwLogicWorldId;
                    }
                }
            }
            else
            {
                obj3.CustomSetActive(false);
                obj4.CustomSetActive(false);
            }
            CArenaSystem.Arena_RankElementEnable(uiEvent);
        }
Beispiel #8
0
        private void RefreshOverviewForm(CUIFormScript overviewForm = null)
        {
            if (overviewForm == null)
            {
                overviewForm = Singleton <CUIManager> .GetInstance().GetForm("UGUI/Form/System/Achieve/Form_Trophy_Overview.prefab");
            }
            if (overviewForm == null)
            {
                return;
            }
            CUIListScript component = overviewForm.GetWidget(1).GetComponent <CUIListScript>();

            if (component != null)
            {
                component.SetElementAmount(this.m_CurAchieveSeries.Count);
            }
            GameObject widget  = overviewForm.GetWidget(2);
            GameObject widget2 = overviewForm.GetWidget(3);
            GameObject widget3 = overviewForm.GetWidget(7);
            GameObject widget4 = overviewForm.GetWidget(8);
            GameObject widget5 = overviewForm.GetWidget(9);
            GameObject widget6 = overviewForm.GetWidget(10);
            GameObject widget7 = overviewForm.GetWidget(4);
            GameObject widget8 = overviewForm.GetWidget(5);
            GameObject widget9 = overviewForm.GetWidget(6);

            if (widget == null || widget2 == null || widget3 == null || widget4 == null || widget7 == null || widget8 == null || widget9 == null || widget5 == null || widget6 == null)
            {
                DebugHelper.Assert(false, "Some of Trophy overview form widgets is null");
                return;
            }
            Text          component2        = widget.GetComponent <Text>();
            Text          component3        = widget2.GetComponent <Text>();
            Image         component4        = widget6.GetComponent <Image>();
            Image         component5        = widget3.GetComponent <Image>();
            Text          component6        = widget4.GetComponent <Text>();
            CAchieveInfo2 masterAchieveInfo = CAchieveInfo2.GetMasterAchieveInfo();

            if (masterAchieveInfo.LastDoneTrophyRewardInfo != null)
            {
                component4.SetSprite(masterAchieveInfo.LastDoneTrophyRewardInfo.GetTrophyImagePath(), overviewForm, true, false, false, false);
            }
            component2.set_text((masterAchieveInfo.LastDoneTrophyRewardInfo == null) ? "0" : string.Format("{0}", masterAchieveInfo.LastDoneTrophyRewardInfo.Cfg.dwTrophyLvl));
            if (masterAchieveInfo.GetWorldRank() == 0u)
            {
                widget5.CustomSetActive(true);
                widget2.CustomSetActive(false);
            }
            else
            {
                widget5.CustomSetActive(false);
                widget2.CustomSetActive(true);
                component3.set_text(masterAchieveInfo.GetWorldRank().ToString());
            }
            uint num  = 0u;
            uint num2 = 0u;

            masterAchieveInfo.GetTrophyProgress(ref num, ref num2);
            CTrophyRewardInfo trophyRewardInfoByPoint = masterAchieveInfo.GetTrophyRewardInfoByPoint(num);
            CTrophyRewardInfo trophyRewardInfoByIndex = masterAchieveInfo.GetTrophyRewardInfoByIndex(trophyRewardInfoByPoint.Index + 1);

            component5.set_fillAmount(Utility.Divide(num - trophyRewardInfoByIndex.MinPoint, trophyRewardInfoByIndex.MaxPoint - trophyRewardInfoByIndex.MinPoint));
            component6.set_text(string.Format("{0}/{1}", num - trophyRewardInfoByIndex.MinPoint, trophyRewardInfoByIndex.MaxPoint - trophyRewardInfoByIndex.MinPoint));
            Text              component7 = widget7.GetComponent <Text>();
            CUIListScript     component8 = widget8.GetComponent <CUIListScript>();
            CUIEventScript    component9 = widget9.GetComponent <CUIEventScript>();
            CTrophyRewardInfo firstTrophyRewardInfoAwardNotGot = masterAchieveInfo.GetFirstTrophyRewardInfoAwardNotGot();

            if (firstTrophyRewardInfoAwardNotGot == null)
            {
                widget7.CustomSetActive(false);
                widget9.CustomSetActive(false);
                component8.SetElementAmount(0);
            }
            else
            {
                bool       flag          = false;
                CUseable[] trophyRewards = firstTrophyRewardInfoAwardNotGot.GetTrophyRewards();
                if (!firstTrophyRewardInfoAwardNotGot.HasGotAward() && firstTrophyRewardInfoAwardNotGot.IsFinish())
                {
                    flag = true;
                }
                widget7.CustomSetActive(true);
                component7.set_text(string.Format("{0}级奖励:", firstTrophyRewardInfoAwardNotGot.Cfg.dwTrophyLvl));
                component8.SetElementAmount(trophyRewards.Length);
                for (int i = 0; i < trophyRewards.Length; i++)
                {
                    CUIListElementScript elemenet = component8.GetElemenet(i);
                    CUICommonSystem.SetItemCell(overviewForm, elemenet.GetWidget(0), trophyRewards[i], false, false, false, false);
                }
                widget9.CustomSetActive(true);
                if (flag)
                {
                    CUICommonSystem.SetButtonEnableWithShader(widget9.GetComponent <Button>(), true, true);
                    component9.SetUIEvent(enUIEventType.Click, enUIEventID.Achievement_Get_Trophy_Reward, new stUIEventParams
                    {
                        tag = firstTrophyRewardInfoAwardNotGot.Index
                    });
                }
                else
                {
                    CUICommonSystem.SetButtonEnableWithShader(widget9.GetComponent <Button>(), false, true);
                }
            }
        }
Beispiel #9
0
            public void Validate()
            {
                if (this.phase == null || this.uiItem == null)
                {
                    return;
                }
                this.uiItem.CustomSetActive(true);
                ResDT_Item_Info resDT_Item_Info  = null;
                ResDT_Item_Info resDT_Item_Info2 = null;
                ResDT_Item_Info stResItemInfo    = this.phase.Config.stResItemInfo;

                if (this.phase.Config.bColItemCnt > 0)
                {
                    resDT_Item_Info = this.phase.Config.astColItemInfo[0];
                }
                if (this.phase.Config.bColItemCnt > 1)
                {
                    resDT_Item_Info2 = this.phase.Config.astColItemInfo[1];
                }
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo();

                CUseableContainer useableContainer = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM);

                if (useableContainer == null)
                {
                    return;
                }
                int arg_CB_0 = (resDT_Item_Info == null) ? 0 : useableContainer.GetUseableStackCount((COM_ITEM_TYPE)resDT_Item_Info.wItemType, resDT_Item_Info.dwItemID);
                int arg_EC_0 = (resDT_Item_Info2 == null) ? 0 : useableContainer.GetUseableStackCount((COM_ITEM_TYPE)resDT_Item_Info2.wItemType, resDT_Item_Info2.dwItemID);

                if (stResItemInfo != null)
                {
                    GameObject gameObject = this.uiItem.transform.FindChild("DuihuanBtn").gameObject;
                    gameObject.GetComponent <CUIEventScript>().m_onClickEventParams.commonUInt32Param1 = (uint)this.index;
                    bool isEnable = this.owner.view.activity.timeState == Activity.TimeState.Going;
                    CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), isEnable, true);
                    if (resDT_Item_Info != null)
                    {
                        CUseable   itemUseable = CUseableManager.CreateUseable((COM_ITEM_TYPE)resDT_Item_Info.wItemType, resDT_Item_Info.dwItemID, 1);
                        GameObject gameObject2 = this.uiItem.transform.FindChild("Panel/ItemCell1").gameObject;
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject2, itemUseable, true, false, false, false);
                        int    useableStackCount = useableContainer.GetUseableStackCount((COM_ITEM_TYPE)resDT_Item_Info.wItemType, resDT_Item_Info.dwItemID);
                        ushort wItemCnt          = resDT_Item_Info.wItemCnt;
                        Text   component         = this.uiItem.transform.FindChild("Panel/ItemCell1/ItemCount").gameObject.GetComponent <Text>();
                        if (useableStackCount < (int)wItemCnt)
                        {
                            component.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), useableStackCount, wItemCnt));
                            CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                        }
                        else
                        {
                            component.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), useableStackCount, wItemCnt));
                        }
                    }
                    if (resDT_Item_Info2 != null)
                    {
                        CUseable   itemUseable2 = CUseableManager.CreateUseable((COM_ITEM_TYPE)resDT_Item_Info2.wItemType, resDT_Item_Info2.dwItemID, 1);
                        GameObject gameObject3  = this.uiItem.transform.FindChild("Panel/ItemCell2").gameObject;
                        gameObject3.CustomSetActive(true);
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject3, itemUseable2, true, false, false, false);
                        int    useableStackCount2 = useableContainer.GetUseableStackCount((COM_ITEM_TYPE)resDT_Item_Info2.wItemType, resDT_Item_Info2.dwItemID);
                        ushort wItemCnt2          = resDT_Item_Info2.wItemCnt;
                        Text   component2         = this.uiItem.transform.FindChild("Panel/ItemCell2/ItemCount").gameObject.GetComponent <Text>();
                        if (useableStackCount2 < (int)wItemCnt2)
                        {
                            component2.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), useableStackCount2, wItemCnt2));
                            CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                        }
                        else
                        {
                            component2.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), useableStackCount2, wItemCnt2));
                        }
                    }
                    else
                    {
                        GameObject gameObject4 = this.uiItem.transform.FindChild("Panel/ItemCell2").gameObject;
                        gameObject4.CustomSetActive(false);
                        GameObject gameObject5 = this.uiItem.transform.FindChild("Panel/Add").gameObject;
                        gameObject5.CustomSetActive(false);
                    }
                    CUseable   cUseable    = CUseableManager.CreateUseable((COM_ITEM_TYPE)stResItemInfo.wItemType, stResItemInfo.dwItemID, (int)stResItemInfo.wItemCnt);
                    GameObject gameObject6 = this.uiItem.transform.FindChild("Panel/GetItemCell").gameObject;
                    bool       bActive     = false;
                    if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                    {
                        CHeroItem cHeroItem = (CHeroItem)cUseable;
                        if (cHeroItem != null)
                        {
                            CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo2 != null)
                            {
                                bActive = masterRoleInfo2.IsHaveHero(cHeroItem.m_baseID, true);
                            }
                        }
                    }
                    else if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                    {
                        CHeroSkin cHeroSkin = (CHeroSkin)cUseable;
                        if (cHeroSkin != null)
                        {
                            CRoleInfo masterRoleInfo3 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo3 != null)
                            {
                                bActive = masterRoleInfo3.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false);
                            }
                        }
                    }
                    Transform transform = this.uiItem.transform.FindChild("Panel/GetItemCell/HaveItemFlag");
                    if (transform != null && transform.gameObject != null)
                    {
                        transform.gameObject.CustomSetActive(bActive);
                    }
                    if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem cItem = cUseable as CItem;
                        if (cItem != null && cItem.m_itemData.bIsView > 0)
                        {
                            CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject6, cUseable, true, false, false, true);
                        }
                        else
                        {
                            CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject6, cUseable, true, false, false, false);
                            if (gameObject6 != null)
                            {
                                CUIEventScript component3 = gameObject6.GetComponent <CUIEventScript>();
                                if (component3 != null)
                                {
                                    component3.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                                }
                            }
                        }
                    }
                    else
                    {
                        CUICommonSystem.SetItemCell(this.owner.view.form.formScript, gameObject6, cUseable, true, false, false, false);
                        if (gameObject6 != null)
                        {
                            CUIEventScript component4 = gameObject6.GetComponent <CUIEventScript>();
                            if (component4 != null)
                            {
                                component4.SetUIEvent(enUIEventType.Click, enUIEventID.None);
                            }
                        }
                    }
                    ExchangeActivity exchangeActivity = this.owner.view.activity as ExchangeActivity;
                    if (exchangeActivity != null)
                    {
                        GameObject gameObject7      = this.uiItem.transform.FindChild("ExchangeCount").gameObject;
                        uint       maxExchangeCount = exchangeActivity.GetMaxExchangeCount((int)this.phase.Config.bIdx);
                        uint       exchangeCount    = exchangeActivity.GetExchangeCount((int)this.phase.Config.bIdx);
                        if (maxExchangeCount > 0u)
                        {
                            gameObject7.CustomSetActive(true);
                            gameObject7.GetComponent <Text>().set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_TimeLimit"), exchangeCount, maxExchangeCount));
                            if (exchangeCount >= maxExchangeCount)
                            {
                                CUICommonSystem.SetButtonEnableWithShader(gameObject.GetComponent <Button>(), false, true);
                            }
                        }
                        else
                        {
                            gameObject7.CustomSetActive(false);
                        }
                    }
                }
            }
Beispiel #10
0
        public static void InitLadderEntry(CUIFormScript form, ref COMDT_RANKDETAIL data, bool isQualified)
        {
            Transform transform  = form.transform.Find("MainPanel/BtnGroup/SingleStart");
            Transform transform2 = form.transform.Find("MainPanel/BtnGroup/DoubleStart");
            Transform transform3 = form.transform.Find("MainPanel/BtnGroup/FiveStart");
            Button    button     = null;
            Button    button2    = null;
            Button    button3    = null;

            if (transform)
            {
                button = transform.GetComponent <Button>();
            }
            if (transform2)
            {
                button2 = transform2.GetComponent <Button>();
            }
            if (transform3)
            {
                button3 = transform3.GetComponent <Button>();
            }
            GameObject widget = form.GetWidget(11);

            widget.CustomSetActive(isQualified);
            if (isQualified)
            {
                form.transform.Find("ReqPanel").gameObject.CustomSetActive(false);
                form.transform.Find("MainPanel/ImgLock").gameObject.CustomSetActive(false);
                form.transform.Find("MainPanel/RankCon").gameObject.CustomSetActive(true);
                GameObject gameObject = form.transform.Find("MainPanel/RankCon").gameObject;
                if (data != null)
                {
                    if (button)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(button, data.bState == 1, true);
                    }
                    if (button2)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(button2, data.bState == 1, true);
                        if (CLadderSystem.MultiLadderMaxTeamerNum() == 2)
                        {
                            CUICommonSystem.SetTextContent(transform2.FindChild("Text"), Singleton <CTextManager> .GetInstance().GetText("Ladder_EntryBtn_Text1"));
                        }
                        else
                        {
                            CUICommonSystem.SetTextContent(transform2.FindChild("Text"), Singleton <CTextManager> .GetInstance().GetText("Ladder_EntryBtn_Text2"));
                        }
                    }
                    if (button3)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(button3, data.bState == 1, true);
                    }
                    CLadderView.ShowRankDetail(gameObject, ref data, false);
                    CUIParticleScript component = form.GetWidget(16).GetComponent <CUIParticleScript>();
                    component.LoadRes(CLadderView.GetGradeParticleBgResName());
                }
                else
                {
                    if (button)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                    }
                    if (button2)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(button2, false, true);
                    }
                    if (button3)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(button3, false, true);
                    }
                }
            }
            else
            {
                if (button)
                {
                    CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                }
                if (button2)
                {
                    CUICommonSystem.SetButtonEnableWithShader(button2, false, true);
                }
                if (button3)
                {
                    CUICommonSystem.SetButtonEnableWithShader(button3, false, true);
                }
                form.transform.Find("ReqPanel").gameObject.CustomSetActive(true);
                form.transform.Find("MainPanel/ImgLock").gameObject.CustomSetActive(true);
                form.transform.Find("MainPanel/RankCon").gameObject.CustomSetActive(false);
                Text      component2     = form.transform.Find("ReqPanel/txtHeroNum").GetComponent <Text>();
                Text      component3     = form.transform.Find("ReqPanel/txtReqHeroNum").GetComponent <Text>();
                int       num            = 0;
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                if (masterRoleInfo != null)
                {
                    num = masterRoleInfo.GetHaveHeroCount(false);
                }
                component2.set_text(string.Format("{0}/{1}", num, CLadderSystem.REQ_HERO_NUM));
                component3.set_text(string.Format(Singleton <CTextManager> .GetInstance().GetText("Ladder_Req_Hero_Num"), CLadderSystem.REQ_HERO_NUM.ToString()));
            }
            CLadderView.ShowBraveScorePanel(form, data, isQualified);
            CLadderView.ShowRewardPanel(form, data);
            CLadderView.ShowBpModePanel(form);
            CLadderView.ShowSuperKingRankPanel(form);
            if (CSysDynamicBlock.bLobbyEntryBlocked)
            {
                form.transform.FindChild("MainPanel/pnlRankingBtn").gameObject.CustomSetActive(false);
            }
        }
        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();
            }
        }
Beispiel #12
0
        public static void OnRankingArenaElementEnable(CUIEvent uiEvent)
        {
            int        srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList;
            GameObject srcWidget   = uiEvent.m_srcWidget;
            GameObject gameObject  = Utility.FindChild(srcWidget, "addFriendBtn");
            GameObject gameObject2 = Utility.FindChild(srcWidget, "sendButton");

            if (Singleton <CArenaSystem> .get_instance().m_rankInfoList.astFigterDetail[srcWidgetIndexInBelongedList].stFigterData.bMemberType == 1)
            {
                COMDT_ARENA_MEMBER_OF_ACNT fighterInfo = CArenaSystem.GetFighterInfo(Singleton <CArenaSystem> .get_instance().m_rankInfoList.astFigterDetail[srcWidgetIndexInBelongedList].stFigterData);
                ulong ullUid       = fighterInfo.ullUid;
                uint  logicWorldID = (uint)MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID;

                COMDT_FRIEND_INFO info = Singleton <CFriendContoller> .get_instance().model.GetInfo(CFriendModel.FriendType.GameFriend, ullUid, logicWorldID);

                COMDT_FRIEND_INFO info2 = Singleton <CFriendContoller> .get_instance().model.GetInfo(CFriendModel.FriendType.SNS, ullUid, logicWorldID);

                bool flag  = info != null;
                bool flag2 = info2 != null;
                if (!flag && !flag2)
                {
                    ulong num = (ulong)((uint)Singleton <CRoleInfoManager> .get_instance().GetMasterRoleInfo().playerUllUID);
                    gameObject.CustomSetActive(num != fighterInfo.ullUid);
                    gameObject2.CustomSetActive(false);
                    CUIEventScript componetInChild = Utility.GetComponetInChild <CUIEventScript>(gameObject, "AddFriend");
                    componetInChild.m_onClickEventID         = enUIEventID.Ranking_ArenaAddFriend;
                    componetInChild.m_onClickEventParams.tag = (int)logicWorldID;
                    componetInChild.m_onClickEventParams.commonUInt64Param1 = fighterInfo.ullUid;
                }
                else
                {
                    COMDT_ACNT_UNIQ cOMDT_ACNT_UNIQ = (info != null) ? info.stUin : info2.stUin;
                    gameObject.CustomSetActive(false);
                    gameObject2.CustomSetActive(true);
                    bool flag3 = Singleton <CFriendContoller> .get_instance().model.HeartData.BCanSendHeart(cOMDT_ACNT_UNIQ);

                    CUICommonSystem.SetButtonEnableWithShader(gameObject2.GetComponent <Button>(), flag3, true);
                    if (flag3)
                    {
                        CUIEventScript component = gameObject2.GetComponent <CUIEventScript>();
                        if (flag)
                        {
                            component.m_onClickEventID = enUIEventID.Ranking_Friend_GAME_SendCoin;
                        }
                        else
                        {
                            component.m_onClickEventID = enUIEventID.Friend_SendCoin;
                        }
                        component.m_onClickEventParams.tag = srcWidgetIndexInBelongedList;
                        component.m_onClickEventParams.commonUInt64Param1 = cOMDT_ACNT_UNIQ.ullUid;
                        component.m_onClickEventParams.commonUInt64Param2 = (ulong)cOMDT_ACNT_UNIQ.dwLogicWorldId;
                    }
                }
            }
            else
            {
                gameObject.CustomSetActive(false);
                gameObject2.CustomSetActive(false);
            }
            CArenaSystem.Arena_RankElementEnable(uiEvent);
        }
Beispiel #13
0
        public static void ShowLBSUserData(CSDT_LBS_USER_INFO info, FriendShower com)
        {
            if (com == null)
            {
                return;
            }
            com.ullUid         = info.stLbsUserInfo.stUin.ullUid;
            com.dwLogicWorldID = info.stLbsUserInfo.stUin.dwLogicWorldId;
            if (info.stLbsUserInfo.szHeadUrl != null)
            {
                string url = UT.Bytes2String(info.stLbsUserInfo.szHeadUrl);
                com.HttpImage.SetImageUrl(Singleton <ApolloHelper> .GetInstance().ToSnsHeadUrl(url));
            }
            if (com.nobeIcon)
            {
                MonoSingleton <NobeSys> .GetInstance().SetNobeIcon(com.nobeIcon.GetComponent <Image>(), (int)info.stLbsUserInfo.stGameVip.dwCurLevel, false, false, info.stLbsUserInfo.ullUserPrivacyBits);
            }
            if (com.HeadIconBack)
            {
                MonoSingleton <NobeSys> .GetInstance().SetHeadIconBk(com.HeadIconBack.GetComponent <Image>(), (int)info.stLbsUserInfo.stGameVip.dwHeadIconId);

                MonoSingleton <NobeSys> .GetInstance().SetHeadIconBkEffect(com.HeadIconBack.GetComponent <Image>(), (int)info.stLbsUserInfo.stGameVip.dwHeadIconId, com.HttpImage.m_belongedFormScript, 1f, true);
            }
            if (com.QQVipImage)
            {
                MonoSingleton <NobeSys> .GetInstance().SetOtherQQVipHead(com.QQVipImage.GetComponent <Image>(), (int)info.stLbsUserInfo.dwQQVIPMask);
            }
            if (com.mentorLv_node)
            {
                com.mentorLv_node.CustomSetActive(false);
            }
            com.intimacyNode.CustomSetActive(false);
            com.SetFriendItemType(FriendShower.ItemType.LBS, true);
            com.ShowName(UT.Bytes2String(info.stLbsUserInfo.szUserName));
            com.ShowLevel(info.stLbsUserInfo.dwPvpLvl);
            com.ShowLastTime(true, UT.GetTimeString(info.stLbsUserInfo.dwLastLoginTime));
            com.ShowGenderType((COM_SNSGENDER)info.stLbsUserInfo.bGender);
            com.ShowDistance(UT.GetDistance(info.dwDistance));
            com.SetBGray(info.stLbsUserInfo.bIsOnline != 1);
            if (com.platChannelIcon != null)
            {
                com.platChannelIcon.CustomSetActive(false);
            }
            if (com.lbsAddFriendBtn != null)
            {
                CFriendModel model = Singleton <CFriendContoller> .instance.model;
                if (model.IsSnsFriend(com.ullUid, com.dwLogicWorldID) || model.IsGameFriend(com.ullUid, com.dwLogicWorldID))
                {
                    CUICommonSystem.SetButtonEnableWithShader(com.lbsAddFriendBtn, false, true);
                }
                else
                {
                    CUICommonSystem.SetButtonEnableWithShader(com.lbsAddFriendBtn, true, true);
                }
            }
            GameObject gameObject  = com.gameObject.transform.Find("body/LBS/Rank").gameObject;
            GameObject gameObject2 = com.gameObject.transform.Find("body/LBS/HisRank").gameObject;

            UT.ShowRank(com.formScript, gameObject, info.bGradeOfRank, info.stLbsUserInfo.dwRankClass);
            UT.ShowRank(com.formScript, gameObject2, info.bMaxGradeOfRank, info.stLbsUserInfo.dwRankClass);
        }
Beispiel #14
0
        public static void InitLadderEntry(CUIFormScript form, ref COMDT_RANKDETAIL data, bool isQualified)
        {
            Transform transform  = form.transform.Find("MainPanel/SingleStart");
            Transform transform2 = form.transform.Find("MainPanel/DoubleStart");
            Button    btn        = null;
            Button    component  = null;

            if (transform != null)
            {
                btn = transform.GetComponent <Button>();
            }
            if (transform2 != null)
            {
                component = transform2.GetComponent <Button>();
            }
            Transform transform3 = form.transform.Find("StatPanel/lblLeagueTime");

            if (isQualified)
            {
                form.transform.Find("StatPanel").gameObject.CustomSetActive(true);
                form.transform.Find("ReqPanel").gameObject.CustomSetActive(false);
                form.transform.Find("MainPanel/ImgLock").gameObject.CustomSetActive(false);
                form.transform.Find("MainPanel/RankCon").gameObject.CustomSetActive(true);
                GameObject gameObject = form.transform.Find("StatPanel/SeasonCon").gameObject;
                GameObject obj3       = form.transform.Find("StatPanel/lblNoRecord").gameObject;
                GameObject go         = form.transform.Find("MainPanel/RankCon").gameObject;
                Text       text       = form.transform.Find("StatPanel/SeasonCon/txtGameNum").GetComponent <Text>();
                Text       text2      = form.transform.Find("StatPanel/SeasonCon/txtWinNum").GetComponent <Text>();
                Text       text3      = form.transform.Find("StatPanel/SeasonCon/txtContiWinNum").GetComponent <Text>();
                Text       text4      = form.transform.Find("StatPanel/txtLeagueTime").GetComponent <Text>();
                Text       text5      = form.transform.Find("MainPanel/txtContiWin").GetComponent <Text>();
                if (data != null)
                {
                    if (gameObject != null)
                    {
                        gameObject.CustomSetActive(data.dwTotalFightCnt != 0);
                    }
                    if (obj3 != null)
                    {
                        obj3.CustomSetActive(data.dwTotalFightCnt == 0);
                    }
                    if (btn != null)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(btn, data.bState == 1, true);
                    }
                    if (component != null)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(component, data.bState == 1, true);
                    }
                    if (text != null)
                    {
                        text.text = data.dwTotalFightCnt.ToString();
                    }
                    if (text2 != null)
                    {
                        text2.text = data.dwTotalWinCnt.ToString();
                    }
                    if (text3 != null)
                    {
                        text3.text = data.dwMaxContinuousWinCnt.ToString();
                    }
                    if (text4 != null)
                    {
                        text4.text = GetSeasonText(ref data);
                    }
                    if (transform3 != null)
                    {
                        transform3.gameObject.CustomSetActive(true);
                    }
                    if (text5 != null)
                    {
                        if (data.dwContinuousWin >= 3)
                        {
                            text5.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("In_Continueos_Win"), data.dwContinuousWin);
                            text5.gameObject.CustomSetActive(true);
                        }
                        else
                        {
                            text5.gameObject.CustomSetActive(false);
                        }
                    }
                    ShowRankDetail(go, ref data, false);
                    int    num        = (data.bMaxSeasonGrade - 1) / 3;
                    string strContent = Singleton <CTextManager> .instance.GetText("Ladder_Award_Tips_" + num);

                    Image image = form.transform.Find("AwardGroup/award1").GetComponent <Image>();
                    image.SetSprite(CUIUtility.s_Sprite_System_Ladder_Dir + "award" + num, form, true, false, false);
                    CUICommonSystem.SetCommonTipsEvent(form, image.gameObject, strContent, enUseableTipsPos.enLeft);
                    form.transform.Find("AwardGroup").gameObject.CustomSetActive(true);
                }
                else
                {
                    if (btn != null)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(btn, false, true);
                    }
                    if (component != null)
                    {
                        CUICommonSystem.SetButtonEnableWithShader(component, false, true);
                    }
                    form.transform.Find("AwardGroup").gameObject.CustomSetActive(false);
                }
            }
            else
            {
                if (btn != null)
                {
                    CUICommonSystem.SetButtonEnableWithShader(btn, false, true);
                }
                if (component != null)
                {
                    CUICommonSystem.SetButtonEnableWithShader(component, false, true);
                }
                form.transform.Find("AwardGroup").gameObject.CustomSetActive(false);
                form.transform.Find("StatPanel").gameObject.CustomSetActive(false);
                form.transform.Find("ReqPanel").gameObject.CustomSetActive(true);
                form.transform.Find("MainPanel/ImgLock").gameObject.CustomSetActive(true);
                form.transform.Find("MainPanel/RankCon").gameObject.CustomSetActive(false);
                Text      text6          = form.transform.Find("ReqPanel/txtHeroNum").GetComponent <Text>();
                Text      text7          = form.transform.Find("ReqPanel/txtReqHeroNum").GetComponent <Text>();
                int       haveHeroCount  = 0;
                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                if (masterRoleInfo != null)
                {
                    haveHeroCount = masterRoleInfo.GetHaveHeroCount(false);
                }
                text6.text = string.Format("{0}/{1}", haveHeroCount, CLadderSystem.REQ_HERO_NUM);
                text7.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Ladder_Req_Hero_Num"), CLadderSystem.REQ_HERO_NUM.ToString());
                if (transform3 != null)
                {
                    transform3.gameObject.CustomSetActive(false);
                }
            }
        }