少年修仙传客户端代码仓库
hch
2019-10-31 3c35f85432d317061f09c93319108de899469d55
0312 升星自动购买拍卖行物品
7个文件已修改
5个文件已添加
262 ■■■■■ 已修改文件
Core/GameEngine/DataToCtl/PackageRegedit.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C6_tagCMEquipPartSuiteActivate.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HA3_Function/HA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HB5_Bourse/HB511_tagGCEquipStarAutoBuyCostInfo.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarMaterialSelectModel.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarMaterialSelectWin.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarModel.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarUpgradeSpecialMaterialBehaviour.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/EquipStar/EquipStarWin.cs 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/DataToCtl/PackageRegedit.cs
@@ -482,7 +482,8 @@
        Register(typeof(HAA24_tagMCDayFreeGoldGiftState), typeof(DTCAA24_tagMCDayFreeGoldGiftState));
        Register(typeof(HAB01_tagMCBossFirstKillStateInfo), typeof(DTCAB01_tagMCBossFirstKillStateInfo));
        Register(typeof(HB511_tagGCEquipStarAutoBuyCostInfo), typeof(DTCB511_tagGCEquipStarAutoBuyCostInfo));
        Register(typeof(HA3B2_tagMCEquipPartSuiteActivateInfo), typeof(DTCA3B2_tagMCEquipPartSuiteActivateInfo));
    }
    private static void Register(Type _pack, Type _business)
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C6_tagCMEquipPartSuiteActivate.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 76662598835d73647b019e70ca4e8e50
timeCreated: 1572440036
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6e4cb6575e29d1e4b877e1ca67eb7d0e
timeCreated: 1572440036
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs
@@ -1,11 +1,20 @@
using UnityEngine;
using System.Collections;
using System;
// B5 11 部位升星自动购买拍品消耗信息 #tagGCEquipStarAutoBuyCostInfo
public class DTCB511_tagGCEquipStarAutoBuyCostInfo : DtcBasic {
    public static event Action<HB511_tagGCEquipStarAutoBuyCostInfo> QueryAutoStarEvent;
    public override void Done(GameNetPackBasic vNetPack) {
        base.Done(vNetPack);
        HB511_tagGCEquipStarAutoBuyCostInfo vNetData = vNetPack as HB511_tagGCEquipStarAutoBuyCostInfo;
        HB511_tagGCEquipStarAutoBuyCostInfo vNetData = vNetPack as HB511_tagGCEquipStarAutoBuyCostInfo;
        if (QueryAutoStarEvent != null)
        {
            QueryAutoStarEvent(vNetData);
        }
    }
}
Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 04cded0fd423d854791ae7f63b28ef09
timeCreated: 1572440032
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/ServerPack/HA3_Function/HA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8f8027f87ffa59d4fbd6cddb5902f645
timeCreated: 1572440037
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Core/NetworkPackage/ServerPack/HB5_Bourse/HB511_tagGCEquipStarAutoBuyCostInfo.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6b62c697c78ceb04384025c9d1c6de13
timeCreated: 1572440036
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/EquipStar/EquipStarMaterialSelectModel.cs
@@ -86,7 +86,9 @@
            {
                rate += starModel.GetMaterialSuccessRate(equipPosition, material);
            }
            // 95%以上概率 则为100%
            if (rate >= 0.95 && rate < 1)
                rate = 1f;
            return rate;
        }
System/EquipStar/EquipStarMaterialSelectWin.cs
@@ -137,7 +137,8 @@
        private void DisplaySuccessRate()
        {
            var successRate = Mathf.RoundToInt(model.CalculateSuccessRate() * 100);
            int successRate = Mathf.RoundToInt(model.CalculateSuccessRate() * 100);
            m_SuccessRate.text = StringUtility.Contact("成功率:", successRate, "%");
            if (successRate < 50)
System/EquipStar/EquipStarModel.cs
@@ -20,6 +20,7 @@
        public readonly LogicList<string> normalMaterials = new LogicList<string>();
        public readonly LogicInt specialMaterial = new LogicInt();
        public readonly LogicInt starResultEffect = new LogicInt();
        public readonly LogicInt autoBuy = new LogicInt();
        Dictionary<int, EquipSetStar> equipStars = new Dictionary<int, EquipSetStar>();
        public Dictionary<int, EquipSetStar> EquipStars { get { return equipStars; } }
@@ -38,6 +39,8 @@
            logicUpdate.Start(OnUpdate);
            packModel.refreshItemCountEvent += OnItemCountRefresh;
            DTC0721_tagMakeItemAnswer.MakeItemAnswerEvent += OnGetUpgradeStarResult;
            autoBuy.value = -1;
        }
        public override void UnInit()
