| System/HappyXB/BestXBWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HappyXB/HappyXBModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HappyXB/RuneXBWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Utility/UIHelper.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/HappyXB/BestXBWin.cs
@@ -5,6 +5,7 @@ using System.Linq; using UnityEngine; using UnityEngine.UI; using TableConfig; namespace Snxxz.UI { @@ -27,7 +28,11 @@ [SerializeField] Transform getXBItemParent; [SerializeField] GameObject xbResultObj; [SerializeField] GameObject maskObj; [SerializeField] GameObject toolXBShowObj; [SerializeField] Image toolImg1; [SerializeField] Image toolImg2; [SerializeField] Text toolNumText; [Header("控制寻宝转动圈数")] [SerializeField] int cycleTimes = 1; [Header("时间间隔")] @@ -47,6 +52,8 @@ List<CommonItemBaisc> xbResultItemBasiclist = new List<CommonItemBaisc>(); HappyXBModel XBModel { get { return ModelCenter.Instance.GetModel<HappyXBModel>(); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } XBFuncSet funcSet; protected override void BindController() { @@ -90,6 +97,7 @@ XBModel.RefreshBestXBTimeAct += RefreshFreeTime; XBModel.RefreshXBTypeInfoAct += RefreshXBTypeInfo; XBModel.RefreshXBResultAct += RefreshXBResult; playerPack.RefreshItemCountAct += RefreshItemCount; getItemlist = XBModel.GetXBGetItemByID(1).Values.ToList(); isHaveFreeTime = XBModel.IsHaveFreeXBTime(1); InitUI(); @@ -116,6 +124,7 @@ XBModel.RefreshXBResultAct -= RefreshXBResult; XBModel.RefreshXBTypeInfoAct -= RefreshXBTypeInfo; XBModel.RefreshAgainXBAct -= RefreshAgainXB; playerPack.RefreshItemCountAct -= RefreshItemCount; } protected override void OnAfterClose() { @@ -142,7 +151,7 @@ getXBItemParent.gameObject.SetActive(false); xbResultObj.SetActive(false); freeXbBtn.gameObject.SetActive(false); XBFuncSet funcSet = XBModel.GetXBFuncSet(1); funcSet = XBModel.GetXBFuncSet(1); if(funcSet != null) { xbBtnText.text = Language.Get("HappyXB101", funcSet.xbNums[0]); @@ -151,9 +160,21 @@ xbManyMoneyText.text = funcSet.xbPrices[1].ToString(); xbOneMoney = funcSet.xbPrices[0]; xbManyMoney = funcSet.xbPrices[1]; ItemConfig itemConfig1 = ConfigManager.Instance.GetTemplate<ItemConfig>(funcSet.costToolIds[0]); ItemConfig itemConfig2 = ConfigManager.Instance.GetTemplate<ItemConfig>(funcSet.costToolIds[1]); if(itemConfig1 != null) { toolImg1.SetSprite(itemConfig1.IconKey); } if (itemConfig2 != null) { toolImg2.SetSprite(itemConfig2.IconKey); } } RefreshXBTypeInfo(); RefreshXBTools(); } private void RefreshFreeTime(float time) @@ -170,8 +191,11 @@ { freeXBTimeText.gameObject.SetActive(true); freeXBTimeText.text = Language.Get("HappyXB102", TimeUtility.SecondsToHMSCHSRetain((int)time)); freeXbBtn.gameObject.SetActive(false); xbBtn.gameObject.SetActive(true); if(!XBModel.IsHaveOneXBTool(1)) { freeXbBtn.gameObject.SetActive(false); xbBtn.gameObject.SetActive(true); } } } else @@ -179,6 +203,39 @@ freeXBTimeText.gameObject.SetActive(false); } } private void RefreshItemCount(PackType type, int index, int id) { if (type != PackType.rptItem || !XBModel.CheckIsXBTool(id, 1)) return; RefreshXBTools(); } public void RefreshXBTools() { if(XBModel.IsHaveOneXBTool(1)) { freeXbBtn.gameObject.SetActive(true); xbBtn.gameObject.SetActive(false); } else { freeXbBtn.gameObject.SetActive(false); xbBtn.gameObject.SetActive(true); } int xbToolCnt = 0; if (XBModel.IsHaveManyXBTool(1,out xbToolCnt)) { toolXBShowObj.SetActive(true); toolNumText.text = StringUtility.Contact("x", xbToolCnt); } else { toolXBShowObj.SetActive(false); } } @@ -194,16 +251,47 @@ { if (XBModel.CheckIsEmptyGrid(PackType.rptTreasure)) { if (UIHelper.GetMoneyCnt(1) >= (ulong)xbManyMoney) int toolCnt = 0; if(XBModel.IsHaveManyXBTool(1,out toolCnt)) { maskObj.SetActive(true); isXBMany = true; XBModel.SendXBQuest(1, 1, 0); int needToolCnt = funcSet.costToolNums[1] - toolCnt; int needMoney = needToolCnt * xbOneMoney; if(needToolCnt > 0) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("HappyXBCostTools", funcSet.costToolNums[1],needMoney,needToolCnt), (bool isOk) => { if (isOk) { CheckXBManyLimit(needMoney); } return; }); } else { CheckXBManyLimit(xbManyMoney); } } else { WindowCenter.Instance.Open<RechargeTipWin>(); CheckXBManyLimit(xbManyMoney); } } } private void CheckXBManyLimit(int needMoney) { if (UIHelper.GetMoneyCnt(1) >= (ulong)needMoney) { maskObj.SetActive(true); isXBMany = true; XBModel.SendXBQuest(1, 1, 0); } else { WindowCenter.Instance.Open<RechargeTipWin>(); } } @@ -213,7 +301,14 @@ { maskObj.SetActive(true); isXBMany = false; XBModel.SendXBQuest(1, 0, 1); if (XBModel.IsHaveFreeXB(1)) { XBModel.SendXBQuest(1, 0, 1); } else if(XBModel.IsHaveOneXBTool(1)) { XBModel.SendXBQuest(1,0,2); } } } System/HappyXB/HappyXBModel.cs
@@ -76,6 +76,8 @@ XBWarehouseRedPoint(); m_storeModel.RefreshTCBPlayerDataEvent -= RefreshStoreScore; m_storeModel.RefreshTCBPlayerDataEvent += RefreshStoreScore; playerPack.RefreshItemCountAct -= RefreshXBTool; playerPack.RefreshItemCountAct += RefreshXBTool; } public override void UnInit() @@ -149,10 +151,16 @@ funcSet.xbPrices[i] = int.Parse(jsonData[i].ToString()); } jsonData = JsonMapper.ToObject(xbSet.Numerical3); funcSet.costTools = new int[jsonData.Count]; funcSet.costToolIds = new int[jsonData.Count]; funcSet.costToolNums = new int[jsonData.Count]; for (int i = 0; i < jsonData.Count; i++) { funcSet.costTools[i] = int.Parse(jsonData[i].ToString()); if(jsonData.IsArray) { funcSet.costToolIds[i] = int.Parse(jsonData[i][0].ToString()); funcSet.costToolNums[i] = int.Parse(jsonData[i][1].ToString()); } } jsonData = JsonMapper.ToObject(xbSet.Numerical4); funcSet.xbFreeCDs = new int[jsonData.Count]; @@ -546,6 +554,45 @@ } return false; } public bool CheckIsXBTool(int itemId,int type) { XBFuncSet funcSet = GetXBFuncSet(type); if (funcSet == null) return false; if(funcSet.costToolIds.Contains(itemId)) { return true; } return false; } public bool IsHaveOneXBTool(int type) { XBFuncSet funcSet = GetXBFuncSet(type); if (funcSet == null) return false; int toolCnt = playerPack.GetItemCountByID(PackType.rptItem, funcSet.costToolIds[0]); if(toolCnt >= funcSet.costToolNums[0]) { return true; } return false; } public bool IsHaveManyXBTool(int type, out int toolCnt) { toolCnt = 0; XBFuncSet funcSet = GetXBFuncSet(type); if (funcSet == null) return false; toolCnt = playerPack.GetItemCountByID(PackType.rptItem, funcSet.costToolIds[1]); if (toolCnt > 0) { return true; } return false; } public void RecordFreeXBTime() { @@ -666,11 +713,18 @@ } } private void RefreshXBTool(PackType type, int index, int id) { if (type != PackType.rptItem) return; if (!CheckIsXBTool(id, 1) && !CheckIsXBTool(id, 2)) return; BestAndRuneXBRedPoint(); } public void BestAndRuneXBRedPoint() { if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HappyFindTreasure)) return; if (IsHaveFreeXB(1)) if (IsHaveFreeXB(1) || IsHaveOneXBTool(1)) { bestXBRed.state = RedPointState.Simple; } @@ -679,7 +733,7 @@ bestXBRed.state = RedPointState.None; } if (IsHaveFreeXB(2)) if (IsHaveFreeXB(2) || IsHaveOneXBTool(2)) { runeXBRed.state = RedPointState.Simple; } @@ -745,7 +799,8 @@ public int xbType;// 1 极品寻宝 2 符印寻宝 public int[] xbNums; public int[] xbPrices; public int[] costTools; public int[]costToolIds; public int[] costToolNums; public int[] xbFreeCDs; public int[] xbScores; } System/HappyXB/RuneXBWin.cs
@@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using TableConfig; using UnityEngine; using UnityEngine.UI; @@ -28,6 +29,10 @@ [SerializeField] GameObject xbResultObj; [SerializeField] Button lookRuneBtn; [SerializeField] GameObject maskObj; [SerializeField] GameObject toolXBShowObj; [SerializeField] Text toolNumText; [SerializeField] Image toolImg1; [SerializeField] Image toolImg2; [Header("控制寻宝转动圈数")] [SerializeField] int cycleTimes = 1; @@ -49,7 +54,8 @@ List<GameObject> xbResultObjlist = new List<GameObject>(); List<CommonItemBaisc> xbResultItemBasiclist = new List<CommonItemBaisc>(); HappyXBModel XBModel { get { return ModelCenter.Instance.GetModel<HappyXBModel>(); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } XBFuncSet funcSet; protected override void BindController() { xbItemlist.Clear(); @@ -95,6 +101,7 @@ protected override void OnPreOpen() { playerPack.RefreshItemCountAct += RefreshItemCount; XBModel.RefreshAgainXBAct += RefreshAgainXB; XBModel.RefreshRuneXBTimeAct += RefreshFreeTime; XBModel.RefreshXBTypeInfoAct += RefreshXBTypeInfo; @@ -125,6 +132,7 @@ XBModel.RefreshRuneXBTimeAct -= RefreshFreeTime; XBModel.RefreshXBResultAct -= RefreshXBResult; XBModel.RefreshXBTypeInfoAct -= RefreshXBTypeInfo; playerPack.RefreshItemCountAct -= RefreshItemCount; } protected override void OnAfterClose() { @@ -152,7 +160,7 @@ getXBItemParent.gameObject.SetActive(false); xbResultObj.SetActive(false); freeXbBtn.gameObject.SetActive(false); XBFuncSet funcSet = XBModel.GetXBFuncSet(2); funcSet = XBModel.GetXBFuncSet(2); if(funcSet != null) { xbBtnText.text = Language.Get("HappyXB101", funcSet.xbNums[0]); @@ -161,9 +169,20 @@ xbManyMoneyText.text = funcSet.xbPrices[1].ToString(); xbOneMoney = funcSet.xbPrices[0]; xbManyMoney = funcSet.xbPrices[1]; ItemConfig itemConfig1 = ConfigManager.Instance.GetTemplate<ItemConfig>(funcSet.costToolIds[0]); ItemConfig itemConfig2 = ConfigManager.Instance.GetTemplate<ItemConfig>(funcSet.costToolIds[1]); if (itemConfig1 != null) { toolImg1.SetSprite(itemConfig1.IconKey); } if (itemConfig2 != null) { toolImg2.SetSprite(itemConfig2.IconKey); } } RefreshXBTypeInfo(); RefreshXBTools(); } private void RefreshFreeTime(float time) @@ -180,8 +199,11 @@ { freeXBTimeText.gameObject.SetActive(true); freeXBTimeText.text = Language.Get("HappyXB102", TimeUtility.SecondsToHMSCHSRetain((int)time)); freeXbBtn.gameObject.SetActive(false); xbBtn.gameObject.SetActive(true); if (!XBModel.IsHaveOneXBTool(2)) { freeXbBtn.gameObject.SetActive(false); xbBtn.gameObject.SetActive(true); } } } else @@ -189,6 +211,38 @@ freeXBTimeText.gameObject.SetActive(false); } } private void RefreshItemCount(PackType type, int index, int id) { if (type != PackType.rptItem || !XBModel.CheckIsXBTool(id, 2)) return; RefreshXBTools(); } public void RefreshXBTools() { if (XBModel.IsHaveOneXBTool(2)) { freeXbBtn.gameObject.SetActive(true); xbBtn.gameObject.SetActive(false); } else { freeXbBtn.gameObject.SetActive(false); xbBtn.gameObject.SetActive(true); } int xbToolCnt = 0; if (XBModel.IsHaveManyXBTool(2, out xbToolCnt)) { toolXBShowObj.SetActive(true); toolNumText.text = StringUtility.Contact("x", xbToolCnt); } else { toolXBShowObj.SetActive(false); } } private void RefreshAgainXB(HappXBTitle title, int xbType) @@ -203,16 +257,46 @@ { if (XBModel.CheckIsEmptyGrid(PackType.rptRunePack)) { if (UIHelper.GetMoneyCnt(1) >= (ulong)xbManyMoney) int toolCnt = 0; if (XBModel.IsHaveManyXBTool(2, out toolCnt)) { maskObj.SetActive(true); isXBMany = true; XBModel.SendXBQuest(2, 1, 0); int needToolCnt = funcSet.costToolNums[1] - toolCnt; int needMoney = needToolCnt * xbOneMoney; if (needToolCnt > 0) { ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), Language.Get("HappyXBCostTools", funcSet.costToolNums[1], needMoney, needToolCnt), (bool isOk) => { if (isOk) { CheckXBManyLimit(needMoney); } return; }); } else { CheckXBManyLimit(xbManyMoney); } } else { WindowCenter.Instance.Open<RechargeTipWin>(); CheckXBManyLimit(xbManyMoney); } } } private void CheckXBManyLimit(int needMoney) { if (UIHelper.GetMoneyCnt(1) >= (ulong)needMoney) { maskObj.SetActive(true); isXBMany = true; XBModel.SendXBQuest(2, 1, 0); } else { WindowCenter.Instance.Open<RechargeTipWin>(); } } @@ -239,7 +323,14 @@ { maskObj.SetActive(true); isXBMany = false; XBModel.SendXBQuest(2, 0, 1); if (XBModel.IsHaveFreeXB(2)) { XBModel.SendXBQuest(2, 0, 1); } else if (XBModel.IsHaveOneXBTool(2)) { XBModel.SendXBQuest(2, 0, 2); } } } Utility/UIHelper.cs
@@ -709,16 +709,9 @@ #region 得到装备位对应的部位名称 public static string GetEquipAreaName(int place) { FuncConfigConfig funcAreaModel = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("EquipArea"); int[] placelist = ConfigParse.GetMultipleStr<int>(funcAreaModel.Numerical1); string[] namelist = ConfigParse.GetMultipleStr(funcAreaModel.Numerical2); int i = 0; for (i = 0; i < placelist.Length; i++) if(GeneralConfig.Instance.equipPlaceNameDict.ContainsKey(place)) { if (placelist[i] == place) { return namelist[i]; } return GeneralConfig.Instance.equipPlaceNameDict[place]; } return ""; }