浏览代码

词牌增加进度条

huangxiaoyue 1 年之前
父节点
当前提交
a68b919523

+ 98 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Card/UI_CardUpLevelUI.cs

@@ -0,0 +1,98 @@
+/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
+
+using FairyGUI;
+
+namespace UI.Card
+{
+    public partial class UI_CardUpLevelUI
+    {
+        public GComponent target;
+        public GGraph m_holderLeftTop;
+        public GGraph m_holderRightDowm;
+        public GList m_list;
+        public GButton m_btnUse;
+        public GTextField m_txtChooseLevel;
+        public GButton m_btnAdd;
+        public GButton m_btnReduce;
+        public GSlider m_slideUpLevel;
+        public GLoader m_loaCost;
+        public GTextField m_txtCost;
+        public const string URL = "ui://7l6lvkaykm99tm5";
+        public const string PACKAGE_NAME = "Card";
+        public const string RES_NAME = "CardUpLevelUI";
+        private static UI_CardUpLevelUI _proxy;
+
+        public static UI_CardUpLevelUI Create(GObject gObject = null)
+        {
+            var ui = new UI_CardUpLevelUI();
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static UI_CardUpLevelUI Proxy(GObject gObject = null)
+        {
+            if(_proxy == null)
+            {
+                _proxy = new UI_CardUpLevelUI();
+            }
+            var ui = _proxy;
+            if(gObject == null)
+            	ui.target =  (GComponent)UIPackage.CreateObject(PACKAGE_NAME, RES_NAME);
+            else
+            	ui.target =  (GComponent)gObject;
+            ui.Init(ui.target);
+            return ui;
+        }
+
+        public static void ProxyEnd()
+        {
+            if (_proxy != null)
+            {
+                _proxy.Dispose();
+            }
+        }
+
+        public static void ClearProxy()
+        {
+            ProxyEnd();
+            _proxy = null;
+        }
+
+        private void Init(GComponent comp)
+        {
+            m_holderLeftTop = (GGraph)comp.GetChild("holderLeftTop");
+            m_holderRightDowm = (GGraph)comp.GetChild("holderRightDowm");
+            m_list = (GList)comp.GetChild("list");
+            m_btnUse = (GButton)comp.GetChild("btnUse");
+            m_txtChooseLevel = (GTextField)comp.GetChild("txtChooseLevel");
+            m_btnAdd = (GButton)comp.GetChild("btnAdd");
+            m_btnReduce = (GButton)comp.GetChild("btnReduce");
+            m_slideUpLevel = (GSlider)comp.GetChild("slideUpLevel");
+            m_loaCost = (GLoader)comp.GetChild("loaCost");
+            m_txtCost = (GTextField)comp.GetChild("txtCost");
+        }
+        public void Dispose(bool disposeTarget = false)
+        {
+            m_holderLeftTop = null;
+            m_holderRightDowm = null;
+            m_list = null;
+            m_btnUse = null;
+            m_txtChooseLevel = null;
+            m_btnAdd = null;
+            m_btnReduce = null;
+            m_slideUpLevel = null;
+            m_loaCost = null;
+            m_txtCost = null;
+            if(disposeTarget && target != null)
+            {
+                target.RemoveFromParent();
+                target.Dispose();
+            }
+            target = null;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Card/UI_CardUpLevelUI.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0a32c659aae0ade4b9f3e8d59f7a6239
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 22 - 18
GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs

@@ -403,10 +403,11 @@ namespace GFGGame
         /***********************************************************升级***************************************************/
         /***********************************************************升级***************************************************/
         private void UpdateUpLvView(bool isPreview = false, int lv = 0, int exp = 0, bool effLight = false)
         private void UpdateUpLvView(bool isPreview = false, int lv = 0, int exp = 0, bool effLight = false)
         {
         {
-
             _showLv = isPreview == true ? lv : _cardData.lv;
             _showLv = isPreview == true ? lv : _cardData.lv;
             _showExp = isPreview == true ? exp : _cardData.exp;
             _showExp = isPreview == true ? exp : _cardData.exp;
 
 
+            ET.Log.Debug("打印测试========UpdateUpLvView========"+ _showExp);
+
             CardLvlCfg cardLvCfg = CardLvlCfgArray.Instance.GetCfgByrarityAndcardLvl(_cardData.itemCfg.rarity, _showLv);
             CardLvlCfg cardLvCfg = CardLvlCfgArray.Instance.GetCfgByrarityAndcardLvl(_cardData.itemCfg.rarity, _showLv);
             if (cardLvCfg == null)
             if (cardLvCfg == null)
             {
             {
@@ -600,12 +601,10 @@ namespace GFGGame
 
 
             for (int i = 0; i < itemsCount.Count; i++)
             for (int i = 0; i < itemsCount.Count; i++)
             {
             {
-
                 if (itemsCount[i] == 0) continue;
                 if (itemsCount[i] == 0) continue;
                 ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(upgradeCardItemsArr[i]);
                 ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(upgradeCardItemsArr[i]);
                 count += itemCfg.cardUpLvGoldsArr[_cardData.itemCfg.rarity - 1][1] * itemsCount[i];
                 count += itemCfg.cardUpLvGoldsArr[_cardData.itemCfg.rarity - 1][1] * itemsCount[i];
                 hasExp += itemCfg.cardUpLvExp * itemsCount[i];
                 hasExp += itemCfg.cardUpLvExp * itemsCount[i];
-
             }
             }
             _comLvConsumeGold = UI_ComCost.Proxy(_comFosterBottom.m_ComLvConsumeGold);
             _comLvConsumeGold = UI_ComCost.Proxy(_comFosterBottom.m_ComLvConsumeGold);
             _comLvConsumeGold.m_txtNeed.text = count.ToString();
             _comLvConsumeGold.m_txtNeed.text = count.ToString();
@@ -614,25 +613,30 @@ namespace GFGGame
             int previewLv = 0;
             int previewLv = 0;
             int previewExp = 0;
             int previewExp = 0;
             CardDataManager.GetPreViewLvAndExp(_cardData.id, _cardData.lv, _cardData.exp, hasExp, out previewLv, out previewExp);
             CardDataManager.GetPreViewLvAndExp(_cardData.id, _cardData.lv, _cardData.exp, hasExp, out previewLv, out previewExp);
+            ET.Log.Debug("打印测试========previewLv========" + previewLv);
+            ET.Log.Debug("打印测试========previewExp========" + previewExp);
+
             this.UpdateUpLvView(true, previewLv, previewExp);
             this.UpdateUpLvView(true, previewLv, previewExp);
         }
         }
+
         private void OnClcikBtnAll()
         private void OnClcikBtnAll()
         {
         {
-            int cardUpLvGoldsNeed = 0;
-            for (int i = 0; i < itemsCount.Count; i++)
-            {
-                int[] cardUpLvGolds = ItemCfgArray.Instance.GetCfg(upgradeCardItemsArr[i]).cardUpLvGoldsArr[_cardData.itemCfg.rarity - 1];
-                long itemNum = ItemDataManager.GetItemNum(upgradeCardItemsArr[i]);
-                for (long j = 0; j < itemNum; j++)
-                {
-
-                    if (ItemDataManager.GetItemNum(cardUpLvGolds[0]) < cardUpLvGoldsNeed + cardUpLvGolds[1] || this.OnClickBtnPlusLvConsume(_comFosterBottom.m_listLvConsume.GetChildAt(i), false) == false)
-                    {
-                        break;
-                    }
-                    cardUpLvGoldsNeed += cardUpLvGolds[1];
-                }
-            }
+            ViewManager.Show<CardUpLevelView>(_cardData);
+            //int cardUpLvGoldsNeed = 0;
+            //for (int i = 0; i < itemsCount.Count; i++)
+            //{
+            //    int[] cardUpLvGolds = ItemCfgArray.Instance.GetCfg(upgradeCardItemsArr[i]).cardUpLvGoldsArr[_cardData.itemCfg.rarity - 1];
+            //    long itemNum = ItemDataManager.GetItemNum(upgradeCardItemsArr[i]);
+            //    for (long j = 0; j < itemNum; j++)
+            //    {
+
+            //        if (ItemDataManager.GetItemNum(cardUpLvGolds[0]) < cardUpLvGoldsNeed + cardUpLvGolds[1] || this.OnClickBtnPlusLvConsume(_comFosterBottom.m_listLvConsume.GetChildAt(i), false) == false)
+            //        {
+            //            break;
+            //        }
+            //        cardUpLvGoldsNeed += cardUpLvGolds[1];
+            //    }
+            //}
         }
         }
         private void OnClcikBtnClearAll()
         private void OnClcikBtnClearAll()
         {
         {

+ 195 - 0
GameClient/Assets/Game/HotUpdate/Views/Card/CardUpLevelView.cs

@@ -0,0 +1,195 @@
+using FairyGUI;
+using UI.Card;
+using System.Collections;
+using UnityEngine;
+using System;
+using System.Collections.Generic;
+using UI.CommonGame;
+using ET;
+
+namespace GFGGame
+{
+    public class CardUpLevelView : BaseWindow
+    {
+        private UI_CardUpLevelUI _ui;
+        private EffectUI _effectUI1;
+        private EffectUI _effectUI2;
+        private int[] upgradeCardItemsArr = GlobalCfgArray.globalCfg.upgradeCardItemsArr;
+        private CardData _cardData;
+        private List<int> itemsCount;
+        private int _countCanUpMaxLevel = 0;
+        private int _nowCountCanUpLevel = 0;
+        private long _goldsHasNum = 0;
+        private int _cumulativeGold = 0;
+
+        public override void Dispose()
+        {
+            EffectUIPool.Recycle(_effectUI1);
+            _effectUI1 = null;
+            EffectUIPool.Recycle(_effectUI2);
+            _effectUI2 = null;
+
+            if (_ui != null)
+            {
+                _ui.Dispose();
+                _ui = null;
+            }
+            base.Dispose();
+        }
+
+        protected override void OnInit()
+        {
+            base.OnInit();
+            _ui = UI_CardUpLevelUI.Create();
+            this.viewCom = _ui.target;
+            this.viewCom.Center();
+            this.modal = true;
+            viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
+
+            _ui.m_btnUse.onClick.Add(OnClickBtnUse);
+            _ui.m_btnReduce.onClick.Add(OnClickBtnReduce);
+            _ui.m_btnAdd.onClick.Add(OnClickBtnAdd);
+            _ui.m_list.itemRenderer = RenderListItem;
+            _ui.m_slideUpLevel.onChanged.Add(OnChangeUpLevel);
+
+        }
+
+        private void OnChangeUpLevel()
+        {
+            float volumn = (float)_ui.m_slideUpLevel.value / 100;
+            //UI_UpLevelSlide slider1 = UI_UpLevelSlide.Proxy(_ui.m_slideUpLevel);
+            //slider1.m_progressBar.fillAmount = volumn;
+            ////tidyData(_nowCountCanUpLevel);
+            ////ReferViewInfo();
+            //UI_UpLevelSlide.ProxyEnd();
+        }
+
+        protected override void OnShown()
+        {
+            base.OnShown();
+            _cardData = (CardData)this.viewData;
+            AddEffect();
+            ClearItemsCountList();
+            
+            int cfgMaxLevel = CardLvlCfgArray.Instance.GetCfgsByrarity(_cardData.itemCfg.rarity).Count - 1;
+            tidyData(cfgMaxLevel);
+            _countCanUpMaxLevel = _nowCountCanUpLevel;
+            tidyData(_cardData.lv);
+            ReferViewInfo();
+        }
+
+        private void tidyData(int setLevel)
+        {
+            _nowCountCanUpLevel = 0;
+            _goldsHasNum = 0;
+            _cumulativeGold = 0;
+            int CumulativeExp = 0;
+            int needExp = CardLvlCfgArray.Instance.GetCfgByrarityAndcardLvl(_cardData.itemCfg.rarity, setLevel).needExp;  //需要升级到的经验值
+            needExp = needExp - _cardData.exp;  //缺的经验值
+        
+            //先计算出可以升满的最高级别
+            for (int i = 0; i < upgradeCardItemsArr.Length; i++)
+            {
+                int itemId = upgradeCardItemsArr[i];
+                ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemId);
+                int num = 0;
+                if(setLevel> _cardData.lv)
+                    num = (int)Math.Ceiling((needExp - CumulativeExp) / (decimal)itemCfg.cardUpLvExp); //需要购买的数量
+                long itemNum = Math.Min(num, ItemDataManager.GetItemNum(itemId)); //物品可购买数量
+                int[] cardUpLvGolds = ItemCfgArray.Instance.GetCfg(upgradeCardItemsArr[i]).cardUpLvGoldsArr[_cardData.itemCfg.rarity - 1];
+                _goldsHasNum = ItemDataManager.GetItemNum(cardUpLvGolds[0]);
+                int goldNum = (int)Math.Floor((_goldsHasNum - _cumulativeGold) / (decimal)cardUpLvGolds[1]);//货币可购买数量
+                int sumNum = (int)Math.Min(goldNum, itemNum);
+                itemsCount[i] = sumNum;
+                CumulativeExp = CumulativeExp + (sumNum * itemCfg.cardUpLvExp);
+                _cumulativeGold = _cumulativeGold + (sumNum * cardUpLvGolds[1]);
+            }
+
+            _nowCountCanUpLevel = _cardData.lv;
+            for (int i = _cardData.lv; i < setLevel; i++)
+            {
+                int needLevelExp = CardLvlCfgArray.Instance.GetCfgByrarityAndcardLvl(_cardData.itemCfg.rarity, i).needExp;
+                if (_cardData.exp + CumulativeExp >= needLevelExp)
+                    _nowCountCanUpLevel += 1;
+                else
+                    break;
+            }
+        }
+
+        //清理itemsCount
+        private void ClearItemsCountList()
+        {
+            if (itemsCount == null)
+            {
+                itemsCount = new List<int>();
+            }
+            itemsCount.Clear();
+            for (int i = 0; i < upgradeCardItemsArr.Length; i++)
+            {
+                itemsCount.Add(0);
+            }
+        }
+
+        protected override void OnHide()
+        {
+            base.OnHide();
+        }
+
+        private void AddEffect()
+        {
+            //邊框左上角特效
+            _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderLeftTop, "ui_Activity", "Com_window_L_up");
+            //邊框右下角特效
+            _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderRightDowm, "ui_Activity", "Com_window_R_Down");
+        }
+
+        private void RenderListItem(int index, GObject obj)
+        {
+            UI_ComItem listItem = UI_ComItem.Proxy(obj);
+            CardLvlCfg cardLvCfg = CardLvlCfgArray.Instance.GetCfgByrarityAndcardLvl(_cardData.itemCfg.rarity, _cardData.lv);
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(upgradeCardItemsArr[index]);
+            listItem.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
+            listItem.m_CountType.selectedIndex = 1;
+            listItem.m_txtDecomCount.text = itemsCount[index].ToString();
+            listItem.m_txtDecomHasCount.text = "/" + ItemDataManager.GetItemNum(itemCfg.id).ToString();
+            UI_ComItem.ProxyEnd();
+        }
+
+        private void ReferViewInfo()
+        {
+            _ui.m_txtChooseLevel.SetVar("value1", _nowCountCanUpLevel.ToString()).FlushVars();
+            _ui.m_txtChooseLevel.SetVar("value2", _countCanUpMaxLevel.ToString()).FlushVars();
+            _ui.m_txtCost.SetVar("value1", _cumulativeGold.ToString()).FlushVars();
+            _ui.m_txtCost.SetVar("value2", _goldsHasNum.ToString()).FlushVars();
+            _ui.m_list.numItems = upgradeCardItemsArr.Length;
+        }
+
+        private async void OnClickBtnUse()
+        {
+            bool result = await CardSProxy.UpgradeCardLvl(_cardData.id, itemsCount);
+            if (result)
+            {
+                this.Hide();
+                LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CI_PAI, 2);
+            }
+        }
+
+        private void OnClickBtnReduce()
+        {
+            _nowCountCanUpLevel -= 1;
+            if (_nowCountCanUpLevel < _cardData.lv)
+                _nowCountCanUpLevel = _cardData.lv;
+            tidyData(_nowCountCanUpLevel);
+            ReferViewInfo();
+        }
+
+        private void OnClickBtnAdd()
+        {
+            _nowCountCanUpLevel += 1;
+            if (_nowCountCanUpLevel > _countCanUpMaxLevel)
+                _nowCountCanUpLevel = _countCanUpMaxLevel;
+            tidyData(_nowCountCanUpLevel);
+            ReferViewInfo();
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Views/Card/CardUpLevelView.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7beed9da3529de54c816fc70819f8ca9
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 10 - 4
GameClient/Assets/Game/HotUpdate/Views/OpenServerActivity/OpenServerStoryView.cs

@@ -93,15 +93,15 @@ namespace GFGGame
                 item.m_rewardItem.target.onClick.Add(OnClickIcon);
                 item.m_rewardItem.target.onClick.Add(OnClickIcon);
 
 
             item.m_rewardItem.target.data = itemCfg.id;
             item.m_rewardItem.target.data = itemCfg.id;
-
-            if (index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1][0].id))
+            if (index > 0 && (!InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1][0].id) || !ItemDataManager.ItemCollect.ContainsKey(activityStoryCfg.needItemsArr[0][0]) || ItemDataManager.ItemCollect[activityStoryCfg.needItemsArr[0][0]] < activityStoryCfg.needItemsArr[0][1])){
                 item.m_storyImageType.selectedIndex = 0;
                 item.m_storyImageType.selectedIndex = 0;
+            }
             else
             else
                 item.m_storyImageType.selectedIndex = index+1;
                 item.m_storyImageType.selectedIndex = index+1;
 
 
-
             if (activityStoryCfg.needItemsArr.Length > 0) { 
             if (activityStoryCfg.needItemsArr.Length > 0) { 
-                item.m_txtNotOpenTitle.text = string.Format("收集{0}/{1}个", ItemDataManager.GetItemNum(activityStoryCfg.needItemsArr[0][0]), activityStoryCfg.needItemsArr[0][1]);
+
+                item.m_txtNotOpenTitle.text = string.Format("收集{0}/{1}个", ItemDataManager.ItemCollect[activityStoryCfg.needItemsArr[0][0]], activityStoryCfg.needItemsArr[0][1]);
                 ItemCfg itemNeedCfg = ItemCfgArray.Instance.GetCfg(activityStoryCfg.needItemsArr[0][0]);
                 ItemCfg itemNeedCfg = ItemCfgArray.Instance.GetCfg(activityStoryCfg.needItemsArr[0][0]);
                 item.m_loaNeedIcon.url = ResPathUtil.GetIconPath(itemNeedCfg);
                 item.m_loaNeedIcon.url = ResPathUtil.GetIconPath(itemNeedCfg);
             }
             }
@@ -123,12 +123,18 @@ namespace GFGGame
         {
         {
             GObject obj = context.sender as GObject;
             GObject obj = context.sender as GObject;
             int index = (int)obj.data;
             int index = (int)obj.data;
+            ActivityStoryCfg activityStoryCfg = ActivityStoryCfgArray.Instance.GetCfg(_activityCfg.params4Arr[index]);
             StoryLevelCfg storyLevelCfg = _storyLevelCfgs[index][0];
             StoryLevelCfg storyLevelCfg = _storyLevelCfgs[index][0];
             if (index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1][0].id))
             if (index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1][0].id))
             {
             {
                 PromptController.Instance.ShowFloatTextPrompt("需通关前置关卡");
                 PromptController.Instance.ShowFloatTextPrompt("需通关前置关卡");
                 return;
                 return;
             }
             }
+            if(index > 0 && ItemDataManager.ItemCollect[activityStoryCfg.needItemsArr[0][0]] < activityStoryCfg.needItemsArr[0][1])
+            {
+                PromptController.Instance.ShowFloatTextPrompt("需收集物达到开启需求");
+                return;
+            }
 
 
             MainStoryDataManager.currentLevelCfgId = storyLevelCfg.id;
             MainStoryDataManager.currentLevelCfgId = storyLevelCfg.id;
             InstanceZonesController.ShowLevelView(storyLevelCfg.id, StudioDataManager.Instance.OnFinishStudioStoryLevel);
             InstanceZonesController.ShowLevelView(storyLevelCfg.id, StudioDataManager.Instance.OnFinishStudioStoryLevel);

+ 0 - 1
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/SettingView.cs

@@ -141,7 +141,6 @@ namespace GFGGame
         private void OnChangeVoiceVolumn()
         private void OnChangeVoiceVolumn()
         {
         {
             float volumn = (float)_ui.m_voiceSlider.target.value / 100;
             float volumn = (float)_ui.m_voiceSlider.target.value / 100;
-
             UI_Slider2 slider1 = UI_Slider2.Proxy(_ui.m_voiceSlider.target);
             UI_Slider2 slider1 = UI_Slider2.Proxy(_ui.m_voiceSlider.target);
             slider1.m_progressBar.fillAmount = volumn;
             slider1.m_progressBar.fillAmount = volumn;
             UI_Slider2.ProxyEnd();
             UI_Slider2.ProxyEnd();

二进制
GameClient/Assets/ResIn/UI/Card/Card_atlas0!a.png


二进制
GameClient/Assets/ResIn/UI/Card/Card_atlas0.png


二进制
GameClient/Assets/ResIn/UI/Card/Card_atlas0_1!a.png


二进制
GameClient/Assets/ResIn/UI/Card/Card_atlas0_1.png


二进制
GameClient/Assets/ResIn/UI/Card/Card_fui.bytes


二进制
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_atlas0!a.png


二进制
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_atlas0.png


二进制
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_atlas0_1!a.png


二进制
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_atlas0_1.png


二进制
GameClient/Assets/ResIn/UI/CommonGame/CommonGame_fui.bytes


二进制
GameClient/Assets/ResIn/UI/Store/Store_fui.bytes