| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Tuesday, September 12, 2017 |
| | | //-------------------------------------------------------- |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using TableConfig; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class DungeonVictoryWin : Window |
| | | { |
| | | [SerializeField] protected Transform m_ContainerPoivt; |
| | | [SerializeField, Header("通关时间")] Transform m_ContainerPassTime; |
| | | [SerializeField] Text m_PassTime; |
| | | [SerializeField, Header("经验")] protected Transform m_ContainerExp; |
| | | [SerializeField] Text m_Experience; |
| | | [SerializeField, Header("金钱")] protected Transform m_ContainerMoney; |
| | | [SerializeField] Text m_Money; |
| | | [SerializeField, Header("精华")] protected Transform m_ContainerEssence; |
| | | [SerializeField] Text m_Essence; |
| | | [SerializeField, Header("魔晶")] protected Transform m_ContainerMagicEssence; |
| | | [SerializeField] Text m_MagicEssence; |
| | | [SerializeField, Header("退出按钮")] ButtonEx m_Exit; |
| | | [SerializeField] protected Text m_ExitTimer; |
| | | [SerializeField, Header("评级")] GameObject m_GradeBottom; |
| | | [SerializeField] Image m_Grade; |
| | | [SerializeField, Header("杀怪数量")] protected Transform m_ContainerKillMonster; |
| | | [SerializeField] Text m_KillMonsterCnt; |
| | | [SerializeField, Header("新记录")] protected Transform m_ContainerNewRecord; |
| | | [SerializeField] Text m_Record; |
| | | [SerializeField, Header("Sp")] protected Transform m_ContainerSP; |
| | | [SerializeField] Text m_SP; |
| | | [SerializeField, Header("物品奖励")] protected Transform m_ContainerReward; |
| | | [SerializeField] protected ItemBehaviour m_SpecialItemCollect; |
| | | [SerializeField] protected DungeonRewardItem[] passRewardBehaviours; |
| | | [SerializeField] protected ScaleTween[] m_RewardTweens; |
| | | |
| | | protected DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } |
| | | |
| | | protected float timer = 0f; |
| | | |
| | | protected List<int> m_RewardIndexs = new List<int>(); |
| | | |
| | | private List<ServerItem> m_RewardSorts = new List<ServerItem>(); |
| | | |
| | | #region Built-in |
| | | protected override void BindController() |
| | | { |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | m_Exit.AddListener(ExitDungeon); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | timer = 0f; |
| | | if (m_ContainerMagicEssence != null) |
| | | { |
| | | m_ContainerMagicEssence.gameObject.SetActive(false); |
| | | } |
| | | if (m_ContainerEssence != null) |
| | | { |
| | | m_ContainerEssence.gameObject.SetActive(false); |
| | | } |
| | | if (m_ContainerMoney != null) |
| | | { |
| | | m_ContainerMoney.gameObject.SetActive(false); |
| | | } |
| | | if (m_ContainerReward != null) |
| | | { |
| | | m_ContainerReward.gameObject.SetActive(false); |
| | | } |
| | | if (m_ContainerNewRecord != null) |
| | | { |
| | | m_ContainerNewRecord.gameObject.SetActive(false); |
| | | } |
| | | if (m_ContainerKillMonster != null) |
| | | { |
| | | m_ContainerKillMonster.gameObject.SetActive(false); |
| | | } |
| | | if (m_ContainerPoivt != null) |
| | | { |
| | | m_ContainerPoivt.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnActived() |
| | | { |
| | | base.OnActived(); |
| | | var config = ConfigManager.Instance.GetTemplate<DungeonOpenTimeConfig>(dungeonModel.dungeonResult.dataMapID); |
| | | StartCoroutine(Co_DelayDisplay(config.DelayTime * 0.001f)); |
| | | } |
| | | #endregion |
| | | |
| | | protected override void LateUpdate() |
| | | { |
| | | base.LateUpdate(); |
| | | |
| | | if (!m_ExitTimer.gameObject.activeInHierarchy) |
| | | { |
| | | m_ExitTimer.gameObject.SetActive(true); |
| | | } |
| | | |
| | | timer -= Time.deltaTime; |
| | | if (timer < 0f) |
| | | { |
| | | timer += 0.5f; |
| | | var endTime = dungeonModel.GetDungeonCoolDownEndTime(DungeonCoolDownType.LeaveMap); |
| | | var seconds = (endTime - DateTime.Now).TotalSeconds; |
| | | DrawExitTimer((int)seconds); |
| | | } |
| | | } |
| | | |
| | | private void ExitDungeon() |
| | | { |
| | | dungeonModel.ExitCurrentDungeon(); |
| | | } |
| | | |
| | | protected virtual void DrawExitTimer(int seconds) |
| | | { |
| | | m_ExitTimer.text = Language.Get("DungeonVictoryWin_Btn_Exit_1", Mathf.Clamp(seconds, 0, int.MaxValue)); |
| | | } |
| | | |
| | | protected virtual void DrawItemRewards() |
| | | { |
| | | var merged = false; |
| | | var serveritems = dungeonModel.dungeonResult.itemInfo; |
| | | var hasReward = (serveritems != null && serveritems.Length > 0) || dungeonModel.specialItemCollectRecord.count > 0; |
| | | |
| | | m_ContainerReward.gameObject.SetActive(hasReward); |
| | | |
| | | m_RewardSorts.Clear(); |
| | | if (serveritems != null) |
| | | { |
| | | m_RewardSorts.AddRange(serveritems); |
| | | int _mapid = dungeonModel.GetDungeonDataIdByMapId(PlayerDatas.Instance.baseData.MapID); |
| | | if (_mapid == 60010 || _mapid == 31130) |
| | | { |
| | | m_RewardSorts.Sort(CompareTrialItemIndex); |
| | | } |
| | | } |
| | | |
| | | m_RewardIndexs.Clear(); |
| | | if (m_RewardTweens != null && m_RewardTweens.Length > 0) |
| | | { |
| | | for (int i = 0; i < m_RewardTweens.Length; i++) |
| | | { |
| | | m_RewardTweens[i].SetEndState(); |
| | | } |
| | | } |
| | | if (m_RewardSorts.Count > 0) |
| | | { |
| | | var items = new List<ItemModel>(); |
| | | for (int i = 0; i < m_RewardSorts.Count; i++) |
| | | { |
| | | var serverItem = m_RewardSorts[i]; |
| | | var itemModel = new ItemModel(PackType.rptItem); |
| | | var itemInfo = new ItemInfo(); |
| | | itemInfo.ItemID = serverItem.ItemID; |
| | | |
| | | if (!merged && itemInfo.ItemID == dungeonModel.specialItemCollectRecord.id) |
| | | { |
| | | itemInfo.ItemCount = serverItem.Count + dungeonModel.specialItemCollectRecord.count; |
| | | merged = true; |
| | | } |
| | | else |
| | | { |
| | | itemInfo.ItemCount = serverItem.Count; |
| | | } |
| | | itemInfo.IsBind = serverItem.IsBind; |
| | | itemInfo.IsSuite = serverItem.IsSuite; |
| | | itemInfo.UserData = serverItem.UserData; |
| | | |
| | | itemModel.SetItemModel(itemInfo); |
| | | items.Add(itemModel); |
| | | } |
| | | |
| | | for (int i = 0; i < passRewardBehaviours.Length; i++) |
| | | { |
| | | var behaviour = passRewardBehaviours[i]; |
| | | if (i < items.Count) |
| | | { |
| | | behaviour.transform.parent.gameObject.SetActive(true); |
| | | behaviour.gameObject.SetActive(false); |
| | | behaviour.serverItem = m_RewardSorts[i]; |
| | | behaviour.Init(items[i]); |
| | | m_RewardIndexs.Add(m_SpecialItemCollect == null ? i : i + 1); |
| | | } |
| | | else |
| | | { |
| | | behaviour.transform.parent.gameObject.SetActive(false); |
| | | behaviour.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | if (m_SpecialItemCollect != null) |
| | | { |
| | | if (!merged && dungeonModel.specialItemCollectRecord.count > 0) |
| | | { |
| | | m_SpecialItemCollect.transform.parent.gameObject.SetActive(true); |
| | | m_SpecialItemCollect.gameObject.SetActive(false); |
| | | m_SpecialItemCollect.SetItem(dungeonModel.specialItemCollectRecord); |
| | | m_RewardIndexs.Insert(0, 0); |
| | | } |
| | | else |
| | | { |
| | | m_SpecialItemCollect.transform.parent.gameObject.SetActive(false); |
| | | m_SpecialItemCollect.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (m_RewardIndexs.Count > 0 && m_RewardTweens != null && m_RewardTweens.Length > 0) |
| | | { |
| | | PlayRewardTween(0); |
| | | } |
| | | } |
| | | |
| | | protected virtual void PlayRewardTween(int _playIndex) |
| | | { |
| | | if (_playIndex < m_RewardIndexs.Count) |
| | | { |
| | | var _index = m_RewardIndexs[_playIndex]; |
| | | if (_index < m_RewardTweens.Length) |
| | | { |
| | | m_RewardTweens[_index].SetStartState(); |
| | | m_RewardTweens[_index].gameObject.SetActive(true); |
| | | m_RewardTweens[_index].Play(() => |
| | | { |
| | | _playIndex += 1; |
| | | PlayRewardTween(_playIndex); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected virtual void DrawPassGrade() |
| | | { |
| | | if (m_Grade != null) |
| | | { |
| | | var grade = dungeonModel.dungeonResult.grade; |
| | | if (grade > 0) |
| | | { |
| | | m_GradeBottom.SetActive(true); |
| | | switch (grade) |
| | | { |
| | | case 5: |
| | | m_Grade.SetSprite("Remark_S"); |
| | | m_Grade.SetNativeSize(); |
| | | break; |
| | | case 4: |
| | | m_Grade.SetSprite("Remark_A"); |
| | | m_Grade.SetNativeSize(); |
| | | break; |
| | | case 3: |
| | | m_Grade.SetSprite("Remark_B"); |
| | | m_Grade.SetNativeSize(); |
| | | break; |
| | | case 2: |
| | | m_Grade.SetSprite("Remark_C"); |
| | | m_Grade.SetNativeSize(); |
| | | break; |
| | | case 1: |
| | | m_Grade.SetSprite("Remark_D"); |
| | | m_Grade.SetNativeSize(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | m_Grade.SetNativeSize(); |
| | | } |
| | | else |
| | | { |
| | | m_GradeBottom.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | protected virtual void DrawNewRecord() |
| | | { |
| | | if (dungeonModel.dungeonResult.upPer > 0) |
| | | { |
| | | m_ContainerNewRecord.gameObject.SetActive(true); |
| | | m_Record.text = Language.Get("FairyLand_Func26", dungeonModel.dungeonResult.upPer); |
| | | } |
| | | else |
| | | { |
| | | m_ContainerNewRecord.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | protected virtual void DrawKillMonster() |
| | | { |
| | | if (dungeonModel.dungeonResult.npcTotal > 0) |
| | | { |
| | | m_ContainerKillMonster.gameObject.SetActive(true); |
| | | m_KillMonsterCnt.text = dungeonModel.dungeonResult.npcTotal.ToString(); |
| | | } |
| | | else |
| | | { |
| | | m_ContainerKillMonster.gameObject.SetActive(false); |
| | | } |
| | | |
| | | } |
| | | |
| | | protected virtual void DrawGetExp(bool _force = false) |
| | | { |
| | | if (m_ContainerExp != null) |
| | | { |
| | | if (dungeonModel.dungeonResult.totalExp > 0 || _force) |
| | | { |
| | | m_ContainerExp.gameObject.SetActive(true); |
| | | m_Experience.text = UIHelper.ReplaceLargeNum((ulong)dungeonModel.dungeonResult.totalExp); |
| | | } |
| | | else |
| | | { |
| | | m_ContainerExp.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | protected virtual void DrawPassTime() |
| | | { |
| | | m_ContainerPassTime.gameObject.SetActive(dungeonModel.dungeonResult.costTime > 0); |
| | | m_PassTime.text = StringUtility.Contact((int)(dungeonModel.dungeonResult.costTime * 0.001f), Language.Get("RealmWin_Bewrite_35")); |
| | | } |
| | | |
| | | protected virtual void DrawGetMoney() |
| | | { |
| | | if (m_ContainerMoney != null) |
| | | { |
| | | m_ContainerMoney.gameObject.SetActive(false); |
| | | } |
| | | |
| | | if (m_ContainerMagicEssence != null) |
| | | { |
| | | m_ContainerMagicEssence.gameObject.SetActive(false); |
| | | } |
| | | |
| | | if (m_ContainerEssence != null) |
| | | { |
| | | m_ContainerEssence.gameObject.SetActive(false); |
| | | } |
| | | |
| | | if (dungeonModel.dungeonResult.money != null && dungeonModel.dungeonResult.money.Length > 0) |
| | | { |
| | | var dungeonMoney = dungeonModel.dungeonResult.money; |
| | | for (int i = 0; i < dungeonMoney.Length; i++) |
| | | { |
| | | var money = dungeonMoney[i]; |
| | | switch (money.moneyType) |
| | | { |
| | | case 3: |
| | | if (m_ContainerMoney != null && money.moneyValue > 0) |
| | | { |
| | | m_ContainerMoney.gameObject.SetActive(true); |
| | | m_Money.text = UIHelper.ReplaceLargeNum((ulong)money.moneyValue); |
| | | } |
| | | break; |
| | | case 14: |
| | | if (m_ContainerMagicEssence != null && money.moneyValue > 0) |
| | | { |
| | | m_ContainerMagicEssence.gameObject.SetActive(true); |
| | | m_MagicEssence.text = UIHelper.ReplaceLargeNum((ulong)money.moneyValue); |
| | | } |
| | | break; |
| | | case 23: |
| | | if (m_ContainerEssence != null && money.moneyValue > 0) |
| | | { |
| | | m_ContainerEssence.gameObject.SetActive(true); |
| | | m_Essence.text = UIHelper.ReplaceLargeNum((ulong)money.moneyValue); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | protected virtual void DrawSP() |
| | | { |
| | | var mapId = dungeonModel.GetDungeonDataIdByMapId(PlayerDatas.Instance.baseData.MapID); |
| | | if (dungeonModel.dungeonResult.sp > 0) |
| | | { |
| | | m_ContainerSP.gameObject.SetActive(true); |
| | | m_SP.text = dungeonModel.dungeonResult.sp.ToString(); |
| | | } |
| | | else |
| | | { |
| | | m_ContainerSP.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | IEnumerator Co_DelayDisplay(float _delay) |
| | | { |
| | | yield return new WaitForSeconds(_delay); |
| | | Display(); |
| | | } |
| | | |
| | | protected virtual void RequireDungeonExit() |
| | | { |
| | | m_Exit.gameObject.SetActive(true); |
| | | var endTime = dungeonModel.GetDungeonCoolDownEndTime(DungeonCoolDownType.LeaveMap); |
| | | var seconds = (endTime - DateTime.Now).TotalSeconds; |
| | | timer = (float)seconds - (int)seconds; |
| | | |
| | | DrawExitTimer((int)seconds); |
| | | } |
| | | |
| | | protected virtual void Display() |
| | | { |
| | | m_ContainerPoivt.gameObject.SetActive(true); |
| | | RequireDungeonExit(); |
| | | DrawPassTime(); |
| | | DrawGetExp(); |
| | | DrawGetMoney(); |
| | | DrawItemRewards(); |
| | | DrawPassGrade(); |
| | | DrawSP(); |
| | | DrawKillMonster(); |
| | | DrawNewRecord(); |
| | | } |
| | | |
| | | protected int CompareTrialItemIndex(ServerItem x, ServerItem y) |
| | | { |
| | | var config_x = ConfigManager.Instance.GetTemplate<ItemConfig>(x.ItemID); |
| | | var config_y = ConfigManager.Instance.GetTemplate<ItemConfig>(y.ItemID); |
| | | bool equip_x = config_x.Type >= 101 && config_x.Type <= 109; |
| | | bool equip_y = config_y.Type >= 101 && config_y.Type <= 109; |
| | | if (equip_x.CompareTo(equip_y) != 0) |
| | | { |
| | | return equip_x.CompareTo(equip_y); |
| | | } |
| | | if (!equip_x && !equip_y) |
| | | { |
| | | bool type_13_x = config_x.Type == 13; |
| | | bool type_13_y = config_y.Type == 13; |
| | | if (type_13_x.CompareTo(type_13_y) != 0) |
| | | { |
| | | return -type_13_x.CompareTo(type_13_y); |
| | | } |
| | | if (config_x.ItemColor.CompareTo(config_y.ItemColor) != 0) |
| | | { |
| | | return -config_x.ItemColor.CompareTo(config_y.ItemColor); |
| | | } |
| | | return x.ItemID.CompareTo(y.ItemID); |
| | | } |
| | | else |
| | | { |
| | | bool type_108109_x = config_x.Type >= 108; |
| | | bool type_108109_y = config_y.Type >= 108; |
| | | if (type_108109_x || type_108109_y) |
| | | { |
| | | if (config_x.Type.CompareTo(config_y.Type) != 0) |
| | | { |
| | | return -config_x.Type.CompareTo(config_y.Type); |
| | | } |
| | | } |
| | | if (config_x.ItemColor.CompareTo(config_y.ItemColor) != 0) |
| | | { |
| | | return -config_x.ItemColor.CompareTo(config_y.ItemColor); |
| | | } |
| | | if (config_x.StarLevel.CompareTo(config_y.StarLevel) != 0) |
| | | { |
| | | return -config_x.StarLevel.CompareTo(config_y.StarLevel); |
| | | } |
| | | if (config_x.LV.CompareTo(config_y.LV) != 0) |
| | | { |
| | | return -config_x.LV.CompareTo(config_y.LV); |
| | | } |
| | | return x.ItemID.CompareTo(y.ItemID); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Tuesday, September 12, 2017
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | using TableConfig;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | |
|
| | | public class DungeonVictoryWin : Window
|
| | | {
|
| | | [SerializeField] protected Transform m_ContainerPoivt;
|
| | | [SerializeField, Header("通关时间")] Transform m_ContainerPassTime;
|
| | | [SerializeField] Text m_PassTime;
|
| | | [SerializeField, Header("经验")] protected Transform m_ContainerExp;
|
| | | [SerializeField] Text m_Experience;
|
| | | [SerializeField, Header("金钱")] protected Transform m_ContainerMoney;
|
| | | [SerializeField] Text m_Money;
|
| | | [SerializeField, Header("精华")] protected Transform m_ContainerEssence;
|
| | | [SerializeField] Text m_Essence;
|
| | | [SerializeField, Header("魔晶")] protected Transform m_ContainerMagicEssence;
|
| | | [SerializeField] Text m_MagicEssence;
|
| | | [SerializeField, Header("退出按钮")] ButtonEx m_Exit;
|
| | | [SerializeField] protected Text m_ExitTimer;
|
| | | [SerializeField, Header("评级")] GameObject m_GradeBottom;
|
| | | [SerializeField] Image m_Grade;
|
| | | [SerializeField, Header("杀怪数量")] protected Transform m_ContainerKillMonster;
|
| | | [SerializeField] Text m_KillMonsterCnt;
|
| | | [SerializeField, Header("新记录")] protected Transform m_ContainerNewRecord;
|
| | | [SerializeField] Text m_Record;
|
| | | [SerializeField, Header("Sp")] protected Transform m_ContainerSP;
|
| | | [SerializeField] Text m_SP;
|
| | | [SerializeField, Header("物品奖励")] protected Transform m_ContainerReward;
|
| | | [SerializeField] protected ItemBehaviour m_SpecialItemCollect;
|
| | | [SerializeField] protected DungeonRewardItem[] passRewardBehaviours;
|
| | | [SerializeField] protected ScaleTween[] m_RewardTweens;
|
| | |
|
| | | protected DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
| | |
|
| | | protected float timer = 0f;
|
| | |
|
| | | protected List<int> m_RewardIndexs = new List<int>();
|
| | |
|
| | | private List<ServerItem> m_RewardSorts = new List<ServerItem>();
|
| | |
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void AddListeners()
|
| | | {
|
| | | if (m_Exit != null)
|
| | | {
|
| | | m_Exit.AddListener(ExitDungeon);
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | timer = 0f;
|
| | | if (m_ContainerMagicEssence != null)
|
| | | {
|
| | | m_ContainerMagicEssence.gameObject.SetActive(false);
|
| | | }
|
| | | if (m_ContainerEssence != null)
|
| | | {
|
| | | m_ContainerEssence.gameObject.SetActive(false);
|
| | | }
|
| | | if (m_ContainerMoney != null)
|
| | | {
|
| | | m_ContainerMoney.gameObject.SetActive(false);
|
| | | }
|
| | | if (m_ContainerReward != null)
|
| | | {
|
| | | m_ContainerReward.gameObject.SetActive(false);
|
| | | }
|
| | | if (m_ContainerNewRecord != null)
|
| | | {
|
| | | m_ContainerNewRecord.gameObject.SetActive(false);
|
| | | }
|
| | | if (m_ContainerKillMonster != null)
|
| | | {
|
| | | m_ContainerKillMonster.gameObject.SetActive(false);
|
| | | }
|
| | | if (m_ContainerPoivt != null)
|
| | | {
|
| | | m_ContainerPoivt.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | | {
|
| | | }
|
| | |
|
| | | protected override void OnActived()
|
| | | {
|
| | | base.OnActived();
|
| | | var config = Config.Instance.Get<DungeonOpenTimeConfig>(dungeonModel.dungeonResult.dataMapID);
|
| | | StartCoroutine(Co_DelayDisplay(config.DelayTime * 0.001f));
|
| | | }
|
| | | #endregion
|
| | |
|
| | | protected override void LateUpdate()
|
| | | {
|
| | | base.LateUpdate();
|
| | |
|
| | | if (m_ExitTimer != null && !m_ExitTimer.gameObject.activeInHierarchy)
|
| | | {
|
| | | m_ExitTimer.gameObject.SetActive(true);
|
| | | }
|
| | |
|
| | | timer -= Time.deltaTime;
|
| | | if (timer < 0f)
|
| | | {
|
| | | timer += 0.5f;
|
| | | var endTime = dungeonModel.GetDungeonCoolDownEndTime(DungeonCoolDownType.LeaveMap);
|
| | | var seconds = (endTime - DateTime.Now).TotalSeconds;
|
| | | DrawExitTimer((int)seconds);
|
| | | }
|
| | | }
|
| | |
|
| | | private void ExitDungeon()
|
| | | {
|
| | | dungeonModel.ExitCurrentDungeon();
|
| | | }
|
| | |
|
| | | protected virtual void DrawExitTimer(int seconds)
|
| | | {
|
| | | if (m_ExitTimer != null)
|
| | | {
|
| | | m_ExitTimer.text = Language.Get("DungeonVictoryWin_Btn_Exit_1", Mathf.Clamp(seconds, 0, int.MaxValue));
|
| | | }
|
| | | }
|
| | |
|
| | | protected virtual void DrawItemRewards()
|
| | | {
|
| | | var merged = false;
|
| | | var serveritems = dungeonModel.dungeonResult.itemInfo;
|
| | | var hasReward = (serveritems != null && serveritems.Length > 0) || dungeonModel.specialItemCollectRecord.count > 0;
|
| | |
|
| | | m_ContainerReward.gameObject.SetActive(hasReward);
|
| | |
|
| | | m_RewardSorts.Clear();
|
| | | if (serveritems != null)
|
| | | {
|
| | | m_RewardSorts.AddRange(serveritems);
|
| | | int _mapid = dungeonModel.GetDungeonDataIdByMapId(PlayerDatas.Instance.baseData.MapID);
|
| | | if (_mapid == 60010 || _mapid == 31130)
|
| | | {
|
| | | m_RewardSorts.Sort(CompareTrialItemIndex);
|
| | | }
|
| | | }
|
| | |
|
| | | m_RewardIndexs.Clear();
|
| | | if (m_RewardTweens != null && m_RewardTweens.Length > 0)
|
| | | {
|
| | | for (int i = 0; i < m_RewardTweens.Length; i++)
|
| | | {
|
| | | m_RewardTweens[i].SetEndState();
|
| | | }
|
| | | }
|
| | | if (m_RewardSorts.Count > 0)
|
| | | {
|
| | | var items = new List<ItemModel>();
|
| | | for (int i = 0; i < m_RewardSorts.Count; i++)
|
| | | {
|
| | | var serverItem = m_RewardSorts[i];
|
| | | var itemModel = new ItemModel(PackType.rptItem);
|
| | | var itemInfo = new ItemInfo();
|
| | | itemInfo.ItemID = serverItem.ItemID;
|
| | |
|
| | | if (!merged && itemInfo.ItemID == dungeonModel.specialItemCollectRecord.id)
|
| | | {
|
| | | itemInfo.ItemCount = serverItem.Count + dungeonModel.specialItemCollectRecord.count;
|
| | | merged = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | itemInfo.ItemCount = serverItem.Count;
|
| | | }
|
| | | itemInfo.IsBind = serverItem.IsBind;
|
| | | itemInfo.IsSuite = serverItem.IsSuite;
|
| | | itemInfo.UserData = serverItem.UserData;
|
| | |
|
| | | itemModel.SetItemModel(itemInfo);
|
| | | items.Add(itemModel);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < passRewardBehaviours.Length; i++)
|
| | | {
|
| | | var behaviour = passRewardBehaviours[i];
|
| | | if (i < items.Count)
|
| | | {
|
| | | behaviour.transform.parent.gameObject.SetActive(true);
|
| | | behaviour.gameObject.SetActive(false);
|
| | | behaviour.serverItem = m_RewardSorts[i];
|
| | | behaviour.Init(items[i]);
|
| | | m_RewardIndexs.Add(m_SpecialItemCollect == null ? i : i + 1);
|
| | | }
|
| | | else
|
| | | {
|
| | | behaviour.transform.parent.gameObject.SetActive(false);
|
| | | behaviour.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | if (m_SpecialItemCollect != null)
|
| | | {
|
| | | if (!merged && dungeonModel.specialItemCollectRecord.count > 0)
|
| | | {
|
| | | m_SpecialItemCollect.transform.parent.gameObject.SetActive(true);
|
| | | m_SpecialItemCollect.gameObject.SetActive(false);
|
| | | m_SpecialItemCollect.SetItem(dungeonModel.specialItemCollectRecord);
|
| | | m_RewardIndexs.Insert(0, 0);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_SpecialItemCollect.transform.parent.gameObject.SetActive(false);
|
| | | m_SpecialItemCollect.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | if (m_RewardIndexs.Count > 0 && m_RewardTweens != null && m_RewardTweens.Length > 0)
|
| | | {
|
| | | PlayRewardTween(0);
|
| | | }
|
| | | }
|
| | |
|
| | | protected virtual void PlayRewardTween(int _playIndex)
|
| | | {
|
| | | if (_playIndex < m_RewardIndexs.Count)
|
| | | {
|
| | | var _index = m_RewardIndexs[_playIndex];
|
| | | if (_index < m_RewardTweens.Length)
|
| | | {
|
| | | m_RewardTweens[_index].SetStartState();
|
| | | m_RewardTweens[_index].gameObject.SetActive(true);
|
| | | m_RewardTweens[_index].Play(() =>
|
| | | {
|
| | | _playIndex += 1;
|
| | | PlayRewardTween(_playIndex);
|
| | | });
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | protected virtual void DrawPassGrade()
|
| | | {
|
| | | if (m_Grade != null)
|
| | | {
|
| | | var grade = dungeonModel.dungeonResult.grade;
|
| | | if (grade > 0)
|
| | | {
|
| | | m_GradeBottom.SetActive(true);
|
| | | switch (grade)
|
| | | {
|
| | | case 5:
|
| | | m_Grade.SetSprite("Remark_S");
|
| | | m_Grade.SetNativeSize();
|
| | | break;
|
| | | case 4:
|
| | | m_Grade.SetSprite("Remark_A");
|
| | | m_Grade.SetNativeSize();
|
| | | break;
|
| | | case 3:
|
| | | m_Grade.SetSprite("Remark_B");
|
| | | m_Grade.SetNativeSize();
|
| | | break;
|
| | | case 2:
|
| | | m_Grade.SetSprite("Remark_C");
|
| | | m_Grade.SetNativeSize();
|
| | | break;
|
| | | case 1:
|
| | | m_Grade.SetSprite("Remark_D");
|
| | | m_Grade.SetNativeSize();
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | m_Grade.SetNativeSize();
|
| | | }
|
| | | else
|
| | | {
|
| | | m_GradeBottom.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | protected virtual void DrawNewRecord()
|
| | | {
|
| | | if (dungeonModel.dungeonResult.upPer > 0)
|
| | | {
|
| | | m_ContainerNewRecord.gameObject.SetActive(true);
|
| | | m_Record.text = Language.Get("FairyLand_Func26", dungeonModel.dungeonResult.upPer);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerNewRecord.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | protected virtual void DrawKillMonster()
|
| | | {
|
| | | if (dungeonModel.dungeonResult.npcTotal > 0)
|
| | | {
|
| | | m_ContainerKillMonster.gameObject.SetActive(true);
|
| | | m_KillMonsterCnt.text = dungeonModel.dungeonResult.npcTotal.ToString();
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerKillMonster.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | protected virtual void DrawGetExp(bool _force = false)
|
| | | {
|
| | | if (m_ContainerExp != null)
|
| | | {
|
| | | if (dungeonModel.dungeonResult.totalExp > 0 || _force)
|
| | | {
|
| | | m_ContainerExp.gameObject.SetActive(true);
|
| | | m_Experience.text = UIHelper.ReplaceLargeNum((ulong)dungeonModel.dungeonResult.totalExp);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerExp.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | protected virtual void DrawPassTime()
|
| | | {
|
| | | m_ContainerPassTime.gameObject.SetActive(dungeonModel.dungeonResult.costTime > 0);
|
| | | m_PassTime.text = StringUtility.Contact((int)(dungeonModel.dungeonResult.costTime * 0.001f), Language.Get("RealmWin_Bewrite_35"));
|
| | | }
|
| | |
|
| | | protected virtual void DrawGetMoney()
|
| | | {
|
| | | if (m_ContainerMoney != null)
|
| | | {
|
| | | m_ContainerMoney.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | if (m_ContainerMagicEssence != null)
|
| | | {
|
| | | m_ContainerMagicEssence.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | if (m_ContainerEssence != null)
|
| | | {
|
| | | m_ContainerEssence.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | if (dungeonModel.dungeonResult.money != null && dungeonModel.dungeonResult.money.Length > 0)
|
| | | {
|
| | | var dungeonMoney = dungeonModel.dungeonResult.money;
|
| | | for (int i = 0; i < dungeonMoney.Length; i++)
|
| | | {
|
| | | var money = dungeonMoney[i];
|
| | | switch (money.moneyType)
|
| | | {
|
| | | case 3:
|
| | | if (m_ContainerMoney != null && money.moneyValue > 0)
|
| | | {
|
| | | m_ContainerMoney.gameObject.SetActive(true);
|
| | | m_Money.text = UIHelper.ReplaceLargeNum((ulong)money.moneyValue);
|
| | | }
|
| | | break;
|
| | | case 14:
|
| | | if (m_ContainerMagicEssence != null && money.moneyValue > 0)
|
| | | {
|
| | | m_ContainerMagicEssence.gameObject.SetActive(true);
|
| | | m_MagicEssence.text = UIHelper.ReplaceLargeNum((ulong)money.moneyValue);
|
| | | }
|
| | | break;
|
| | | case 23:
|
| | | if (m_ContainerEssence != null && money.moneyValue > 0)
|
| | | {
|
| | | m_ContainerEssence.gameObject.SetActive(true);
|
| | | m_Essence.text = UIHelper.ReplaceLargeNum((ulong)money.moneyValue);
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | protected virtual void DrawSP()
|
| | | {
|
| | | var mapId = dungeonModel.GetDungeonDataIdByMapId(PlayerDatas.Instance.baseData.MapID);
|
| | | if (dungeonModel.dungeonResult.sp > 0)
|
| | | {
|
| | | m_ContainerSP.gameObject.SetActive(true);
|
| | | m_SP.text = dungeonModel.dungeonResult.sp.ToString();
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerSP.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | IEnumerator Co_DelayDisplay(float _delay)
|
| | | {
|
| | | yield return new WaitForSeconds(_delay);
|
| | | Display();
|
| | | }
|
| | |
|
| | | protected virtual void RequireDungeonExit()
|
| | | {
|
| | | if (m_Exit != null)
|
| | | {
|
| | | m_Exit.gameObject.SetActive(true);
|
| | | }
|
| | | var endTime = dungeonModel.GetDungeonCoolDownEndTime(DungeonCoolDownType.LeaveMap);
|
| | | var seconds = (endTime - DateTime.Now).TotalSeconds;
|
| | | timer = (float)seconds - (int)seconds;
|
| | |
|
| | | DrawExitTimer((int)seconds);
|
| | | }
|
| | |
|
| | | protected virtual void Display()
|
| | | {
|
| | | m_ContainerPoivt.gameObject.SetActive(true);
|
| | | RequireDungeonExit();
|
| | | DrawPassTime();
|
| | | DrawGetExp();
|
| | | DrawGetMoney();
|
| | | DrawItemRewards();
|
| | | DrawPassGrade();
|
| | | DrawSP();
|
| | | DrawKillMonster();
|
| | | DrawNewRecord();
|
| | | }
|
| | |
|
| | | protected int CompareTrialItemIndex(ServerItem x, ServerItem y)
|
| | | {
|
| | | var config_x = Config.Instance.Get<ItemConfig>(x.ItemID);
|
| | | var config_y = Config.Instance.Get<ItemConfig>(y.ItemID);
|
| | | bool equip_x = config_x.Type >= 101 && config_x.Type <= 109;
|
| | | bool equip_y = config_y.Type >= 101 && config_y.Type <= 109;
|
| | | if (equip_x.CompareTo(equip_y) != 0)
|
| | | {
|
| | | return equip_x.CompareTo(equip_y);
|
| | | }
|
| | | if (!equip_x && !equip_y)
|
| | | {
|
| | | bool type_13_x = config_x.Type == 13;
|
| | | bool type_13_y = config_y.Type == 13;
|
| | | if (type_13_x.CompareTo(type_13_y) != 0)
|
| | | {
|
| | | return -type_13_x.CompareTo(type_13_y);
|
| | | }
|
| | | if (config_x.ItemColor.CompareTo(config_y.ItemColor) != 0)
|
| | | {
|
| | | return -config_x.ItemColor.CompareTo(config_y.ItemColor);
|
| | | }
|
| | | return x.ItemID.CompareTo(y.ItemID);
|
| | | }
|
| | | else
|
| | | {
|
| | | bool type_108109_x = config_x.Type >= 108;
|
| | | bool type_108109_y = config_y.Type >= 108;
|
| | | if (type_108109_x || type_108109_y)
|
| | | {
|
| | | if (config_x.Type.CompareTo(config_y.Type) != 0)
|
| | | {
|
| | | return -config_x.Type.CompareTo(config_y.Type);
|
| | | }
|
| | | }
|
| | | if (config_x.ItemColor.CompareTo(config_y.ItemColor) != 0)
|
| | | {
|
| | | return -config_x.ItemColor.CompareTo(config_y.ItemColor);
|
| | | }
|
| | | if (config_x.StarLevel.CompareTo(config_y.StarLevel) != 0)
|
| | | {
|
| | | return -config_x.StarLevel.CompareTo(config_y.StarLevel);
|
| | | }
|
| | | if (config_x.LV.CompareTo(config_y.LV) != 0)
|
| | | {
|
| | | return -config_x.LV.CompareTo(config_y.LV);
|
| | | }
|
| | | return x.ItemID.CompareTo(y.ItemID);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|