Core/GameEngine/Model/Config/RealmConfig.cs
@@ -1,6 +1,6 @@ //-------------------------------------------------------- // [Author]: Fish // [ Date ]: 2024年12月30日 // [ Date ]: 2024年12月31日 //-------------------------------------------------------- using System.Collections.Generic; @@ -24,9 +24,6 @@ public readonly long expLimit; public readonly string Img; public readonly int Quality; public readonly int FightPower; public readonly int effectId; public readonly int requireIconEffect; public readonly Dictionary<int, int[]> LearnSkillIDInfo; public readonly int AddFreePoint; public readonly int EquipLV; @@ -87,17 +84,11 @@ int.TryParse(tables[10],out Quality); int.TryParse(tables[11],out FightPower); LearnSkillIDInfo = ConfigParse.ParseIntArrayDict(tables[11]); int.TryParse(tables[12],out effectId); int.TryParse(tables[12],out AddFreePoint); int.TryParse(tables[13],out requireIconEffect); LearnSkillIDInfo = ConfigParse.ParseIntArrayDict(tables[14]); int.TryParse(tables[15],out AddFreePoint); int.TryParse(tables[16],out EquipLV); int.TryParse(tables[13],out EquipLV); } catch (Exception ex) { Core/GameEngine/Model/TelPartialConfig/RealmLVUPTaskConfig.cs
@@ -6,6 +6,8 @@ { //境界:任务ID:索引id private static Dictionary<int, Dictionary<int, int>> missionDict = new Dictionary<int, Dictionary<int, int>>(); //境界:BOSSID static Dictionary<int, int> realmBossDict = new Dictionary<int, int>(); public void OnConfigParseCompleted() { @@ -14,6 +16,10 @@ missionDict.Add(Lv, new Dictionary<int, int>()); } missionDict[Lv][TaskID] = ID; if (TaskType == 6) { realmBossDict[Lv] = NeedValueList[0]; } } public static int GetID(int realmLV, int taskID) @@ -34,7 +40,21 @@ list.Sort(); return list; } return list; } public static int GetBossID(int realmLV) { if (realmBossDict.ContainsKey(realmLV)) { return realmBossDict[realmLV]; } return 0; } public static bool IsRealmBoss(int npcID) { return realmBossDict.ContainsValue(npcID); } } System/Equip/EquipModel.cs
@@ -11,6 +11,7 @@ { public static readonly List<int> realmEquipTypes = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; public static readonly int[] equipShowPlaces = new int[] { 1, 2, 4}; //展示外观的装备位 public static readonly int[] equip8Places = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; //8件套装备位 public int showedUnLockLevel { get { return LocalSave.GetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "EquipSetUnLockHasShowed"), 1); } set { LocalSave.SetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "EquipSetUnLockHasShowed"), value); } System/FindPrecious/FindPreciousModel.cs
@@ -287,9 +287,9 @@ public bool IsSameBigRealmStageBoss(int bossId) { var myRealmLevel = PlayerDatas.Instance.baseData.realmLevel; var myRealmStage = realmModel.GetRealmStage(myRealmLevel); var myRealmStage = RealmConfig.Get(myRealmLevel).LvLarge; var config = NPCConfig.Get(bossId); var bossRealmStage = realmModel.GetRealmStage(config.Realm); var bossRealmStage = RealmConfig.Get(config.Realm).LvLarge; return myRealmStage == bossRealmStage; } System/MainInterfacePanel/LowSettingTip.cs
@@ -19,7 +19,7 @@ [SerializeField] Button _Rune1Btn;//符印按钮 [SerializeField] Button _SetUp1Btn;//设置按钮 [SerializeField] Button _Jingjie1Btn;//设置按钮 [SerializeField] Button _Jingjie1Btn;//境界按钮 [SerializeField] Button _RankingListBtn;//排行榜按钮 [SerializeField] Button _Strengthen1Btn;//强化按钮 @@ -216,7 +216,6 @@ void Jingjie1Button() { MainPositionTween.SetRecoverToSkillTimer(); WindowCenter.Instance.Open<RealmWin>(); } System/Realm/RealmAnimationBehaviour.cs
@@ -103,75 +103,75 @@ public void DisplayLevelUp(int index) { //StartCoroutine(Co_DisplayLevelUp(index)); StartCoroutine(Co_DisplayLevelUp(index)); } //IEnumerator Co_DisplayLevelUp(int index) //{ // if (index >= m_EffectLines.Length) // { // yield break; // } IEnumerator Co_DisplayLevelUp(int index) { if (index >= m_EffectLines.Length) { yield break; } // isPlayingAnimation = true; isPlayingAnimation = true; // if (m_EffectBoss.IsPlaying) // { // if (m_EffectBase.target != null) // { // var obj = m_EffectBase.target.transform.Find("GameObject/b/b (3)"); // if (obj != null) // { // obj.SetActive(true); // } // } // } // m_EffectBoss.StopImediatly(); if (m_EffectBoss.IsPlaying) { if (m_EffectBase.target != null) { var obj = m_EffectBase.target.transform.Find("GameObject/b/b (3)"); if (obj != null) { obj.SetActive(true); } } } m_EffectBoss.StopImediatly(); // StartLine(index); StartLine(index); // m_EffectLevelUp.StopImediatly(); // var config = RealmConfig.Get(model.displayRealmLevel - 1); // var levelUpEffectId = config.BossID != 0 ? 7037 : 7038; // m_EffectLevelUp.effect = levelUpEffectId; // m_EffectLevelUp.Play(); // var effectTime = config.BossID != 0 ? m_SpecialLevelUpEffectTime : m_NormalLevelUpEffectTime; // if (config.BossID != 0) // { // yield return WaitingForSecondConst.GetWaitForSeconds(m_CoverChangeTime); // if (onCoverChange != null) // { // onCoverChange(); // } // yield return WaitingForSecondConst.GetWaitForSeconds(effectTime - m_CoverChangeTime); // } // else // { // yield return WaitingForSecondConst.GetWaitForSeconds(effectTime); // } // yield return WaitingForSecondConst.WaitMS500; m_EffectLevelUp.StopImediatly(); var config = RealmConfig.Get(model.displayRealmLevel - 1); var levelUpEffectId = config.Lv % 4 == 0 ? 7037 : 7038; m_EffectLevelUp.effect = levelUpEffectId; m_EffectLevelUp.Play(); var effectTime = config.Lv % 4 == 0 ? m_SpecialLevelUpEffectTime : m_NormalLevelUpEffectTime; if (config.Lv % 4 == 0) { yield return WaitingForSecondConst.GetWaitForSeconds(m_CoverChangeTime); if (onCoverChange != null) { onCoverChange(); } yield return WaitingForSecondConst.GetWaitForSeconds(effectTime - m_CoverChangeTime); } else { yield return WaitingForSecondConst.GetWaitForSeconds(effectTime); } // if (index == 3 && model.displayRealmLevel < model.realmMaxLevel) // { // StartRotate(); // } yield return WaitingForSecondConst.WaitMS500; // if (model.SatisfyChallengeBoss(model.displayRealmLevel)) // { // StartBossEffectShow(); // model.SetBossEffectShow(model.displayRealmLevel); // yield return WaitingForSecondConst.WaitMS3000; // } if (index == 3 && model.displayRealmLevel < model.realmMaxLevel) { StartRotate(); } // isPlayingAnimation = false; if (model.SatisfyChallengeBoss()) { StartBossEffectShow(); model.SetBossEffectShow(model.displayRealmLevel); yield return WaitingForSecondConst.WaitMS3000; } // if (onLevelUpComplete != null) // { // onLevelUpComplete(); // } //} isPlayingAnimation = false; if (onLevelUpComplete != null) { onLevelUpComplete(); } } RealmStageBehaviour GetRealmStageBeha(int index) { System/Realm/RealmBossShow.cs
@@ -82,7 +82,7 @@ IsOpen = true; transform.localPosition = Vector3.zero; var config = RealmConfig.Get(realmLv); m_Effect = SFXPlayUtility.Instance.Play(config.effectId, transform); m_Effect = SFXPlayUtility.Instance.Play(4003, transform); m_Effect.duration = 0; m_Effect.transform.localPosition = Vector3.zero; LayerUtility.SetLayer(m_Effect.gameObject, LayerUtility.BossShow, true); System/Realm/RealmBriefBehaviour.cs
@@ -21,10 +21,6 @@ [SerializeField] List<RealmMissionCell> missionObjs; RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } } OffLineOnHookModel onHookModel { get { return ModelCenter.Instance.GetModel<OffLineOnHookModel>(); } } public void Display() { @@ -85,7 +81,8 @@ else { unLockEffect.text = ""; unLockEffectBtn.gameObject.SetActive(false); unLockEffectBtn.SetActive(false); unLockEffectBtn.RemoveAllListeners(); } //unLockEffectShowAllBtn.AddListener(); System/Realm/RealmHeartMagicBehaviour.cs
@@ -40,14 +40,14 @@ void DisplayBase() { var config = RealmConfig.Get(realmLevel); var fightPower = PlayerDatas.Instance.baseData.FightPoint; var satisfy = fightPower >= (ulong)config.FightPower; var bossFightPower = NPCExConfig.Get( RealmLVUPTaskConfig.GetBossID(realmLevel)).SuppressFightPower; var satisfy = fightPower >= (ulong)bossFightPower; var label = UIHelper.AppendColor(satisfy ? TextColType.LightGreen : TextColType.Red, fightPower.ToString()); m_FightPower.text = StringUtility.Contact(UIHelper.AppendColor(TextColType.LightGreen, Language.Get("RolePromoteBetterFight")), label, "/", config.FightPower); //var npcConfig = NPCConfig.Get(config.BossID); //m_BossName.text = npcConfig.charName; Language.Get("RolePromoteBetterFight")), label, "/", bossFightPower); var npcConfig = NPCConfig.Get(RealmLVUPTaskConfig.GetBossID(realmLevel)); m_BossName.text = npcConfig.charName; } IEnumerator Co_DisplayBoss() @@ -58,28 +58,28 @@ void DisplayBoss() { // var config = RealmConfig.Get(realmLevel); // m_RawBoss.SetActive(true); // UI3DModelExhibition.Instance.ShowNPC(m_RawBoss, new UI3DNPCExhibitionData() // { // gray = false, // isDialogue = false, // npcId = config.BossID, // }); m_RawBoss.SetActive(true); int bossID = RealmLVUPTaskConfig.GetBossID(realmLevel); UI3DModelExhibition.Instance.ShowNPC(m_RawBoss, new UI3DNPCExhibitionData() { gray = false, isDialogue = false, npcId = bossID, }); // var npcConfig = NPCConfig.Get(config.BossID); var npcConfig = NPCConfig.Get(bossID); // var npcModel = UI3DModelExhibition.Instance.NpcModelPet; // if (npcModel != null) // { // var animator = npcModel.GetComponentInChildren<Animator>(); // if (animator != null) // { // var runtimeController = AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerRealmSuffix, npcConfig.MODE); // animator.runtimeAnimatorController = runtimeController; // animator.Play(State_EnterHash, 0); // } // } var npcModel = UI3DModelExhibition.Instance.NpcModelPet; if (npcModel != null) { var animator = npcModel.GetComponentInChildren<Animator>(); if (animator != null) { var runtimeController = AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerRealmSuffix, npcConfig.MODE); animator.runtimeAnimatorController = runtimeController; animator.Play(State_EnterHash, 0); } } } public void Dispose() System/Realm/RealmLevelUpBehaviour.cs
@@ -8,72 +8,59 @@ { public class RealmLevelUpBehaviour : MonoBehaviour { [SerializeField] Transform m_ContainerCondition; [SerializeField] RealmUpCondition m_LevelCondition; [SerializeField] RealmUpCondition m_BossCondition; [SerializeField] RealmEquipCondition m_EquipCondition; [SerializeField] Transform m_ContainerCost; [SerializeField] ItemBehaviour m_Item; [SerializeField] Text m_RequireRealmLevel; [SerializeField] Text m_RealmLevel; [SerializeField] Button m_LevelUp; int realmLevel = 0; [SerializeField] IntensifySmoothSlider ExpSlider; [SerializeField] Text m_ExpText; RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } } PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } private void Awake() { m_LevelUp.AddListener(OnLevelUp); PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefreshEvent; PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent; } public void Display(int realmLevel) public void Display() { this.realmLevel = realmLevel; var currentRealmLevel = model.displayRealmLevel; var isNext = realmLevel == currentRealmLevel + 1; m_ContainerCondition.SetActive(isNext); m_ContainerCost.SetActive(isNext); m_LevelUp.SetActive(isNext); m_RequireRealmLevel.SetActive(!isNext); //RealmLV1 如 55级 筑基后期 · 12阶 //L1091 {0}阶 //LoadIconLV {0}级 var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel); var beforeConfig = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel - 1); int newRankLV = PlayerDatas.Instance.baseData.LV - beforeConfig.LVMax; m_RealmLevel.text = Language.Get("RealmLV1", Language.Get("LoadIconLV", PlayerDatas.Instance.baseData.LV), config.Name, Language.Get("L1091", UIHelper.ChineseNumber(newRankLV))); if (isNext) { DisplayCondition(); } else { var config = RealmConfig.Get(realmLevel - 1); m_RequireRealmLevel.text = Language.Get("RealmLevelUpRequire", config.Img); } } public void DisplayCondition() { var config = RealmConfig.Get(realmLevel - 1); m_LevelCondition.DisplayLevel(realmLevel - 1); m_EquipCondition.SetActive(model.HasEquipCondition(realmLevel - 1)); if (model.HasEquipCondition(realmLevel - 1)) { m_EquipCondition.DisplayLevel(realmLevel - 1); } ulong totalExp = (ulong)PlayerDatas.Instance.baseData.TotalExp + (ulong)PlayerDatas.Instance.baseData.ExpPoint * Constants.ExpPointValue; ulong maxExp = (ulong)PlayerLVConfig.GetExpByPlayerLv(PlayerDatas.Instance.baseData.LV); ExpSlider.value = (float)totalExp / maxExp; m_ExpText.text = StringUtility.Contact(UIHelper.ReplaceLargeNumEx(totalExp), "/", UIHelper.ReplaceLargeNumEx(maxExp)); m_LevelUp.SetActive(PlayerDatas.Instance.baseData.realmLevel < model.realmMaxLevel); } private void OnLevelUp() { var error = 0; int error; if (model.TryLevelUp(out error)) { var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel); //LimitedTimeLuxuryGiftModel.Instance.IsItemIdShow(23, config.NeedGood, config.NeedNum, 1, 0); CA523_tagCMRealmLVUp pak = new CA523_tagCMRealmLVUp(); GameNetSystem.Instance.SendInfo(pak); } else { DisplayErrorTip(error); //根据任务引导 if (error < 100) { model.RealMissionGuide(error); } else { DisplayErrorTip(error); } } } @@ -82,115 +69,33 @@ { switch (error) { case 1: case 101: SysNotifyMgr.Instance.ShowTip("RealmMissionAward"); break; case 102: SysNotifyMgr.Instance.ShowTip("RealmLevelUpError_1"); model.RealMissionGuide(1); break; case 2: case 103: SysNotifyMgr.Instance.ShowTip("RealmLevelUpError_2"); model.RealMissionGuide(1); break; case 3: //var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel); //ItemTipUtility.Show(config.NeedGood); break; case 4: model.realmUpgrateNoEnoughReason = 1; WindowCenter.Instance.Open<RealmRecommandEquipWin>(); break; case 5: model.realmUpgrateNoEnoughReason = 2; WindowCenter.Instance.Open<RealmRecommandEquipWin>(); break; } } } [Serializable] public class RealmUpCondition { [SerializeField] Transform m_Container; [SerializeField] Text m_Condition; [SerializeField] Text m_Progress; RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } } public void DisplayLevel(int realmLevel) private void PlayerDataRefreshEvent(PlayerDataType dataType) { var config = RealmConfig.Get(realmLevel); m_Condition.text = Language.Get("RealmConditionLevel", config.LVMax); var level = PlayerDatas.Instance.baseData.LV; var satisfy = level >= config.LVMax; m_Progress.text = StringUtility.Contact(level, "/", config.LVMax); m_Progress.color = satisfy ? UIHelper.s_LightGreen : UIHelper.s_DarkRedColor; } public void DisplayBoss(int realmLevel) { var config = RealmConfig.Get(realmLevel + 1); var label = UIHelper.GetRealmColorByLv(realmLevel + 1, StringUtility.Contact("[", config.Name, "]")); m_Condition.text = Language.Get("RealmConditionBoss", label); var progress = model.isBossPass ? 1 : 0; m_Progress.text = StringUtility.Contact(progress, "/", 1); m_Progress.color = model.isBossPass ? UIHelper.s_LightGreen : UIHelper.s_DarkRedColor; } public void SetActive(bool active) { m_Container.SetActive(active); } } [Serializable] public class RealmEquipCondition { [SerializeField] Transform m_Container; [SerializeField] Text m_Condition; [SerializeField] Text m_Progress; [SerializeField] Text[] m_EquipPlaceNames; readonly Color s_Gray = new Color32(189, 189, 189, 255); RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } } EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } public void DisplayLevel(int realmLevel) { RealmLevelUpEquipCondition equipCondition; if (model.TryGetRealmEquipCondition(realmLevel, out equipCondition)) if (dataType == PlayerDataType.RealmLevel || dataType == PlayerDataType.LV || dataType == PlayerDataType.TotalExp) { var equipSet = equipModel.GetEquipSet(equipCondition.level); var realmConfig = RealmConfig.Get(equipSet.realm); if (!equipCondition.isSuit) { var colorName = UIHelper.GetColorNameByItemColor(equipCondition.itemColor); m_Condition.text = Language.Get("RealmNeedEquipCondition_1", realmConfig.Name, colorName, equipCondition.starLevel, 8); } else { m_Condition.text = Language.Get("RealmNeedEquipCondition_2", realmConfig.Name, equipCondition.starLevel, 8); } List<int> notSatisfyPlaces; model.SatisfyEquipCondition(model.equipNeedConfig, out notSatisfyPlaces); var progress = 8 - notSatisfyPlaces.Count; for (int i = 0; i < m_EquipPlaceNames.Length; i++) { var place = i + 1; m_EquipPlaceNames[i].text = UIHelper.GetEquipPlaceName(place); bool satisfy = !notSatisfyPlaces.Contains(place); m_EquipPlaceNames[i].color = satisfy ? UIHelper.s_LightGreen : s_Gray; } m_Progress.text = StringUtility.Contact(progress, "/", 8); m_Progress.color = progress >= 8 ? UIHelper.s_LightGreen : UIHelper.s_DarkRedColor; Display(); } } public void SetActive(bool active) { m_Container.SetActive(active); } } } System/Realm/RealmMissionCell.cs
@@ -115,10 +115,19 @@ else if (state == 0) { WindowCenter.Instance.Close<RealmWin>(); if (model.realMissionGuides.ContainsKey(type)) if (type == 5) { model.realmUpgrateNoEnoughReason = 2; WindowCenter.Instance.Open<RealmRecommandEquipWin>(); } else if (model.realMissionGuides.ContainsKey(type)) { NewBieCenter.Instance.StartNewBieGuideEx(model.realMissionGuides[type]); } if (type == 4) { LimitedTimeLuxuryGiftModel.Instance.IsItemIdShow(23, RealmModel.BreakRealmPill, config.NeedValueList[0], 1, 0); } } }); } System/Realm/RealmModel.cs
@@ -8,13 +8,10 @@ { public class RealmModel : Model, IPlayerLoginOk, IBeforePlayerDataInitialize { Dictionary<int, Dictionary<int, int>> m_RealmProperties = new Dictionary<int, Dictionary<int, int>>(); Dictionary<int, Dictionary<int, int[]>> m_RealmPreviewEquips = new Dictionary<int, Dictionary<int, int[]>>(); //Dictionary<int, RealmLevelUpEquipCondition> m_RealmEquipConditions = new Dictionary<int, RealmLevelUpEquipCondition>(); Dictionary<int, Dictionary<int, int[]>> m_RecommandEquips = new Dictionary<int, Dictionary<int, int[]>>(); //List<List<int>> m_RealmStages = new List<List<int>>(); Dictionary<int, Dictionary<int, int[]>> m_RealmPreviewEquips = new Dictionary<int, Dictionary<int, int[]>>(); //境界预览装备用于解锁 Dictionary<int, Dictionary<int, int[]>> m_RecommandEquips = new Dictionary<int, Dictionary<int, int[]>>(); //推荐装备用于任务完成 List<List<int>> m_RealmStages = new List<List<int>>(); public int realmMaxLevel { get; private set; } public int realmPoolOpenLevel { get; private set; } public bool isBossPass { get; private set; } public int realmExpTime { get; private set; } public long startExp { get; private set; } @@ -23,54 +20,7 @@ public uint buffSeconds { get; private set; } public int realmUpgrateNoEnoughReason = 0; //境界提升不足提示 1。换装备,2 升星 public long totalExp { get { if (PlayerDatas.Instance.baseData.realmLevel < realmPoolOpenLevel) { return startExp; } float exp = startExp; var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel); if (exp >= config.expLimit) { return config.expLimit; } var tick = (TimeUtility.ServerNow - expStartTime).Ticks; var singleTick = realmExpTime * TimeSpan.TicksPerSecond; var times = tick / singleTick; float expRate = config.expRate; long buffTimes = 0; if (buffSeconds > 0) { var buffTick = buffSeconds * TimeSpan.TicksPerSecond; var buffTicks = tick > buffTick ? buffTick : tick; buffTimes = buffTicks / singleTick; } if (buffTimes > 0) { var rate = expRate + expRate * (buffAddRate / 10000f); exp += rate * buffTimes; } var normalTimes = times - buffTimes; if (normalTimes > 0) { exp += expRate * normalTimes; } exp = exp > config.expLimit ? config.expLimit : exp; return (long)exp; } } public DateTime expStartTime { get; private set; } @@ -93,9 +43,6 @@ public readonly Redpoint levelUpRedpoint = new Redpoint(114, 11401); public readonly Redpoint challengeRedpoint = new Redpoint(114, 11402); //public readonly Redpoint realmPoolRedpoint = new Redpoint(114, 11403); public readonly Redpoint realmDailyRedpoint = new Redpoint(114, 11404); public readonly Redpoint xxzlRedpoint = new Redpoint(114, 11405); public readonly Redpoint towerRedpoint = new Redpoint(114, 11406); int m_SelectRealm = 0; @@ -223,78 +170,25 @@ void ParseConfig() { realmMaxLevel = 0; //List<int> stages = new List<int>(); //m_RealmStages.Add(stages); List<int> stages = new List<int>(); var configs = RealmConfig.GetValues(); foreach (var config in configs) { // if (config.Lv > realmMaxLevel) // { // realmMaxLevel = config.Lv; // } // if (config.AddAttrType != null && config.AddAttrType.Length > 0) // { // Dictionary<int, int> dict = new Dictionary<int, int>(); // for (int i = 0; i < config.AddAttrType.Length; i++) // { // dict.Add(config.AddAttrType[i], config.AddAttrNum[i]); // } // m_RealmProperties.Add(config.Lv, dict); // } // if (config.Lv != 0) // { // stages.Add(config.Lv); // if (config.BossID != 0) // { // stages = new List<int>(); // m_RealmStages.Add(stages); // } // } //if (!string.IsNullOrEmpty(config.equips)) //{ // var json = LitJson.JsonMapper.ToObject(config.equips); // Dictionary<int, int[]> dict = new Dictionary<int, int[]>(); // foreach (var jobKey in json.Keys) // { // var job = int.Parse(jobKey); // var equipArray = LitJson.JsonMapper.ToObject<int[]>(json[jobKey].ToJson()); // dict.Add(job, equipArray); // } // m_RealmPreviewEquips.Add(config.Lv, dict); //} //if (!string.IsNullOrEmpty(config.recommandEquips)) //{ // var json = LitJson.JsonMapper.ToObject(config.recommandEquips); // Dictionary<int, int[]> dict = new Dictionary<int, int[]>(); // foreach (var jobKey in json.Keys) // { // var job = int.Parse(jobKey); // var equipArray = LitJson.JsonMapper.ToObject<int[]>(json[jobKey].ToJson()); // dict.Add(job, equipArray); // } // m_RecommandEquips.Add(config.Lv, dict); //} if (realmPoolOpenLevel == 0 && config.expRate != 0) if (config.Lv > realmMaxLevel) { realmPoolOpenLevel = config.Lv; realmMaxLevel = config.Lv; } //if (config.NeedEquip != null && config.NeedEquip.Length > 1) //{ // m_RealmEquipConditions.Add(config.Lv, new RealmLevelUpEquipCondition() // { // level = config.NeedEquip[0], // starLevel = config.NeedEquip[1], // isSuit = config.NeedEquip[2] == 1, // itemColor = config.NeedEquip.Length > 3 ? config.NeedEquip[3] : 0, // }); //} if (config.Lv != 0) { if (config.Lv == config.LvLarge) { stages = new List<int>(); m_RealmStages.Add(stages); } stages.Add(config.Lv); } } var funcConfig = FuncConfigConfig.Get("RealmExpTime"); @@ -305,19 +199,15 @@ } public bool TryGetRealmProperty(int level, out Dictionary<int, int> propertyDict) { return m_RealmProperties.TryGetValue(level, out propertyDict); } public bool TryGetRealmStages(int index, out List<int> stages) { stages = null; //if (index < m_RealmStages.Count) //{ // stages = m_RealmStages[index]; // return true; //} if (index < m_RealmStages.Count) { stages = m_RealmStages[index]; return true; } return false; } @@ -352,16 +242,39 @@ return true; } public bool TryGetRecommandEquips(int level, int job, out int[] equips) public bool TryGetRecommandEquips(int level, int job, int itemColor, out int[] equips) { equips = null; if (m_RecommandEquips.ContainsKey(level)) { return m_RecommandEquips[level].TryGetValue(job, out equips); } if (!m_RecommandEquips.ContainsKey(level)) { m_RecommandEquips[level] = new Dictionary<int, int[]>(); } if (!m_RecommandEquips[level].ContainsKey(job)) { m_RecommandEquips[level].Add(job, new int[3]); } for (int i = 0; i < EquipModel.equip8Places.Length; i++) { int place = EquipModel.equip8Places[i]; var config = ItemConfig.GetEquipConfig(level, place, itemColor, job); if (config != null) { m_RecommandEquips[level][job][i] = config.ID; } } equips = m_RecommandEquips[level][job]; return false; } //从任务条件获取 public bool TryGetRealmEquipCondition(int level, out RealmLevelUpEquipCondition equipCondition) { equipCondition = new RealmLevelUpEquipCondition(); @@ -369,42 +282,56 @@ return false; } //境界任务完成后才可以渡劫,否则点击渡劫按任务顺序做引导 public bool TryLevelUp(out int error) { error = 0; error = 100; //小于100的错误码是任务引导 var missions = RealmLVUPTaskConfig.GetMissionIDs(PlayerDatas.Instance.baseData.realmLevel); bool hasAward = false; //是否有奖励可领取 for (int i = 0; i < missions.Count; i++) { int missionID = missions[i]; int state = GetMissionState(PlayerDatas.Instance.baseData.realmLevel, missionID); if (state == 0) { var id = RealmLVUPTaskConfig.GetID(PlayerDatas.Instance.baseData.realmLevel, missionID); error = RealmLVUPTaskConfig.Get(id).TaskType; return false; } if (state == 1) { hasAward = true; } } if (hasAward) { error = 101; return false; } var realmLevel = PlayerDatas.Instance.baseData.realmLevel; if (realmLevel >= realmMaxLevel) { error = 100; return false; } var config = RealmConfig.Get(realmLevel); if (PlayerDatas.Instance.baseData.LV < config.LVMax) { error = 1; error = 102; return false; } //if (config.BossID != 0 && !isBossPass) //{ // error = 2; // return false; //} //int equipError = 0; //if (!SatisfyEquipCondition(realmLevel, out equipError)) //{ // error = equipError; // return false; //} //if (config.NeedGood != 0) //{ // var count = packModel.GetItemCountByID(PackType.Item, config.NeedGood); // if (count < config.NeedNum) // { // error = 3; // return false; // } //} //需要满经验 ulong totalExp = (ulong)PlayerDatas.Instance.baseData.TotalExp + (ulong)PlayerDatas.Instance.baseData.ExpPoint * Constants.ExpPointValue; ulong maxExp = (ulong)PlayerLVConfig.GetExpByPlayerLv(PlayerDatas.Instance.baseData.LV); if (totalExp < maxExp) { error = 103; return false; } return true; } @@ -557,27 +484,31 @@ return false; } //大境界索引(m_RealmStages) public int GetRealmStage(int realmLevel) { if (realmLevel == 0) { return 0; } //for (int i = 0; i < m_RealmStages.Count; i++) //{ // var stages = m_RealmStages[i]; // var index = stages.IndexOf(realmLevel); // if (index != -1) // { // if (stages.Count == 1) // { // return i - 1; // } // return i; // } //} //return m_RealmStages.Count - 1; return 0; for (int i = 0; i < m_RealmStages.Count; i++) { var stages = m_RealmStages[i]; var index = stages.IndexOf(realmLevel); if (index != -1) { if (stages.Count == 1) { //最后一大境界 return i - 1; } return i; } } //最后一大境界 return m_RealmStages.Count - 1; } public int GetRealmStageEffect(int realmLevel) @@ -646,13 +577,20 @@ LocalSave.SetBool(StringUtility.Contact("RealmBossEffect_", realmLevel, "_", playerId), true); } public bool SatisfyChallengeBoss(int reamLevel) public bool SatisfyChallengeBoss() { //var config = RealmConfig.Get(reamLevel); //if (config != null) //{ // return config.BossID != 0 && !isBossPass && PlayerDatas.Instance.baseData.LV >= config.NeedLV; //} //有BOSS任务并且 未通关 if (RealmLVUPTaskConfig.GetBossID(PlayerDatas.Instance.baseData.realmLevel) == 0) return false; var missionIDs = RealmLVUPTaskConfig.GetMissionIDs(PlayerDatas.Instance.baseData.realmLevel); foreach (var missionID in missionIDs) { var id = RealmLVUPTaskConfig.GetID(PlayerDatas.Instance.baseData.realmLevel, missionID); //未挑战成功 if (GetMissionProcess(id) == 0) return true; } return false; } @@ -665,45 +603,7 @@ public void TryPushRealmPoolMessage() { return; var remainTime = 0f; var realmLevel = PlayerDatas.Instance.baseData.realmLevel; var config = RealmConfig.Get(realmLevel); if (realmLevel >= realmPoolOpenLevel && config.expRate != 0) { if (totalExp < config.expLimit) { float surplusExp = config.expLimit - totalExp; if (buffSeconds > 0) { var expRate = config.expRate + config.expRate * (buffAddRate / 10000f); var times = buffSeconds / realmExpTime; if (times * expRate >= surplusExp) { remainTime = Mathf.CeilToInt(surplusExp / expRate) * realmExpTime; surplusExp = 0; } else { remainTime = times * realmExpTime; surplusExp = surplusExp - times * expRate; } } if (surplusExp > 0) { remainTime += Mathf.CeilToInt(surplusExp / config.expRate) * realmExpTime; } } } if (remainTime > 0f) { var json = pushModel.GetPushJsonData(11403, (int)remainTime, Language.Get("RealmPoolGeTui_Title"), Language.Get("RealmPoolGeTui_Content")); pushModel.SendPushInfo(json); } else { pushModel.RemovePushInfo(11403); } } @@ -843,25 +743,11 @@ WindowCenter.Instance.Open<RealmTransitionWin>(); } public void SetDayRemind() { if (realmDailyRedpoint.state == RedPointState.Simple) { DayRemind.Instance.SetDayRemind(DayRemind.DAILYREALMREDPOINT, true); RefreshRedpoint(); } } void RefreshRedpoint() { var levelUpable = false; var challengeable = false; var dailyRedpointable = false; levelUpRedpoint.state = RedPointState.None; challengeRedpoint.state = RedPointState.None; realmDailyRedpoint.state = RedPointState.None; towerRedpoint.state = RedPointState.None; @@ -870,26 +756,13 @@ var realmLevel = PlayerDatas.Instance.baseData.realmLevel; if (realmLevel < realmMaxLevel) { var config = RealmConfig.Get(realmLevel); if (SatisfyChallengeBoss(realmLevel)) { challengeable = PlayerDatas.Instance.baseData.FightPoint >= (ulong)config.FightPower; } var error = 0; int error; if (TryLevelUp(out error)) { levelUpable = true; } } if (realmLevel >= realmPoolOpenLevel) { if (!DayRemind.Instance.GetDayRemind(DayRemind.DAILYREALMREDPOINT)) { dailyRedpointable = true; } } if (GetErrorOfChallenge() == 0) { @@ -898,124 +771,10 @@ } levelUpRedpoint.state = levelUpable ? RedPointState.Simple : RedPointState.None; challengeRedpoint.state = challengeable ? RedPointState.Simple : RedPointState.None; realmDailyRedpoint.state = dailyRedpointable ? RedPointState.Simple : RedPointState.None; //RefreshRealmPoolRedpoint(); } //void RefreshRealmPoolRedpoint() //{ // var isPoolFull = false; // if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Realm)) // { // var realmLevel = PlayerDatas.Instance.baseData.realmLevel; // if (realmLevel >= realmPoolOpenLevel) // { // var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel); // if (totalExp >= config.expLimit * (realmPoolRedpointPercent / 100f)) // { // isPoolFull = true; // } // } // } // realmPoolRedpoint.state = isPoolFull ? RedPointState.Simple : RedPointState.None; //} //#region 修仙之路 //public int selectXXZL; ////任务完成进度 //public bool IsRealmXXZLMissionFinish(int missionID, out int process) //{ // var config = RealmXXZLConfig.Get(missionID); // bool isFinish = false; // process = 0; // switch (config.TaskType) // { // case 1: // isFinish = treasureModel.IsTreasureCollected(config.NeedValue); // process = isFinish ? 1 : 0; // break; // case 2: // process = ModelCenter.Instance.GetModel<SkyTowerModel>().highestPassFloor; // isFinish = process >= config.NeedValue; // break; // case 3: // process = ModelCenter.Instance.GetModel<WorldBossModel>().killCntTotal; // isFinish = process >= config.NeedValue; // break; // case 4: // process = (int)ModelCenter.Instance.GetModel<DailyQuestModel>().ActivityPlaceInfo.TotalCount; // isFinish = process >= config.NeedValue; // break; // case 5: // isFinish = ModelCenter.Instance.GetModel<PersonalBossModel>().IsFBPass(config.NeedValue); // process = isFinish ? 1 : 0; // break; // case 6: // process = ModelCenter.Instance.GetModel<DungeonModel>().GetAllEnterTimes(60010); // isFinish = process >= config.NeedValue; // break; // case 7: // process = ModelCenter.Instance.GetModel<ReikiRootModel>().GetReikiRootTotalPointWithFree(); // isFinish = process >= config.NeedValue; // break; // } // return isFinish; //} //public int GetXXZLProcess() //{ // var ids = RealmXXZLConfig.GetKeys(); // int process = 0; // foreach (var id in ids) // { // if (IsGetAward(int.Parse(id))) // { // process++; // } // } // return process; //} //public bool IsGetAward(int missionID) //{ // return (xxzlAwardState & (int)Math.Pow(2, missionID)) != 0; //} //public void FocusSelectIndex() //{ // var ids = RealmXXZLConfig.GetKeys(); // int index = -1; // foreach (var id in ids) // { // int missionID = int.Parse(id); // int process; // var state = IsGetAward(missionID); // bool isFinish = IsRealmXXZLMissionFinish(missionID, out process); // if (!state && isFinish) // { // selectXXZL = missionID - 1; // return; // } // else if (!state && !isFinish && index == -1) // { // index = missionID - 1; // } // } // selectXXZL = index; //} //#endregion #region 境界塔 public void RequestChallenge() @@ -1166,12 +925,23 @@ return 0; } //public int GetMissionType(int realm, int missionID) //{ // var id = RealmLVUPTaskConfig.GetID(realm, missionID); // var config = RealmLVUPTaskConfig.Get(id); // return config.TaskType; //} public void RealMissionGuide(int type) { if (type != 6) WindowCenter.Instance.Close<RealmWin>(); if (type == 5) { realmUpgrateNoEnoughReason = 2; WindowCenter.Instance.Open<RealmRecommandEquipWin>(); } else if (realMissionGuides.ContainsKey(type)) { NewBieCenter.Instance.StartNewBieGuideEx(realMissionGuides[type]); } } #endregion } System/Realm/RealmNewEquipWin.cs
@@ -69,6 +69,10 @@ void Display() { var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel); //XT_JJZB_1 m_EquipName.SetSprite(StringUtility.Contact("XT_JJZB_" + config.EquipLV)); var job = PlayerDatas.Instance.baseData.Job; int[] equips = null; model.TryGetRealmPreviewEquips(functionOrder, job, out equips); System/Realm/RealmPoolBehaviour.cs
File was deleted System/Realm/RealmPoolBehaviour.cs.meta
File was deleted System/Realm/RealmPromoteWin.cs
@@ -27,7 +27,7 @@ [SerializeField] Transform m_CloseRemind; public static int realmLevel = 0; int realmLevel = 0; static Dictionary<int, int> propertys = new Dictionary<int, int>(); @@ -47,6 +47,7 @@ protected override void OnPreOpen() { realmLevel = PlayerDatas.Instance.baseData.realmLevel; timer = 0f; m_CloseRemind.SetActive(false); Dispaly(); System/Realm/RealmRecommandEquipWin.cs
@@ -73,7 +73,7 @@ List<int> notSatisfyPlaces; int[] recommandEquips; if (!model.SatisfyEquipCondition(model.equipNeedConfig, out notSatisfyPlaces) && model.TryGetRecommandEquips(realmLevel, PlayerDatas.Instance.baseData.Job, out recommandEquips)) && model.TryGetRecommandEquips(realmLevel, PlayerDatas.Instance.baseData.Job, model.equipNeedConfig.NeedValueList[3], out recommandEquips)) { for (int i = 0; i < m_Items.Length; i++) { System/Realm/RealmStageBehaviour.cs
@@ -10,11 +10,8 @@ public class RealmStageBehaviour : MonoBehaviour { [SerializeField] Image m_RealmIcon; [SerializeField] Transform m_ContainerSelect; [SerializeField] Image m_SelectIcon; [SerializeField] UIEffect m_Effect; [SerializeField] UIEffect m_PracticeEffect; [SerializeField] Button m_Select; public int realmLevel { get; private set; } @@ -22,10 +19,6 @@ RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } } private void Awake() { m_Select.AddListener(OnSelect); } public void Display(int _realmLv) { @@ -35,7 +28,6 @@ model.selectRealmRefresh += SelectRealmRefresh; DisplayBase(); DisplaySelect(); DisplayPracticeEffect(); DisplayEffect(false); } @@ -46,19 +38,11 @@ m_RealmIcon.SetSprite(config.Img); } void DisplaySelect() { m_ContainerSelect.SetActive(model.selectRealm == realmLevel); if (model.selectRealm == realmLevel) { var config = RealmConfig.Get(realmLevel); m_SelectIcon.SetSprite(StringUtility.Contact("RealmSelectBottom_", config.Quality)); } } void DisplayPracticeEffect() { if (model.displayRealmLevel + 1 == realmLevel) if (model.displayRealmLevel == realmLevel) { if (!m_PracticeEffect.IsPlaying) { @@ -111,13 +95,12 @@ private void SelectRealmRefresh() { DisplaySelect(); DisplayPracticeEffect(); } private void OnSelect() { model.selectRealm = realmLevel; //model.selectRealm = realmLevel; } } } System/Realm/RealmTakeExpWin.cs
File was deleted System/Realm/RealmTakeExpWin.cs.meta
File was deleted System/Realm/RealmWin.cs
@@ -28,10 +28,8 @@ [SerializeField] UIEffect m_EffectBoss; [SerializeField] UIEffect m_EffectBase; [SerializeField] Button towerBtn; [SerializeField] RealmLevelUpBehaviour m_RealmUP; [SerializeField] Transform m_RealmContainer; [SerializeField] IntensifySmoothSlider ExpSlider; int cacheRealmLevel = 0; @@ -109,8 +107,6 @@ cacheRealmLevel = PlayerDatas.Instance.baseData.realmLevel; model.SetDayRemind(); } private void Model_RealmMissionRefreshEvent() @@ -160,22 +156,14 @@ m_ContainerRealmUp.SetActive(true); model.displayRealms.Clear(); var realmLevel = PlayerDatas.Instance.baseData.realmLevel; if (realmLevel < model.realmMaxLevel) { model.selectRealm = realmLevel + 1; } else { model.selectRealm = realmLevel; } model.selectRealm = PlayerDatas.Instance.baseData.realmLevel; DisplayRealmLevelUp(); DisplayRealmStages(); DisplayRealmBrief(); DisplayCover(); if (model.SatisfyChallengeBoss(model.displayRealmLevel)) if (model.SatisfyChallengeBoss()) { if (!model.GetBossEffectShow(model.displayRealmLevel)) { @@ -235,48 +223,15 @@ void DisplayRealmLevelUp() { m_GotoBoss.SetActive(model.SatisfyChallengeBoss(model.displayRealmLevel)); m_GotoBoss.SetActive(model.SatisfyChallengeBoss()); } void DisplayRealmBrief() { m_RealmBrief.Display(); m_RealmUP.Display(); } //void DisplayUnlockEquip() //{ // if (model.displayRealmLevel < model.realmEquipDisplayLevel) // { // return; // } // var stage = model.GetRealmStage(model.displayRealmLevel); // List<int> realms = null; // if (model.TryGetRealmStages(stage, out realms)) // { // for (int i = 0; i < REALM_STAGE_COUNT; i++) // { // var level = realms[0] + i; // var equipSet = 0; // if (model.displayRealmLevel < level && model.selectRealm != level // && model.IsUnlockEquipRealm(level, out equipSet)) // { // var index = i; // foreach (var realmStage in m_RealmStages) // { // if (realmStage.animIndex == index) // { // var worldpos = realmStage.transform.TransformPoint(Vector2.zero + Vector2.down * 60); // var localpos = m_ContainerRealmUp.InverseTransformPoint(worldpos); // break; // } // } // var config = RealmConfig.Get(level); // break; // } // } // } //} void DisplayCover() { @@ -290,7 +245,7 @@ else { var config = RealmConfig.Get(model.displayRealmLevel); var isBossExist = model.SatisfyChallengeBoss(model.displayRealmLevel); var isBossExist = model.SatisfyChallengeBoss(); if (isBossExist) { return; @@ -310,7 +265,7 @@ { bool requireBossEffect = false; m_EffectBoss.StopImediatly(); if (model.SatisfyChallengeBoss(model.displayRealmLevel)) if (model.SatisfyChallengeBoss()) { requireBossEffect = true; m_EffectBoss.Play(); @@ -341,11 +296,15 @@ if (!model.displayRealms.Contains(realmLevel)) { model.displayRealms.Add(realmLevel); if (model.displayRealms.Count == 1) { TryStartAnimation(); } //if (model.displayRealms.Count == 1) //{ // TryStartAnimation(); //} WindowCenter.Instance.Open<RealmPromoteWin>(); } m_RealmBrief.Display(); } else if (dataType == PlayerDataType.LV) { @@ -353,7 +312,7 @@ { return; } if (model.SatisfyChallengeBoss(model.displayRealmLevel) if (model.SatisfyChallengeBoss() && !model.GetBossEffectShow(model.displayRealmLevel)) { model.SetBossEffectShow(model.displayRealmLevel); @@ -369,7 +328,7 @@ if (cacheRealmLevel > model.displayRealmLevel || stage > currentStage + 1) { model.displayRealms.Clear(); model.selectRealm = PlayerDatas.Instance.baseData.realmLevel + 1; model.selectRealm = PlayerDatas.Instance.baseData.realmLevel; DisplayRealmStages(); DisplayCover(); DisplayEffectBoss(); @@ -405,8 +364,8 @@ } } RealmPromoteWin.realmLevel = model.displayRealmLevel; WindowCenter.Instance.Open<RealmPromoteWin>(); //RealmPromoteWin.realmLevel = model.displayRealmLevel; //WindowCenter.Instance.Open<RealmPromoteWin>(); if (model.displayRealms.Count > 0) { model.displayRealms.RemoveAt(0); @@ -416,22 +375,18 @@ private void OnLevelUpComplete() { model.selectRealm = model.displayRealmLevel; if (model.displayRealmLevel == model.realmMaxLevel) { model.selectRealm = model.displayRealmLevel; DisplayRealmLevelUp(); } else { model.selectRealm = model.displayRealmLevel + 1; } DisplayCover(); if (!m_RealmAnimation.rotating) { RealmPromoteWin.realmLevel = model.displayRealmLevel; WindowCenter.Instance.Open<RealmPromoteWin>(); //RealmPromoteWin.realmLevel = model.displayRealmLevel; //WindowCenter.Instance.Open<RealmPromoteWin>(); if (model.displayRealms.Count > 0) { model.displayRealms.RemoveAt(0); @@ -444,26 +399,30 @@ { if (window is RealmPromoteWin) { var equipLevel = 0; if (model.IsUnlockEquipRealm(RealmPromoteWin.realmLevel, out equipLevel)) { WindowCenter.Instance.Open<RealmNewEquipWin>(false, equipLevel); } else { if (model.displayRealms.Count > 0) { TryStartAnimation(); } } } if (window is RealmNewEquipWin) { //var equipLevel = 0; //if (model.IsUnlockEquipRealm(RealmPromoteWin.realmLevel, out equipLevel)) //{ // WindowCenter.Instance.Open<RealmNewEquipWin>(false, equipLevel); //} //else //{ // if (model.displayRealms.Count > 0) // { // TryStartAnimation(); // } //} if (model.displayRealms.Count > 0) { TryStartAnimation(); } } //if (window is RealmNewEquipWin) //{ // if (model.displayRealms.Count > 0) // { // TryStartAnimation(); // } //} } public void OnBossAppearComplete() @@ -476,6 +435,7 @@ } } private void OnCoverChange() { var id = model.GetRealmCoverEffect(model.displayRealmLevel + 1); UI/Common/UI3DModelFactory.cs
@@ -91,7 +91,7 @@ var animator = model.GetComponent<Animator>(); if (animator != null) { //ResetRealmBossAnimator(id, animator); ResetRealmBossAnimator(id, animator); animator.enabled = false; } @@ -111,26 +111,21 @@ } } //private static void ResetRealmBossAnimator(int _id, Animator animator) //{ // var configs = RealmConfig.GetValues(); // var index = configs.FindIndex((x) => // { // return x.BossID == _id; // }); // if (index != -1) // { // var npcConfig = NPCConfig.Get(_id); // if (npcConfig != null) // { // var runtimeController = AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerSuffix, npcConfig.MODE); // if (runtimeController != null) // { // animator.runtimeAnimatorController = runtimeController; // } // } // } //} private static void ResetRealmBossAnimator(int _id, Animator animator) { if (RealmLVUPTaskConfig.IsRealmBoss(_id)) { var npcConfig = NPCConfig.Get(_id); if (npcConfig != null) { var runtimeController = AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerSuffix, npcConfig.MODE); if (runtimeController != null) { animator.runtimeAnimatorController = runtimeController; } } } } public static GameObject LoadUIHorse(int id) { Utility/UIHelper.cs
@@ -21,6 +21,49 @@ public static readonly string no_breaking_space = "\u00A0"; //Text文本框输入空格自动换行问题 替换编码 //不需要提取翻译的文本 private static readonly string[] numbers = new string[] { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" }; private static readonly string[] units = new string[] { "十", "百", "千", "万" }; //数字转中文(只做小数字),海外版本调用改函数切换版本请直接返回数字 public static string ChineseNumber(int number) { if (number == 0) return numbers[0]; string result = ""; int unitPlace = 1; // 位数,1 表示十位,2 表示百位,3 表示千位,4 表示万位 bool needZero = false; // 是否需要添加 '零' while (number > 0) { int part = number % 10; if (part != 0) { if (needZero) result = StringUtility.Contact(numbers[0] + result); result = numbers[part] + (unitPlace == 1 ? "" : units[unitPlace - 2]) + result; // 单位只在十、百、千、万内部使用 needZero = false; } else { needZero = true; } number /= 10; unitPlace++; } if (result.StartsWith("一十")) { result = result.Substring(1); } return result; } #region UI通用 public static void SetIconWithMoneyType(this Image _image, int moneyType) { @@ -342,6 +385,31 @@ } } // 转化大数值带单位的显示,如果小于200000则显示原值,否则显示大数值 public static string ReplaceLargeNumEx(double num) { if (num < 200000) { //根据界面的显示假定值 200000,可根据实际情况调整 return GetNumFormat(num); } else { return ReplaceLargeNum(num); } } //显示最多两位小数,并按地区显示格式 // 如中文用F2 显示 1111.34,英文用N2 显示 1,111.34(带逗号) public static string GetNumFormat(double num) { if (num == (int)num) { return num.ToString("F0"); } return num.ToString("F2").TrimEnd('0').TrimEnd('.'); } public static float ReplacePercentage(float num, int isPer, int decimals = 1) {