Exemple #1
0
        public void Init(TreasureChestsType chestsType, SingleRewardPanel_V4 myParent, bool isHero)
        {
            SMSGEctypeInitialize_SC sMSGEctypeInitialize_SC = (SMSGEctypeInitialize_SC)GameDataManager.Instance.PeekData(DataType.InitializeEctype);

            EctypeData   = EctypeConfigManager.Instance.EctypeContainerConfigList [sMSGEctypeInitialize_SC.dwEctypeContainerId];
            IsHero       = isHero;
            MyParent     = myParent;
            MyChestsType = chestsType;
            string costFormat = LanguageTextManager.GetString("IDS_I4_21");
            string costText   = string.Format(costFormat, EctypeData.ByCost.ToString());
            bool   canPay     = false;

            switch (EctypeData.ByCostType)
            {
            case 0:    //元宝
                int PayGoldMoney = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY;
                canPay = PayGoldMoney >= EctypeData.ByCost;
                break;

            case 1:    //铜币
                int PayCopperMoney = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HOLDMONEY;
                canPay = PayCopperMoney >= EctypeData.ByCost;
                break;
            }


            switch (chestsType)
            {
            case TreasureChestsType.Normal:
                CreatTreasureChestEffectPoint.ClearChild();
                //CreatTreasureChestEffectPoint.InstantiateNGUIObj(NormalBoxEffect);
                CostLabel.gameObject.SetActive(false);
                break;

            case TreasureChestsType.CostMoney:
                CostLabel.gameObject.SetActive(isHero);
                CostLabel.spriteSwith.ChangeSprite(2 - EctypeData.ByCostType);
                //CreatTreasureChestEffectPoint.InstantiateNGUIObj(NormalBoxEffect);
                CostLabel.SetButtonText(costText);
                if (canPay)
                {
                    CostLabel.SetTextColor(Color.white);
                }
                else
                {
                    CostLabel.SetTextColor(Color.red);
                }

                break;

            case TreasureChestsType.VIP:
                CreatTreasureChestEffectPoint.ClearChild();
                if (isHero && PlayerDataManager.Instance.GetPlayerVIPLevel() < 5)
                {
                    VIPBoxEffect.SetActive(true);
                }
                else
                {
                    VIPBoxEffect.SetActive(false);
                }
//					if(isHero && PlayerDataManager.Instance.GetMainEctypeRewardTimes() < 5)
//                    {
//                        //vipLabel.SetText(string.Format(LanguageTextManager.GetString("IDS_I21_2"), PlayerDataManager.Instance.GetMainEctypeVIPRewardMinLevel()));
//                    }
//					else
//					{
//						VIPBoxEffect.SetActive(false);
//						//CreatTreasureChestEffectPoint.InstantiateNGUIObj(NormalBoxEffect);
//					}
                CostLabel.gameObject.SetActive(isHero);
                CostLabel.spriteSwith.ChangeSprite(2 - EctypeData.ByCostType);
                CostLabel.SetButtonText(costText);
                if (canPay)
                {
                    CostLabel.SetTextColor(Color.white);
                }
                else
                {
                    CostLabel.SetTextColor(Color.red);
                }
                break;
            }
        }
Exemple #2
0
 void GrayButton(SingleButtonCallBack button)
 {
     button.SetImageButtonComponentActive(false);
     button.SetTextColor(Color.gray);
     button.SetButtonBackground(2);
 }
Exemple #3
0
 void RecoverButton(SingleButtonCallBack button)
 {
     button.SetImageButtonComponentActive(true);
     button.SetTextColor(Color.white);
     button.SetButtonBackground(1);
 }
