Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0403_tagPlayerLoginLoadOK.cs
@@ -19,6 +19,12 @@ finishedLogin = true; NetLinkWin.Hide(); if (loginModel.reconnectBackGround) { WindowCenter.Instance.Close<LoadingWin>(); } switch (vNetData.socketType) { case GameNetSystem.SocketType.Main: @@ -26,6 +32,7 @@ break; case GameNetSystem.SocketType.CrossSever: CrossServerLogin.Instance.reconnectBackGround = false; CrossServerLogin.Instance.StopLoginOverTimeProcess(); break; default: break; System/Compose/New/ComposeEquipWin.cs
@@ -106,7 +106,7 @@ protected override void OnPreOpen() { composeWinModel.UpdateSendComposeEvent += UpdateSendCompose; composeWinModel.UpdateSecondTypeEvent += UpdateSecondType; composeWinModel.UpdateThirdTypeEvent += UpdateThirdType; composeWinModel.UpdateReduceEvent += UpdateReduce; @@ -125,6 +125,7 @@ protected override void OnPreClose() { composeWinModel.UpdateSendComposeEvent -= UpdateSendCompose; composeWinModel.UpdateReduceEvent -= UpdateReduce; DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnComposeAnswer; composeWinModel.UpdateSecondTypeEvent -= UpdateSecondType; @@ -624,6 +625,8 @@ var unfixeAddDict = selectModel.GetHaveUnfixedSelectItem(); int[] unfixedDisplays = compoundModel.unfixedItemDisplay; var fixedAndUnfixeds = compoundModel.unfixedItemCount > 3 ? five_FixedAndUnfixeds : three_FixedAndUnfixeds; List<ItemModel> unSelectItems = unfixedSelectItemDict.Values.ToList(); unSelectItems.Sort(CompareByOverdueTime); for (int i = 0; i < unfixedDisplays.Length; i++) { @@ -633,18 +636,60 @@ var matCell = fixedAndUnfixeds[unfixedDisplay - 1]; if (matCell.itemModel == null) { foreach (var index in unfixedSelectItemDict.Keys) for(int j = 0; j < unSelectItems.Count; j++) { if (!unfixeAddDict.ContainsKey(index)) ItemModel _model = unSelectItems[i]; if (!unfixeAddDict.ContainsKey(_model.itemInfo.ItemPlace)) { selectModel.AddHaveUnfixedSelectItem(index); UpdateSelect(matCell, index, SelectItemType.unfixed); selectModel.AddHaveUnfixedSelectItem(_model.itemInfo.ItemPlace); UpdateSelect(matCell, _model.itemInfo.ItemPlace, SelectItemType.unfixed); break; } } } } } } private int CompareByOverdueTime(ItemModel start,ItemModel end) { int remainTime1 = 0; int remainTime2 = 0; bool isRemain1 = TryGetRemainTime(start,out remainTime1); bool isRemain2 = TryGetRemainTime(end,out remainTime2); if (isRemain1.CompareTo(isRemain2) != 0) return -isRemain1.CompareTo(isRemain2); if (remainTime1.CompareTo(remainTime2) != 0) return -remainTime1.CompareTo(remainTime2); return 0; } private bool TryGetRemainTime(ItemModel model,out int seconds) { seconds = 0; if (model.chinItemModel.EquipPlace != (int)RoleEquipType.retSpiritAnimal || model.chinItemModel.ExpireTime <= 0) return false; ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(model.itemInfo.ItemGUID); bool isShow = model.chinItemModel.ExpireTime > 0; if (isShow) { List<int> itemEffectTime = model.GetUseDataModel((int)ItemUseDataKey.Def_IudetCreateTime); seconds = model.chinItemModel.ExpireTime; if (itemEffectTime != null && itemEffectTime[0] != 0 && model.itemInfo.ItemGUID != "") { seconds = cool == null ? 0 : (int)cool.GetRemainTime(); } return true; } return false; } private void UpdateSendCompose() { if (compoundModel == null) return; SetFixedItemIndexDic(); composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict, GetPlayUIEffct(), 1, 10000, isIncreaseRate); } private void OnClickComposeBtn() @@ -658,8 +703,17 @@ return; } } SetFixedItemIndexDic(); composeWinModel.SendComposeRequest(compoundModel,fixedItemIndexDict, GetPlayUIEffct(), 1,10000,isIncreaseRate); ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(compoundModel.makeID[0]); switch((RoleEquipType)itemConfig.EquipPlace) { case RoleEquipType.retSpiritAnimal: WindowCenter.Instance.Open<GuardComposeConfirmWin>(); break; default: SetFixedItemIndexDic(); composeWinModel.SendComposeRequest(compoundModel, fixedItemIndexDict, GetPlayUIEffct(), 1, 10000, isIncreaseRate); break; } } private void SetFixedItemIndexDic() System/Compose/New/ComposeSelectItemCell.cs
New file @@ -0,0 +1,115 @@ using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class ComposeSelectItemCell : MonoBehaviour { [SerializeField] Text nameText; [SerializeField] ItemCell itemCell; [SerializeField] Text remainTimeText; [SerializeField] Button selectBtn; SelectEquipModel _selectModel; SelectEquipModel selectModel { get { return _selectModel ?? (_selectModel = ModelCenter.Instance.GetModel<SelectEquipModel>()); } } ItemModel itemModel = null; private void OnEnable() { KnapsackTimeCDMgr.Instance.RefreshItemOverdueTimeAct += UpdateRemainTime; } private void OnDisable() { KnapsackTimeCDMgr.Instance.RefreshItemOverdueTimeAct -= UpdateRemainTime; } public void SetDisplay(ItemModel _itemModel) { itemModel = _itemModel; selectBtn.RemoveAllListeners(); if (itemModel == null) return; itemCell.Init(itemModel); nameText.color = UIHelper.GetUIColor(itemModel.chinItemModel.ItemColor, true); nameText.text = itemModel.chinItemModel.ItemName; selectBtn.onClick.RemoveAllListeners(); selectBtn.onClick.AddListener(() => { OnClickSelectItem(itemModel); }); UpdateRemainTime(); } private void UpdateRemainTime(string guid) { if (itemModel == null || guid != itemModel.itemInfo.ItemGUID) return; UpdateRemainTime(); } private void UpdateRemainTime() { remainTimeText.gameObject.SetActive(false); if (itemModel == null || itemModel.chinItemModel.EquipPlace != (int)RoleEquipType.retSpiritAnimal) return; ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(itemModel.itemInfo.ItemGUID); bool isShow = itemModel.chinItemModel.ExpireTime > 0; remainTimeText.gameObject.SetActive(isShow); if (isShow) { List<int> itemEffectTime = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetCreateTime); double remianTime = itemModel.chinItemModel.ExpireTime; if (itemEffectTime != null && itemEffectTime[0] != 0 && itemModel.itemInfo.ItemGUID != "") { remianTime = cool == null ? 0 : cool.GetRemainTime(); } if (remianTime > 0) { remainTimeText.text = Language.Get("Remaining_Z", SecondsToHM((int)remianTime)); } else { selectModel.UpdateSelectItems(); } } } public string SecondsToHM(int _seconds) { string timeStr = string.Empty; int hours = _seconds / 3600; int mins = _seconds % 3600 / 60; if (hours > 0) { timeStr = StringUtility.Contact(hours, Language.Get("Hour")); } if (mins > 0) { timeStr = StringUtility.Contact(timeStr,mins, Language.Get("Minute")); } return timeStr; } public void OnClickSelectItem(ItemModel itemModel) { switch (selectModel.selectItem) { case SelectItemType.unfixed: selectModel.AddHaveUnfixedSelectItem(itemModel.itemInfo.ItemPlace); break; case SelectItemType.addons: selectModel.AddHaveAddSelectItem(itemModel.itemInfo.ItemPlace); break; } selectModel.UpdateSelectItem(itemModel.itemInfo.ItemPlace); WindowCenter.Instance.CloseImmediately<SelectItemWin>(); } } } System/Compose/New/ComposeSelectItemCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: c89b658ca99d9cd498b10278bafa571a timeCreated: 1546484174 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Compose/New/ComposeWinModel.cs
@@ -9,7 +9,7 @@ [XLua.LuaCallCSharp] public class ComposeWinModel : Model, IBeforePlayerDataInitialize,IPlayerLoginOk { public event Action UpdateSendComposeEvent; public event Action ResetModelEvent; SelectEquipModel _selectModel; SelectEquipModel selectModel @@ -403,6 +403,14 @@ } #endregion public void SetUpdateSendComposeEvent() { if(UpdateSendComposeEvent != null) { UpdateSendComposeEvent(); } } public bool IsComposeJobLimit(int composeId) { int playerJob = PlayerDatas.Instance.baseData.Job; System/Compose/New/GuardComposeConfirmWin.cs
New file @@ -0,0 +1,145 @@ using System; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; using TableConfig; namespace Snxxz.UI { public class GuardComposeConfirmWin : Window { [SerializeField] Button popConfirmBtn; [SerializeField] RichText popConfirmInfo; [SerializeField] Text popConfirmTitle; [SerializeField] Button closeBtn; SelectEquipModel _selectModel; SelectEquipModel selectModel { get { return _selectModel ?? (_selectModel = ModelCenter.Instance.GetModel<SelectEquipModel>()); } } ComposeWinModel _composeWinModel; ComposeWinModel composeWinModel { get { return _composeWinModel ?? (_composeWinModel = ModelCenter.Instance.GetModel<ComposeWinModel>()); } } ItemModel itemModel = null; #region Built-in protected override void BindController() { } protected override void AddListeners() { closeBtn.AddListener(CloseClick); popConfirmBtn.AddListener(ClickGuardCompose); } protected override void OnPreOpen() { KnapsackTimeCDMgr.Instance.RefreshItemOverdueTimeAct += UpdateRemainTime; SetDisplay(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { KnapsackTimeCDMgr.Instance.RefreshItemOverdueTimeAct -= UpdateRemainTime; } protected override void OnAfterClose() { } #endregion private void SetDisplay() { var unfixeAddDict = selectModel.GetHaveUnfixedSelectItem(); var modellist = unfixeAddDict.Values.ToList(); modellist.Sort(CompareByOverdueTime); itemModel = modellist.Count > 0 ? modellist[0] : null; if(itemModel != null) { UpdateRemainTime(itemModel.itemInfo.ItemGUID); } } private void UpdateRemainTime(string guid) { if (composeWinModel.CurComposeModel == null || itemModel == null) return; if (itemModel.itemInfo.ItemGUID == guid) { int remainTime = 0; bool isRemain = TryGetRemainTime(itemModel, out remainTime); if (isRemain) { ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(composeWinModel.CurComposeModel.makeID[0]); popConfirmInfo.text = Language.Get("Compose111", SecondsToHM(remainTime), itemConfig.ItemName); } } } public string SecondsToHM(int _seconds) { string timeStr = string.Empty; int hours = _seconds / 3600; int mins = _seconds % 3600 / 60; if (hours > 0) { timeStr = StringUtility.Contact(hours, Language.Get("Hour")); } if (mins > 0) { timeStr = StringUtility.Contact(timeStr, mins, Language.Get("Minute")); } return timeStr; } private int CompareByOverdueTime(ItemModel start, ItemModel end) { int remainTime1 = 0; int remainTime2 = 0; bool isRemain1 = TryGetRemainTime(start, out remainTime1); bool isRemain2 = TryGetRemainTime(end, out remainTime2); if (isRemain1.CompareTo(isRemain2) != 0) return -isRemain1.CompareTo(isRemain2); if (remainTime1.CompareTo(remainTime2) != 0) return remainTime1.CompareTo(remainTime2); return 0; } private bool TryGetRemainTime(ItemModel model, out int seconds) { seconds = 0; if (model.chinItemModel.EquipPlace != (int)RoleEquipType.retSpiritAnimal || model.chinItemModel.ExpireTime <= 0) return false; ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(model.itemInfo.ItemGUID); bool isShow = model.chinItemModel.ExpireTime > 0; if (isShow) { List<int> itemEffectTime = model.GetUseDataModel((int)ItemUseDataKey.Def_IudetCreateTime); seconds = model.chinItemModel.ExpireTime; if (itemEffectTime != null && itemEffectTime[0] != 0 && model.itemInfo.ItemGUID != "") { seconds = cool == null ? 0 : (int)cool.GetRemainTime(); } return true; } return false; } private void ClickGuardCompose() { composeWinModel.SetUpdateSendComposeEvent(); CloseClick(); } } } System/Compose/New/GuardComposeConfirmWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: d28ed3c88bfa90740871bdc83017b0f2 timeCreated: 1546501468 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Compose/New/SelectEquipModel.cs
@@ -27,7 +27,7 @@ private Dictionary<int, ItemModel> haveAddSelectItemDic = new Dictionary<int, ItemModel>();//用于存储已选择添加的道具 public SelectItemType selectItem = SelectItemType.Nomral; public event Action UpdateSelectItemsEvent; PlayerPackModel _playerPack; PlayerPackModel playerPack { @@ -65,8 +65,20 @@ _unfixedItemDict.Clear(); foreach (int key in allBagItemInfo.Keys) { ItemModel itemModel = allBagItemInfo[key]; if (!haveUnfixedSelectItemDic.ContainsKey(key)) { switch((RoleEquipType)itemModel.chinItemModel.EquipPlace) { case RoleEquipType.retSpiritAnimal: bool isOverdue = modelInterface.IsOverdue(itemModel.itemInfo.ItemGUID, itemModel.itemId, itemModel.useDataDict); if(isOverdue) { continue; } break; } int i = 0; for (i = 0; i < unfixedIds.Length; i++) { @@ -82,8 +94,6 @@ return _unfixedItemDict; } public Dictionary<int, ItemModel> GetAddItemModel() { SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem); @@ -97,9 +107,20 @@ for(int i= 0; i < modellist.Count; i++) { int index = modellist[i].itemInfo.ItemPlace; ItemModel itemModel = modellist[i]; int index = itemModel.itemInfo.ItemPlace; if (!haveAddSelectItemDic.ContainsKey(index)) { switch ((RoleEquipType)itemModel.chinItemModel.EquipPlace) { case RoleEquipType.retSpiritAnimal: bool isOverdue = modelInterface.IsOverdue(itemModel.itemInfo.ItemGUID, itemModel.itemId, itemModel.useDataDict); if (isOverdue) { continue; } break; } int j = 0; for (j = 0; j < _addonsTypelist.Length; j++) { @@ -240,6 +261,15 @@ } } public void UpdateSelectItems() { if (UpdateSelectItemsEvent != null) { UpdateSelectItemsEvent(); } } public void ClearSelectModel() { selectMatCell = null; System/Compose/New/SelectItemWin.cs
@@ -33,6 +33,7 @@ protected override void OnPreOpen() { selectModel.UpdateSelectItemsEvent += OnInitPanel; selectItemDict = null; OnInitPanel(); } @@ -44,7 +45,7 @@ protected override void OnPreClose() { selectModel.UpdateSelectItemsEvent -= OnInitPanel; } protected override void OnAfterClose() @@ -78,31 +79,8 @@ private void OnRefreshSelectCell(ScrollerDataType type, CellView cell) { ItemModel itemModel = selectItemDict[cell.index]; ItemCell itemCell = cell.transform.Find("ItemCell").GetComponent<ItemCell>(); Text itemName = cell.transform.Find("NameText").GetComponent<Text>(); itemCell.Init(itemModel); itemName.color = UIHelper.GetUIColor(itemModel.chinItemModel.ItemColor,true); itemName.text = itemModel.chinItemModel.ItemName; Button selectBtn = cell.GetComponent<Button>(); selectBtn.onClick.RemoveAllListeners(); selectBtn.onClick.AddListener(() => { OnClickSelectItem(itemModel); }); } public void OnClickSelectItem(ItemModel itemModel) { switch (selectModel.selectItem) { case SelectItemType.unfixed: selectModel.AddHaveUnfixedSelectItem(itemModel.itemInfo.ItemPlace); break; case SelectItemType.addons: selectModel.AddHaveAddSelectItem(itemModel.itemInfo.ItemPlace); break; } selectModel.UpdateSelectItem(itemModel.itemInfo.ItemPlace); CloseWin(); ComposeSelectItemCell itemCell = cell.GetComponent<ComposeSelectItemCell>(); itemCell.SetDisplay(itemModel); } public void CloseWin() System/CrossServerOneVsOne/CrossServerOneVsOneHonorShopCell.cs
@@ -16,6 +16,7 @@ [SerializeField] Image sellImg; [SerializeField] Button shopCellBtn; [SerializeField] Text refreshTimeText; [SerializeField] RedpointBehaviour redpointBeh; StoreModel _storeModel; StoreModel m_storeModel @@ -23,12 +24,18 @@ get { return _storeModel ?? (_storeModel = ModelCenter.Instance.GetModel<StoreModel>()); } } ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } CrossServerOneVsOneModel crossServerModel { get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); } } public void SetDisplay(StoreConfig storeConfig) { ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(m_storeModel.GetReplaceId(storeConfig.ID,storeConfig.ItemID)); if (itemConfig == null) return; Redpoint redpoint = crossServerModel.GetRedpointById(storeConfig.ID); if(redpoint != null) { redpointBeh.redpointId = redpoint.id; } ItemCellModel cellModel = new ItemCellModel(itemConfig.ID, false, 0, storeConfig.IsBind,"",PackType.rptDeleted,true); itemCell.Init(cellModel); nameText.text = itemConfig.ItemName; @@ -107,6 +114,7 @@ shopCellBtn.AddListener(()=> { m_storeModel.OnClickShopCell(storeConfig); crossServerModel.ClearRedpoint(storeConfig.ID); }); } System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs
@@ -4,6 +4,7 @@ using System.Text; using TableConfig; using LitJson; using UnityEngine; namespace Snxxz.UI { @@ -33,14 +34,18 @@ } public DateTime matchStartTime { get; set; } public DateTime roundEndTime { get; private set; } StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } public override void Init() { IsMatching = false; ParseFuncConfig(); SetHonorRedpoint(); } public void OnBeforePlayerDataInitialize() { PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= UpdatePlayerData; CrossServerOneVsOnePlayerInfo.Instance.UpdatePlayerInfoEvent -= UpdatePlayerInfo; CrossServerOneVsOnePKSeason.Instance.updateSelfSeasonEvent -= UpdateSeason; TimeMgr.Instance.OnMinuteEvent -= UpdateMinute; @@ -49,7 +54,7 @@ CrossServerOneVsOnePlayerInfo.Instance.UpdatePlayerInfoEvent -= UpdateDayAwardState; InitData(); } public void OnAfterPlayerDataInitialize() { int playerId = (int)PlayerDatas.Instance.baseData.PlayerID; @@ -64,6 +69,7 @@ public void OnPlayerLoginOk() { PlayerDatas.Instance.PlayerDataRefreshInfoEvent += UpdatePlayerData; CrossServerOneVsOnePlayerInfo.Instance.UpdatePlayerInfoEvent += UpdatePlayerInfo; CrossServerOneVsOnePKSeason.Instance.updateSelfSeasonEvent += UpdateSeason; TimeMgr.Instance.OnMinuteEvent += UpdateMinute; @@ -78,6 +84,7 @@ UpdateCrossDayAwardsRedpoint(); UpdateCrossMatchRedpoint(); UpdateCanBuyRedpoint(); } public override void UnInit() @@ -136,6 +143,7 @@ private void UpdateSeason() { UpdateCrossMatchRedpoint(); UpdateCanBuyRedpoint(); } private void UpdatePlayerInfo() @@ -567,6 +575,119 @@ crossServerRedpoint.count = 0; } } #region 荣誉商店红点 public const int CrossHonorStoreRedKey = 2130104; public Redpoint crossHonorStoreRedpoint = new Redpoint(CrossOneVsOneRedKey, CrossHonorStoreRedKey); private Dictionary<int, Redpoint> honorRedpointDict = new Dictionary<int, Redpoint>(); public void SetHonorRedpoint() { honorRedpointDict.Clear(); List<StoreConfig> storelist = Config.Instance.GetAllValues<StoreConfig>(); for (int i = 0; i < storelist.Count; i++) { StoreConfig storeConfig = storelist[i]; int redKey = 0; Redpoint redpoint = null; if(storeConfig.ShopType == (int)StoreFunc.CrossOneVsOneHonor) { redKey = CrossHonorStoreRedKey *100 + storeConfig.ID; redpoint = new Redpoint(CrossHonorStoreRedKey, redKey); honorRedpointDict.Add(storeConfig.ID, redpoint); } } } public Redpoint GetRedpointById(int shopId) { Redpoint redpoint = null; honorRedpointDict.TryGetValue(shopId,out redpoint); return redpoint; } private void UpdatePlayerData(PlayerDataRefresh type) { switch(type) { case PlayerDataRefresh.CDBPlayerRefresh_Honor: UpdateCanBuyRedpoint(); break; } } public void UpdateCanBuyRedpoint() { var pkSeason = CrossServerOneVsOnePKSeason.Instance; if (!pkSeason.IsEnterCrossServer()) return; List<StoreModel.StoreData> storeDatas = storeModel.TryGetStoreDatas((int)StoreFunc.CrossOneVsOneHonor); if(storeDatas != null) { for(int i = 0; i < storeDatas.Count; i++) { var storeData = storeDatas[i]; var storeConfig = storeData.storeConfig; int type = 0; TryGetRedTypeByShopId(storeConfig.ID, out type); if (type == 6) { string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", storeData.shopId); int remainNum = 0; honorRedpointDict[storeConfig.ID].state = RedPointState.None; if (!storeModel.TryGetIsSellOut(storeConfig, out remainNum)) { if(!PlayerPrefs.HasKey(key)) { if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber) { honorRedpointDict[storeConfig.ID].state = RedPointState.Simple; LocalSave.SetBool(key, true); } } else { if(LocalSave.GetBool(key)) { if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber) { honorRedpointDict[storeConfig.ID].state = RedPointState.Simple; } } } } } } } } public bool TryGetRedTypeByShopId(int shopId, out int type) { type = 0; var ruleDict = storeModel.storeRedRuleDict; foreach (var key in ruleDict.Keys) { List<int> idlist = ruleDict[key]; if (idlist.Contains(shopId)) { type = key; return true; } } return false; } public void ClearRedpoint(int shopId) { string record = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", shopId); if(honorRedpointDict[shopId].state != RedPointState.None) { honorRedpointDict[shopId].state = RedPointState.None; LocalSave.SetBool(record, false); } } #endregion #endregion } } System/CrossServerOneVsOne/CrossServerOneVsOnePKSeason.cs
@@ -32,26 +32,6 @@ } } public bool IsEnterCrossServer { get { bool isFuncOpen = FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.CrossServer); bool isOpenDay = TimeUtility.OpenDay >= crossServerModel.afterOpenDayOpenCross; if(!isFuncOpen) { SysNotifyMgr.Instance.ShowTip("FuncLimit_Level"); return false; } if(!isOpenDay) { SysNotifyMgr.Instance.ShowTip("CrossMatching15", crossServerModel.afterOpenDayOpenCross); return false; } return true; } } public class PkZoneInfo { public int ZoneID { get; private set; } // 赛区ID @@ -157,6 +137,31 @@ } } public bool IsEnterCrossServer(bool isTip = false) { bool isFuncOpen = FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.CrossServer); bool isOpenDay = TimeUtility.OpenDay >= crossServerModel.afterOpenDayOpenCross; if (!isFuncOpen) { if(isTip) { SysNotifyMgr.Instance.ShowTip("FuncLimit_Level"); } return false; } if (!isOpenDay) { if (isTip) { SysNotifyMgr.Instance.ShowTip("CrossMatching15", crossServerModel.afterOpenDayOpenCross); } return false; } return true; } public void UpdatePkSeason(HC004_tagGCCrossRealmPKSeasonInfo pkSeason) { inDateNotify = false; System/Dungeon/TargetBriefInfoWin.cs
@@ -238,6 +238,7 @@ return; } m_ContainerBoss.gameObject.SetActive(true); m_BossLifeBar.Show(_hp, _maxHp); } @@ -281,6 +282,7 @@ return; } m_ContainerPlayer.gameObject.SetActive(true); m_PlayerLifeBar.Show(_hp, _maxHp); } System/Login/CrossServerLogin.cs
@@ -1,271 +1,300 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using System; namespace Snxxz.UI { public class CrossServerLogin : Singleton<CrossServerLogin> { bool m_Busy = false; public bool busy { get { return m_Busy; } set { m_Busy = value; } } public bool reconnectBackGround { get; set; } int reLoginTime = 0; Clock loginOverTimeClock; public CrossServerOneVsOne oneVsOnePlayerData { get; private set; } LoginModel loginModel { get { return ModelCenter.Instance.GetModel<LoginModel>(); } } public void Init() { SnxxzGame.Instance.AddApplicationOutAction(OnApplicationOut); } public void UnInit() { SnxxzGame.Instance.RemoveApplicationOutAction(OnApplicationOut); } public string ipBuf { get; private set; } public int portBuf { get; private set; } public int gamePortBuf { get; private set; } public string accountBuf { get; private set; } public string passwordBuf { get; private set; } public void UpdateCrossServerOneVsOneData(HC001_tagGCCrossRealmPKMatchOK matchOK) { oneVsOnePlayerData = new CrossServerOneVsOne() { roomId = matchOK.RoomID, waitForLoginCrossServer = true, validTimeLimited = Time.time + 30f, autoEnsureTime = Time.time + 3f, myName = matchOK.PlayerName, myJob = PlayerDatas.Instance.baseData.Job, myBornPoint = matchOK.Number, opponentName = matchOK.MatchPlayer[0].PlayerName, opponentJob = matchOK.MatchPlayer[0].Job, opponentMaxHp = (int)matchOK.MatchPlayer[0].MaxHP, opponentLevel = (int)matchOK.MatchPlayer[0].LV, opponentPlayerId = (int)matchOK.MatchPlayer[0].PlayerID, MaxProDef = (int)matchOK.MatchPlayer[0].MaxProDef, }; Clock.Create(DateTime.Now + new TimeSpan(5 * TimeSpan.TicksPerSecond), () => { if (oneVsOnePlayerData.waitForLoginCrossServer) { CrossServerOneVsOneLogin(); } }); } public void CrossServerOneVsOneLogin() { var loginModel = ModelCenter.Instance.GetModel<LoginModel>(); var account = loginModel.accountBuf; var ip = GameNetSystem.Instance.crossServerData.ip; var port = GameNetSystem.Instance.crossServerData.port; WindowCenter.Instance.Open<LoadingWin>(); oneVsOnePlayerData = oneVsOnePlayerData.SetWaitForLoginCrossServer(false); AccountLogin(account, ip, port, false); } public bool IsEnterCrossServerPreparing() { return oneVsOnePlayerData.IsCrossServerOneVsOneEntering(); } public void AccountLogin(string account, string ip, int gamePort, bool reconnectBackGround) { if (Application.internetReachability == NetworkReachability.NotReachable) { ConfirmCancel.ShowPopConfirm( Language.Get("Mail101"), Language.Get("L1116"), () => { } ); return; } if (busy) { return; } busy = true; reLoginTime = 0; try { this.reconnectBackGround = reconnectBackGround; accountBuf = account; ipBuf = ip; gamePortBuf = gamePort; if (loginOverTimeClock != null) { loginOverTimeClock.Stop(); } loginOverTimeClock = Clock.Create(DateTime.Now + new TimeSpan(15 * TimeSpan.TicksPerSecond), ProcessLoginFailure); GameNetSystem.Instance.BeginConnectCrossServer(ipBuf, gamePortBuf, OnGameServerConnected); NetLinkWin.Show(); } catch (Exception ex) { Debug.Log(ex); busy = false; } } public void ReAccountLogin() { if (busy) { return; } busy = true; try { if (loginOverTimeClock != null) { loginOverTimeClock.Stop(); } loginOverTimeClock = Clock.Create(DateTime.Now + new TimeSpan(15 * TimeSpan.TicksPerSecond), ProcessLoginFailure); GameNetSystem.Instance.BeginConnectCrossServer(ipBuf, gamePortBuf, OnGameServerConnected); NetLinkWin.Show(); } catch (Exception ex) { Debug.Log(ex); busy = false; } } private void OnGameServerConnected(bool ok) { if (ok) { var sendInfo = new C0123_tagCClientPackVersion(); sendInfo.Version = LoginModel.DwVersionNo; GameNetSystem.Instance.SendToCrossServer(sendInfo); } else { busy = false; } } public void AccessLogin(H0101_tagServerPrepared _serverInfo) { GameNetSystem.Instance.SendToCrossServer(loginModel.Get0101SendPackage(_serverInfo)); // 登录 NetLinkWin.Show(); } public void CheckClientVersion() { var sendInfo = new C010D_tagCClientVersion(); sendInfo.Version = "10.1000.1"; GameNetSystem.Instance.SendToCrossServer(sendInfo); NetLinkWin.Show(); } public void OnGetPlayerLoginInfo(byte _type) { NetLinkWin.Hide(); busy = false; if (Application.internetReachability == NetworkReachability.NotReachable) { ConfirmCancel.ShowPopConfirm( Language.Get("Mail101"), Language.Get("L1116"), () => { } ); return; } GameNetSystem.Instance.crossServerConnected_Loigc = true; var tagCRoleLoginAsk = new C0108_tagCRoleLoginAsk(); tagCRoleLoginAsk.Type = (byte)_type;//进入游戏 tagCRoleLoginAsk.ClientID = SDKUtility.Instance.RegistrationID; GameNetSystem.Instance.SendToCrossServer(tagCRoleLoginAsk); NetLinkWin.Show(); if (loginOverTimeClock != null) { loginOverTimeClock.Stop(); } } private void ProcessLoginFailure() { if (reLoginTime < 1) { busy = false; reLoginTime++; ReAccountLogin(); } else { ExceptionCatcher.ReportException("登录跨服出现异常", StringUtility.Contact("角色:", PlayerDatas.Instance.baseData.PlayerName)); var sendInfo = new CC003_tagCGForceQuitCrossState(); GameNetSystem.Instance.SendInfo(sendInfo); loginModel.ReAccountLogin(); } } private void OnApplicationOut() { var sendInfo = new C0103_tagCPlayerLogOut(); sendInfo.Type = 1; GameNetSystem.Instance.SendToCrossServer(sendInfo); } } public struct CrossServerOneVsOne { public int roomId; public bool waitForLoginCrossServer; public float autoEnsureTime; public float validTimeLimited; public string myName; public int myJob; public int myBornPoint;//1-左;2-右 public int opponentPlayerId; public string opponentName; public int opponentJob; public int opponentLevel; public int opponentMaxHp; using System.Collections; using System.Collections.Generic; using UnityEngine; using System; namespace Snxxz.UI { public class CrossServerLogin : Singleton<CrossServerLogin> { bool m_Busy = false; public bool busy { get { return m_Busy; } set { m_Busy = value; } } public bool reconnectBackGround { get; set; } int reLoginTime = 0; Clock loginOverTimeClock; float lastLoginTime = 0f; int reLoginTimes = 0; public CrossServerOneVsOne oneVsOnePlayerData { get; private set; } LoginModel loginModel { get { return ModelCenter.Instance.GetModel<LoginModel>(); } } public void Init() { SnxxzGame.Instance.AddApplicationOutAction(OnApplicationOut); } public void UnInit() { SnxxzGame.Instance.RemoveApplicationOutAction(OnApplicationOut); } public string ipBuf { get; private set; } public int portBuf { get; private set; } public int gamePortBuf { get; private set; } public string accountBuf { get; private set; } public string passwordBuf { get; private set; } public void UpdateCrossServerOneVsOneData(HC001_tagGCCrossRealmPKMatchOK matchOK) { oneVsOnePlayerData = new CrossServerOneVsOne() { roomId = matchOK.RoomID, waitForLoginCrossServer = true, validTimeLimited = Time.time + 30f, autoEnsureTime = Time.time + 3f, myName = matchOK.PlayerName, myJob = PlayerDatas.Instance.baseData.Job, myBornPoint = matchOK.Number, opponentName = matchOK.MatchPlayer[0].PlayerName, opponentJob = matchOK.MatchPlayer[0].Job, opponentMaxHp = (int)matchOK.MatchPlayer[0].MaxHP, opponentLevel = (int)matchOK.MatchPlayer[0].LV, opponentPlayerId = (int)matchOK.MatchPlayer[0].PlayerID, MaxProDef = (int)matchOK.MatchPlayer[0].MaxProDef, }; Clock.Create(DateTime.Now + new TimeSpan(5 * TimeSpan.TicksPerSecond), () => { if (oneVsOnePlayerData.waitForLoginCrossServer) { CrossServerOneVsOneLogin(); } }); } public void CrossServerOneVsOneLogin() { var loginModel = ModelCenter.Instance.GetModel<LoginModel>(); var account = loginModel.accountBuf; var ip = GameNetSystem.Instance.crossServerData.ip; var port = GameNetSystem.Instance.crossServerData.port; WindowCenter.Instance.Open<LoadingWin>(); oneVsOnePlayerData = oneVsOnePlayerData.SetWaitForLoginCrossServer(false); AccountLogin(account, ip, port, false); } public bool IsEnterCrossServerPreparing() { return oneVsOnePlayerData.IsCrossServerOneVsOneEntering(); } public void AccountLogin(string account, string ip, int gamePort, bool reconnectBackGround) { if (Application.internetReachability == NetworkReachability.NotReachable) { ConfirmCancel.ShowPopConfirm( Language.Get("Mail101"), Language.Get("L1116"), () => { } ); return; } if (busy) { return; } busy = true; if (Time.time - lastLoginTime < 15) { reLoginTimes++; if (reLoginTimes > 2) { ProcessLoginFailure(); return; } } else { reLoginTimes = 0; } lastLoginTime = Time.time; try { this.reconnectBackGround = reconnectBackGround; accountBuf = account; ipBuf = ip; gamePortBuf = gamePort; StopLoginOverTimeProcess(); loginOverTimeClock = Clock.Create(DateTime.Now + new TimeSpan(15 * TimeSpan.TicksPerSecond), () => { busy = false; ReAccountLogin(); }); GameNetSystem.Instance.BeginConnectCrossServer(ipBuf, gamePortBuf, OnGameServerConnected); NetLinkWin.Show(); } catch (Exception ex) { Debug.Log(ex); busy = false; } } public void ReAccountLogin() { if (busy) { return; } busy = true; if (Time.time - lastLoginTime < 15) { reLoginTimes++; if (reLoginTimes > 2) { ProcessLoginFailure(); return; } } else { reLoginTimes = 0; } lastLoginTime = Time.time; try { StopLoginOverTimeProcess(); loginOverTimeClock = Clock.Create(DateTime.Now + new TimeSpan(15 * TimeSpan.TicksPerSecond), () => { busy = false; ReAccountLogin(); }); GameNetSystem.Instance.BeginConnectCrossServer(ipBuf, gamePortBuf, OnGameServerConnected); NetLinkWin.Show(); } catch (Exception ex) { Debug.Log(ex); busy = false; } } public void StopLoginOverTimeProcess() { if (loginOverTimeClock != null) { loginOverTimeClock.Stop(); } loginOverTimeClock = null; } private void OnGameServerConnected(bool ok) { if (ok) { var sendInfo = new C0123_tagCClientPackVersion(); sendInfo.Version = LoginModel.DwVersionNo; GameNetSystem.Instance.SendToCrossServer(sendInfo); } else { busy = false; } } public void AccessLogin(H0101_tagServerPrepared _serverInfo) { GameNetSystem.Instance.SendToCrossServer(loginModel.Get0101SendPackage(_serverInfo)); // 登录 NetLinkWin.Show(); } public void CheckClientVersion() { var sendInfo = new C010D_tagCClientVersion(); sendInfo.Version = "10.1000.1"; GameNetSystem.Instance.SendToCrossServer(sendInfo); NetLinkWin.Show(); } public void OnGetPlayerLoginInfo(byte _type) { NetLinkWin.Hide(); busy = false; if (Application.internetReachability == NetworkReachability.NotReachable) { ConfirmCancel.ShowPopConfirm( Language.Get("Mail101"), Language.Get("L1116"), () => { } ); return; } GameNetSystem.Instance.crossServerConnected_Loigc = true; var tagCRoleLoginAsk = new C0108_tagCRoleLoginAsk(); tagCRoleLoginAsk.Type = (byte)_type;//进入游戏 tagCRoleLoginAsk.ClientID = SDKUtility.Instance.RegistrationID; GameNetSystem.Instance.SendToCrossServer(tagCRoleLoginAsk); NetLinkWin.Show(); } private void ProcessLoginFailure() { busy = false; ExceptionCatcher.ReportException("登录跨服出现异常", StringUtility.Contact("角色:", PlayerDatas.Instance.baseData.PlayerName)); var sendInfo = new CC003_tagCGForceQuitCrossState(); GameNetSystem.Instance.SendInfo(sendInfo); Clock.Create(DateTime.Now + new TimeSpan(2 * TimeSpan.TicksPerSecond), () => { loginModel.ReAccountLogin(); }); } private void OnApplicationOut() { var sendInfo = new C0103_tagCPlayerLogOut(); sendInfo.Type = 1; GameNetSystem.Instance.SendToCrossServer(sendInfo); } } public struct CrossServerOneVsOne { public int roomId; public bool waitForLoginCrossServer; public float autoEnsureTime; public float validTimeLimited; public string myName; public int myJob; public int myBornPoint;//1-左;2-右 public int opponentPlayerId; public string opponentName; public int opponentJob; public int opponentLevel; public int opponentMaxHp; public int MaxProDef;// 最大护盾 public CrossServerOneVsOne SetWaitForLoginCrossServer(bool waitForLoginCrossServer) { this.waitForLoginCrossServer = waitForLoginCrossServer; return this; } public bool IsCrossServerOneVsOneEntering() { return autoEnsureTime > Time.time; } } } public CrossServerOneVsOne SetWaitForLoginCrossServer(bool waitForLoginCrossServer) { this.waitForLoginCrossServer = waitForLoginCrossServer; return this; } public bool IsCrossServerOneVsOneEntering() { return autoEnsureTime > Time.time; } } } System/Message/RichTableEvent.cs
@@ -381,11 +381,13 @@ var _id = 0; if (_dict.ContainsKey("id") && int.TryParse(_dict["id"], out _id)) { var config = Config.Instance.Get<CrossServerArenaConfig>(_id); if (config != null) var text = RichTextMgr.Inst.presentRichText; int colorType = 0; if (text != null) { return config.Name; colorType = text.colorType == RichText.ColorType.Dark ? 0 : 1; } return UIHelper.AppendDanLVNameColor(_id, colorType == 1); } } break; System/Strengthening/InlaidPanel.cs
@@ -477,7 +477,8 @@ } _gemEquipCell.count.text = cell.info.Value.infoStr1; _gemEquipCell.bind.gameObject.SetActive(cell.info.Value.infoInt3 == 1); _gemEquipCell.redpoint.gameObject.SetActive(model.GetHoleRedpoint(model.presentGemHole - 1) _gemEquipCell.redpoint.gameObject.SetActive(IsBestGem(cfg.ID, m_GemItems) && model.GetHoleRedpoint(model.presentGemHole - 1) && model.CheckEquipHole(model.presentGemEquip, model.presentGemHole - 1, cfg.ID)); } } @@ -653,6 +654,21 @@ m_GemItems.Sort(Compare); } bool IsBestGem(int itemId, List<ItemModel> list) { var config = Config.Instance.Get<ItemConfig>(itemId); for (int i = 0; i < list.Count; i++) { var compareItem = list[i]; var compareConfig = Config.Instance.Get<ItemConfig>(compareItem.itemId); if (compareConfig.EffectValueB1 > config.EffectValueB1) { return false; } } return true; } private int Compare(ItemModel x, ItemModel y) { ItemConfig cfgx = Config.Instance.Get<ItemConfig>((int)x.itemInfo.ItemID); System/WindowJump/WindowJumpMgr.cs
@@ -1015,7 +1015,7 @@ case JumpUIType.CrossServerOneVsOne277: case JumpUIType.CrossServerOneVsOne278: case JumpUIType.CrossServerOneVsOne279: if(!CrossServerOneVsOnePKSeason.Instance.IsEnterCrossServer) if(!CrossServerOneVsOnePKSeason.Instance.IsEnterCrossServer(true)) { return false; } Utility/UIHelper.cs
@@ -474,6 +474,34 @@ return Color.white; } public static string AppendDanLVNameColor(int danLv, bool bright = false) { var crossDanLVConfig = Config.Instance.Get<CrossServerArenaConfig>(danLv); if (crossDanLVConfig == null) { return string.Empty; } var name = crossDanLVConfig.Name; switch (crossDanLVConfig.DanType) { case 0: return StringUtility.Contact("<color=#", bright ? "666666" : "dddddd", ">", name, "</color>"); case 1: return StringUtility.Contact("<color=#", bright ? "9460ff" : "7999ff", ">", name, "</color>"); case 2: return StringUtility.Contact("<color=#", bright ? "0066ff" : "00c6ff", ">", name, "</color>"); case 3: return StringUtility.Contact("<color=#", bright ? "00b337" : "66ff00", ">", name, "</color>"); case 4: return StringUtility.Contact("<color=#", bright ? "ff6600" : "ff9000", ">", name, "</color>"); case 5: return StringUtility.Contact("<color=#", bright ? "ff0000" : "ff0000", ">", name, "</color>"); case 6: return StringUtility.Contact("<color=#", bright ? "ff00f6" : "f000ff", ">", name, "</color>"); } return name; } public static Color GetUIColor(int itemColor, bool bright = false) { switch (itemColor)