@@ -87,6 +90,8 @@
            redpointDirty = true;
        }
        void OnGetUpgradeStarResult(H0721_tagMakeItemAnswer info)
        {
            if (info.MakeType == (byte)MakeType.EquipStarUpgrade)
@@ -100,6 +105,7 @@
                    var successModel = ModelCenter.Instance.GetModel<EquipStarSuccessModel>();
                    successModel.Show(equipPosition, GetStarLevel(equipPosition));
                    starResultEffect.value = 1;
                }
                else
                {
@@ -109,7 +115,45 @@
            }
        }
        public void DoStarUpgrade(Int2 equipPosition, int starLevel)
        //查询自动购买状态
        public void QueryAutoBuy()
        {
            var placeValue = selectedPlace.value;
            if (placeValue == 0) return;
            var equipPosition = new Int2(selectedLevel.value, placeValue);
            var currentStarLevel = GetEquipStarLevel(equipPosition);
            if (starUpgradeProbability.value >= 100)
            {
                autoBuy.value = GetItemsMoney(equipPosition, currentStarLevel + 1);
                return;
            }
            DoStarUpgrade(equipPosition, currentStarLevel + 1, 2);
        }
        //装备已填充100%后,客户端自己计算升星石价格
        public int GetItemsMoney(Int2 equipPosition, int starLevel)
        {
            var config = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel);
            if (config == null)
            {
                return 0;
            }
            int itemID = config.CostItemDict.x;
            int count = config.CostItemDict.y;
            if (itemID <= 0 || count <= 0) return 0;
            var shopConfig = StoreConfig.GetStoreCfg(itemID, 2, 5);
            if (shopConfig == null) return 0;
            int hasCnt = packModel.GetItemCountByID(PackType.Item, config.CostItemDict.x);
            int needCnt = count >= hasCnt ? count - hasCnt : 0;
            return needCnt * shopConfig.MoneyNumber;
        }
        public void DoStarUpgrade(Int2 equipPosition, int starLevel, int auto=0)
        {
            if (!equipStars.ContainsKey(equipPosition.x))
            {
@@ -141,13 +185,13 @@
                return;
            }
            if (config.CostItemDict.x > 0 && specialMaterial.value == 0)
            if (config.CostItemDict.x > 0 && specialMaterial.value == 0 && auto == 0)
            {
                SysNotifyMgr.Instance.ShowTip("StarLevelUp2", config.CostItemDict.x);
                return;
            }
            if (config.CostItemDict.x > 0 && packModel.GetItemCountByID(PackType.Item, config.CostItemDict.x) < config.CostItemDict.y)
            if (config.CostItemDict.x > 0 && packModel.GetItemCountByID(PackType.Item, config.CostItemDict.x) < config.CostItemDict.y && auto == 0)
            {
                SysNotifyMgr.Instance.ShowTip("StarLevelUp2", config.CostItemDict.x);
                return;
@@ -173,10 +217,11 @@
                info.CostEquipIndex = materialIndexs.ToArray();
                info.CostEquipID = materialItemIds.ToArray();
                info.CostEquipCnt = (byte)materialIndexs.Count;
                info.AutoBuy = (byte)auto;
                GameNetSystem.Instance.SendInfo(info);
            };
            if (starUpgradeProbability.value < 50)
            if (starUpgradeProbability.value < 50 && auto == 0)
            {
                ConfirmCancel.ShowPopConfirm(
                    Language.Get("Mail101"),
@@ -192,6 +237,7 @@
        public void ResetOperateParams()
        {
            if (autoBuy.value == -2) autoBuy.value = -1;
            selectedLevel.value = 0;
            selectedPlace.value = 0;
            equipStarLevel.value = 0;
@@ -523,13 +569,18 @@
                        probability += GetMaterialSuccessRate(equipPosition, material);
                    }
                }
                starUpgradeProbability.value = Mathf.RoundToInt(probability * 100);
                // 95%以上概率 则为100%
                int value = Mathf.RoundToInt(probability * 100);
                if (value >= 95 && value < 100)
                    value = 100;
                starUpgradeProbability.value = value;
                starUpgradeProbability.dirty = true;
            }
            else
            {
                starUpgradeProbability.value = -1;
            }
        }
        public float GetMaterialSuccessRate(Int2 equipPosition, string guid)
