From 3c35f85432d317061f09c93319108de899469d55 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 31 十月 2019 02:55:34 +0800
Subject: [PATCH] 0312 升星自动购买拍卖行物品
---
System/EquipStar/EquipStarModel.cs | 63 +++++++++++-
Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs | 11 ++
Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs.meta | 12 ++
System/EquipStar/EquipStarMaterialSelectModel.cs | 4
Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C6_tagCMEquipPartSuiteActivate.cs.meta | 12 ++
Core/NetworkPackage/ServerPack/HA3_Function/HA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta | 12 ++
Core/GameEngine/DataToCtl/PackageRegedit.cs | 3
System/EquipStar/EquipStarMaterialSelectWin.cs | 3
Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta | 12 ++
System/EquipStar/EquipStarUpgradeSpecialMaterialBehaviour.cs | 2
Core/NetworkPackage/ServerPack/HB5_Bourse/HB511_tagGCEquipStarAutoBuyCostInfo.cs.meta | 12 ++
System/EquipStar/EquipStarWin.cs | 116 ++++++++++++++++++++++
12 files changed, 248 insertions(+), 14 deletions(-)
diff --git a/Core/GameEngine/DataToCtl/PackageRegedit.cs b/Core/GameEngine/DataToCtl/PackageRegedit.cs
index 9787176..a35b91e 100644
--- a/Core/GameEngine/DataToCtl/PackageRegedit.cs
+++ b/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)
diff --git a/Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C6_tagCMEquipPartSuiteActivate.cs.meta b/Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C6_tagCMEquipPartSuiteActivate.cs.meta
new file mode 100644
index 0000000..51e7b5c
--- /dev/null
+++ b/Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA5C6_tagCMEquipPartSuiteActivate.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 76662598835d73647b019e70ca4e8e50
+timeCreated: 1572440036
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta b/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta
new file mode 100644
index 0000000..5c5de0a
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6e4cb6575e29d1e4b877e1ca67eb7d0e
+timeCreated: 1572440036
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs b/Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs
index 9cba599..3d93523 100644
--- a/Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs
+++ b/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);
+ }
+
}
+
}
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs.meta b/Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs.meta
new file mode 100644
index 0000000..328efa7
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HB5_Bourse/DTCB511_tagGCEquipStarAutoBuyCostInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 04cded0fd423d854791ae7f63b28ef09
+timeCreated: 1572440032
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Core/NetworkPackage/ServerPack/HA3_Function/HA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta b/Core/NetworkPackage/ServerPack/HA3_Function/HA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta
new file mode 100644
index 0000000..a906a70
--- /dev/null
+++ b/Core/NetworkPackage/ServerPack/HA3_Function/HA3B2_tagMCEquipPartSuiteActivateInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8f8027f87ffa59d4fbd6cddb5902f645
+timeCreated: 1572440037
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Core/NetworkPackage/ServerPack/HB5_Bourse/HB511_tagGCEquipStarAutoBuyCostInfo.cs.meta b/Core/NetworkPackage/ServerPack/HB5_Bourse/HB511_tagGCEquipStarAutoBuyCostInfo.cs.meta
new file mode 100644
index 0000000..914bdbc
--- /dev/null
+++ b/Core/NetworkPackage/ServerPack/HB5_Bourse/HB511_tagGCEquipStarAutoBuyCostInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6b62c697c78ceb04384025c9d1c6de13
+timeCreated: 1572440036
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/System/EquipStar/EquipStarMaterialSelectModel.cs b/System/EquipStar/EquipStarMaterialSelectModel.cs
index 30344cd..e722222 100644
--- a/System/EquipStar/EquipStarMaterialSelectModel.cs
+++ b/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;
}
diff --git a/System/EquipStar/EquipStarMaterialSelectWin.cs b/System/EquipStar/EquipStarMaterialSelectWin.cs
index a1223bd..b03caaf 100644
--- a/System/EquipStar/EquipStarMaterialSelectWin.cs
+++ b/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)
diff --git a/System/EquipStar/EquipStarModel.cs b/System/EquipStar/EquipStarModel.cs
index ea918a0..af6070e 100644
--- a/System/EquipStar/EquipStarModel.cs
+++ b/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)
diff --git a/System/EquipStar/EquipStarUpgradeSpecialMaterialBehaviour.cs b/System/EquipStar/EquipStarUpgradeSpecialMaterialBehaviour.cs
index 54c37d0..c90e2a4 100644
--- a/System/EquipStar/EquipStarUpgradeSpecialMaterialBehaviour.cs
+++ b/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);
diff --git a/System/EquipStar/EquipStarWin.cs b/System/EquipStar/EquipStarWin.cs
index 4cbfbd0..e963ada 100644
--- a/System/EquipStar/EquipStarWin.cs
+++ b/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()
--
Gitblit v1.8.0