Exemple #4
0
        public void ShowMyself(HeroResurrectionPanel_V2 heroResurrectionPanel_V2)
        {
            SoundManager.Instance.PlaySoundEffect("Sound_Voice_Resurge");
            MyParent = heroResurrectionPanel_V2;
            transform.localPosition = new Vector3(0, 0, -200);


            m_maxReliveTime = EctypeManager.Instance.GetCurrentEctypeData().ReviveTime;
            //显示逻辑
            switch (EctypeManager.Instance.GetCurrentEctypeData().ReviveType)
            {
            case 0:
                PassiveResurrect.SetActive(false);
                InitiativeResurrect.SetActive(false);
                return;

            case 1:
                PassiveResurrect.SetActive(false);
                InitiativeResurrect.SetActive(true);
                break;

            case 2:
                PassiveResurrect.SetActive(true);
                InitiativeResurrect.SetActive(false);
                break;
            }

            int vipLevel  = PlayerManager.Instance.FindHeroDataModel().GetCommonValue().PLAYER_FIELD_VISIBLE_VIP;
            var reviveNum = EctypeManager.Instance.GetCurrentEctypeData().ReviveNums.SingleOrDefault(p => p.VipLevel == vipLevel);

            int reliveTime = EctypeManager.Instance.GetEctypeProps().dwReliveTimes + 1;
            int time       = reviveNum.Num - reliveTime;

            if (reviveNum.Num == -1)
            {
                Label_SurplusResurrect_Tip.text = LanguageTextManager.GetString("IDS_I11_7");
                Label_SurplusResurrectTime.text = "";
            }
            else
            {
                Label_SurplusResurrect_Tip.text = LanguageTextManager.GetString("IDS_I11_3");
                Label_SurplusResurrectTime.text = time.ToString();

                if (time <= 0)
                {
                    m_isNotTimeResurrect            = true;
                    Label_SurplusResurrect_Tip.text = LanguageTextManager.GetString("IDS_I11_8");
                    Label_SurplusResurrectTime.text = "";

                    QuarterHealthResurgenceBtn.SetButtonColliderActive(false);
                    FullHealthResurgenceBtn.SetButtonColliderActive(false);
                }
            }


            //price
            var simplePrice = EctypeManager.Instance.GetCurrentEctypeData().SimpleRevivePrice;

            //计算当前应支付的铜币(元宝) = (向下取整((参数1×〖复活次数〗^2+参数2×复活次数+参数3)/参数4)×参数4)
            m_NormalHealthPay = (int)((simplePrice.Parma1 * reliveTime * reliveTime + simplePrice.Parma2 * reliveTime + simplePrice.Parma3) / simplePrice.Parma4) * simplePrice.Parma4;
            if (simplePrice.GoodsID == 3050001)           //3050001 铜币
            {
                Swith_NormalPay.ChangeSprite(1);
                m_isNotEnoughtNormal = m_NormalHealthPay > PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HOLDMONEY;
            }
            else
            {
                Swith_NormalPay.ChangeSprite(2);
                m_isNotEnoughtNormal = m_NormalHealthPay > PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY;
            }

            var pefectPrice = EctypeManager.Instance.GetCurrentEctypeData().PefectRevivePrice;

            //计算当前应支付的铜币(元宝) = (向下取整((参数1×〖复活次数〗^2+参数2×复活次数+参数3)/参数4)×参数4)
            m_FullHealthPay = (int)((pefectPrice.Parma1 * reliveTime * reliveTime + pefectPrice.Parma2 * reliveTime + pefectPrice.Parma3) / pefectPrice.Parma4) * pefectPrice.Parma4;
            if (pefectPrice.GoodsID == 3050001)           //3050001 铜币
            {
                Swith_FullPay.ChangeSprite(1);
                m_isNotEnoughtPerfect = m_FullHealthPay > PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HOLDMONEY;
            }
            else
            {
                Swith_FullPay.ChangeSprite(2);
                m_isNotEnoughtPerfect = m_FullHealthPay > PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY;
            }

            if (m_isNotEnoughtNormal)
            {
                QuarterHealthResurgenceBtn.SetTextColor(Color.red);
            }
            else
            {
                QuarterHealthResurgenceBtn.SetTextColor(Color.white);
            }
            if (m_isNotEnoughtPerfect)
            {
                FullHealthResurgenceBtn.SetTextColor(Color.red);
            }
            else
            {
                FullHealthResurgenceBtn.SetTextColor(Color.white);
            }

            FullHealthResurgenceBtn.SetButtonText("x" + m_FullHealthPay.ToString());
            QuarterHealthResurgenceBtn.SetButtonText("x" + m_NormalHealthPay.ToString());
        }