System/EquipStar/EquipStarUpgradeSpecialMaterialBehaviour.cs
@@ -15,7 +15,6 @@
        [SerializeField] ItemBehaviour m_Item;
        [SerializeField] Text m_Count;
        [SerializeField] RectTransform m_Locked;
        [SerializeField] RectTransform m_MaterialTip;
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
@@ -35,7 +34,6 @@
        private void DisplayBaseInfo()
        {
            m_Locked.gameObject.SetActive(!isUnLocked);
            m_MaterialTip.gameObject.SetActive(isUnLocked);
            m_Empty.gameObject.SetActive(!isUnLocked);
            m_Item.gameObject.SetActive(isUnLocked);
            m_Count.gameObject.SetActive(isUnLocked);
System/EquipStar/EquipStarWin.cs
@@ -36,6 +36,12 @@
        [SerializeField] UIEffect m_EffectSuccess;
        [SerializeField] UIEffect m_EffectFailed;
        [SerializeField] ToggleButton m_Auto;
        [SerializeField] Text m_AutoMoney;
        [SerializeField] RectTransform m_AutoTextContainer;
        [SerializeField] Text m_UnAutoText;
        [SerializeField] RectTransform m_AutoContainer;
        List<EquipStarLevelSelectBehaviour> levelBehaviours = new List<EquipStarLevelSelectBehaviour>();
        EquipStarModel model { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
@@ -57,10 +63,39 @@
                var equipStarEffectTipModel = ModelCenter.Instance.GetModel<EquipStarEffectTipModel>();
                equipStarEffectTipModel.Preview(new Int2(model.selectedLevel.value, model.selectedPlace.value));
            });
            m_Auto.SetListener(ShowAuto);
        }
        protected override void OnPreOpen()
        private void ShowAuto()
        {
            m_Auto.isOn = !m_Auto.isOn;
            if (m_Auto.isOn)
            {
                model.QueryAutoBuy();
            }
            else
            {
                model.autoBuy.value = -1;
                model.CalculateStarUpgradeProbability(new Int2(model.selectedLevel.value, model.selectedPlace.value));
            }
        }
        public void ShowAutoText(int money)
        {
            //"8888自动提升至100%成功率(与全服拍卖同步)"
            //m_LevelLimit.colorType =
            var color = PlayerDatas.Instance.baseData.bindDiamond > money ? TextColType.Green : TextColType.Red;
            m_AutoMoney.text = Language.Get("StartUpAutoBuy", UIHelper.AppendColor(color, money.ToString(), true));
        }
    protected override void OnPreOpen()
        {
            DTCB511_tagGCEquipStarAutoBuyCostInfo.QueryAutoStarEvent += QueryAutoStarEvent;
            storeModel.RefreshBuyResultEvent += OnItemCountRefresh;
            if (model.selectedLevel.value == 0)
            {
@@ -78,6 +113,7 @@
        protected override void OnPreClose()
        {
            storeModel.RefreshBuyResultEvent -= OnItemCountRefresh;
            DTCB511_tagGCEquipStarAutoBuyCostInfo.QueryAutoStarEvent -= QueryAutoStarEvent;
        }
@@ -100,6 +136,19 @@
        #endregion
        void QueryAutoStarEvent(HB511_tagGCEquipStarAutoBuyCostInfo pack)
        {
            if (pack.ClassLV != model.selectedLevel.value) return;
            if (pack.EquipPlace != model.selectedPlace.value) return;
            var equipPosition = new Int2(model.selectedLevel.value, model.selectedPlace.value);
            var currentStarLevel = model.GetEquipStarLevel(equipPosition);
            if (pack.CurStar != currentStarLevel) return;
            model.autoBuy.value = pack.CurRate >= 100 ? pack.AutoBuyCostMoney : -2;
            model.autoBuy.dirty = true;
            //model.starUpgradeProbability.value = pack.CurRate;
        }
        private void OnItemCountRefresh(int index)
        {
            var equipPosition = new Int2(model.selectedLevel.value, model.selectedPlace.value);
@@ -114,6 +163,8 @@
        {
            CreateLevelBehaviours();
        }
        private void DisplayDynamicInfo(bool force)
        {
@@ -178,6 +229,16 @@
            if (force || model.starUpgradeProbability.dirty)
            {
                DisplaySuccessRate(model.starUpgradeProbability.Fetch());
                if (model.autoBuy.value != -1)
                {
                    if (model.equipMaxStarLevel.value != model.equipStarLevel.value)
                        model.QueryAutoBuy();
                }
                m_AutoContainer.gameObject.SetActive(true);
                if (model.equipMaxStarLevel.value == model.equipStarLevel.value)
                {
                    m_AutoContainer.gameObject.SetActive(false);
                }
            }
            if (force || model.starResultEffect.dirty)
@@ -193,6 +254,47 @@
                var currentStarLevel = model.GetEquipStarLevel(equipPosition);
                model.normalMaterials.Fetch();
                DisplayMaterialSlots(equipPosition, currentStarLevel);
            }
            if (force || model.autoBuy.dirty)
            {
                if (model.equipMaxStarLevel.value == model.equipStarLevel.value)
                {
                    m_AutoTextContainer.gameObject.SetActive(false);
                    m_UnAutoText.gameObject.SetActive(false);
                }
                else
                {
                    var value = model.autoBuy.Fetch();
                    if (value == -1)
                    {
                        //不勾选自动购买
                        m_Auto.isOn = false;
                        m_AutoTextContainer.gameObject.SetActive(false);
                        m_UnAutoText.gameObject.SetActive(true);
                        m_UnAutoText.text = Language.Get("StarAutoBuy1");
                    }
                    else if (value == -2)
                    {
                        //勾选自动购买 但拍卖行装备不足
                        m_Auto.isOn = true;
                        m_AutoTextContainer.gameObject.SetActive(false);
                        m_UnAutoText.gameObject.SetActive(true);
                        m_UnAutoText.text = Language.Get("StarAutoBuy2");
                        DisplaySuccessRate(100);
                    }
                    else
                    {
                        m_Auto.isOn = true;
                        m_AutoTextContainer.gameObject.SetActive(true);
                        m_UnAutoText.gameObject.SetActive(false);
                        ShowAutoText(value);
                        DisplaySuccessRate(100);
                    }
                }
            }
        }
@@ -366,6 +468,8 @@
        private void DisplaySuccessRate(int successRate)
        {
            if (model.autoBuy.value != -1) successRate = 100;   //有勾选即100%
            if (successRate >= 0)
            {
                m_SuccessRate.text = string.Format("成功率 {0}%", successRate);
@@ -409,7 +513,15 @@
        {
            var equipPosition = new Int2(model.selectedLevel.value, model.selectedPlace.value);
            var currentStarLevel = model.GetEquipStarLevel(equipPosition);
            model.DoStarUpgrade(equipPosition, currentStarLevel + 1);
            if (model.autoBuy.value == -2)
            {
                //库存不足
                SysNotifyMgr.Instance.ShowTip("AuctionNoEquip");
                return;
            }
            var auto = model.autoBuy.value > 0 ? 1 : 0;
            model.DoStarUpgrade(equipPosition, currentStarLevel + 1, auto);
        }
        private void CreateLevelBehaviours()