| System/HappyXB/BestXBWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HappyXB/HappyXBModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/HappyXB/RuneXBWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/KnapSack/Logic/TreasureEffectModel.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,6 +28,10 @@ [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; @@ -47,6 +52,9 @@ List<CommonItemBaisc> xbResultItemBasiclist = new List<CommonItemBaisc>(); HappyXBModel XBModel { get { return ModelCenter.Instance.GetModel<HappyXBModel>(); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } XBFuncSet funcSet; float coolTime = 3; protected override void BindController() { @@ -90,7 +98,9 @@ XBModel.RefreshBestXBTimeAct += RefreshFreeTime; XBModel.RefreshXBTypeInfoAct += RefreshXBTypeInfo; XBModel.RefreshXBResultAct += RefreshXBResult; playerPack.RefreshItemCountAct += RefreshItemCount; getItemlist = XBModel.GetXBGetItemByID(1).Values.ToList(); GlobalTimeEvent.Instance.secondEvent += RefreshSecond; isHaveFreeTime = XBModel.IsHaveFreeXBTime(1); InitUI(); TimeDownMgr.CoolTimeData data; @@ -116,10 +126,31 @@ XBModel.RefreshXBResultAct -= RefreshXBResult; XBModel.RefreshXBTypeInfoAct -= RefreshXBTypeInfo; XBModel.RefreshAgainXBAct -= RefreshAgainXB; playerPack.RefreshItemCountAct -= RefreshItemCount; GlobalTimeEvent.Instance.secondEvent -= RefreshSecond; } protected override void OnAfterClose() { } private void RefreshSecond() { if(XBModel.isXBCoolTime) { coolTime -= 1; if(coolTime < 0) { XBModel.isXBCoolTime = false; ResetXBItemState(); coolTime = 3; DebugEx.Log("请求超时服务端未回包"); } } else { coolTime = 3; } } private void InitUI() @@ -142,7 +173,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 +182,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 +213,11 @@ { freeXBTimeText.gameObject.SetActive(true); freeXBTimeText.text = Language.Get("HappyXB102", TimeUtility.SecondsToHMSCHSRetain((int)time)); if(!XBModel.IsHaveOneXBTool(1)) { freeXbBtn.gameObject.SetActive(false); xbBtn.gameObject.SetActive(true); } } } else @@ -179,6 +225,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,7 +273,39 @@ { if (XBModel.CheckIsEmptyGrid(PackType.rptTreasure)) { if (UIHelper.GetMoneyCnt(1) >= (ulong)xbManyMoney) int toolCnt = 0; if(XBModel.IsHaveManyXBTool(1,out toolCnt)) { 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 { CheckXBManyLimit(xbManyMoney); } } } private void CheckXBManyLimit(int needMoney) { if (UIHelper.GetMoneyCnt(1) >= (ulong)needMoney) { maskObj.SetActive(true); isXBMany = true; @@ -205,7 +316,6 @@ WindowCenter.Instance.Open<RechargeTipWin>(); } } } private void ClickFreeXbBtn() { @@ -213,7 +323,14 @@ { maskObj.SetActive(true); isXBMany = false; if (XBModel.IsHaveFreeXB(1)) { XBModel.SendXBQuest(1, 0, 1); } else if(XBModel.IsHaveOneXBTool(1)) { XBModel.SendXBQuest(1,0,2); } } } @@ -288,7 +405,8 @@ { if (index == xbResultItemBasiclist.Count - 1) { RestXBItemState(); ResetXBItemState(); WindowCenter.Instance.Open<HappyXBGetItemWin>(); } }); if (xbResultItemBasiclist[index].itemConfig != null) @@ -370,7 +488,8 @@ } else { RestXBItemState(); ResetXBItemState(); WindowCenter.Instance.Open<HappyXBGetItemWin>(); } } else @@ -380,7 +499,7 @@ } } private void RestXBItemState() private void ResetXBItemState() { luckDesObj.SetActive(true); maskObj.SetActive(false); @@ -389,8 +508,6 @@ { xbItemlist[i].RefreshSelectIcon(0); } WindowCenter.Instance.Open<HappyXBGetItemWin>(); } } } System/HappyXB/HappyXBModel.cs
@@ -26,6 +26,7 @@ public static string HAPPYXBITEMKEY; public List<ArrayList> XBNotifyParms = new List<ArrayList>(); public bool isXBCoolTime { get; set; } public override void Init() { @@ -63,6 +64,7 @@ public void OnBeforePlayerDataInitialize() { isXBCoolTime = false; XBNotifyParms.Clear(); xbTypeInfoDict.Clear(); } @@ -76,6 +78,8 @@ XBWarehouseRedPoint(); m_storeModel.RefreshTCBPlayerDataEvent -= RefreshStoreScore; m_storeModel.RefreshTCBPlayerDataEvent += RefreshStoreScore; playerPack.RefreshItemCountAct -= RefreshXBTool; playerPack.RefreshItemCountAct += RefreshXBTool; } public override void UnInit() @@ -149,10 +153,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]; @@ -318,6 +328,7 @@ } } SetXBResultRecord(); isXBCoolTime = false; if (RefreshXBResultAct != null) { RefreshXBResultAct(); @@ -468,6 +479,7 @@ /// <param name="index"></param> public void SendXBQuest(int type,int index,int costType) { isXBCoolTime = true; CA568_tagCMRequestTreasure treasure = new CA568_tagCMRequestTreasure(); treasure.TreasureType = (byte)type; treasure.TreasureIndex = (byte)index; @@ -543,6 +555,45 @@ { return true; } } 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; } @@ -666,11 +717,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 +737,7 @@ bestXBRed.state = RedPointState.None; } if (IsHaveFreeXB(2)) if (IsHaveFreeXB(2) || IsHaveOneXBTool(2)) { runeXBRed.state = RedPointState.Simple; } @@ -745,7 +803,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,9 @@ 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; float coolTime = 3; protected override void BindController() { xbItemlist.Clear(); @@ -95,10 +102,12 @@ protected override void OnPreOpen() { playerPack.RefreshItemCountAct += RefreshItemCount; XBModel.RefreshAgainXBAct += RefreshAgainXB; XBModel.RefreshRuneXBTimeAct += RefreshFreeTime; XBModel.RefreshXBTypeInfoAct += RefreshXBTypeInfo; XBModel.RefreshXBResultAct += RefreshXBResult; GlobalTimeEvent.Instance.secondEvent += RefreshSecond; getItemlist = XBModel.GetXBGetItemByID(2).Values.ToList(); isHaveFreeTime = XBModel.IsHaveFreeXBTime(2); InitUI(); @@ -125,10 +134,31 @@ XBModel.RefreshRuneXBTimeAct -= RefreshFreeTime; XBModel.RefreshXBResultAct -= RefreshXBResult; XBModel.RefreshXBTypeInfoAct -= RefreshXBTypeInfo; playerPack.RefreshItemCountAct -= RefreshItemCount; GlobalTimeEvent.Instance.secondEvent -= RefreshSecond; } protected override void OnAfterClose() { } private void RefreshSecond() { if (XBModel.isXBCoolTime) { coolTime -= 1; if (coolTime < 0) { XBModel.isXBCoolTime = false; ResetXBItemState(); coolTime = 3; DebugEx.Log("请求超时服务端未回包"); } } else { coolTime = 3; } } private void InitUI() @@ -152,7 +182,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 +191,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 +221,11 @@ { freeXBTimeText.gameObject.SetActive(true); freeXBTimeText.text = Language.Get("HappyXB102", TimeUtility.SecondsToHMSCHSRetain((int)time)); if (!XBModel.IsHaveOneXBTool(2)) { freeXbBtn.gameObject.SetActive(false); xbBtn.gameObject.SetActive(true); } } } else @@ -189,6 +233,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,7 +279,38 @@ { if (XBModel.CheckIsEmptyGrid(PackType.rptRunePack)) { if (UIHelper.GetMoneyCnt(1) >= (ulong)xbManyMoney) int toolCnt = 0; if (XBModel.IsHaveManyXBTool(2, out toolCnt)) { 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 { CheckXBManyLimit(xbManyMoney); } } } private void CheckXBManyLimit(int needMoney) { if (UIHelper.GetMoneyCnt(1) >= (ulong)needMoney) { maskObj.SetActive(true); isXBMany = true; @@ -212,7 +319,6 @@ else { WindowCenter.Instance.Open<RechargeTipWin>(); } } } @@ -239,7 +345,14 @@ { maskObj.SetActive(true); isXBMany = false; if (XBModel.IsHaveFreeXB(2)) { XBModel.SendXBQuest(2, 0, 1); } else if (XBModel.IsHaveOneXBTool(2)) { XBModel.SendXBQuest(2, 0, 2); } } } @@ -296,7 +409,8 @@ { if (index == xbResultItemBasiclist.Count - 1) { RestXBItemState(); ResetXBItemState(); WindowCenter.Instance.Open<HappyXBGetItemWin>(); } }); ; if(xbResultItemBasiclist[index].itemConfig != null) @@ -376,7 +490,8 @@ } else { RestXBItemState(); ResetXBItemState(); WindowCenter.Instance.Open<HappyXBGetItemWin>(); } } else @@ -386,7 +501,7 @@ } } private void RestXBItemState() private void ResetXBItemState() { luckDesObj.SetActive(true); maskObj.SetActive(false); @@ -395,8 +510,6 @@ { xbItemlist[i].RefreshSelectIcon(0); } WindowCenter.Instance.Open<HappyXBGetItemWin>(); } } } System/KnapSack/Logic/TreasureEffectModel.cs
@@ -10,9 +10,8 @@ public class TreasureEffectModel : Model,IBeforePlayerDataInitialize,IAfterPlayerDataInitialize,IPlayerLoginOk { public List<int> treasureAddAtklist { get; private set; } public List<int> treasureSignlist { get; private set;} public List<string> treasureIdlist { get; private set; } public Dictionary<int, Dictionary<int, int>> treasureSignDict { get; private set; } TreasureModel m_Model; TreasureModel model { @@ -31,14 +30,15 @@ treasureAddAtklist.Add(addExpIds[i]); } List<TreasureUpConfig> treasureUplist = ConfigManager.Instance.GetAllValues<TreasureUpConfig>(); treasureSignlist = new List<int>(); for (int i = 0; i < treasureUplist.Count; i++) FuncConfigConfig MWSignDayAttr = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("MWSignDayAttr"); int treasureId = int.Parse(MWSignDayAttr.Numerical2); JsonData signAttrData = JsonMapper.ToObject(MWSignDayAttr.Numerical1); treasureSignDict = new Dictionary<int, Dictionary<int, int>>(); Dictionary<int, int> attrDict = new Dictionary<int, int>(); treasureSignDict.Add(treasureId,attrDict); foreach (var id in signAttrData.Keys) { if(treasureUplist[i].Privilege == (int)TreasurePrivilege.Sign) { treasureSignlist.Add(treasureUplist[i].ID); } attrDict.Add(int.Parse(id),int.Parse(signAttrData[id].ToString())); } treasureIdlist = ConfigManager.Instance.GetAllKeys<TreasureConfig>(); @@ -51,7 +51,6 @@ showType = 0; killNpcAtk = 0; effectDesSB.Length = 0; attrDict.Clear(); } public void OnAfterPlayerDataInitialize() @@ -83,7 +82,6 @@ public StringBuilder effectDesSB = new StringBuilder(); public int killNpcAtk { get; private set; } public int showType; private Dictionary<int, int> attrDict = new Dictionary<int, int>(); public void SetTreasureID(int id, int vipLv = 0) { @@ -105,7 +103,6 @@ type = 0; effectDesSB.Length = 0; killNpcAtk = 0; attrDict.Clear(); TreasureConfig treasureConfig = ConfigManager.Instance.GetTemplate<TreasureConfig>(treasureId); if (treasureAddAtklist.Contains(treasureId)) { @@ -120,18 +117,9 @@ return; } for (int i = 0; i < treasureSignlist.Count;i++) if(treasureSignDict.ContainsKey(treasureId)) { TreasureUpConfig treasureUpConfig = ConfigManager.Instance.GetTemplate<TreasureUpConfig>(treasureSignlist[i]); if (treasureUpConfig.MWID == treasureId && treasureUpConfig.LV == 0) { type = 2; TreasurePrivilegeConfig privilegeConfig = ConfigManager.Instance.GetTemplate<TreasurePrivilegeConfig>(treasureUpConfig.Privilege); JsonData signData = JsonMapper.ToObject(privilegeConfig.attr); foreach (var key in signData.Keys) { attrDict.Add(int.Parse(key),int.Parse(signData[key].ToString())); } Dictionary<int, int> attrDict = treasureSignDict[treasureId]; Treasure treasure; model.TryGetTreasure(treasureId,out treasure); bool isHaveTreasure = false; @@ -142,7 +130,6 @@ isHaveTreasure = true; } } foreach (var id in attrDict.Keys) { PlayerPropertyConfig propertyConfig = ConfigManager.Instance.GetTemplate<PlayerPropertyConfig>(id); @@ -165,7 +152,6 @@ } } return; } } if(effectDesSB.Length <= 0) @@ -211,7 +197,7 @@ } break; case 2: fight += UIHelper.GetFightPower(attrDict); fight += UIHelper.GetFightPower(treasureSignDict[treasureId]); break; case 3: break; 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 ""; }