From b9751b2f076ee050fe5b685e91ae4fc4469b1015 Mon Sep 17 00:00:00 2001 From: yyl <yyl> Date: 星期一, 09 六月 2025 09:01:02 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts --- Main/Component/UI/Decorate/Tweens/ScaleTween.cs | 54 Main/Component/UI/Decorate/Tweens/Tween.cs | 404 +- Main/Component/UI/Common/TimerBehaviour.cs | 121 Main/Component/UI/Decorate/Move/UISmoothMove.cs | 69 Main/Component/UI/Decorate/PingPong/PingPongMove.cs | 76 Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0706_tagUseItemSuccess.cs | 1 Main/System/Chat/ChatExtraOneCell.cs | 3 Main/Component/UI/Common/ItemBehaviour.cs | 390 +- Main/Component/UI/Decorate/Graph/PolylineImage.cs | 92 Main/System/GMCommand/GMInputWin.cs | 281 Main/System/Chat/ChatRecentlyCell.cs | 102 Main/System/Mail/MailGlobalCell.cs | 79 Main/Component/UI/Common/CyclicScroll.cs | 2 Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0707_tagItemCountRefresh.cs | 1 Main/System/GMCommand/GMCmdManager.cs | 3 Main/Component/UI/Common/PressTip.cs | 153 Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0725_tagRolePackRefreshEx.cs | 1 Main/System/Chat/ChatTrailCell.cs | 70 Main/System/Message/WordAnalysis.cs | 3 Main/System/Message/SysNotifyMgr.cs | 3 Main/Core/NetworkPackage/DTCFile/ServerPack/H02_PlayerTalk/DTC0212_tagNotifyCode.cs | 1 Main/System/KnapSack/New/ItemCell.cs | 123 Main/Component/UI/Decorate/Graph/Hexagon.cs | 98 Main/System/KnapSack/Logic/ItemModel.cs | 297 +- Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0709_tagClearItem.cs | 1 Main/System/Sound/SoundPlayer.cs | 1 Main/Component/UI/Common/ScreenMoveTo.cs | 258 Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0403_tagPlayerLoginLoadOK.cs | 1 Main/System/Task/TaskManager.cs | 7 Main/Component/UI/Decorate/Graph/OffsetImage.cs | 128 Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0711_tagClearItemPack.cs | 1 Main/Component/UI/Core/GrayGroup.cs | 61 Main/Component/UI/Common/SecondFrameLoader2.cs | 177 Main/System/Chat/ChatChannelCell.cs | 3 Main/System/Mail/MailInfoWin.cs | 243 Main/System/KnapSack/VirtualPackManager.cs | 629 ++-- Main/Component/UI/Decorate/Tweens/RotationTween.cs | 59 Main/Component/UI/Decorate/Graph/CustomImage.cs | 110 Main/System/Mail/MailInfoAwardItemCell.cs | 37 Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0704_tagRolePackRefresh.cs | 1 Main/Component/UI/Core/DebugCanvasAddition.cs | 1 Main/System/Chat/ChatFriendCell.cs | 80 Main/System/Skill/FlipScroll.cs | 572 +- Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs | 1 Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA204_tagMCVPackRefresh.cs | 1 Main/System/Chat/ChatManager.cs | 1 Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA363_tagMCMailStateChange.cs | 1 Main/Component/UI/Decorate/PingPong/PingPongRotation.cs | 75 Main/Core/GameEngine/Launch/GetVersionInfoTask.cs | 1 Main/System/Mail/MailWin.cs | 281 Main/System/SystemSetting/SystemSetting.cs | 1 Main/System/Sound/SoundUtility.cs | 295 - Main/Component/UI/Common/UITextReplace.cs | 25 Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs | 1 Main/System/Mail/MailManager.cs | 563 +- Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA205_tagMCVPackClear.cs | 1 Main/System/Skill/ScrollerUI.cs | 9 Main/Utility/UIUtility.cs | 2 Main/Component/UI/Decorate/PingPong/PingPongScale.cs | 74 Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA362_tagMCMailList.cs | 1 Main/Component/UI/Decorate/Graph/OffsetImage2.cs | 114 Main/Component/UI/Decorate/Move/UILinerMove.cs | 107 Main/Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0316_tagPackResetOK.cs | 1 Main/System/Message/RichTableEvent.cs | 3 Main/System/GMCommand/MoveObj.cs | 85 Main/System/KnapSack/Logic/SinglePack.cs | 695 ++-- Main/Component/UI/Common/ScreenDiffuseMove.cs | 260 Main/System/Chat/ChatItemCell.cs | 13 Main/System/Message/HrefAnalysis.cs | 3 Main/SDK/SDKUtils.cs | 2 Main/Component/UI/Common/TimerToChsBehaviour.cs | 20 Main/Component/UI/Effect/EffectMgr.cs | 3 Main/Utility/GMCommand.cs | 1 Main/System/Message/RichNormalEvent.cs | 3 Main/Component/UI/Common/UIPlaySound.cs | 49 Main/Utility/LanguageVerify.cs | 3 Main/System/Mail/MailPersonalCell.cs | 79 Main/Component/UI/Decorate/Effect/SpriteEffect.cs | 96 Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA809_tagMCItemDayUseCntInfo.cs | 1 Main/Component/UI/Common/RandomTip.cs | 95 Main/Component/UI/Decorate/Graph/Rhombus.cs | 93 Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0724_tagRolePackCanUseCount.cs | 1 /dev/null | 12 Main/System/Message/RichShowPlayerEvent.cs | 3 Main/Component/UI/Effect/UIEffectBehaviour.cs | 239 Main/System/GMCommand/GMCmdPanel.cs | 137 Main/Core/GameEngine/Launch/LaunchInHot.cs | 1 Main/System/Message/RichViewItemUtility.cs | 431 +- Main/Component/UI/Core/CanvasAddition.cs | 1 Main/Component/UI/Effect/UIEffect.cs | 1 Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA206_tagMCAutoItemCountRefresh.cs | 1 Main/Component/UI/Common/RollNumber.cs | 82 92 files changed, 4,298 insertions(+), 4,467 deletions(-) diff --git a/Main/Component/UI/Common/CyclicScroll.cs b/Main/Component/UI/Common/CyclicScroll.cs index 0f09643..699ebb5 100644 --- a/Main/Component/UI/Common/CyclicScroll.cs +++ b/Main/Component/UI/Common/CyclicScroll.cs @@ -287,7 +287,7 @@ public void OnDrag(PointerEventData eventData) { - // if (vnxbqy.UI.NewBieCenter.Instance.inGuiding) + // if (NewBieCenter.Instance.inGuiding) // { // return; // } diff --git a/Main/Component/UI/Common/EnableAccordingToMap.cs b/Main/Component/UI/Common/EnableAccordingToMap.cs deleted file mode 100644 index e5ea7e6..0000000 --- a/Main/Component/UI/Common/EnableAccordingToMap.cs +++ /dev/null @@ -1,88 +0,0 @@ -锘�// //-------------------------------------------------------- -// // [Author]: 绗簩涓栫晫 -// // [ Date ]: Wednesday, January 10, 2018 -// //-------------------------------------------------------- -// using UnityEngine; -// using System.Collections; -// using UnityEngine.UI; - - -// namespace vnxbqy.UI -// { - -// public class EnableAccordingToMap : MonoBehaviour -// { -// [SerializeField] EnableType m_EnableType; -// [SerializeField] MonoBehaviour m_Component; - -// private void Awake() -// { -// DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent += OnMapInitOk; -// } - -// private void OnDestroy() -// { -// DTC0403_tagPlayerLoginLoadOK.mapInitOkEvent -= OnMapInitOk; -// } - -// private void OnEnable() -// { -// OnMapInitOk(); -// } - -// private void OnMapInitOk() -// { -// if (PlayerDatas.Instance.baseData.MapID == 0) -// { -// return; -// } - -// var dungeonModel = ModelCenter.Instance.GetModel<DungeonModel>(); -// var dataMapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID); - -// if (dataMapId != 0) -// { -// var config = DungeonOpenTimeConfig.Get(dataMapId); -// switch (m_EnableType) -// { -// case EnableType.PlayerMove: -// m_Component.SetActive(config.Movable == 1); -// break; -// case EnableType.PlayerSkill: -// m_Component.enabled = config.Skillable == 1; -// break; -// case EnableType.SelectPlayer: -// m_Component.enabled = config.SelectPlayerable == 1; -// break; -// } -// } -// else -// { -// switch (m_EnableType) -// { -// case EnableType.PlayerMove: -// m_Component.SetActive(true); -// break; -// case EnableType.PlayerSkill: -// m_Component.enabled = true; -// break; -// case EnableType.SelectPlayer: -// m_Component.enabled = true; -// break; -// } -// } -// } - -// public enum EnableType -// { -// PlayerMove, -// PlayerSkill, -// SelectPlayer, -// } - -// } - -// } - - - diff --git a/Main/Component/UI/Common/EnableAccordingToMap.cs.meta b/Main/Component/UI/Common/EnableAccordingToMap.cs.meta deleted file mode 100644 index d6e912e..0000000 --- a/Main/Component/UI/Common/EnableAccordingToMap.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 98aa2216d9434214589fdeff3c10dda2 -timeCreated: 1515568744 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/ItemBehaviour.cs b/Main/Component/UI/Common/ItemBehaviour.cs index a0a19b2..a7731a2 100644 --- a/Main/Component/UI/Common/ItemBehaviour.cs +++ b/Main/Component/UI/Common/ItemBehaviour.cs @@ -1,199 +1,199 @@ -锘�// //-------------------------------------------------------- -// // [Author]: 绗簩涓栫晫 -// // [ Date ]: Monday, July 31, 2017 -// //-------------------------------------------------------- -// using UnityEngine; -// using System.Collections; -// using UnityEngine.UI; -// using System; +锘�//-------------------------------------------------------- +// [Author]: 绗簩涓栫晫 +// [ Date ]: Monday, July 31, 2017 +//-------------------------------------------------------- +using UnityEngine; +using System.Collections; +using UnityEngine.UI; +using System; + + +public class ItemBehaviour : MonoBehaviour +{ + + + [SerializeField] ImageEx m_Icon; + public ImageEx icon { get { return m_Icon; } } + + [SerializeField] ImageEx m_BackGround; + public ImageEx backGround { get { return m_BackGround; } } + + [SerializeField] Transform m_CountContainer; + public Transform countContainer { get { return m_CountContainer; } } + + [SerializeField] Text m_Count; + public Text count { get { return m_Count; } } + + [SerializeField] Button m_ViewDetails; + + [SerializeField] ItemType m_ItemType = ItemType.Rewards; + + EquipSuitEffect m_EquipSuitEffect; + EquipSuitEffect equipSuitEffect + { + get + { + if (m_EquipSuitEffect == null) + { + m_EquipSuitEffect = EquipSuitEffect.Create(transform as RectTransform); + } + return m_EquipSuitEffect; + } + } + + //鐗╁搧鍩虹鐗规晥锛堢墿鍝佽〃锛� + ItemBaseEffect m_ItemBaseEffect; + ItemBaseEffect itemBaseEffect + { + get + { + if (m_ItemBaseEffect == null) + { + m_ItemBaseEffect = ItemBaseEffect.Create(transform as RectTransform); + } + return m_ItemBaseEffect; + } + } + + bool m_ShowCount = true; + public bool showCount + { + get + { + return m_ShowCount; + } + set + { + if (m_ShowCount != value) + { + m_ShowCount = value; + DisplayCount(); + } + } + } + + public int itemId + { + get; private set; + } + + public int itemCount + { + get; private set; + } + + public int itemQuality { get; private set; } + + private void Awake() + { + if (m_ViewDetails != null) + { + m_ViewDetails.SetListener(ViewDetails); + } + } + + public void SetItem(Item _item) + { + SetItem(_item.id, _item.count, _item.quality); + } + + public void SetItem(int _id, int _count, int _quality = 0) + { + itemId = _id; + itemCount = _count; + itemQuality = _quality; + DisplayBaseInfo(); + DisplayCount(); + } + + public void SetCount(int _count) + { + itemCount = _count; + DisplayCount(); + } + + public void DisplayEmpty() + { + try + { + icon.SetActive(false); + backGround.SetActive(false); + if (countContainer != null) + { + countContainer.SetActive(false); + } + } + catch (System.Exception ex) + { + Debug.Log(ex); + } + } + + private void DisplayBaseInfo() + { + try + { + var itemInfo = ItemConfig.Get(itemId); + if (icon != null) + { + icon.SetActive(true); + icon.SetSprite(itemInfo.IconKey); + } + + if (backGround != null) + { + backGround.SetActive(true); + backGround.SetItemBackGround(itemQuality != 0 ? itemQuality : itemInfo.ItemColor, itemInfo.QualityEchoType); + } + + equipSuitEffect.Display(itemId); + itemBaseEffect.Display(itemId); + } + catch (Exception e) + { + Debug.Log(e); + } + } + + private void DisplayCount() + { + if (countContainer == null) + { + return; + } + switch (m_ItemType) + { + case ItemType.Rewards: + if (showCount && itemCount > 1) + { + countContainer.SetActive(true); + count.text = UIHelper.ReplaceLargeNum((ulong)itemCount); + } + else + { + countContainer.SetActive(false); + } + break; + case ItemType.Use: + var _itemCnt = PackManager.Instance.GetItemCountByID(PackType.Item, itemId); + count.text = StringUtility.Contact(_itemCnt >= itemCount ? "<color=#35e112>" : "<color=#ff0303>", _itemCnt, + "</color><color=#f7f7f7>/", itemCount, "</color>"); + break; + } + } + + private void ViewDetails() + { + ItemTipUtility.Show(itemId); + } + + public enum ItemType + { + Rewards, + Use, + } +} -// using vnxbqy.UI; - -// namespace vnxbqy.UI -// { - -// public class ItemBehaviour : MonoBehaviour -// { - - -// [SerializeField] ImageEx m_Icon; -// public ImageEx icon { get { return m_Icon; } } - -// [SerializeField] ImageEx m_BackGround; -// public ImageEx backGround { get { return m_BackGround; } } - -// [SerializeField] Transform m_CountContainer; -// public Transform countContainer { get { return m_CountContainer; } } - -// [SerializeField] Text m_Count; -// public Text count { get { return m_Count; } } - -// [SerializeField] Button m_ViewDetails; - -// [SerializeField] ItemType m_ItemType = ItemType.Rewards; - -// EquipSuitEffect m_EquipSuitEffect; -// EquipSuitEffect equipSuitEffect -// { -// get -// { -// if (m_EquipSuitEffect == null) -// { -// m_EquipSuitEffect = EquipSuitEffect.Create(transform as RectTransform); -// } -// return m_EquipSuitEffect; -// } -// } - -// //鐗╁搧鍩虹鐗规晥锛堢墿鍝佽〃锛� -// ItemBaseEffect m_ItemBaseEffect; -// ItemBaseEffect itemBaseEffect -// { -// get -// { -// if (m_ItemBaseEffect == null) -// { -// m_ItemBaseEffect = ItemBaseEffect.Create(transform as RectTransform); -// } -// return m_ItemBaseEffect; -// } -// } - -// bool m_ShowCount = true; -// public bool showCount { -// get { -// return m_ShowCount; -// } -// set { -// if (m_ShowCount != value) -// { -// m_ShowCount = value; -// DisplayCount(); -// } -// } -// } - -// public int itemId { -// get; private set; -// } - -// public int itemCount { -// get; private set; -// } - -// public int itemQuality { get; private set; } - -// private void Awake() -// { -// if (m_ViewDetails != null) -// { -// m_ViewDetails.SetListener(ViewDetails); -// } -// } - -// public void SetItem(Item _item) -// { -// SetItem(_item.id, _item.count, _item.quality); -// } - -// public void SetItem(int _id, int _count, int _quality = 0) -// { -// itemId = _id; -// itemCount = _count; -// itemQuality = _quality; -// DisplayBaseInfo(); -// DisplayCount(); -// } - -// public void SetCount(int _count) -// { -// itemCount = _count; -// DisplayCount(); -// } - -// public void DisplayEmpty() -// { -// try -// { -// icon.SetActive(false); -// backGround.SetActive(false); -// if (countContainer != null) -// { -// countContainer.SetActive(false); -// } -// } -// catch (System.Exception ex) -// { -// Debug.Log(ex); -// } -// } - -// private void DisplayBaseInfo() -// { -// try -// { -// var itemInfo = ItemConfig.Get(itemId); -// if (icon != null) -// { -// icon.SetActive(true); -// icon.SetSprite(itemInfo.IconKey); -// } - -// if (backGround != null) -// { -// backGround.SetActive(true); -// backGround.SetItemBackGround(itemQuality != 0 ? itemQuality : itemInfo.ItemColor, itemInfo.QualityEchoType); -// } - -// equipSuitEffect.Display(itemId); -// itemBaseEffect.Display(itemId); -// } -// catch (Exception e) -// { -// Debug.Log(e); -// } -// } - -// private void DisplayCount() -// { -// if (countContainer == null) -// { -// return; -// } -// switch (m_ItemType) -// { -// case ItemType.Rewards: -// if (showCount && itemCount > 1) -// { -// countContainer.SetActive(true); -// count.text = UIHelper.ReplaceLargeNum((ulong)itemCount); -// } -// else -// { -// countContainer.SetActive(false); -// } -// break; -// case ItemType.Use: -// var _itemCnt = ModelCenter.Instance.GetModel<PackModel>().GetItemCountByID(PackType.Item, itemId); -// count.text = StringUtility.Contact(_itemCnt >= itemCount ? "<color=#35e112>" : "<color=#ff0303>", _itemCnt, -// "</color><color=#f7f7f7>/", itemCount, "</color>"); -// break; -// } -// } - -// private void ViewDetails() -// { -// ItemTipUtility.Show(itemId); -// } - -// public enum ItemType -// { -// Rewards, -// Use, -// } -// } - -// } diff --git a/Main/Component/UI/Common/NumKeyBoard.cs b/Main/Component/UI/Common/NumKeyBoard.cs deleted file mode 100644 index 9fe0d63..0000000 --- a/Main/Component/UI/Common/NumKeyBoard.cs +++ /dev/null @@ -1,260 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using UnityEngine.Events; -using vnxbqy.UI; -namespace UnityEngine.UI -{ - [AddComponentMenu("UI/NumKeyBoard")] - [RequireComponent(typeof(RectTransform))] - public class NumKeyBoard : MonoBehaviour - { - [SerializeField] - NumKeyBoardType m_Type; - public NumKeyBoardType type - { - get { return m_Type; } - } - [SerializeField] - bool deActiveConfirm = false; - [SerializeField] - private uint m_Min; - public uint min - { - get { return m_Min; } - set { m_Min = value; } - } - [SerializeField] - private uint m_Max; - public uint max { get { return m_Max; } set { m_Max = value; } } - [SerializeField] - private int m_NumLimit; - public int limit { get { return m_NumLimit; } set { m_NumLimit = value; } } - [SerializeField] - private Button[] m_NumBtns = new Button[10]; - [SerializeField] - private Button okBtn; - [SerializeField] - private Button cancelBtn; - [Serializable] - public class NumKeyboardEvent : UnityEvent { } - private NumKeyboardEvent m_OnValueChange = new NumKeyboardEvent(); - public NumKeyboardEvent onValueChange - { - get { return m_OnValueChange; } - } - [Serializable] - public class NumKeyboardConfirmEvent : UnityEvent<bool> { } - private NumKeyboardConfirmEvent m_OnConfirm = new NumKeyboardConfirmEvent(); - public NumKeyboardConfirmEvent onConfirm - { - get { return m_OnConfirm; } - } - public bool displayOutValue = true; - private StringBuilder m_Value = new StringBuilder(); - - [SerializeField] ClickScreenOtherSpace m_ClickOther; - - public string Value - { - get { return m_Value.ToString(); } - set - { - switch (type) - { - case NumKeyBoardType.Math: - { - if (!Regex.IsMatch(value, "[0-9]+")) - { - throw new Exception("No Correct Format!"); - } - m_IntValue = uint.Parse(value); - m_RealIntValue = m_IntValue; - } - break; - case NumKeyBoardType.Password: - { - if (!Regex.IsMatch(value, "[0-9]*")) - { - throw new Exception("No Correct Format!"); - } - } - break; - } - m_Value.Length = 0; - m_Value.Append(value); - SetTargetTextValue(); - } - } - private uint m_IntValue = 0; - private uint m_RealIntValue = 0; - private bool resetValue = false; - /// <summary> - /// 鐩爣鏄剧ず鏂囨湰缁勪欢 - /// </summary> - public Text targetText; - - private void Awake() - { - for (int i = 0; i < m_NumBtns.Length; i++) - { - if (m_NumBtns[i] != null) - { - uint index = (uint)i; - m_NumBtns[i].onClick.AddListener(() => - { - OnClickNum(index); - }); - } - } - okBtn.onClick.AddListener(OnOkBtn); - cancelBtn.onClick.AddListener(OnCancelBtn); - ResetValue(); - if (m_ClickOther != null) - { - m_ClickOther.AddListener(OnOkBtn); - } - } - - private void ResetValue() - { - switch (type) - { - case NumKeyBoardType.Math: - m_IntValue = (uint)Mathf.Max(0, min); - m_RealIntValue = m_IntValue; - m_Value.Length = 0; - m_Value.Append(m_IntValue); - break; - case NumKeyBoardType.Password: - m_Value.Length = 0; - break; - } - SetTargetTextValue(); - resetValue = true; - } - - private void OnEnable() - { - resetValue = true; - } - - private void OnCancelBtn() - { - ResetValue(); - onValueChange.Invoke(); - onConfirm.Invoke(false); - } - - private void OnOkBtn() - { - CheckValue(); - onConfirm.Invoke(true); - if (deActiveConfirm) - { - gameObject.SetActive(false); - } - } - - private void OnClickNum(uint index) - { - switch (type) - { - case NumKeyBoardType.Math: - { - if (resetValue) - { - m_RealIntValue = index; - if (max > 0 && index > max) - { - index = max; - } - if (!displayOutValue && min > 0 && index < min) - { - index = min; - } - m_IntValue = index; - resetValue = false; - } - else - { - uint _value = m_RealIntValue * 10 + index; - m_RealIntValue = _value; - if (max > 0 && _value > max) - { - _value = max; - } - var maxlength = LengthOf(max); - var length = LengthOf(_value); - if (min > 0 && _value < min && (!displayOutValue || (max > 0 && length == maxlength))) - { - _value = min; - } - if (_value == m_IntValue) - { - return; - } - m_IntValue = _value; - } - m_Value.Length = 0; - m_Value.Append(m_IntValue); - SetTargetTextValue(); - } - break; - case NumKeyBoardType.Password: - if (limit != 0 && m_Value.Length >= limit) - { - return; - } - m_Value.Append(index); - SetTargetTextValue(); - break; - } - m_OnValueChange.Invoke(); - } - - private void CheckValue() - { - if (type == NumKeyBoardType.Math) - { - var value = 0; - int.TryParse(Value,out value); - if (max > 0 && value > max) - { - Value = max.ToString(); - } - if (min > 0 && value < min) - { - Value = min.ToString(); - } - } - } - - void SetTargetTextValue() - { - if (targetText != null) - { - targetText.text = Value; - } - } - - static int LengthOf(uint value) - { - for (int i = 0; i <= 10; i++) - { - if (value / (ulong)Mathf.Pow(10, i) < 1) - { - return i; - } - } - return 0; - } - } - public enum NumKeyBoardType - { - Math, - Password, - } -} - diff --git a/Main/Component/UI/Common/NumKeyBoard.cs.meta b/Main/Component/UI/Common/NumKeyBoard.cs.meta deleted file mode 100644 index 17c19b5..0000000 --- a/Main/Component/UI/Common/NumKeyBoard.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 95a1a64971aac184aaa6fd7d61de62d4 -timeCreated: 1508292193 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/PlayerLifeBar.cs b/Main/Component/UI/Common/PlayerLifeBar.cs deleted file mode 100644 index 26f0ce7..0000000 --- a/Main/Component/UI/Common/PlayerLifeBar.cs +++ /dev/null @@ -1,131 +0,0 @@ -锘�// //-------------------------------------------------------- -// // [Author]: 绗簩涓栫晫 -// // [ Date ]: Saturday, October 14, 2017 -// //-------------------------------------------------------- -// using UnityEngine; -// using System.Collections; -// using UnityEngine.UI; - -// namespace vnxbqy.UI -// { - -// public class PlayerLifeBar : MonoBehaviour -// { -// [SerializeField] AvatarCell avatarCell; -// [SerializeField] Text m_PlayerName; -// [SerializeField] Text m_PlayerLevel; -// [SerializeField] Text m_Hp; -// [SerializeField] Text m_ShieldText; -// [SerializeField] Image m_Shield;//鎶ょ浘鏄剧ず - -// [SerializeField] MultipleSmoothSlider m_MultipleSlider; -// public MultipleSmoothSlider multipleSlider -// { -// get { return m_MultipleSlider; } -// } - -// [SerializeField] -// [Range(0, 10)] -// float m_Delay; -// public float delay -// { -// get { return m_Delay; } -// } - -// float m_Value; -// public float value -// { -// get -// { -// return m_Value; -// } -// set -// { -// m_Value = Mathf.Clamp01(value); -// if (multipleSlider != null) -// { -// multipleSlider.value = m_Value; -// } -// } -// } - -// int playerIdBuf = 0; -// float[] reduceHpDelay = new float[2]; -// float[] addHpDelay = new float[2]; - -// int playerId = 0; - -// public void SetBaseInfo(int _playerId,int face,int facePic, int _job, int _jobRank, string _name, -// int _level, ulong _hp, ulong _maxHp, int shield, int maxShield) -// { -// playerId = _playerId; -// avatarCell.InitUI(AvatarHelper.GetAvatarModel(_playerId, face, facePic, _job)); -// m_PlayerName.text = _name; -// m_PlayerLevel.text = _level.ToString(); - -// var targetValue = (float)_hp / _maxHp; -// m_Hp.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(_hp), "/", UIHelper.ReplaceLargeNum(_maxHp)); -// multipleSlider.ResetValue(targetValue); -// ShowShield(shield, maxShield); -// } - -// public void Show(ulong _hp, ulong _maxHp, int shield, int maxShield) -// { -// var targetValue = _hp / (float)_maxHp; -// if (targetValue < this.value) -// { -// multipleSlider.UpdateDelayTimes(reduceHpDelay); -// } -// else -// { -// multipleSlider.UpdateDelayTimes(addHpDelay); -// } - -// value = targetValue; -// m_Hp.text = StringUtility.Contact(UIHelper.ReplaceLargeNum(_hp), "/", UIHelper.ReplaceLargeNum(_maxHp)); -// this.SetActive(true); -// ShowShield(shield, maxShield); -// } - -// void ShowShield(int shield, int maxShield) -// { -// var fillAmount = maxShield <= 0 ? 1f : (float)shield / maxShield; -// m_Shield.fillAmount = fillAmount; -// m_ShieldText.text = StringUtility.Contact(UIHelper.ReplaceLargeNumEx(shield), "/", UIHelper.ReplaceLargeNumEx(maxShield)); -// } - -// public void Hide() -// { -// this.SetActive(false); -// } - -// void Awake() -// { -// reduceHpDelay[0] = 0f; -// reduceHpDelay[1] = delay; - -// addHpDelay[0] = delay; -// addHpDelay[1] = 0f; -// } - -// private void OnEnable() -// { -// multipleSlider.ResetValue(value); -// avatarCell.button.AddListener(ViewPlayer); -// } - -// private void OnDisable() -// { -// avatarCell.button.RemoveAllListeners(); -// } - -// private void ViewPlayer() -// { -// PlayerDetails.ShowAreaPlayer(playerId); -// } -// } - -// } - - - diff --git a/Main/Component/UI/Common/PlayerLifeBar.cs.meta b/Main/Component/UI/Common/PlayerLifeBar.cs.meta deleted file mode 100644 index 8c57a72..0000000 --- a/Main/Component/UI/Common/PlayerLifeBar.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ba974cd686dad874cb284f41816c448c -timeCreated: 1507991835 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/PrepareWin.cs b/Main/Component/UI/Common/PrepareWin.cs deleted file mode 100644 index 921e7a5..0000000 --- a/Main/Component/UI/Common/PrepareWin.cs +++ /dev/null @@ -1,102 +0,0 @@ -锘�// //-------------------------------------------------------- -// // [Author]: 绗簩涓栫晫 -// // [ Date ]: Monday, November 06, 2017 -// //-------------------------------------------------------- - -// using System; -// using System.Collections; -// using System.Collections.Generic; -// using UnityEngine; -// using UnityEngine.UI; - -// namespace vnxbqy.UI -// { - -// /// <summary> -// /// 涓嶱repareHandler閰嶅悎浣跨敤鐨勪竴涓繘搴︽潯绫� -// /// </summary> -// public class PrepareWin : Window -// { -// private float m_ProcessTime; -// private float m_TotalTime; - -// public SmoothSlider m_Process; -// public Text m_Content; - -// #region Built-in -// protected sealed override void BindController() -// { -// } - -// protected sealed override void LateUpdate() -// { -// base.LateUpdate(); -// if (m_ProcessTime > m_TotalTime) -// { -// m_ProcessTime = m_TotalTime; -// return; -// } - -// m_ProcessTime += Time.deltaTime; -// m_Process.value = m_ProcessTime / m_TotalTime; -// } - -// protected sealed override void AddListeners() -// { -// } - -// protected sealed override void OnPreOpen() -// { -// PrepareHandler.ClientH0812 _prepareInfo = PrepareHandler.Instance.clientPrepareH0812; -// PrepareHandler.E_PrepareType _type = (PrepareHandler.E_PrepareType)_prepareInfo.PrepareState; - -// // 鍒ゆ柇杩涘害鏉$被鍨� -// switch (_type) -// { -// case PrepareHandler.E_PrepareType.pstSkill: - -// HandlerSkillPrepare(); - -// break; -// } -// m_Process.value = m_ProcessTime = 0; -// m_TotalTime = _prepareInfo.MaxTime; -// } - -// protected sealed override void OnAfterOpen() -// { -// } - -// protected sealed override void OnPreClose() -// { -// } - -// protected sealed override void OnAfterClose() -// { -// } -// #endregion - -// private void HandlerSkillPrepare() -// { -// PrepareHandler.ClientH0812 _prepareInfo = PrepareHandler.Instance.clientPrepareH0812; -// GActorFight _actor = GAMgr.Instance.GetBySID(_prepareInfo.PlayerID) as GActorFight; -// if (_actor == null) -// { -// Debug.Log("瑙掕壊涓嶅瓨鍦�"); -// return; -// } -// Skill _skill = _actor.SkillMgr.Get(_prepareInfo.PrepareID); -// if (_skill == null) -// { -// Debug.Log("鎶�鑳戒笉瀛樺湪"); -// return; -// } -// m_Content.text = string.Format(Language.Get("SkillBuffer_Z"), _skill.skillInfo.config.SkillName); -// } -// } - -// } - - - - diff --git a/Main/Component/UI/Common/PrepareWin.cs.meta b/Main/Component/UI/Common/PrepareWin.cs.meta deleted file mode 100644 index 632915f..0000000 --- a/Main/Component/UI/Common/PrepareWin.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9bd6f9ce503725249a1518e3573992d0 -timeCreated: 1509959523 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/PressTip.cs b/Main/Component/UI/Common/PressTip.cs index bae47f0..904a035 100644 --- a/Main/Component/UI/Common/PressTip.cs +++ b/Main/Component/UI/Common/PressTip.cs @@ -4,99 +4,96 @@ using UnityEngine.EventSystems; using System; -namespace vnxbqy.UI + +public class PressTip : MonoBehaviour, IPointerDownHandler, IPointerUpHandler { + [SerializeField] GameObject m_Container; + [SerializeField] float m_Delay = 0f; - public class PressTip : MonoBehaviour, IPointerDownHandler, IPointerUpHandler + float timer = 0f; + PointerState pointerState = PointerState.Up; + bool triggered = false; + + private void OnEnable() { - [SerializeField] GameObject m_Container; - [SerializeField] float m_Delay = 0f; + this.pointerState = PointerState.Up; + this.m_Container.SetActive(false); + } - float timer = 0f; - PointerState pointerState = PointerState.Up; - bool triggered = false; + private void OnDisable() + { + this.pointerState = PointerState.Up; + this.m_Container.SetActive(false); + } - private void OnEnable() + public virtual void OnPointerDown(PointerEventData eventData) + { + this.pointerState = PointerState.Down; + this.timer = 0f; + triggered = false; + } + + public virtual void OnPointerUp(PointerEventData eventData) + { + this.pointerState = PointerState.Up; + this.m_Container.SetActive(false); + } + + private void LateUpdate() + { + if (this.pointerState != PointerState.Down) { - this.pointerState = PointerState.Up; - this.m_Container.SetActive(false); + return; } - private void OnDisable() + this.timer += Time.deltaTime; + if (this.timer > this.m_Delay && !triggered) { - this.pointerState = PointerState.Up; - this.m_Container.SetActive(false); - } + triggered = true; - public virtual void OnPointerDown(PointerEventData eventData) - { - this.pointerState = PointerState.Down; - this.timer = 0f; - triggered = false; - } - - public virtual void OnPointerUp(PointerEventData eventData) - { - this.pointerState = PointerState.Up; - this.m_Container.SetActive(false); - } - - private void LateUpdate() - { - if (this.pointerState != PointerState.Down) + if (this.m_Container != null) { - return; + this.m_Container.SetActive(true); + AdjustmentContainerPosition(this.m_Container.transform as RectTransform); } - - this.timer += Time.deltaTime; - if (this.timer > this.m_Delay && !triggered) - { - triggered = true; - - if (this.m_Container != null) - { - this.m_Container.SetActive(true); - AdjustmentContainerPosition(this.m_Container.transform as RectTransform); - } - } - - } - - void AdjustmentContainerPosition(RectTransform _container) - { - if (_container == null) - { - return; - } - - var viewPortPoint = CameraManager.uiCamera.ScreenToViewportPoint(Input.mousePosition); - var normalizedOffset = CalculateNormalizedOffset(_container); - - var containerSize = new Vector2(_container.rect.width, _container.rect.height); - var xOffset = viewPortPoint.x < normalizedOffset.x ? 1 : viewPortPoint.x > (1 - normalizedOffset.x) ? -1 : 0; - var yOffset = viewPortPoint.y > (1 - normalizedOffset.y * 2) ? -1 : xOffset != 0 ? 0 : 1; - - var uiposition = CameraManager.uiCamera.ViewportToWorldPoint(viewPortPoint); - - _container.position = uiposition.SetZ(0); - _container.localPosition += new Vector3(xOffset * containerSize.x * 0.5f, yOffset * containerSize.y * 0.5f, -_container.localPosition.z); - } - - Vector2 CalculateNormalizedOffset(RectTransform _rectTransform) - { - var offsetX = _rectTransform.rect.width / Constants.DESIGN_RESOLUTION.x * 0.5f; - var offsetY = _rectTransform.rect.height / Constants.DESIGN_RESOLUTION.y * 0.5f; - - return new Vector2(offsetX, offsetY); - } - - enum PointerState - { - Down, - Up } } + void AdjustmentContainerPosition(RectTransform _container) + { + if (_container == null) + { + return; + } + + var viewPortPoint = CameraManager.uiCamera.ScreenToViewportPoint(Input.mousePosition); + var normalizedOffset = CalculateNormalizedOffset(_container); + + var containerSize = new Vector2(_container.rect.width, _container.rect.height); + var xOffset = viewPortPoint.x < normalizedOffset.x ? 1 : viewPortPoint.x > (1 - normalizedOffset.x) ? -1 : 0; + var yOffset = viewPortPoint.y > (1 - normalizedOffset.y * 2) ? -1 : xOffset != 0 ? 0 : 1; + + var uiposition = CameraManager.uiCamera.ViewportToWorldPoint(viewPortPoint); + + _container.position = uiposition.SetZ(0); + _container.localPosition += new Vector3(xOffset * containerSize.x * 0.5f, yOffset * containerSize.y * 0.5f, -_container.localPosition.z); + } + + Vector2 CalculateNormalizedOffset(RectTransform _rectTransform) + { + var offsetX = _rectTransform.rect.width / Constants.DESIGN_RESOLUTION.x * 0.5f; + var offsetY = _rectTransform.rect.height / Constants.DESIGN_RESOLUTION.y * 0.5f; + + return new Vector2(offsetX, offsetY); + } + + enum PointerState + { + Down, + Up + } + } + diff --git a/Main/Component/UI/Common/PriorityWindowConfig.cs b/Main/Component/UI/Common/PriorityWindowConfig.cs deleted file mode 100644 index 9a2280a..0000000 --- a/Main/Component/UI/Common/PriorityWindowConfig.cs +++ /dev/null @@ -1,21 +0,0 @@ -锘縰sing System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[CreateAssetMenu(menuName = "Config/PriorityWindowConfig")] -public class PriorityWindowConfig :ScriptableObject { - - public List<string> priorityWindows; - - static PriorityWindowConfig config; - public static PriorityWindowConfig Get() - { - if (config == null) - { - config = BuiltInLoader.LoadScriptableObject<PriorityWindowConfig>("PriorityWindowConfig"); - } - - return config; - } - -} diff --git a/Main/Component/UI/Common/PriorityWindowConfig.cs.meta b/Main/Component/UI/Common/PriorityWindowConfig.cs.meta deleted file mode 100644 index ee4016b..0000000 --- a/Main/Component/UI/Common/PriorityWindowConfig.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0526ef20afb14c04ea62a22bc41884c9 -timeCreated: 1518335421 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/RandomTip.cs b/Main/Component/UI/Common/RandomTip.cs index e7fd3c2..6c8a668 100644 --- a/Main/Component/UI/Common/RandomTip.cs +++ b/Main/Component/UI/Common/RandomTip.cs @@ -6,73 +6,70 @@ using System.Collections; using UnityEngine.UI; -namespace vnxbqy.UI + +public class RandomTip : MonoBehaviour { + int index = 0; + [SerializeField] UpdateType m_UpdateType; + [SerializeField] Text m_Content; + [SerializeField] float m_Interval = 2f; + [SerializeField] string[] m_LanguageKeys; - public class RandomTip : MonoBehaviour + float timer = 0f; + private void OnEnable() { - int index = 0; - [SerializeField] UpdateType m_UpdateType; - [SerializeField] Text m_Content; - [SerializeField] float m_Interval = 2f; - [SerializeField] string[] m_LanguageKeys; + timer = 0f; + UpdateTip(); + } - float timer = 0f; - private void OnEnable() + private void OnDisable() + { + + } + + private void LateUpdate() + { + timer += Time.deltaTime; + if (timer > m_Interval) { timer = 0f; UpdateTip(); } + } - private void OnDisable() + private void UpdateTip() + { + if (m_LanguageKeys == null || m_LanguageKeys.Length == 0) { - + return; } - private void LateUpdate() + switch (m_UpdateType) { - timer += Time.deltaTime; - if (timer > m_Interval) - { - timer = 0f; - UpdateTip(); - } + case UpdateType.Queue: + index = (++index) % m_LanguageKeys.Length; + m_Content.text = Language.Get(m_LanguageKeys[index]); + break; + case UpdateType.Random: + var randomIndex = index; + while (index == randomIndex) + { + randomIndex = Random.Range(0, m_LanguageKeys.Length); + } + index = randomIndex; + m_Content.text = Language.Get(m_LanguageKeys[index]); + break; } + } - private void UpdateTip() - { - if (m_LanguageKeys == null || m_LanguageKeys.Length == 0) - { - return; - } - - switch (m_UpdateType) - { - case UpdateType.Queue: - index = (++index) % m_LanguageKeys.Length; - m_Content.text = Language.Get(m_LanguageKeys[index]); - break; - case UpdateType.Random: - var randomIndex = index; - while (index == randomIndex) - { - randomIndex = Random.Range(0, m_LanguageKeys.Length); - } - index = randomIndex; - m_Content.text = Language.Get(m_LanguageKeys[index]); - break; - } - } - - public enum UpdateType - { - Queue, - Random, - } - + public enum UpdateType + { + Queue, + Random, } } + diff --git a/Main/Component/UI/Common/RollNumber.cs b/Main/Component/UI/Common/RollNumber.cs index 49ae6d4..0a83082 100644 --- a/Main/Component/UI/Common/RollNumber.cs +++ b/Main/Component/UI/Common/RollNumber.cs @@ -2,59 +2,57 @@ using UnityEngine; using UnityEngine.UI; -namespace vnxbqy.UI { - [RequireComponent(typeof(Text))] - public class RollNumber:MonoBehaviour { +[RequireComponent(typeof(Text))] +public class RollNumber:MonoBehaviour { - [SerializeField] - Text m_Text; - public Text text { - get { - return m_Text; - } + [SerializeField] + Text m_Text; + public Text text { + get { + return m_Text; } + } - float to = 0; - float from = 0; - float now = 0; + float to = 0; + float from = 0; + float now = 0; - float duration = 0f; - float timer = 0f; - Action endCallBack = null; + float duration = 0f; + float timer = 0f; + Action endCallBack = null; - public void Perform(int _from,int _to,float _duration,Action _callBack) { - ResetTimer(); - duration = Mathf.Clamp(_duration,0f,float.MaxValue); - from = _from; - to = _to; - endCallBack = _callBack; - } + public void Perform(int _from,int _to,float _duration,Action _callBack) { + ResetTimer(); + duration = Mathf.Clamp(_duration,0f,float.MaxValue); + from = _from; + to = _to; + endCallBack = _callBack; + } - private void LateUpdate() { - if(timer < duration) { - timer += Time.deltaTime; - now = Mathf.Lerp(from,to,Mathf.Clamp01(timer / duration)); - if(timer > duration) { - ResetTimer(); - now = to; - if(endCallBack != null) { - endCallBack(); - endCallBack = null; - } - } - - if(text != null) { - var nowInt = (int)now; - text.text = nowInt.ToString(); + private void LateUpdate() { + if(timer < duration) { + timer += Time.deltaTime; + now = Mathf.Lerp(from,to,Mathf.Clamp01(timer / duration)); + if(timer > duration) { + ResetTimer(); + now = to; + if(endCallBack != null) { + endCallBack(); + endCallBack = null; } } - } - private void ResetTimer() { - timer = 0f; - duration = 0f; + if(text != null) { + var nowInt = (int)now; + text.text = nowInt.ToString(); + } } } + + private void ResetTimer() { + timer = 0f; + duration = 0f; + } } diff --git a/Main/Component/UI/Common/ScreenDiffuseMove.cs b/Main/Component/UI/Common/ScreenDiffuseMove.cs index 4363b7a..f412ec1 100644 --- a/Main/Component/UI/Common/ScreenDiffuseMove.cs +++ b/Main/Component/UI/Common/ScreenDiffuseMove.cs @@ -6,155 +6,151 @@ using System.Collections; using UnityEngine.UI; -namespace vnxbqy.UI + +public class ScreenDiffuseMove : MonoBehaviour { - public class ScreenDiffuseMove : MonoBehaviour + [SerializeField] DiffuseType m_MoveType = DiffuseType.MoveUp; + public DiffuseType moveType { get { return m_MoveType; } } + + [SerializeField] float m_Speed = 10f; + public float speed { + get { return m_Speed; } + set { m_Speed = value; } + } + + [SerializeField] TweenCurve m_SpeedRatioCurve; + [SerializeField] float m_Duration = 1f; + public float duration { + get { return m_Duration; } + set { m_Duration = value; } + } + + [SerializeField] float m_Delay = 0f; + public float delay { + get { return m_Delay; } + set { m_Delay = value; } + } + + [SerializeField] bool m_IsLocal = true; + public bool isLocal { + get { return m_IsLocal; } + } + + float beginTime = 0f; + float endTime = 0f; + Vector2 direction = Vector2.up; + bool disableOnEnd = true; + + public void Begin(bool _disableOnEnd = true) { + beginTime = Time.time + delay; + endTime = Time.time + delay + duration; + disableOnEnd = _disableOnEnd; - [SerializeField] DiffuseType m_MoveType = DiffuseType.MoveUp; - public DiffuseType moveType { get { return m_MoveType; } } - - [SerializeField] float m_Speed = 10f; - public float speed { - get { return m_Speed; } - set { m_Speed = value; } - } - - [SerializeField] TweenCurve m_SpeedRatioCurve; - [SerializeField] float m_Duration = 1f; - public float duration { - get { return m_Duration; } - set { m_Duration = value; } - } - - [SerializeField] float m_Delay = 0f; - public float delay { - get { return m_Delay; } - set { m_Delay = value; } - } - - [SerializeField] bool m_IsLocal = true; - public bool isLocal { - get { return m_IsLocal; } - } - - float beginTime = 0f; - float endTime = 0f; - Vector2 direction = Vector2.up; - bool disableOnEnd = true; - - public void Begin(bool _disableOnEnd = true) + switch (m_MoveType) { - beginTime = Time.time + delay; - endTime = Time.time + delay + duration; - disableOnEnd = _disableOnEnd; - - switch (m_MoveType) - { - case DiffuseType.MoveUp: - direction = Vector2.up * m_Speed; - break; - case DiffuseType.MoveDown: - direction = Vector2.down * m_Speed; - break; - case DiffuseType.MoveLeft: - direction = Vector2.left * m_Speed; - break; - case DiffuseType.MoveRight: - direction = Vector2.right * m_Speed; - break; - case DiffuseType.RelativePosition: - direction = new Vector2(this.transform.position.x, this.transform.position.y).normalized * m_Speed; - break; - case DiffuseType.ReversalRelativePosition: - direction = new Vector2(-this.transform.position.x, this.transform.position.y).normalized * m_Speed; - break; - } - - this.enabled = true; - if (!this.gameObject.activeInHierarchy) - { - this.SetActive(true); - } - + case DiffuseType.MoveUp: + direction = Vector2.up * m_Speed; + break; + case DiffuseType.MoveDown: + direction = Vector2.down * m_Speed; + break; + case DiffuseType.MoveLeft: + direction = Vector2.left * m_Speed; + break; + case DiffuseType.MoveRight: + direction = Vector2.right * m_Speed; + break; + case DiffuseType.RelativePosition: + direction = new Vector2(this.transform.position.x, this.transform.position.y).normalized * m_Speed; + break; + case DiffuseType.ReversalRelativePosition: + direction = new Vector2(-this.transform.position.x, this.transform.position.y).normalized * m_Speed; + break; } - public void Begin(Vector3 _direction, bool _disableOnEnd = true) + this.enabled = true; + if (!this.gameObject.activeInHierarchy) { - beginTime = Time.time + delay; - endTime = Time.time + delay + duration; - disableOnEnd = _disableOnEnd; - - switch (m_MoveType) - { - case DiffuseType.MoveUp: - direction = Vector2.up * m_Speed; - break; - case DiffuseType.MoveDown: - direction = Vector2.down * m_Speed; - break; - case DiffuseType.MoveLeft: - direction = Vector2.left * m_Speed; - break; - case DiffuseType.MoveRight: - direction = Vector2.right * m_Speed; - break; - case DiffuseType.RelativePosition: - direction = new Vector2(_direction.x, _direction.y).normalized * m_Speed; - break; - case DiffuseType.ReversalRelativePosition: - direction = new Vector2(_direction.x, -_direction.y).normalized * m_Speed; - break; - } - - this.enabled = true; - if (!this.gameObject.activeInHierarchy) - { - this.SetActive(true); - } + this.SetActive(true); } - private void LateUpdate() - { - if (Time.time < beginTime) - { - return; - } + } - if (Time.time < endTime) - { - var delta = direction * Time.deltaTime * m_SpeedRatioCurve.Evaluate((Time.time - beginTime) / duration); - if (isLocal) - { - this.transform.localPosition += new Vector3(delta.x, delta.y, 0); - } - else - { - this.transform.position += new Vector3(delta.x, delta.y, 0); - } - } - else - { - if (disableOnEnd) - { - this.enabled = false; - } - } + public void Begin(Vector3 _direction, bool _disableOnEnd = true) + { + beginTime = Time.time + delay; + endTime = Time.time + delay + duration; + disableOnEnd = _disableOnEnd; + + switch (m_MoveType) + { + case DiffuseType.MoveUp: + direction = Vector2.up * m_Speed; + break; + case DiffuseType.MoveDown: + direction = Vector2.down * m_Speed; + break; + case DiffuseType.MoveLeft: + direction = Vector2.left * m_Speed; + break; + case DiffuseType.MoveRight: + direction = Vector2.right * m_Speed; + break; + case DiffuseType.RelativePosition: + direction = new Vector2(_direction.x, _direction.y).normalized * m_Speed; + break; + case DiffuseType.ReversalRelativePosition: + direction = new Vector2(_direction.x, -_direction.y).normalized * m_Speed; + break; } - - public enum DiffuseType + this.enabled = true; + if (!this.gameObject.activeInHierarchy) { - MoveUp, - MoveDown, - MoveLeft, - MoveRight, - RelativePosition, - ReversalRelativePosition, + this.SetActive(true); } } + private void LateUpdate() + { + if (Time.time < beginTime) + { + return; + } + + if (Time.time < endTime) + { + var delta = direction * Time.deltaTime * m_SpeedRatioCurve.Evaluate((Time.time - beginTime) / duration); + if (isLocal) + { + this.transform.localPosition += new Vector3(delta.x, delta.y, 0); + } + else + { + this.transform.position += new Vector3(delta.x, delta.y, 0); + } + } + else + { + if (disableOnEnd) + { + this.enabled = false; + } + } + } + + + public enum DiffuseType + { + MoveUp, + MoveDown, + MoveLeft, + MoveRight, + RelativePosition, + ReversalRelativePosition, + } } diff --git a/Main/Component/UI/Common/ScreenMoveTo.cs b/Main/Component/UI/Common/ScreenMoveTo.cs index 8c71560..5b1d630 100644 --- a/Main/Component/UI/Common/ScreenMoveTo.cs +++ b/Main/Component/UI/Common/ScreenMoveTo.cs @@ -7,164 +7,160 @@ using UnityEngine.UI; using System; -namespace vnxbqy.UI +public class ScreenMoveTo : MonoBehaviour { - public class ScreenMoveTo : MonoBehaviour + [SerializeField] + LerpType m_LerpType = LerpType.Linear; + + [SerializeField] + Vector2 m_Destination; + public Vector2 destination { + get { return m_Destination; } + set { m_Destination = value; } + } + + [SerializeField] + float m_Duration = 0.5f; + public float duration { + get { return m_Duration; } + set { m_Duration = value; } + } + + [SerializeField] + bool m_IsLocal = true; + public bool isLocal { + get { return m_IsLocal; } + } + + bool disableOnEnd = true; + float endTime = 0f; + + Vector3 startPosition = Vector3.zero; + Vector3 startLocalPosition = Vector3.zero; + Vector3 refPosition = Vector3.zero; + + bool end = false; + Action endCallBack = null; + + public void Begin(bool _deActiveOnEnd = true) { + endTime = Time.time + duration; + end = false; + disableOnEnd = _deActiveOnEnd; + startPosition = this.transform.position; + startLocalPosition = this.transform.localPosition; + refPosition = Vector3.zero; + endCallBack = null; - [SerializeField] - LerpType m_LerpType = LerpType.Linear; - - [SerializeField] - Vector2 m_Destination; - public Vector2 destination { - get { return m_Destination; } - set { m_Destination = value; } - } - - [SerializeField] - float m_Duration = 0.5f; - public float duration { - get { return m_Duration; } - set { m_Duration = value; } - } - - [SerializeField] - bool m_IsLocal = true; - public bool isLocal { - get { return m_IsLocal; } - } - - bool disableOnEnd = true; - float endTime = 0f; - - Vector3 startPosition = Vector3.zero; - Vector3 startLocalPosition = Vector3.zero; - Vector3 refPosition = Vector3.zero; - - bool end = false; - Action endCallBack = null; - - public void Begin(bool _deActiveOnEnd = true) + this.enabled = true; + if (!this.gameObject.activeInHierarchy) { - endTime = Time.time + duration; - end = false; - disableOnEnd = _deActiveOnEnd; - startPosition = this.transform.position; - startLocalPosition = this.transform.localPosition; - refPosition = Vector3.zero; - endCallBack = null; - - this.enabled = true; - if (!this.gameObject.activeInHierarchy) - { - this.SetActive(true); - } + this.SetActive(true); } + } - public void Begin(Action _callBack, bool _disableOnEnd = true) + public void Begin(Action _callBack, bool _disableOnEnd = true) + { + endTime = Time.time + duration; + end = false; + disableOnEnd = _disableOnEnd; + startPosition = this.transform.position; + startLocalPosition = this.transform.localPosition; + refPosition = Vector3.zero; + endCallBack = _callBack; + + this.enabled = true; + if (!this.gameObject.activeInHierarchy) { - endTime = Time.time + duration; - end = false; - disableOnEnd = _disableOnEnd; - startPosition = this.transform.position; - startLocalPosition = this.transform.localPosition; - refPosition = Vector3.zero; - endCallBack = _callBack; - - this.enabled = true; - if (!this.gameObject.activeInHierarchy) - { - this.SetActive(true); - } + this.SetActive(true); } + } - private void LateUpdate() + private void LateUpdate() + { + switch (m_LerpType) { - switch (m_LerpType) - { - case LerpType.Linear: - if (Time.time < endTime) - { - var t = Mathf.Clamp01(1f - (endTime - Time.time) / m_Duration); - if (isLocal) - { - this.transform.localPosition = Vector3.Lerp(startLocalPosition, destination, t); - } - else - { - this.transform.position = Vector3.Lerp(startPosition, destination, t); - } - } - else - { - end = true; - if (isLocal) - { - this.transform.localPosition = destination; - } - else - { - this.transform.position = destination; - } - } - break; - case LerpType.Smooth: - + case LerpType.Linear: + if (Time.time < endTime) + { + var t = Mathf.Clamp01(1f - (endTime - Time.time) / m_Duration); if (isLocal) { - if (Vector3.Distance(this.transform.localPosition, new Vector3(destination.x, destination.y)) > 1) - { - this.transform.localPosition = Vector3.SmoothDamp(this.transform.localPosition, destination, ref refPosition, duration); - } - else - { - this.transform.localPosition = destination; - end = true; - } + this.transform.localPosition = Vector3.Lerp(startLocalPosition, destination, t); } else { - if (Vector3.Distance(this.transform.position, new Vector3(destination.x, destination.y)) > 1) - { - this.transform.position = Vector3.SmoothDamp(this.transform.position, destination, ref refPosition, duration); - } - else - { - this.transform.position = destination; - end = true; - } + this.transform.position = Vector3.Lerp(startPosition, destination, t); } - break; - } - - if (end) - { - if (endCallBack != null) - { - endCallBack(); - endCallBack = null; } - } + else + { + end = true; + if (isLocal) + { + this.transform.localPosition = destination; + } + else + { + this.transform.position = destination; + } + } + break; + case LerpType.Smooth: - if (end && disableOnEnd) - { - this.enabled = false; - } - + if (isLocal) + { + if (Vector3.Distance(this.transform.localPosition, new Vector3(destination.x, destination.y)) > 1) + { + this.transform.localPosition = Vector3.SmoothDamp(this.transform.localPosition, destination, ref refPosition, duration); + } + else + { + this.transform.localPosition = destination; + end = true; + } + } + else + { + if (Vector3.Distance(this.transform.position, new Vector3(destination.x, destination.y)) > 1) + { + this.transform.position = Vector3.SmoothDamp(this.transform.position, destination, ref refPosition, duration); + } + else + { + this.transform.position = destination; + end = true; + } + } + break; } - - public enum LerpType + if (end) { - Linear, - Smooth, + if (endCallBack != null) + { + endCallBack(); + endCallBack = null; + } + } + + if (end && disableOnEnd) + { + this.enabled = false; } } + + public enum LerpType + { + Linear, + Smooth, + } + } + diff --git a/Main/Component/UI/Common/SecondFrameLoader.cs b/Main/Component/UI/Common/SecondFrameLoader.cs deleted file mode 100644 index 517039c..0000000 --- a/Main/Component/UI/Common/SecondFrameLoader.cs +++ /dev/null @@ -1,39 +0,0 @@ -锘�/* - 杩欐槸鏃х殑浜岀骇鐣岄潰鍔犺浇鍣紝宸插惎鐢紝璇蜂娇鐢⊿econdFrameLoader2 -*/ -using UnityEngine; -using System.Collections; -using UnityEngine.UI; - -namespace vnxbqy.UI -{ - [ExecuteAlways] - public class SecondFrameLoader : UIPrefabLoader - { - [SerializeField] string m_TitleKey; - - public override void Create() - { - base.Create(); - - if (Application.isPlaying) - { - var text = this.GetComponentInChildren<Text>(); - if (text != null) - { - text.fontSize = 24; - text.resizeTextForBestFit = false; - text.rectTransform.sizeDelta = new Vector2(24, 141); - if (!string.IsNullOrEmpty(m_TitleKey)) - text.text = Language.Get(m_TitleKey); - } - } - } - - - } - -} - - - diff --git a/Main/Component/UI/Common/SecondFrameLoader.cs.meta b/Main/Component/UI/Common/SecondFrameLoader.cs.meta deleted file mode 100644 index e3b1b02..0000000 --- a/Main/Component/UI/Common/SecondFrameLoader.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 28068c14282ee1a48953dc84be40db67 -timeCreated: 1557405564 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/SecondFrameLoader2.cs b/Main/Component/UI/Common/SecondFrameLoader2.cs index 2295433..4b8914b 100644 --- a/Main/Component/UI/Common/SecondFrameLoader2.cs +++ b/Main/Component/UI/Common/SecondFrameLoader2.cs @@ -3,109 +3,106 @@ /** 杩欐槸鏂扮殑浜岀骇鐣岄潰鍔犺浇鍣� */ -namespace vnxbqy.UI -{ - public enum FrameSize +public enum FrameSize +{ + Free, + XLarge, + Large, + Medium, + Small, +} + +[ExecuteAlways] +public class SecondFrameLoader2 : UIPrefabLoader +{ + [SerializeField] public FrameSize frameSize; + + [SerializeField] public Vector2 size; + + public string m_TitleKey; + + public override string prefabName { get { return "SecondFrame"; } } + + public override void Create() { - Free, - XLarge, - Large, - Medium, - Small, + base.Create(); + UpdateSize(); + InitUI(); } - [ExecuteAlways] - public class SecondFrameLoader2 : UIPrefabLoader + private void Update() { - [SerializeField] public FrameSize frameSize; + if (Application.isPlaying) + return; + UpdateSize(); + } - [SerializeField] public Vector2 size; - - public string m_TitleKey; - - public override string prefabName { get { return "SecondFrame"; } } - - public override void Create() + public void InitUI() + { + var button = this.GetComponentInChildren<ButtonEx>(); + var window = this.GetComponentInParent<UIBase>(); + button.AddListener(() =>//鍏抽棴鎸夐挳 { - base.Create(); - UpdateSize(); - InitUI(); - } - - private void Update() + Debug.Log("鍏抽棴绐楀彛"); + window.CloseWindow(); + }); + var text = this.GetComponentInChildren<Text>(); + if (text != null) { if (Application.isPlaying) - return; - UpdateSize(); - } - - public void InitUI() - { - var button = this.GetComponentInChildren<ButtonEx>(); - var window = this.GetComponentInParent<UIBase>(); - button.AddListener(() =>//鍏抽棴鎸夐挳 { - Debug.Log("鍏抽棴绐楀彛"); - window.CloseWindow(); - }); - var text = this.GetComponentInChildren<Text>(); - if (text != null) - { - if (Application.isPlaying) - { - text.fontSize = 24; - text.resizeTextForBestFit = false; - text.rectTransform.sizeDelta = new Vector2(24, 141); - if (!string.IsNullOrEmpty(m_TitleKey)) - text.text = Language.Get(m_TitleKey); - } - else - text.text = "褰撳墠鏍囬"; + text.fontSize = 24; + text.resizeTextForBestFit = false; + text.rectTransform.sizeDelta = new Vector2(24, 141); + if (!string.IsNullOrEmpty(m_TitleKey)) + text.text = Language.Get(m_TitleKey); } + else + text.text = "褰撳墠鏍囬"; + } +} + + public void UpdateSize() + { + if (instance == null) + return; + switch (frameSize) + { + case FrameSize.XLarge: + { + SetSize(1000, 650); + break; + } + case FrameSize.Large: + { + SetSize(800, 650); + break; + } + case FrameSize.Medium: + { + SetSize(650, 650); + break; + } + case FrameSize.Small: + { + SetSize(550, 650); + break; + } + case FrameSize.Free: + { + SetSize(size.x, size.y); + break; + } + } } - public void UpdateSize() - { - if (instance == null) - return; - switch (frameSize) - { - case FrameSize.XLarge: - { - SetSize(1000, 650); - break; - } - case FrameSize.Large: - { - SetSize(800, 650); - break; - } - case FrameSize.Medium: - { - SetSize(650, 650); - break; - } - case FrameSize.Small: - { - SetSize(550, 650); - break; - } - case FrameSize.Free: - { - SetSize(size.x, size.y); - break; - } - } - } - - private void SetSize(float width, float height) - { - if (instance == null) - return; - (instance.transform as RectTransform).sizeDelta = new Vector2(width, height); - } - + private void SetSize(float width, float height) + { + if (instance == null) + return; + (instance.transform as RectTransform).sizeDelta = new Vector2(width, height); } } + diff --git a/Main/Component/UI/Common/TimerBehaviour.cs b/Main/Component/UI/Common/TimerBehaviour.cs index 6064160..a80956d 100644 --- a/Main/Component/UI/Common/TimerBehaviour.cs +++ b/Main/Component/UI/Common/TimerBehaviour.cs @@ -7,90 +7,87 @@ using UnityEngine.UI; using System; -namespace vnxbqy.UI + +public class TimerBehaviour : MonoBehaviour { + [SerializeField] protected Text m_TimeShow; + public Text timeShow { get { return m_TimeShow; } } - public class TimerBehaviour : MonoBehaviour + [SerializeField] Pattern m_Pattern = Pattern.English; + + protected DateTime endTime; + Action onTime; + + float secondTimer = 0f; + + public void Begin(int seconds, Action _callBack = null) { - [SerializeField] protected Text m_TimeShow; - public Text timeShow { get { return m_TimeShow; } } - - [SerializeField] Pattern m_Pattern = Pattern.English; - - protected DateTime endTime; - Action onTime; - - float secondTimer = 0f; - - public void Begin(int seconds, Action _callBack = null) + endTime = TimeUtility.ServerNow + new TimeSpan(seconds * TimeSpan.TicksPerSecond); + onTime = _callBack; + if (endTime > TimeUtility.ServerNow) { - endTime = TimeUtility.ServerNow + new TimeSpan(seconds * TimeSpan.TicksPerSecond); - onTime = _callBack; - if (endTime > TimeUtility.ServerNow) - { - this.SetActive(true); - UpdateTimeShow(); - } - else - { - this.SetActive(false); - } + this.SetActive(true); + UpdateTimeShow(); } - - public void Stop() + else { - endTime = DateTime.MinValue; - onTime = null; this.SetActive(false); } + } - private void LateUpdate() + public void Stop() + { + endTime = DateTime.MinValue; + onTime = null; + this.SetActive(false); + } + + private void LateUpdate() + { + if (TimeUtility.ServerNow > endTime) { - if (TimeUtility.ServerNow > endTime) + if (onTime != null) { - if (onTime != null) - { - onTime(); - onTime = null; - } - - this.SetActive(false); + onTime(); + onTime = null; } - else + + this.SetActive(false); + } + else + { + secondTimer += Time.deltaTime; + if (secondTimer > 1f) { - secondTimer += Time.deltaTime; - if (secondTimer > 1f) - { - secondTimer = 0f; - UpdateTimeShow(); - } + secondTimer = 0f; + UpdateTimeShow(); } } + } - protected virtual void UpdateTimeShow() + protected virtual void UpdateTimeShow() + { + var lastSecond = (float)(endTime - TimeUtility.ServerNow).TotalSeconds; + + switch (m_Pattern) { - var lastSecond = (float)(endTime - TimeUtility.ServerNow).TotalSeconds; - - switch (m_Pattern) - { - case Pattern.English: - m_TimeShow.text = TimeUtility.SecondsToHMS(Mathf.RoundToInt(lastSecond)); - break; - case Pattern.Chinese: - m_TimeShow.text = TimeUtility.SecondsToDHMSCHS(Mathf.RoundToInt(lastSecond)); - break; - } + case Pattern.English: + m_TimeShow.text = TimeUtility.SecondsToHMS(Mathf.RoundToInt(lastSecond)); + break; + case Pattern.Chinese: + m_TimeShow.text = TimeUtility.SecondsToDHMSCHS(Mathf.RoundToInt(lastSecond)); + break; } + } - public enum Pattern - { - English = 0, - Chinese = 1, - } - + public enum Pattern + { + English = 0, + Chinese = 1, } } + diff --git a/Main/Component/UI/Common/TimerToChsBehaviour.cs b/Main/Component/UI/Common/TimerToChsBehaviour.cs index cd4d046..13cbf73 100644 --- a/Main/Component/UI/Common/TimerToChsBehaviour.cs +++ b/Main/Component/UI/Common/TimerToChsBehaviour.cs @@ -2,18 +2,16 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -namespace vnxbqy.UI -{ - public class TimerToChsBehaviour : TimerBehaviour - { - [HideInInspector] - public string addtionInfo = string.Empty; - protected override void UpdateTimeShow() - { - var lastSecond = (endTime - TimeUtility.ServerNow).TotalSeconds; - m_TimeShow.text = StringUtility.Contact(TimeUtility.SecondsToDHMSCHS((int)lastSecond), addtionInfo); - } +public class TimerToChsBehaviour : TimerBehaviour +{ + [HideInInspector] + public string addtionInfo = string.Empty; + + protected override void UpdateTimeShow() + { + var lastSecond = (endTime - TimeUtility.ServerNow).TotalSeconds; + m_TimeShow.text = StringUtility.Contact(TimeUtility.SecondsToDHMSCHS((int)lastSecond), addtionInfo); } } diff --git a/Main/Component/UI/Common/UI3DHeroSkillShow.cs b/Main/Component/UI/Common/UI3DHeroSkillShow.cs deleted file mode 100644 index 20fd11c..0000000 --- a/Main/Component/UI/Common/UI3DHeroSkillShow.cs +++ /dev/null @@ -1,358 +0,0 @@ -锘�// using System; -// using System.Collections; -// using System.Collections.Generic; - -// using UnityEngine; -// using UnityEngine.UI; - -// namespace vnxbqy.UI -// { -// public class UI3DHeroSkillShow : MonoBehaviour -// { -// static UI3DHeroSkillShow m_Instance = null; -// public static UI3DHeroSkillShow Instance { -// get { -// if (m_Instance == null) -// { -// var gameObject = Instantiate(UILoader.LoadTreasure("Misc", "UI3DHeroSkillShow")); -// m_Instance = gameObject.GetComponent<UI3DHeroSkillShow>(); -// Instance.transform.position = new Vector3(0, 4000, 5000); -// m_Instance.name = "UI3DHeroSkillShow"; -// m_Instance.SetActive(true); -// DontDestroyOnLoad(gameObject); -// } - -// return m_Instance; -// } -// } - -// [SerializeField] Transform m_Stage; -// [SerializeField] Camera m_ShowCamera; -// [SerializeField] Animator m_CameraAnimator; -// [SerializeField] List<RuntimeAnimatorController> m_HeroShowControllers; -// [SerializeField] List<TreasureSkill> m_TreasureSkills; -// [SerializeField] List<SkillAct> m_SkillActs; - -// UI3DShowHero m_HeroShow = new UI3DShowHero(); - -// PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } } - -// Transform m_HeroPoint; -// public Transform hero { -// get { -// return m_HeroPoint; -// } -// } - -// Animator m_HeroAnimator; - -// Action m_HeroSkillCompletet; - -// SFXController m_SkillExtraSfx; - -// public int cacheSkillId { get; private set; } - -// public Camera showCamera { get { return m_ShowCamera; } } - -// public SFXController skillEffect; - -// public Transform MP_Name1 { -// get { -// var mp_name = hero.GetChildTransformDeeply("A_Name2"); -// if (!mp_name) -// { -// return hero; -// } -// return mp_name; -// } -// } - -// public Transform MP_Weapon { -// get { -// var mp_weapon = hero.GetChildTransformDeeply(WEAPON_NODE); -// if (mp_weapon != null) -// { -// if (mp_weapon.childCount > 0) -// { -// return mp_weapon.GetChild(0); -// } -// return mp_weapon; -// } -// return hero; -// } -// } - -// const string WEAPON_NODE = "Bip001 Prop1"; - - -// private void ShowHeroSkill(int _skillId, string _clip) -// { -// if (UI3DTreasureSelectStage.Instance.IsOpen) -// { -// UI3DTreasureSelectStage.Instance.showCamera.enabled = false; -// } - -// cacheSkillId = _skillId; - -// var _job = PlayerDatas.Instance.baseData.Job; - -// #region 瑁呭 -// var appearance = ModelCenter.Instance.GetModel<EquipModel>().GetAppearance(); - -// var _clothesId = appearance.clothes; -// var _wingsId = appearance.wings; -// var _secondaryId = appearance.secondary; -// var _weaponId = appearance.weapon; -// var fashionClothesId = appearance.fashionClothes; -// var fashionWeaponId = appearance.fashionWeapon; -// var fashionSecondaryId = appearance.fashionSecondary; - -// int _suitLevel = 0; -// #endregion - -// UI3DPlayerExhibitionData data = new UI3DPlayerExhibitionData() -// { -// job = _job, -// fashionClothesId = fashionClothesId, -// clothesId = _clothesId, -// suitLevel = _suitLevel, -// fashionWeaponId = fashionWeaponId, -// weaponId = _weaponId, -// wingsId = _wingsId, -// fashionSecondaryId = fashionSecondaryId, -// secondaryId = _secondaryId, -// isDialogue = false, -// }; - -// var _hero = m_HeroShow.Show(data, m_Stage); -// if (_hero != null) -// { -// m_HeroPoint = _hero.transform; -// m_HeroAnimator = _hero.GetComponent<Animator>(); -// if (m_HeroAnimator != null) -// { -// m_HeroAnimator.runtimeAnimatorController = m_HeroShowControllers[_job - 1]; -// StartCoroutine(Co_PlaySkill()); -// } -// } - -// m_Stage.localEulerAngles = Vector3.zero; -// m_ShowCamera.SetActive(true); - -// m_CameraAnimator.Play(_clip, 0, 0); -// m_CameraAnimator.speed = 0; -// } - -// public void ShowTreasureSkill(int _treasureId, Action callback) -// { -// StopShow(); - -// Treasure _treasure; -// ModelCenter.Instance.GetModel<TreasureModel>().TryGetTreasure(_treasureId, out _treasure); -// if (_treasure != null) -// { -// m_HeroSkillCompletet = callback; -// var _skillId = _treasure.skillId; -// var _index = m_TreasureSkills.FindIndex((x) => -// { -// return x.treasureId == _treasureId; -// }); -// var _treasureSkill = _index != -1 ? m_TreasureSkills[_index] : m_TreasureSkills[0]; -// _index = _treasureSkill.clip.FindIndex((x) => -// { -// return (int)x.job == PlayerDatas.Instance.baseData.Job; -// }); -// var _clip = _index != -1 ? _treasureSkill.clip[_index] : _treasureSkill.clip[0]; -// ShowHeroSkill(_skillId, _clip.clip); -// if (_treasureSkill.effects != null && _treasureSkill.effects.Count > 0) -// { -// _index = _treasureSkill.effects.FindIndex((x) => -// { -// return (int)x.job == PlayerDatas.Instance.baseData.Job; -// }); -// var _effect = _index != -1 ? _treasureSkill.effects[_index] : _treasureSkill.effects[0]; -// StartCoroutine(Co_PlayExtraEffect(_effect)); -// } -// } -// } - -// private void StartPlaySkill(int _skillId) -// { -// var config = SkillConfig.Get(_skillId); -// if (config == null) -// { -// return; -// } -// var skillActMark = config.Skillactmark; - -// var index = m_SkillActs.FindIndex((x) => -// { -// return x.skillId == _skillId; -// }); - -// if (index != -1) -// { -// skillActMark = m_SkillActs[index].mark; -// } - -// if (skillActMark > 0 && skillActMark < 20) -// { -// switch (config.Skillactmark) -// { -// case 10: -// m_HeroAnimator.Play(GAStaticDefine.State_Attack1Hash, 0); -// break; -// case 11: -// m_HeroAnimator.Play(GAStaticDefine.State_Attack2Hash, 0); -// break; -// case 12: -// m_HeroAnimator.Play(GAStaticDefine.State_Attack3Hash, 0); -// break; -// case 13: -// m_HeroAnimator.Play(GAStaticDefine.State_Attack4Hash, 0); -// break; -// } -// } -// else -// { -// switch (skillActMark) -// { -// case 21: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill21, 0); -// break; -// case 22: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill22, 0); -// break; -// case 23: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill23, 0); -// break; -// case 24: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill24, 0); -// break; -// case 25: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill25, 0); -// break; -// case 26: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill26, 0); -// break; -// case 27: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill27, 0); -// break; -// case 28: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill28, 0); -// break; -// case 29: -// m_HeroAnimator.Play(GAStaticDefine.State_Skill29, 0); -// break; -// case 99: -// m_HeroAnimator.Play(GAStaticDefine.State_RollHash, 0); -// break; -// } -// } - - -// } - -// IEnumerator Co_PlaySkill() -// { -// yield return WaitingForSecondConst.WaitMS1000; -// if (m_HeroAnimator != null) -// { -// StartPlaySkill(cacheSkillId); -// } - -// m_CameraAnimator.speed = 1; -// yield return null; -// var _showTime = m_CameraAnimator.GetCurrentAnimatorStateInfo(0).length; -// yield return new WaitForSeconds(_showTime); -// if (m_HeroSkillCompletet != null) -// { -// m_HeroSkillCompletet(); -// } -// StopShow(); -// } - -// IEnumerator Co_PlayExtraEffect(Effect effect) -// { -// yield return new WaitForSeconds(effect.startTime); -// if (m_SkillExtraSfx != null) -// { -// SFXPlayUtility.Instance.Release(m_SkillExtraSfx); -// m_SkillExtraSfx = null; -// } -// var parent = hero; -// if (!string.IsNullOrEmpty(effect.parentName) && hero != null) -// { -// parent = hero.GetChildTransformDeeply(effect.parentName, true); -// } -// m_SkillExtraSfx = SFXPlayUtility.Instance.Play(effect.id, parent); -// if (m_SkillExtraSfx != null) -// { -// m_SkillExtraSfx.duration = effect.duration; -// m_SkillExtraSfx.transform.localPosition = effect.position; -// } -// } - -// public void StopShow() -// { -// if (UI3DTreasureSelectStage.Instance.IsOpen) -// { -// UI3DTreasureSelectStage.Instance.showCamera.enabled = true; -// } -// m_ShowCamera.SetActive(false); -// m_HeroSkillCompletet = null; -// m_HeroShow.Dispose(); -// if (m_SkillExtraSfx != null) -// { -// SFXPlayUtility.Instance.Release(m_SkillExtraSfx); -// m_SkillExtraSfx = null; -// } - -// if (skillEffect != null) -// { -// SFXPlayUtility.Instance.Release(skillEffect); -// skillEffect = null; -// } -// } - -// [Serializable] -// public struct CameraClip -// { -// public PlayerJob job; -// public string clip; -// } - -// [Serializable] -// public struct Effect -// { -// public PlayerJob job; -// public int id; -// public float startTime; -// public float duration; -// public string parentName; -// public Vector3 position; -// } - -// [Serializable] -// public struct TreasureSkill -// { -// public int treasureId; -// public List<CameraClip> clip; -// public List<Effect> effects; -// } - -// [Serializable] -// public struct SkillAct -// { -// public int skillId; -// public int mark; -// } - -// public enum PlayerJob -// { -// Qiang = 1, -// Fashi, -// } -// } -// } - diff --git a/Main/Component/UI/Common/UI3DHeroSkillShow.cs.meta b/Main/Component/UI/Common/UI3DHeroSkillShow.cs.meta deleted file mode 100644 index 1915aeb..0000000 --- a/Main/Component/UI/Common/UI3DHeroSkillShow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 25df4c1b0d67ec646be407d927845b1d -timeCreated: 1525425915 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/UI3DModelInteractProcessor.cs b/Main/Component/UI/Common/UI3DModelInteractProcessor.cs deleted file mode 100644 index b560d3a..0000000 --- a/Main/Component/UI/Common/UI3DModelInteractProcessor.cs +++ /dev/null @@ -1,110 +0,0 @@ -锘�// //-------------------------------------------------------- -// // [Author]: 绗簩涓栫晫 -// // [ Date ]: Sunday, September 10, 2017 -// //-------------------------------------------------------- -// using UnityEngine; -// using System.Collections; -// using UnityEngine.UI; -// using UnityEngine.EventSystems; -// using System; - -// namespace vnxbqy.UI -// { - -// public class UI3DModelInteractProcessor : MonoBehaviour -// { -// public event Action clickEvent; -// public event Action<Vector2> beginDragEvent; -// public event Action<Vector2> endDragEvent; -// public event Action<Vector2> dragingEvent; - -// RectTransform m_RectTransform; -// public RectTransform rectTransform { -// get { return m_RectTransform; } -// set { -// m_RectTransform = value; -// } -// } - -// bool isDown = false; -// float downTime = 0f; - -// private void LateUpdate() -// { -// if (Input.GetMouseButtonDown(0)) -// { -// OnPointerDown(); -// } - -// if (Input.GetMouseButton(0)) -// { -// OnPointerDrag(); -// } - -// if (Input.GetMouseButtonUp(0)) -// { -// OnPointerUp(); -// } -// } - -// void OnPointerDown() -// { -// if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, CameraManager.uiCamera)) -// { -// isDown = true; -// downTime = Time.time; -// if (beginDragEvent != null) -// { -// beginDragEvent(Input.mousePosition); -// } -// } - -// } - -// void OnPointerDrag() -// { -// if (!isDown) -// { -// return; -// } - -// if (dragingEvent != null) -// { -// dragingEvent(Input.mousePosition); -// } -// } - -// void OnPointerUp() -// { -// if (isDown) -// { -// if (Time.time - downTime < 0.3f) -// { -// if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, CameraManager.uiCamera)) -// { -// OnPointerClick(); -// } -// } - -// if (endDragEvent != null) -// { -// endDragEvent(Input.mousePosition); -// } -// } - -// isDown = false; -// } - -// void OnPointerClick() -// { -// if (clickEvent != null) -// { -// clickEvent(); -// } -// } -// } - -// } - - - diff --git a/Main/Component/UI/Common/UI3DModelInteractProcessor.cs.meta b/Main/Component/UI/Common/UI3DModelInteractProcessor.cs.meta deleted file mode 100644 index 11016fe..0000000 --- a/Main/Component/UI/Common/UI3DModelInteractProcessor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a39ec84bacd381e4e9e286a1a8d6123a -timeCreated: 1505052429 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/UI3DModelShowSpecialNPC.cs b/Main/Component/UI/Common/UI3DModelShowSpecialNPC.cs deleted file mode 100644 index fdc577e..0000000 --- a/Main/Component/UI/Common/UI3DModelShowSpecialNPC.cs +++ /dev/null @@ -1,50 +0,0 @@ -锘�// //-------------------------------------------------------- -// // [Author]: 绗簩涓栫晫 -// // [ Date ]: Friday, May 17, 2019 -// //-------------------------------------------------------- -// using UnityEngine; -// using System.Collections; -// using UnityEngine.UI; - -// namespace vnxbqy.UI -// { - -// /// <summary> -// /// 杩欎釜浠呬粎鏄粰浠欑殗娈嬮瓊鐢ㄧ殑 -// /// </summary> -// public class UI3DModelShowSpecialNPC : MonoBehaviour -// { -// [SerializeField] Transform m_StandPoint; -// public Transform standPoint { get { return m_StandPoint; } } - -// static UI3DModelShowSpecialNPC showPlatform; - -// public static void Display(GameObject model) -// { -// if (showPlatform == null) -// { -// var prefab = BuiltInLoader.LoadPrefab("UI3DModelShowSpecialNPC"); -// var instance = Instantiate(prefab); -// instance.transform.position = new Vector3(1000, 3000, 5000); -// showPlatform = instance.GetComponent<UI3DModelShowSpecialNPC>(); -// showPlatform.gameObject.name = "UI3DModelShowSpecialNPC"; -// } - -// model.transform.SetParentEx(showPlatform.standPoint, Vector3.zero, Quaternion.identity, Vector3.one); -// } - -// public static void Dispose() -// { -// if (showPlatform != null) -// { -// DestroyImmediate(showPlatform); -// showPlatform = null; -// } -// } - -// } - -// } - - - diff --git a/Main/Component/UI/Common/UI3DModelShowSpecialNPC.cs.meta b/Main/Component/UI/Common/UI3DModelShowSpecialNPC.cs.meta deleted file mode 100644 index c11e06e..0000000 --- a/Main/Component/UI/Common/UI3DModelShowSpecialNPC.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f7b8d7e81351bcd4d909f10df6a26ee1 -timeCreated: 1558072373 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/UI3DTreasureExhibition.cs b/Main/Component/UI/Common/UI3DTreasureExhibition.cs deleted file mode 100644 index 338eed4..0000000 --- a/Main/Component/UI/Common/UI3DTreasureExhibition.cs +++ /dev/null @@ -1,203 +0,0 @@ -锘�// //-------------------------------------------------------- -// // [Author]: 绗簩涓栫晫 -// // [ Date ]: Thursday, October 12, 2017 -// //-------------------------------------------------------- -// using UnityEngine; -// using System.Collections; -// using UnityEngine.UI; - - -// namespace vnxbqy.UI -// { - -// public class UI3DTreasureExhibition : MonoBehaviour -// { -// const string EFFECT_BONE = "Bone_effect"; - -// [SerializeField] Transform m_ShowPoint; -// [SerializeField] Camera m_ShowCamera; - -// //娉曞疂 -// int m_TreasureId = 0; -// GameObject treasureModel = null; -// SFXController effect; - -// //娉曞櫒 -// string m_FaqiPathName; -// string m_FaqiModelName; -// GameObject faqiModel = null; - -// GameObject weaponModel = null; -// int m_GodWeaponType = 0; - -// static UI3DTreasureExhibition m_Instance = null; -// public static UI3DTreasureExhibition Instance { -// get { -// if (m_Instance == null) -// { -// var gameObject = Instantiate(BuiltInLoader.LoadPrefab("UI3DTreasureExhibitionStage")); -// m_Instance = gameObject.GetComponent<UI3DTreasureExhibition>(); -// Instance.transform.position = new Vector3(0, 2000, 3000); -// m_Instance.name = "UI3DTreasureExhibitionStage"; -// m_Instance.SetActive(true); -// m_Instance.m_ShowCamera.enabled = false; -// DontDestroyOnLoad(gameObject); -// } - -// return m_Instance; -// } -// } - - -// public void ShowFaQiModel(string pathName, string modelName, RawImage _rawImage, int effectID) -// { -// var instance = UI3DModelFactory.LoadUIFaqi(pathName, modelName); -// if (instance == null) -// { -// return; -// } - -// Stop(); - -// m_ShowCamera.enabled = true; -// m_FaqiPathName = pathName; -// m_FaqiModelName = modelName; -// faqiModel = instance; -// instance.transform.SetParentEx(m_ShowPoint, Vector3.zero, Quaternion.identity, Vector3.one); -// instance.SetActive(true); - -// var fbPoint = faqiModel.transform.GetChildTransformDeeply(EFFECT_BONE); -// if (fbPoint == null) -// { -// fbPoint = faqiModel.transform; -// } - -// effect = SFXPlayUtility.Instance.Play(effectID, fbPoint); -// if (effect != null) -// { -// LayerUtility.SetLayer(effect.gameObject, LayerUtility.UILayer, true); -// } - -// if (_rawImage != null) -// { -// _rawImage.texture = m_ShowCamera.targetTexture; -// _rawImage.material = MaterialUtility.GetGUIRenderTextureMaterial(); -// } -// } - - -// public void ShowTreasure(int _treasureId, RawImage _rawImage) -// { -// var instance = UI3DModelFactory.LoadUITreasure(_treasureId); -// if (instance == null) -// { -// return; -// } - -// Stop(); - -// m_ShowCamera.enabled = true; -// m_TreasureId = _treasureId; -// treasureModel = instance; - -// var config = TreasureConfig.Get(_treasureId); - -// var scale = (config == null || config.UIScale == 0) ? 100 : config.UIScale; -// instance.transform.SetParentEx(m_ShowPoint, Vector3.zero, Quaternion.identity, Vector3.one * ((float)scale / 100)); -// instance.SetActive(true); - -// var mountPoint = treasureModel.transform.GetChildTransformDeeply(EFFECT_BONE); -// if (mountPoint == null) -// { -// mountPoint = treasureModel.transform; -// } - -// effect = SFXPlayUtility.Instance.Play(config.EffectID, mountPoint); -// if (effect != null) -// { -// LayerUtility.SetLayer(effect.gameObject, LayerUtility.UILayer, true); -// } - -// if (_rawImage != null) -// { -// _rawImage.texture = m_ShowCamera.targetTexture; -// _rawImage.material = MaterialUtility.GetGUIRenderTextureMaterial(); -// } -// } - -// public void ShowGodWeapon(int _type, RawImage _rawImage) -// { -// var instance = UI3DModelFactory.LoadUIGodWeapon(_type); -// if (instance == null) -// { -// return; -// } - -// Stop(); - -// m_ShowCamera.enabled = true; -// m_GodWeaponType = _type; -// weaponModel = instance; -// instance.transform.SetParentEx(m_ShowPoint, Vector3.zero, Quaternion.identity, Vector3.one); -// instance.SetActive(true); - -// if (_rawImage != null) -// { -// _rawImage.texture = m_ShowCamera.targetTexture; -// _rawImage.material = MaterialUtility.GetGUIRenderTextureMaterial(); -// } -// } - -// public void Stop() -// { -// m_ShowCamera.enabled = false; -// if (effect != null) -// { -// SFXPlayUtility.Instance.Release(effect); -// effect = null; -// } - -// if (weaponModel != null) -// { -// UI3DModelFactory.ReleaseUIGodWeapon(m_GodWeaponType, weaponModel); -// weaponModel = null; -// m_GodWeaponType = 0; -// } - -// if (treasureModel != null) -// { -// UI3DModelFactory.ReleaseUITreasure(m_TreasureId, treasureModel); -// treasureModel = null; -// m_TreasureId = 0; -// } - -// if (faqiModel != null) -// { -// UI3DModelFactory.ReleaseUIFaqi(m_FaqiPathName, m_FaqiModelName, faqiModel); -// faqiModel = null; -// m_FaqiPathName = string.Empty; -// m_FaqiModelName = string.Empty; -// } -// } - -// private void Awake() -// { -// OnQualityChange(); -// SystemSetting.Instance.qualityLevelChangeEvent += OnQualityChange; -// } - -// private void OnDestroy() -// { -// SystemSetting.Instance.qualityLevelChangeEvent -= OnQualityChange; -// } - -// private void OnQualityChange() -// { -// } - -// } - -// } - - - diff --git a/Main/Component/UI/Common/UI3DTreasureExhibition.cs.meta b/Main/Component/UI/Common/UI3DTreasureExhibition.cs.meta deleted file mode 100644 index c0f5a3b..0000000 --- a/Main/Component/UI/Common/UI3DTreasureExhibition.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 674a66b010e39974db01d315e509a3ac -timeCreated: 1507775902 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/UIPlaySound.cs b/Main/Component/UI/Common/UIPlaySound.cs index 26d14df..c3a5885 100644 --- a/Main/Component/UI/Common/UIPlaySound.cs +++ b/Main/Component/UI/Common/UIPlaySound.cs @@ -6,45 +6,42 @@ using System.Collections; using UnityEngine.UI; -namespace vnxbqy.UI + +public class UIPlaySound : MonoBehaviour { + [SerializeField] TriggerType m_TriggerType = TriggerType.Manual; + [SerializeField] int m_Audio = 1; - public class UIPlaySound : MonoBehaviour + public void Play() { - [SerializeField] TriggerType m_TriggerType = TriggerType.Manual; - [SerializeField] int m_Audio = 1; + SoundPlayer.Instance.PlayUIAudio(m_Audio); + } - public void Play() + private void OnEnable() + { + if (m_TriggerType == TriggerType.OnEnable) { - SoundPlayer.Instance.PlayUIAudio(m_Audio); + Play(); } + } - private void OnEnable() + private void Start() + { + if (m_TriggerType == TriggerType.OnStart) { - if (m_TriggerType == TriggerType.OnEnable) - { - Play(); - } + Play(); } + } - private void Start() - { - if (m_TriggerType == TriggerType.OnStart) - { - Play(); - } - } - - public enum TriggerType - { - OnEnable, - OnStart, - Manual - } - + public enum TriggerType + { + OnEnable, + OnStart, + Manual } } + diff --git a/Main/Component/UI/Common/UITextMark.cs b/Main/Component/UI/Common/UITextMark.cs deleted file mode 100644 index 69919de..0000000 --- a/Main/Component/UI/Common/UITextMark.cs +++ /dev/null @@ -1,16 +0,0 @@ -锘縰sing System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using System; -namespace vnxbqy.UI -{ - //缁橢ditor鐜涓嬩娇鐢紝鍙槸鎵撴爣璁扮敤锛岃鍙栫殑鏄痀.璇█琛� - //閫氳繃宸ュ叿缁欏凡鎵撴爣璁扮殑棰勫埗浣撹緭鍏ユ枃鏈唴瀹癸紝闈炴父鎴忚繍琛屾椂浣跨敤 - //姣斿鍦ㄨ秺鍗楃増鏈紙鍚庣画鍙樻垚鍒濆鐗堟湰锛夌粰棰勫埗浣撴墦鏍囪锛岀劧鍚庤嫳鏂囩増鏈憳鍙栧悗锛岀粰鎵撴爣璁扮殑棰勫埗浣撹繘琛岀炕璇� - public class UITextMark : MonoBehaviour - { - [SerializeField] public string language; - - } -} diff --git a/Main/Component/UI/Common/UITextMark.cs.meta b/Main/Component/UI/Common/UITextMark.cs.meta deleted file mode 100644 index da85a2e..0000000 --- a/Main/Component/UI/Common/UITextMark.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ce86e2e711a995b4ab51f002ac632cc9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/Component/UI/Common/UITextReplace.cs b/Main/Component/UI/Common/UITextReplace.cs index 2c2c161..167f057 100644 --- a/Main/Component/UI/Common/UITextReplace.cs +++ b/Main/Component/UI/Common/UITextReplace.cs @@ -3,21 +3,20 @@ using UnityEngine; using UnityEngine.UI; using System; -namespace vnxbqy.UI + + +//鍙敤浜嶵ext缁勪欢锛岃ˉ鍏呰缃枃鏈紝璇诲彇鐨勬槸Y.璇█琛�;娓告垙杩愯浼氳缃枃鏈唴瀹� +public class UITextReplace : MonoBehaviour { - //鍙敤浜嶵ext缁勪欢锛岃ˉ鍏呰缃枃鏈紝璇诲彇鐨勬槸Y.璇█琛�;娓告垙杩愯浼氳缃枃鏈唴瀹� - public class UITextReplace : MonoBehaviour - { - [SerializeField] string language; + [SerializeField] string language; - private void Awake() - { - var textObj = this.transform.GetComponent<Text>(); - if (textObj == null) - return; + private void Awake() + { + var textObj = this.transform.GetComponent<Text>(); + if (textObj == null) + return; - textObj.text = Language.Get(language); - } - + textObj.text = Language.Get(language); } + } diff --git a/Main/Component/UI/Core/CanvasAddition.cs b/Main/Component/UI/Core/CanvasAddition.cs index cae7da8..c7ae492 100644 --- a/Main/Component/UI/Core/CanvasAddition.cs +++ b/Main/Component/UI/Core/CanvasAddition.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; -using vnxbqy.UI; [DisallowMultipleComponent] [RequireComponent(typeof(Canvas))] diff --git a/Main/Component/UI/Core/DebugCanvasAddition.cs b/Main/Component/UI/Core/DebugCanvasAddition.cs index dae8105..23ed1a9 100644 --- a/Main/Component/UI/Core/DebugCanvasAddition.cs +++ b/Main/Component/UI/Core/DebugCanvasAddition.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; -using vnxbqy.UI; [DisallowMultipleComponent] [RequireComponent(typeof(Canvas))] diff --git a/Main/Component/UI/Core/GrayGroup.cs b/Main/Component/UI/Core/GrayGroup.cs index d76089b..0f1c37a 100644 --- a/Main/Component/UI/Core/GrayGroup.cs +++ b/Main/Component/UI/Core/GrayGroup.cs @@ -3,46 +3,43 @@ using UnityEngine; using UnityEngine.UI; -namespace vnxbqy.UI + +public class GrayGroup : MonoBehaviour { - public class GrayGroup : MonoBehaviour - { + Image[] m_Images; + Image[] images { + get { + if (m_Images == null) + { + m_Images = this.GetComponentsInChildren<Image>(); + } + return m_Images; + } + } - Image[] m_Images; - Image[] images { - get { - if (m_Images == null) + bool m_Gray = false; + public bool gray { + get { return m_Gray; } + set { + m_Gray = value; + + for (int i = 0; i < images.Length; i++) + { + var image = images[i]; + if (this.m_Gray) { - m_Images = this.GetComponentsInChildren<Image>(); + image.material = MaterialUtility.GetDefaultSpriteGrayMaterial(); } - return m_Images; + else + { + image.material = MaterialUtility.GetUIDefaultGraphicMaterial(); + } + } } - - bool m_Gray = false; - public bool gray { - get { return m_Gray; } - set { - m_Gray = value; - - for (int i = 0; i < images.Length; i++) - { - var image = images[i]; - if (this.m_Gray) - { - image.material = MaterialUtility.GetDefaultSpriteGrayMaterial(); - } - else - { - image.material = MaterialUtility.GetUIDefaultGraphicMaterial(); - } - - } - } - } - } } + diff --git a/Main/Component/UI/Decorate/Effect/SpriteEffect.cs b/Main/Component/UI/Decorate/Effect/SpriteEffect.cs index d2724bd..5f8c525 100644 --- a/Main/Component/UI/Decorate/Effect/SpriteEffect.cs +++ b/Main/Component/UI/Decorate/Effect/SpriteEffect.cs @@ -6,64 +6,62 @@ using System.Collections; using UnityEngine.UI; -namespace vnxbqy.UI { - [RequireComponent(typeof(Image))] - public class SpriteEffect:MonoBehaviour { +[RequireComponent(typeof(Image))] +public class SpriteEffect:MonoBehaviour { - [SerializeField] - Effect m_Effect = Effect.None; + [SerializeField] + Effect m_Effect = Effect.None; - CanvasAddition m_CanvasAddition; - public CanvasAddition canvasAddition { - get { - return this.m_CanvasAddition ?? (this.m_CanvasAddition = this.GetComponentInParent<CanvasAddition>()); + CanvasAddition m_CanvasAddition; + public CanvasAddition canvasAddition { + get { + return this.m_CanvasAddition ?? (this.m_CanvasAddition = this.GetComponentInParent<CanvasAddition>()); + } + } + + Image m_Image; + public Image image { + get { + return m_Image ?? (m_Image = this.AddMissingComponent<Image>()); + } + } + + Material m_TwinkleMaterial; + Material twinleMaterial { + get { + return m_TwinkleMaterial??(m_TwinkleMaterial=MaterialUtility.GetDefaultSpriteGrayMaterial()); + } + } + + + + private void OnEnable() { + if(this.image != null) { + switch(this.m_Effect) { + case Effect.Gray: + this.image.material = canvasAddition.spriteGrayMaterial; + break; + case Effect.Twinkle: + this.image.material = this.canvasAddition.spriteGrayMaterial; + break; + case Effect.None: + this.image.material = null; + break; + default: + break; } } + } - Image m_Image; - public Image image { - get { - return m_Image ?? (m_Image = this.AddMissingComponent<Image>()); - } - } - - Material m_TwinkleMaterial; - Material twinleMaterial { - get { - return m_TwinkleMaterial??(m_TwinkleMaterial=MaterialUtility.GetDefaultSpriteGrayMaterial()); - } - } - - - - private void OnEnable() { - if(this.image != null) { - switch(this.m_Effect) { - case Effect.Gray: - this.image.material = canvasAddition.spriteGrayMaterial; - break; - case Effect.Twinkle: - this.image.material = this.canvasAddition.spriteGrayMaterial; - break; - case Effect.None: - this.image.material = null; - break; - default: - break; - } - } - } - - public enum Effect { - None, - Gray, - Twinkle, - } - + public enum Effect { + None, + Gray, + Twinkle, } } + diff --git a/Main/Component/UI/Decorate/Graph/CustomImage.cs b/Main/Component/UI/Decorate/Graph/CustomImage.cs index 48e835c..16dfc8d 100644 --- a/Main/Component/UI/Decorate/Graph/CustomImage.cs +++ b/Main/Component/UI/Decorate/Graph/CustomImage.cs @@ -8,74 +8,72 @@ using UnityEngine.Sprites; using System; -namespace vnxbqy.UI { - [DisallowMultipleComponent] - [RequireComponent(typeof(Image))] - public class CustomImage:BaseMeshEffect { +[DisallowMultipleComponent] +[RequireComponent(typeof(Image))] +public class CustomImage:BaseMeshEffect { - [SerializeField] - Vector2[] m_Points; - public Vector2[] points { - get { - return this.m_Points; - } - set { - this.m_Points = value; - SetVerticesDirty(); - } + [SerializeField] + Vector2[] m_Points; + public Vector2[] points { + get { + return this.m_Points; + } + set { + this.m_Points = value; + SetVerticesDirty(); + } + } + + private Image m_Image; + public Image image { + get { + return this.m_Image ?? (this.m_Image = this.AddMissingComponent<Image>()); + } + } + + public void SetVerticesDirty() { + this.graphic.SetVerticesDirty(); + } + + public override void ModifyMesh(VertexHelper vh) { + vh.Clear(); + + if(this.image == null) { + throw new NullReferenceException(); } - private Image m_Image; - public Image image { - get { - return this.m_Image ?? (this.m_Image = this.AddMissingComponent<Image>()); - } + if(this.points == null || this.points.Length < 3) { + return; } - public void SetVerticesDirty() { - this.graphic.SetVerticesDirty(); + var width = this.image.rectTransform.rect.width; + var height = this.image.rectTransform.rect.height; + + var uv = this.image.overrideSprite != null ? DataUtility.GetOuterUV(this.image.overrideSprite) : Vector4.zero; + var uvcenterX = (uv.x + uv.z) * 0.5f; + var uvcenterY = (uv.y + uv.w) * 0.5f; + var uvscaleX = (uv.z - uv.x) / width; + var uvscaleY = (uv.w - uv.y) / height; + + for(var i = 0;i < this.points.Length;i++) { + var point = this.points[i]; + + var position = new Vector2(point.x,point.y); + var uv0 = new Vector2(position.x * uvscaleX + uvcenterX,position.y * uvscaleY + uvcenterY); + var vertex = UIUtility.PackageUIVertex(position,uv0,this.image.color); + vh.AddVert(vertex); } - public override void ModifyMesh(VertexHelper vh) { - vh.Clear(); - - if(this.image == null) { - throw new NullReferenceException(); - } - - if(this.points == null || this.points.Length < 3) { - return; - } - - var width = this.image.rectTransform.rect.width; - var height = this.image.rectTransform.rect.height; - - var uv = this.image.overrideSprite != null ? DataUtility.GetOuterUV(this.image.overrideSprite) : Vector4.zero; - var uvcenterX = (uv.x + uv.z) * 0.5f; - var uvcenterY = (uv.y + uv.w) * 0.5f; - var uvscaleX = (uv.z - uv.x) / width; - var uvscaleY = (uv.w - uv.y) / height; - - for(var i = 0;i < this.points.Length;i++) { - var point = this.points[i]; - - var position = new Vector2(point.x,point.y); - var uv0 = new Vector2(position.x * uvscaleX + uvcenterX,position.y * uvscaleY + uvcenterY); - var vertex = UIUtility.PackageUIVertex(position,uv0,this.image.color); - vh.AddVert(vertex); - } - - var vertexCount = this.points.Length; - var index = 0; - for(;index < vertexCount - 2;index++) { - vh.AddTriangle(index,index + 1,index + 2); - } + var vertexCount = this.points.Length; + var index = 0; + for(;index < vertexCount - 2;index++) { + vh.AddTriangle(index,index + 1,index + 2); } - } } + diff --git a/Main/Component/UI/Decorate/Graph/Hexagon.cs b/Main/Component/UI/Decorate/Graph/Hexagon.cs index 4211b86..fef0cfe 100644 --- a/Main/Component/UI/Decorate/Graph/Hexagon.cs +++ b/Main/Component/UI/Decorate/Graph/Hexagon.cs @@ -6,64 +6,62 @@ using UnityEngine.Sprites; using UnityEngine.UI; -namespace vnxbqy.UI { - [RequireComponent(typeof(RectTransform))] - public class Hexagon:BaseMeshEffect { +[RequireComponent(typeof(RectTransform))] +public class Hexagon:BaseMeshEffect { - const float SQUARE_ROOT_THREE = 1.732f; - Vector3[] positions = new Vector3[3]; + const float SQUARE_ROOT_THREE = 1.732f; + Vector3[] positions = new Vector3[3]; - RectTransform m_RectTransform; - public RectTransform rectTransform { - get { - return m_RectTransform ?? (m_RectTransform = this.transform as RectTransform); - } + RectTransform m_RectTransform; + public RectTransform rectTransform { + get { + return m_RectTransform ?? (m_RectTransform = this.transform as RectTransform); + } + } + + Image m_Image; + public Image image { + get { + return m_Image ?? (m_Image = this.GetComponent<Image>()); + } + } + + public override void ModifyMesh(VertexHelper vh) { + vh.Clear(); + + var uv = this.image != null ? DataUtility.GetOuterUV(this.image.overrideSprite) : Vector4.zero; + + var uvCenterX = (uv.x + uv.z) * 0.5f; + var uvCenterY = (uv.y + uv.w) * 0.5f; + var uvScaleX = (uv.z - uv.x) / this.rectTransform.rect.width; + var uvScaleY = (uv.w - uv.y) / this.rectTransform.rect.height; + + var xoffset = this.rectTransform.rect.width * 0.5f; + var yoffset = this.rectTransform.rect.height * 0.5f; + + this.positions[0] = new Vector3(0,yoffset); + this.positions[1] = new Vector3(-xoffset,yoffset * (1f - SQUARE_ROOT_THREE)); + this.positions[2] = new Vector3(xoffset,yoffset * (1f - SQUARE_ROOT_THREE)); + + for(var i = 0;i < 3;i++) { + var position = this.positions[i]; + var uv0 = new Vector2(position.x * uvScaleX + uvCenterX,position.y * uvScaleY + uvCenterY); + var vertex = UIUtility.PackageUIVertex(position,uv0,this.image.color); + vh.AddVert(vertex); + + position = this.positions[i] * -1f; + uv0 = new Vector2(position.x * uvScaleX + uvCenterX,position.y * uvScaleY + uvCenterY); + vertex = UIUtility.PackageUIVertex(position,uv0,this.image.color); + vh.AddVert(vertex); } - Image m_Image; - public Image image { - get { - return m_Image ?? (m_Image = this.GetComponent<Image>()); - } - } - - public override void ModifyMesh(VertexHelper vh) { - vh.Clear(); - - var uv = this.image != null ? DataUtility.GetOuterUV(this.image.overrideSprite) : Vector4.zero; - - var uvCenterX = (uv.x + uv.z) * 0.5f; - var uvCenterY = (uv.y + uv.w) * 0.5f; - var uvScaleX = (uv.z - uv.x) / this.rectTransform.rect.width; - var uvScaleY = (uv.w - uv.y) / this.rectTransform.rect.height; - - var xoffset = this.rectTransform.rect.width * 0.5f; - var yoffset = this.rectTransform.rect.height * 0.5f; - - this.positions[0] = new Vector3(0,yoffset); - this.positions[1] = new Vector3(-xoffset,yoffset * (1f - SQUARE_ROOT_THREE)); - this.positions[2] = new Vector3(xoffset,yoffset * (1f - SQUARE_ROOT_THREE)); - - for(var i = 0;i < 3;i++) { - var position = this.positions[i]; - var uv0 = new Vector2(position.x * uvScaleX + uvCenterX,position.y * uvScaleY + uvCenterY); - var vertex = UIUtility.PackageUIVertex(position,uv0,this.image.color); - vh.AddVert(vertex); - - position = this.positions[i] * -1f; - uv0 = new Vector2(position.x * uvScaleX + uvCenterX,position.y * uvScaleY + uvCenterY); - vertex = UIUtility.PackageUIVertex(position,uv0,this.image.color); - vh.AddVert(vertex); - } - - vh.AddTriangle(0,2,4); - vh.AddTriangle(1,3,5); - } - + vh.AddTriangle(0,2,4); + vh.AddTriangle(1,3,5); } } + diff --git a/Main/Component/UI/Decorate/Graph/OffsetImage.cs b/Main/Component/UI/Decorate/Graph/OffsetImage.cs index 623b32d..a2ef73e 100644 --- a/Main/Component/UI/Decorate/Graph/OffsetImage.cs +++ b/Main/Component/UI/Decorate/Graph/OffsetImage.cs @@ -8,86 +8,83 @@ using System; using System.Collections.Generic; -namespace vnxbqy.UI { - public class OffsetImage:BaseMeshEffect { +public class OffsetImage:BaseMeshEffect { - [SerializeField] - Vector2 m_Offset; - public Vector2 offset { - get { - return m_Offset; - } - set { - m_Offset = value; + [SerializeField] + Vector2 m_Offset; + public Vector2 offset { + get { + return m_Offset; + } + set { + m_Offset = value; + } + } + + public override void ModifyMesh(VertexHelper vh) { + List<UIVertex> vertexs = new List<UIVertex>(); + vh.GetUIVertexStream(vertexs); + + if(vertexs == null || vertexs.Count == 0) { + return; + } + vh.Clear(); + + var positions = new Vector3[3]; + var uv0s = new Vector2[3]; + + var firstQuard = new UIVertex[6] { + vertexs[0], + vertexs[1], + vertexs[2], + vertexs[3], + vertexs[4], + vertexs[5] + }; + + for(var i = 0;i < firstQuard.Length;i++) { + var vertex = firstQuard[i]; + var position = vertex.position + new Vector3(offset.x,offset.y,0); + vertex.position = position; + firstQuard[i] = vertex; + + if((i % 3) == 2) { + positions[0] = firstQuard[i - 2].position; + uv0s[0] = firstQuard[i - 2].uv0; + positions[1] = firstQuard[i - 1].position; + uv0s[1] = firstQuard[i - 1].uv0; + positions[2] = firstQuard[i].position; + uv0s[2] = firstQuard[i].uv0; + + UIUtility.AddTriangle(vh,positions,Color.white,uv0s); } } - public override void ModifyMesh(VertexHelper vh) { - List<UIVertex> vertexs = new List<UIVertex>(); - vh.GetUIVertexStream(vertexs); - if(vertexs == null || vertexs.Count == 0) { - return; - } - vh.Clear(); - var positions = new Vector3[3]; - var uv0s = new Vector2[3]; + var index = 5 * 6; + for(int i = 0;i < vertexs.Count;i++) { - var firstQuard = new UIVertex[6] { - vertexs[0], - vertexs[1], - vertexs[2], - vertexs[3], - vertexs[4], - vertexs[5] - }; + if(i > index) { - for(var i = 0;i < firstQuard.Length;i++) { - var vertex = firstQuard[i]; - var position = vertex.position + new Vector3(offset.x,offset.y,0); - vertex.position = position; - firstQuard[i] = vertex; - - if((i % 3) == 2) { - positions[0] = firstQuard[i - 2].position; - uv0s[0] = firstQuard[i - 2].uv0; - positions[1] = firstQuard[i - 1].position; - uv0s[1] = firstQuard[i - 1].uv0; - positions[2] = firstQuard[i].position; - uv0s[2] = firstQuard[i].uv0; - - UIUtility.AddTriangle(vh,positions,Color.white,uv0s); - } } + if((i % 3) == 2) { + positions[0] = vertexs[i - 2].position; + uv0s[0] = vertexs[i - 2].uv0; + positions[1] = vertexs[i - 1].position; + uv0s[1] = vertexs[i - 1].uv0; + positions[2] = vertexs[i].position; + uv0s[2] = vertexs[i].uv0; - - var index = 5 * 6; - for(int i = 0;i < vertexs.Count;i++) { - - if(i > index) { - - } - - if((i % 3) == 2) { - positions[0] = vertexs[i - 2].position; - uv0s[0] = vertexs[i - 2].uv0; - positions[1] = vertexs[i - 1].position; - uv0s[1] = vertexs[i - 1].uv0; - positions[2] = vertexs[i].position; - uv0s[2] = vertexs[i].uv0; - - UIUtility.AddTriangle(vh,positions,Color.white,uv0s); - } + UIUtility.AddTriangle(vh,positions,Color.white,uv0s); } - - - - } + + + } @@ -95,3 +92,4 @@ + diff --git a/Main/Component/UI/Decorate/Graph/OffsetImage2.cs b/Main/Component/UI/Decorate/Graph/OffsetImage2.cs index 2860c18..1ff47f5 100644 --- a/Main/Component/UI/Decorate/Graph/OffsetImage2.cs +++ b/Main/Component/UI/Decorate/Graph/OffsetImage2.cs @@ -7,69 +7,66 @@ using UnityEngine.UI; using System.Collections.Generic; -namespace vnxbqy.UI { - public class OffsetImage2:Text { +public class OffsetImage2:Text { - [SerializeField] - Vector2 m_Offset; - public Vector2 offset { - get { - return m_Offset; - } - set { - m_Offset = value; - - } + [SerializeField] + Vector2 m_Offset; + public Vector2 offset { + get { + return m_Offset; } - - protected override void OnPopulateMesh(VertexHelper toFill) { - base.OnPopulateMesh(toFill); - List<UIVertex> vertexs = new List<UIVertex>(); - toFill.GetUIVertexStream(vertexs); - - if(vertexs == null || vertexs.Count == 0) { - return; - } - - toFill.Clear(); - var newVertexs = new List<UIVertex>(); - var index = 1 * 6 - 1; - for(int i = 0;i < vertexs.Count;i++) { - - var vertex = vertexs[i]; - if(i == index) { - newVertexs.AddRange(AddHexgon(vertexs[i - 5].position,new Vector2(offset.x,font.fontSize),Color.white)); - } - if(i > index) { - var position = vertex.position + new Vector3(offset.x,offset.y,0); - vertex.position = position; - } - newVertexs.Add(vertex); - } - - - var aaa= this.cachedTextGenerator.verts; - toFill.AddUIVertexTriangleStream(newVertexs); - LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform); - } - - private UIVertex[] AddHexgon(Vector3 _startPosition,Vector2 _offset,Color _color) { - - var hexgon = new UIVertex[4]; - var positions = new Vector3[4]; - positions[0] = _startPosition; - positions[1] = _startPosition + new Vector3(_offset.x,0,0); - positions[2] = _startPosition + new Vector3(_offset.x,-_offset.y,0); - positions[3] = _startPosition + new Vector3(0,-_offset.y,0); - - for(int i = 0;i < 4;i++) { - hexgon[i] = UIUtility.PackageUIVertexUV1(positions[i],Vector2.zero,_color); - } - - return hexgon; + set { + m_Offset = value; } + } + + protected override void OnPopulateMesh(VertexHelper toFill) { + base.OnPopulateMesh(toFill); + List<UIVertex> vertexs = new List<UIVertex>(); + toFill.GetUIVertexStream(vertexs); + + if(vertexs == null || vertexs.Count == 0) { + return; + } + + toFill.Clear(); + var newVertexs = new List<UIVertex>(); + var index = 1 * 6 - 1; + for(int i = 0;i < vertexs.Count;i++) { + + var vertex = vertexs[i]; + if(i == index) { + newVertexs.AddRange(AddHexgon(vertexs[i - 5].position,new Vector2(offset.x,font.fontSize),Color.white)); + } + if(i > index) { + var position = vertex.position + new Vector3(offset.x,offset.y,0); + vertex.position = position; + } + newVertexs.Add(vertex); + } + + + var aaa= this.cachedTextGenerator.verts; + toFill.AddUIVertexTriangleStream(newVertexs); + LayoutRebuilder.MarkLayoutForRebuild(this.rectTransform); + } + + private UIVertex[] AddHexgon(Vector3 _startPosition,Vector2 _offset,Color _color) { + + var hexgon = new UIVertex[4]; + var positions = new Vector3[4]; + positions[0] = _startPosition; + positions[1] = _startPosition + new Vector3(_offset.x,0,0); + positions[2] = _startPosition + new Vector3(_offset.x,-_offset.y,0); + positions[3] = _startPosition + new Vector3(0,-_offset.y,0); + + for(int i = 0;i < 4;i++) { + hexgon[i] = UIUtility.PackageUIVertexUV1(positions[i],Vector2.zero,_color); + } + + return hexgon; } @@ -77,3 +74,4 @@ + diff --git a/Main/Component/UI/Decorate/Graph/PolylineImage.cs b/Main/Component/UI/Decorate/Graph/PolylineImage.cs index 8aaddb2..063fcab 100644 --- a/Main/Component/UI/Decorate/Graph/PolylineImage.cs +++ b/Main/Component/UI/Decorate/Graph/PolylineImage.cs @@ -6,61 +6,58 @@ using UnityEngine; using UnityEngine.UI; -namespace vnxbqy.UI { - /// <summary> - /// 杩欎釜缁勪欢鎺ユ敹涓�浜涢《鐐癸紝缁樺埗鍑烘按骞冲拰鍨傜洿鐨勭嚎銆� - /// </summary> - public class PolylineImage:Graphic { +/// <summary> +/// 杩欎釜缁勪欢鎺ユ敹涓�浜涢《鐐癸紝缁樺埗鍑烘按骞冲拰鍨傜洿鐨勭嚎銆� +/// </summary> +public class PolylineImage:Graphic { - [SerializeField] - float m_Width; - public float width { - get { - return this.m_Width; - } - set { - this.m_Width = value; - base.SetVerticesDirty(); - } + [SerializeField] + float m_Width; + public float width { + get { + return this.m_Width; + } + set { + this.m_Width = value; + base.SetVerticesDirty(); + } + } + + [SerializeField] + Vector2[] m_Points; + public Vector2[] points { + get { + return this.m_Points; + } + set { + this.m_Points = value; + base.SetVerticesDirty(); + } + } + + protected override void OnPopulateMesh(VertexHelper vh) { + vh.Clear(); + if(this.points == null || this.points.Length < 2) { + return; } - [SerializeField] - Vector2[] m_Points; - public Vector2[] points { - get { - return this.m_Points; - } - set { - this.m_Points = value; - base.SetVerticesDirty(); - } - } + var hw = this.width * 0.5f; - protected override void OnPopulateMesh(VertexHelper vh) { - vh.Clear(); - if(this.points == null || this.points.Length < 2) { - return; - } + for(var i = 0;i < this.points.Length - 1;i++) { + var point = this.points[i]; + var nextPoint = this.points[i + 1]; - var hw = this.width * 0.5f; + var xReversal = point.x > nextPoint.x; + var yReversal = point.y > nextPoint.y; - for(var i = 0;i < this.points.Length - 1;i++) { - var point = this.points[i]; - var nextPoint = this.points[i + 1]; + var positions = new Vector3[4]; + positions[0] = new Vector2(xReversal ? point.x + hw : point.x - hw,yReversal ? point.y + hw : point.y - hw); + positions[1] = new Vector2(xReversal ? nextPoint.x - hw : nextPoint.x + hw,yReversal ? point.y + hw : point.y - hw); + positions[2] = new Vector2(xReversal ? nextPoint.x - hw : nextPoint.x + hw,yReversal ? nextPoint.y - hw : nextPoint.y + hw); + positions[3] = new Vector2(xReversal ? point.x + hw : point.x - hw,yReversal ? nextPoint.y - hw : nextPoint.y + hw); - var xReversal = point.x > nextPoint.x; - var yReversal = point.y > nextPoint.y; - - var positions = new Vector3[4]; - positions[0] = new Vector2(xReversal ? point.x + hw : point.x - hw,yReversal ? point.y + hw : point.y - hw); - positions[1] = new Vector2(xReversal ? nextPoint.x - hw : nextPoint.x + hw,yReversal ? point.y + hw : point.y - hw); - positions[2] = new Vector2(xReversal ? nextPoint.x - hw : nextPoint.x + hw,yReversal ? nextPoint.y - hw : nextPoint.y + hw); - positions[3] = new Vector2(xReversal ? point.x + hw : point.x - hw,yReversal ? nextPoint.y - hw : nextPoint.y + hw); - - UIUtility.AddQuad(vh,positions,color,new Vector2[4] { Vector2.one,Vector2.one,Vector2.one,Vector2.one }); - } - + UIUtility.AddQuad(vh,positions,color,new Vector2[4] { Vector2.one,Vector2.one,Vector2.one,Vector2.one }); } } @@ -69,3 +66,4 @@ + diff --git a/Main/Component/UI/Decorate/Graph/Rhombus.cs b/Main/Component/UI/Decorate/Graph/Rhombus.cs index 61f67c6..52ad822 100644 --- a/Main/Component/UI/Decorate/Graph/Rhombus.cs +++ b/Main/Component/UI/Decorate/Graph/Rhombus.cs @@ -6,64 +6,60 @@ using UnityEngine.Sprites; using UnityEngine.UI; -namespace vnxbqy.UI + +[RequireComponent(typeof(RectTransform))] +public class Rhombus : BaseMeshEffect { + const float SQUARE_ROOT_THREE = 1f; + Vector3[] positions = new Vector3[3]; - [RequireComponent(typeof(RectTransform))] - public class Rhombus : BaseMeshEffect + RectTransform m_RectTransform; + public RectTransform rectTransform { + get { + return m_RectTransform ?? (m_RectTransform = this.transform as RectTransform); + } + } + + Image m_Image; + public Image image { + get { + return m_Image ?? (m_Image = this.GetComponent<Image>()); + } + } + + public override void ModifyMesh(VertexHelper vh) { - const float SQUARE_ROOT_THREE = 1f; - Vector3[] positions = new Vector3[3]; + vh.Clear(); - RectTransform m_RectTransform; - public RectTransform rectTransform { - get { - return m_RectTransform ?? (m_RectTransform = this.transform as RectTransform); - } - } + var uv = this.image != null ? DataUtility.GetOuterUV(this.image.overrideSprite) : Vector4.zero; - Image m_Image; - public Image image { - get { - return m_Image ?? (m_Image = this.GetComponent<Image>()); - } - } + var uvCenterX = (uv.x + uv.z) * 0.5f; + var uvCenterY = (uv.y + uv.w) * 0.5f; + var uvScaleX = (uv.z - uv.x) / this.rectTransform.rect.width; + var uvScaleY = (uv.w - uv.y) / this.rectTransform.rect.height; - public override void ModifyMesh(VertexHelper vh) + var xoffset = this.rectTransform.rect.width * 0.5f; + var yoffset = this.rectTransform.rect.height * 0.5f; + + this.positions[0] = new Vector3(0, yoffset); + this.positions[1] = new Vector3(-xoffset, yoffset * (1f - SQUARE_ROOT_THREE)); + this.positions[2] = new Vector3(xoffset, yoffset * (1f - SQUARE_ROOT_THREE)); + + for (var i = 0; i < 3; i++) { - vh.Clear(); + var position = this.positions[i]; + var uv0 = new Vector2(position.x * uvScaleX + uvCenterX, position.y * uvScaleY + uvCenterY); + var vertex = UIUtility.PackageUIVertex(position, uv0, this.image.color); + vh.AddVert(vertex); - var uv = this.image != null ? DataUtility.GetOuterUV(this.image.overrideSprite) : Vector4.zero; - - var uvCenterX = (uv.x + uv.z) * 0.5f; - var uvCenterY = (uv.y + uv.w) * 0.5f; - var uvScaleX = (uv.z - uv.x) / this.rectTransform.rect.width; - var uvScaleY = (uv.w - uv.y) / this.rectTransform.rect.height; - - var xoffset = this.rectTransform.rect.width * 0.5f; - var yoffset = this.rectTransform.rect.height * 0.5f; - - this.positions[0] = new Vector3(0, yoffset); - this.positions[1] = new Vector3(-xoffset, yoffset * (1f - SQUARE_ROOT_THREE)); - this.positions[2] = new Vector3(xoffset, yoffset * (1f - SQUARE_ROOT_THREE)); - - for (var i = 0; i < 3; i++) - { - var position = this.positions[i]; - var uv0 = new Vector2(position.x * uvScaleX + uvCenterX, position.y * uvScaleY + uvCenterY); - var vertex = UIUtility.PackageUIVertex(position, uv0, this.image.color); - vh.AddVert(vertex); - - position = this.positions[i] * -1f; - uv0 = new Vector2(position.x * uvScaleX + uvCenterX, position.y * uvScaleY + uvCenterY); - vertex = UIUtility.PackageUIVertex(position, uv0, this.image.color); - vh.AddVert(vertex); - } - - vh.AddTriangle(0, 2, 4); - vh.AddTriangle(1, 3, 5); + position = this.positions[i] * -1f; + uv0 = new Vector2(position.x * uvScaleX + uvCenterX, position.y * uvScaleY + uvCenterY); + vertex = UIUtility.PackageUIVertex(position, uv0, this.image.color); + vh.AddVert(vertex); } + vh.AddTriangle(0, 2, 4); + vh.AddTriangle(1, 3, 5); } } @@ -71,3 +67,4 @@ + diff --git a/Main/Component/UI/Decorate/Move/UILinerMove.cs b/Main/Component/UI/Decorate/Move/UILinerMove.cs index 29cf4d3..00b30c0 100644 --- a/Main/Component/UI/Decorate/Move/UILinerMove.cs +++ b/Main/Component/UI/Decorate/Move/UILinerMove.cs @@ -6,77 +6,74 @@ using System.Collections; using UnityEngine.UI; -namespace vnxbqy.UI +[RequireComponent(typeof(RectTransform))] +public class UILinerMove : MonoBehaviour { - [RequireComponent(typeof(RectTransform))] - public class UILinerMove : MonoBehaviour + [SerializeField] float m_Duration; + public float duration { + get { return m_Duration; } + set { m_Duration = value; } + } + + [SerializeField] Vector2 m_From; + public Vector2 from { + get { return m_From; } + set { m_From = value; } + } + + [SerializeField] Vector2 m_To; + public Vector2 to { + get { return m_To; } + set { m_To = value; } + } + + float timer = float.MaxValue; + RectTransform rectTransform { get { return this.transform as RectTransform; } } + + public void Begin() { - [SerializeField] float m_Duration; - public float duration { - get { return m_Duration; } - set { m_Duration = value; } - } - - [SerializeField] Vector2 m_From; - public Vector2 from { - get { return m_From; } - set { m_From = value; } - } - - [SerializeField] Vector2 m_To; - public Vector2 to { - get { return m_To; } - set { m_To = value; } - } - - float timer = float.MaxValue; - RectTransform rectTransform { get { return this.transform as RectTransform; } } - - public void Begin() + if (duration < 0f) { - if (duration < 0f) - { - return; - } - - if (!this.gameObject.activeInHierarchy) - { - Stop(); - } - else - { - timer = 0f; - rectTransform.anchoredPosition = from; - } + return; } - public void Stop() + if (!this.gameObject.activeInHierarchy) { - timer = float.MaxValue; - rectTransform.anchoredPosition = to; + Stop(); } - - private void OnDisable() + else { - if (timer < duration) - { - Stop(); - } + timer = 0f; + rectTransform.anchoredPosition = from; } + } - private void LateUpdate() + public void Stop() + { + timer = float.MaxValue; + rectTransform.anchoredPosition = to; + } + + private void OnDisable() + { + if (timer < duration) { - if (timer < duration) - { - timer += Time.deltaTime; - var t = Mathf.Clamp01(timer / duration); - rectTransform.anchoredPosition = Vector2.Lerp(from, to, t); - } + Stop(); } + } + private void LateUpdate() + { + if (timer < duration) + { + timer += Time.deltaTime; + var t = Mathf.Clamp01(timer / duration); + rectTransform.anchoredPosition = Vector2.Lerp(from, to, t); + } } } + diff --git a/Main/Component/UI/Decorate/Move/UISmoothMove.cs b/Main/Component/UI/Decorate/Move/UISmoothMove.cs index 255b4ac..b15f3b2 100644 --- a/Main/Component/UI/Decorate/Move/UISmoothMove.cs +++ b/Main/Component/UI/Decorate/Move/UISmoothMove.cs @@ -6,55 +6,52 @@ using System.Collections; using UnityEngine.UI; -namespace vnxbqy.UI + +public class UISmoothMove : MonoBehaviour { + [SerializeField] Vector2 m_To; + public Vector2 to { + get { return m_To; } + set { m_To = value; } + } - public class UISmoothMove : MonoBehaviour + [SerializeField] float m_Smooth = 0.2f; + + Vector2 refPosition = Vector2.zero; + RectTransform rectTransform { get { return this.transform as RectTransform; } } + + bool show = false; + + public void Begin() { - [SerializeField] Vector2 m_To; - public Vector2 to { - get { return m_To; } - set { m_To = value; } - } + refPosition = Vector2.zero; + show = true; + } - [SerializeField] float m_Smooth = 0.2f; + public void Stop() + { + show = false; + } - Vector2 refPosition = Vector2.zero; - RectTransform rectTransform { get { return this.transform as RectTransform; } } - - bool show = false; - - public void Begin() + private void LateUpdate() + { + if (Vector2.Distance(rectTransform.anchoredPosition, to) > 1f) { - refPosition = Vector2.zero; - show = true; + if (show) + { + var newPosition = Vector2.SmoothDamp(rectTransform.anchoredPosition, to, ref refPosition, m_Smooth, 1000, Time.deltaTime); + rectTransform.anchoredPosition = newPosition; + } } - - public void Stop() + else { show = false; } - - private void LateUpdate() - { - if (Vector2.Distance(rectTransform.anchoredPosition, to) > 1f) - { - if (show) - { - var newPosition = Vector2.SmoothDamp(rectTransform.anchoredPosition, to, ref refPosition, m_Smooth, 1000, Time.deltaTime); - rectTransform.anchoredPosition = newPosition; - } - } - else - { - show = false; - } - } - - } + } + diff --git a/Main/Component/UI/Decorate/PingPong/PingPongMove.cs b/Main/Component/UI/Decorate/PingPong/PingPongMove.cs index 024af32..b93dba9 100644 --- a/Main/Component/UI/Decorate/PingPong/PingPongMove.cs +++ b/Main/Component/UI/Decorate/PingPong/PingPongMove.cs @@ -1,47 +1,45 @@ 锘縰sing UnityEngine; using System.Collections; -namespace vnxbqy.UI { - public class PingPongMove:MonoBehaviour { +public class PingPongMove:MonoBehaviour { - public Transform reference; - public Vector3 amplitue; - public float speed; + public Transform reference; + public Vector3 amplitue; + public float speed; - Vector3 referencePos = Vector3.zero; + Vector3 referencePos = Vector3.zero; - void OnEnable() { - referencePos = reference == null ? this.transform.localPosition : reference.localPosition; - } - - float x = 0f; - float y = 0f; - float z = 0f; - void LateUpdate() { - - if(Mathf.Abs(amplitue.x) > 0.001f) { - x = referencePos.x - amplitue.x * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.x); - } - else { - x = referencePos.x; - } - - if(Mathf.Abs(amplitue.y) > 0.001f) { - y = referencePos.y - amplitue.y * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.y); - } - else { - y = referencePos.y; - } - - if(Mathf.Abs(amplitue.z) > 0.001f) { - z = referencePos.z - amplitue.z * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.z); - } - else { - z = referencePos.z; - } - - this.transform.localPosition = new Vector3(x,y,z); - } - + void OnEnable() { + referencePos = reference == null ? this.transform.localPosition : reference.localPosition; } + + float x = 0f; + float y = 0f; + float z = 0f; + void LateUpdate() { + + if(Mathf.Abs(amplitue.x) > 0.001f) { + x = referencePos.x - amplitue.x * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.x); + } + else { + x = referencePos.x; + } + + if(Mathf.Abs(amplitue.y) > 0.001f) { + y = referencePos.y - amplitue.y * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.y); + } + else { + y = referencePos.y; + } + + if(Mathf.Abs(amplitue.z) > 0.001f) { + z = referencePos.z - amplitue.z * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.z); + } + else { + z = referencePos.z; + } + + this.transform.localPosition = new Vector3(x,y,z); + } + } diff --git a/Main/Component/UI/Decorate/PingPong/PingPongRotation.cs b/Main/Component/UI/Decorate/PingPong/PingPongRotation.cs index fdf6859..31c091e 100644 --- a/Main/Component/UI/Decorate/PingPong/PingPongRotation.cs +++ b/Main/Component/UI/Decorate/PingPong/PingPongRotation.cs @@ -1,47 +1,46 @@ 锘縰sing UnityEngine; using System.Collections; -namespace vnxbqy.UI { - public class PingPongRotation:MonoBehaviour { - public Transform reference; - public Vector3 amplitue; - public float speed; +public class PingPongRotation:MonoBehaviour { - Vector3 referenceEuler = Vector3.zero; + public Transform reference; + public Vector3 amplitue; + public float speed; - void OnEnable() { - referenceEuler = reference == null ? this.transform.localEulerAngles : reference.localEulerAngles; - } + Vector3 referenceEuler = Vector3.zero; - float x = 0f; - float y = 0f; - float z = 0f; - void LateUpdate() { - - if(Mathf.Abs(amplitue.x) > 0.001f) { - x = referenceEuler.x - amplitue.x * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.x); - } - else { - x = referenceEuler.x; - } - - if(Mathf.Abs(amplitue.y) > 0.001f) { - y = referenceEuler.y - amplitue.y * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.y); - } - else { - y = referenceEuler.y; - } - - if(Mathf.Abs(amplitue.z) > 0.001f) { - z = referenceEuler.z - amplitue.z * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.z); - } - else { - z = referenceEuler.z; - } - - this.transform.localEulerAngles = new Vector3(x,y,z); - } - + void OnEnable() { + referenceEuler = reference == null ? this.transform.localEulerAngles : reference.localEulerAngles; } + + float x = 0f; + float y = 0f; + float z = 0f; + void LateUpdate() { + + if(Mathf.Abs(amplitue.x) > 0.001f) { + x = referenceEuler.x - amplitue.x * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.x); + } + else { + x = referenceEuler.x; + } + + if(Mathf.Abs(amplitue.y) > 0.001f) { + y = referenceEuler.y - amplitue.y * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.y); + } + else { + y = referenceEuler.y; + } + + if(Mathf.Abs(amplitue.z) > 0.001f) { + z = referenceEuler.z - amplitue.z * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.z); + } + else { + z = referenceEuler.z; + } + + this.transform.localEulerAngles = new Vector3(x,y,z); + } + } diff --git a/Main/Component/UI/Decorate/PingPong/PingPongScale.cs b/Main/Component/UI/Decorate/PingPong/PingPongScale.cs index ce2c45e..533f7b0 100644 --- a/Main/Component/UI/Decorate/PingPong/PingPongScale.cs +++ b/Main/Component/UI/Decorate/PingPong/PingPongScale.cs @@ -1,48 +1,46 @@ 锘縰sing UnityEngine; using System.Collections; -namespace vnxbqy.UI { - public class PingPongScale:MonoBehaviour { +public class PingPongScale:MonoBehaviour { - public Transform reference; - public Vector3 amplitue; - public float speed; + public Transform reference; + public Vector3 amplitue; + public float speed; - Vector3 referenceScale = Vector3.zero; + Vector3 referenceScale = Vector3.zero; - void OnEnable() { - referenceScale = reference == null ? this.transform.localScale : reference.localScale; - } - - float x = 0f; - float y = 0f; - float z = 0f; - void LateUpdate() { - - if(Mathf.Abs(amplitue.x) > 0.001f) { - x = referenceScale.x - amplitue.x * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.x); - } - else { - x = referenceScale.x; - } - - if(Mathf.Abs(amplitue.y) > 0.001f) { - y = referenceScale.y - amplitue.y * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.y); - } - else { - y = referenceScale.y; - } - - if(Mathf.Abs(amplitue.z) > 0.001f) { - z = referenceScale.z - amplitue.z * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.z); - } - else { - z = referenceScale.z; - } - - this.transform.localScale = new Vector3(x,y,z); - } + void OnEnable() { + referenceScale = reference == null ? this.transform.localScale : reference.localScale; } + float x = 0f; + float y = 0f; + float z = 0f; + void LateUpdate() { + + if(Mathf.Abs(amplitue.x) > 0.001f) { + x = referenceScale.x - amplitue.x * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.x); + } + else { + x = referenceScale.x; + } + + if(Mathf.Abs(amplitue.y) > 0.001f) { + y = referenceScale.y - amplitue.y * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.y); + } + else { + y = referenceScale.y; + } + + if(Mathf.Abs(amplitue.z) > 0.001f) { + z = referenceScale.z - amplitue.z * 0.5f + Mathf.PingPong(Time.time * speed,amplitue.z); + } + else { + z = referenceScale.z; + } + + this.transform.localScale = new Vector3(x,y,z); + } } + diff --git a/Main/Component/UI/Decorate/Tweens/RotationTween.cs b/Main/Component/UI/Decorate/Tweens/RotationTween.cs index c5aa8dd..719bbae 100644 --- a/Main/Component/UI/Decorate/Tweens/RotationTween.cs +++ b/Main/Component/UI/Decorate/Tweens/RotationTween.cs @@ -1,41 +1,38 @@ 锘縰sing UnityEngine; using System.Collections; -namespace vnxbqy.UI + +public class RotationTween : Tween { - public class RotationTween : Tween + public override void SetStartState() + { + base.SetStartState(); + this.transform.localEulerAngles = from; + } + + public override void SetEndState() + { + base.SetEndState(); + this.transform.localEulerAngles = to; + } + + protected override void OnPrepare() + { + base.OnPrepare(); + this.transform.localEulerAngles = reversal ? to : from; + } + + protected override void OnOnceEnd() { - public override void SetStartState() - { - base.SetStartState(); - this.transform.localEulerAngles = from; - } + this.transform.localEulerAngles = reversal ? from : to; + base.OnOnceEnd(); + } - public override void SetEndState() - { - base.SetEndState(); - this.transform.localEulerAngles = to; - } - - protected override void OnPrepare() - { - base.OnPrepare(); - this.transform.localEulerAngles = reversal ? to : from; - } - - protected override void OnOnceEnd() - { - - this.transform.localEulerAngles = reversal ? from : to; - base.OnOnceEnd(); - } - - protected override void UpdateVector3() - { - base.UpdateVector3(); - this.transform.localEulerAngles = CalculateVector3(); - } + protected override void UpdateVector3() + { + base.UpdateVector3(); + this.transform.localEulerAngles = CalculateVector3(); } } diff --git a/Main/Component/UI/Decorate/Tweens/ScaleTween.cs b/Main/Component/UI/Decorate/Tweens/ScaleTween.cs index a03c80d..ae98577 100644 --- a/Main/Component/UI/Decorate/Tweens/ScaleTween.cs +++ b/Main/Component/UI/Decorate/Tweens/ScaleTween.cs @@ -1,36 +1,36 @@ 锘縰sing UnityEngine; using System.Collections; - public class ScaleTween : Tween +public class ScaleTween : Tween +{ + public override void SetStartState() { - public override void SetStartState() - { - base.SetStartState(); - this.transform.localScale = from; - } + base.SetStartState(); + this.transform.localScale = from; + } - public override void SetEndState() - { - base.SetEndState(); - this.transform.localScale = to; - } + public override void SetEndState() + { + base.SetEndState(); + this.transform.localScale = to; + } - protected override void OnPrepare() - { - base.OnPrepare(); - this.transform.localScale = reversal ? to : from; - } + protected override void OnPrepare() + { + base.OnPrepare(); + this.transform.localScale = reversal ? to : from; + } - protected override void OnOnceEnd() - { - this.transform.localScale = reversal ? from : to; - base.OnOnceEnd(); - } + protected override void OnOnceEnd() + { + this.transform.localScale = reversal ? from : to; + base.OnOnceEnd(); + } - protected override void UpdateVector3() - { - base.UpdateVector3(); - this.transform.localScale = CalculateVector3(); - } + protected override void UpdateVector3() + { + base.UpdateVector3(); + this.transform.localScale = CalculateVector3(); + } - } \ No newline at end of file +} \ No newline at end of file diff --git a/Main/Component/UI/Decorate/Tweens/Tween.cs b/Main/Component/UI/Decorate/Tweens/Tween.cs index 8b18ab9..87ea6e4 100644 --- a/Main/Component/UI/Decorate/Tweens/Tween.cs +++ b/Main/Component/UI/Decorate/Tweens/Tween.cs @@ -2,232 +2,232 @@ using System.Collections; using System; - [RequireComponent(typeof(RectTransform))] - public class Tween : MonoBehaviour +[RequireComponent(typeof(RectTransform))] +public class Tween : MonoBehaviour +{ + public TweenCurve curve; + public Vector3 from; + public Vector3 to; + + public DelayMode delayMode = DelayMode.Time; + public float delay = 0f; + + public float duration = 1f; + public Trigger trigger = Trigger.Manual; + public WrapMode wrapMode; + public bool reversal; + + protected RectTransform rectTransform { get { return this.transform as RectTransform; } } + + protected float accumulatedTime; + protected float curveLength; + protected bool doTween = false; + + Action onPlayEndCallBack; + + public virtual void SetStartState() { - public TweenCurve curve; - public Vector3 from; - public Vector3 to; - public DelayMode delayMode = DelayMode.Time; - public float delay = 0f; + } - public float duration = 1f; - public Trigger trigger = Trigger.Manual; - public WrapMode wrapMode; - public bool reversal; + public virtual void SetEndState() + { - protected RectTransform rectTransform { get { return this.transform as RectTransform; } } + } - protected float accumulatedTime; - protected float curveLength; - protected bool doTween = false; + public void Play() + { + onPlayEndCallBack = null; + reversal = false; + StopAllCoroutines(); + StartCoroutine(Co_StartTween()); + } - Action onPlayEndCallBack; + public void Play(bool _reversal) + { + onPlayEndCallBack = null; + reversal = _reversal; + StopAllCoroutines(); + StartCoroutine(Co_StartTween()); + } - public virtual void SetStartState() + public void Play(Action _callBack) + { + reversal = false; + onPlayEndCallBack = _callBack; + StopAllCoroutines(); + StartCoroutine(Co_StartTween()); + } + + public void Play(bool _reversal, Action _callBack) + { + reversal = _reversal; + onPlayEndCallBack = _callBack; + StopAllCoroutines(); + StartCoroutine(Co_StartTween()); + } + + void Start() + { + if (trigger == Trigger.Start) { - - } - - public virtual void SetEndState() - { - - } - - public void Play() - { - onPlayEndCallBack = null; - reversal = false; - StopAllCoroutines(); StartCoroutine(Co_StartTween()); } + } - public void Play(bool _reversal) + protected virtual void OnEnable() + { + if (trigger == Trigger.Enable) { - onPlayEndCallBack = null; - reversal = _reversal; - StopAllCoroutines(); StartCoroutine(Co_StartTween()); } + } - public void Play(Action _callBack) + protected virtual void OnDisable() + { + onPlayEndCallBack = null; + StopAllCoroutines(); + } + + void LateUpdate() + { + if (doTween && duration > 0.001f) { - reversal = false; - onPlayEndCallBack = _callBack; - StopAllCoroutines(); - StartCoroutine(Co_StartTween()); - } + accumulatedTime += Time.deltaTime; + UpdateVector3(); - public void Play(bool _reversal, Action _callBack) - { - reversal = _reversal; - onPlayEndCallBack = _callBack; - StopAllCoroutines(); - StartCoroutine(Co_StartTween()); - } - - void Start() - { - if (trigger == Trigger.Start) - { - StartCoroutine(Co_StartTween()); - } - } - - protected virtual void OnEnable() - { - if (trigger == Trigger.Enable) - { - StartCoroutine(Co_StartTween()); - } - } - - protected virtual void OnDisable() - { - onPlayEndCallBack = null; - StopAllCoroutines(); - } - - void LateUpdate() - { - if (doTween && duration > 0.001f) - { - accumulatedTime += Time.deltaTime; - UpdateVector3(); - - switch (wrapMode) - { - case WrapMode.Once: - if (accumulatedTime > duration) - { - OnOnceEnd(); - doTween = false; - } - break; - case WrapMode.PingPongOnce: - if (accumulatedTime > duration*2) - { - OnOnceEnd(); - doTween = false; - } - break; - } - } - } - - IEnumerator Co_StartTween() - { - if (delay < 0f) - { - Debug.LogError("Delaytime should not be less than zero!"); - yield break; - } - if (duration < 0.001f) - { - Debug.LogError("Duration should not be less than zero!"); - yield break; - } - - if (curve.keys.Length < 2) - { - Debug.LogError("涓嶆纭殑鏇茬嚎!"); - yield break; - } - - accumulatedTime = 0f; - doTween = false; - OnPrepare(); - switch (delayMode) - { - case DelayMode.OneFrame: - yield return null; - break; - case DelayMode.TwiceFrame: - yield return null; - yield return null; - break; - case DelayMode.Time: - if (delay > 0.001f) - { - yield return new WaitForSeconds(delay); - } - break; - } - - curveLength = curve.keys[curve.keys.Length - 1].time - curve.keys[0].time; - doTween = true; - - } - - protected Vector3 CalculateVector3() - { - Vector3 newVector3 = Vector3.zero; - float t = 0f; switch (wrapMode) { case WrapMode.Once: - t = (accumulatedTime / duration) * curveLength; + if (accumulatedTime > duration) + { + OnOnceEnd(); + doTween = false; + } break; - case WrapMode.Loop: - t = Mathf.Repeat((accumulatedTime / duration) * curveLength, 1); - break; - case WrapMode.PingPong: case WrapMode.PingPongOnce: - t = Mathf.PingPong((accumulatedTime / duration) * curveLength, 1); + if (accumulatedTime > duration*2) + { + OnOnceEnd(); + doTween = false; + } break; } - - var value = curve.Evaluate(reversal ? curveLength - t : t); - newVector3 = Vector3.LerpUnclamped(from, to, value); - - return newVector3; - } - - protected virtual void OnPrepare() - { - - } - - protected virtual void OnOnceEnd() - { - if (onPlayEndCallBack != null) - { - onPlayEndCallBack(); - onPlayEndCallBack = null; - } - } - - protected virtual void UpdateVector3() - { - - } - - public void Stop() - { - doTween = false; - } - - public enum DelayMode - { - OneFrame, - TwiceFrame, - Time, - } - - public enum Trigger - { - Manual, - Start, - Enable, - } - - public enum WrapMode - { - Once, - Loop, - PingPong, - PingPongOnce, } } + IEnumerator Co_StartTween() + { + if (delay < 0f) + { + Debug.LogError("Delaytime should not be less than zero!"); + yield break; + } + if (duration < 0.001f) + { + Debug.LogError("Duration should not be less than zero!"); + yield break; + } + + if (curve.keys.Length < 2) + { + Debug.LogError("涓嶆纭殑鏇茬嚎!"); + yield break; + } + + accumulatedTime = 0f; + doTween = false; + OnPrepare(); + switch (delayMode) + { + case DelayMode.OneFrame: + yield return null; + break; + case DelayMode.TwiceFrame: + yield return null; + yield return null; + break; + case DelayMode.Time: + if (delay > 0.001f) + { + yield return new WaitForSeconds(delay); + } + break; + } + + curveLength = curve.keys[curve.keys.Length - 1].time - curve.keys[0].time; + doTween = true; + + } + + protected Vector3 CalculateVector3() + { + Vector3 newVector3 = Vector3.zero; + float t = 0f; + switch (wrapMode) + { + case WrapMode.Once: + t = (accumulatedTime / duration) * curveLength; + break; + case WrapMode.Loop: + t = Mathf.Repeat((accumulatedTime / duration) * curveLength, 1); + break; + case WrapMode.PingPong: + case WrapMode.PingPongOnce: + t = Mathf.PingPong((accumulatedTime / duration) * curveLength, 1); + break; + } + + var value = curve.Evaluate(reversal ? curveLength - t : t); + newVector3 = Vector3.LerpUnclamped(from, to, value); + + return newVector3; + } + + protected virtual void OnPrepare() + { + + } + + protected virtual void OnOnceEnd() + { + if (onPlayEndCallBack != null) + { + onPlayEndCallBack(); + onPlayEndCallBack = null; + } + } + + protected virtual void UpdateVector3() + { + + } + + public void Stop() + { + doTween = false; + } + + public enum DelayMode + { + OneFrame, + TwiceFrame, + Time, + } + + public enum Trigger + { + Manual, + Start, + Enable, + } + + public enum WrapMode + { + Once, + Loop, + PingPong, + PingPongOnce, + } +} + diff --git a/Main/Component/UI/Effect/EffectMgr.cs b/Main/Component/UI/Effect/EffectMgr.cs index fee045b..e0b1024 100644 --- a/Main/Component/UI/Effect/EffectMgr.cs +++ b/Main/Component/UI/Effect/EffectMgr.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using UnityEngine; +锘縰sing UnityEngine; public class EffectMgr : SingletonMonobehaviour<EffectMgr> diff --git a/Main/Component/UI/Effect/UIEffect.cs b/Main/Component/UI/Effect/UIEffect.cs index b074a1a..33eb1d4 100644 --- a/Main/Component/UI/Effect/UIEffect.cs +++ b/Main/Component/UI/Effect/UIEffect.cs @@ -3,7 +3,6 @@ using UnityEngine; using System; using UnityEngine.Rendering; -using vnxbqy.UI; using UnityEngine.UI; #if UNITY_EDITOR diff --git a/Main/Component/UI/Effect/UIEffectBehaviour.cs b/Main/Component/UI/Effect/UIEffectBehaviour.cs index 729a241..5540e39 100644 --- a/Main/Component/UI/Effect/UIEffectBehaviour.cs +++ b/Main/Component/UI/Effect/UIEffectBehaviour.cs @@ -2,157 +2,154 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; -namespace vnxbqy.UI +public class UIEffectBehaviour : MonoBehaviour { - public class UIEffectBehaviour : MonoBehaviour + private List<ParticleSystem> m_Particles = new List<ParticleSystem>(); + private List<Animator> m_Animators = new List<Animator>(); + private List<Renderer> m_Renderers = new List<Renderer>(); + + public float duration { get; private set; } + private Vector3 m_RectMaskPosition; + private bool m_RectMaskEnable; + private RectTransform m_RectMask; + + public bool IsAnimatorControl { get; private set; } + + private void Awake() { - private List<ParticleSystem> m_Particles = new List<ParticleSystem>(); - private List<Animator> m_Animators = new List<Animator>(); - private List<Renderer> m_Renderers = new List<Renderer>(); + GetComponent(); + this.gameObject.SetLayer(LayerUtility.UIEffectLayer, true); + } - public float duration { get; private set; } - private Vector3 m_RectMaskPosition; - private bool m_RectMaskEnable; - private RectTransform m_RectMask; - - public bool IsAnimatorControl { get; private set; } - - private void Awake() + public void SetParticlesScale(Vector3 _scale) + { + if (_scale != Vector3.one) + foreach (var par in m_Particles) { - GetComponent(); - this.gameObject.SetLayer(LayerUtility.UIEffectLayer, true); + par.transform.localScale = _scale; } + } - public void SetParticlesScale(Vector3 _scale) + + public void SetOrder(int _order) + { + foreach (var _renderer in m_Renderers) { - if (_scale != Vector3.one) - foreach (var par in m_Particles) - { - par.transform.localScale = _scale; - } + _renderer.sortingOrder = _order; + _renderer.sortingLayerName = "UI"; } + } - - public void SetOrder(int _order) + public void PerformMask(RectMask2D[] _masks) + { + RectTransform _rect = null; + var _mask = _masks == null || _masks.Length == 0 ? null : _masks[0]; + if (_mask == null) { - foreach (var _renderer in m_Renderers) - { - _renderer.sortingOrder = _order; - _renderer.sortingLayerName = "UI"; - } - } - - public void PerformMask(RectMask2D[] _masks) - { - RectTransform _rect = null; - var _mask = _masks == null || _masks.Length == 0 ? null : _masks[0]; - if (_mask == null) - { - _rect = null; - } - else - { - _rect = _mask.rectTransform; - } - PerformMask(_rect); - } - - public void PerformMask(Mask[] _masks) - { - RectTransform _rect = null; - var _mask = _masks == null || _masks.Length == 0 ? null : _masks[0]; - if (_mask == null) - { _rect = null; - } - else - { - _rect = _mask.rectTransform; - } - PerformMask(_rect); } - - public void PerformMask(RectTransform _mask) + else { - m_RectMask = _mask; - m_RectMaskEnable = _mask != null; - if (_mask != null) - { - m_RectMaskPosition = _mask.position; - _mask.GetWorldCorners(s_RectMask); - s_ClipRect.x = s_RectMask[0].x; s_ClipRect.y = s_RectMask[0].y; - s_ClipRect.z = s_RectMask[2].x; s_ClipRect.w = s_RectMask[2].y; - } - foreach (var _renderer in m_Renderers) - { - var _mat = _renderer.material; - SetClipRect(_mat, s_ClipRect, m_RectMaskEnable); - } + _rect = _mask.rectTransform; } + PerformMask(_rect); + } - private void GetComponent() + public void PerformMask(Mask[] _masks) + { + RectTransform _rect = null; + var _mask = _masks == null || _masks.Length == 0 ? null : _masks[0]; + if (_mask == null) { - transform.GetComponentsInChildren(true, m_Renderers); - IsAnimatorControl = false; - TraverseChild(transform); + _rect = null; } - - private void TraverseChild(Transform parent) + else { - ParticleSystem particle = parent.GetComponent<ParticleSystem>(); - if (particle != null) - { - if (particle.main.duration > duration && !IsAnimatorControl) - { - duration = particle.main.duration; - } - m_Particles.Add(particle); - } - Animator animator = parent.GetComponent<Animator>(); - if (animator != null) - { - m_Animators.Add(animator); - AnimatorStateInfo state = animator.GetCurrentAnimatorStateInfo(0); - duration = state.length > duration ? state.length : duration; - IsAnimatorControl = true; - } - foreach (Transform child in parent) - { - TraverseChild(child); - } + _rect = _mask.rectTransform; } + PerformMask(_rect); + } - private Vector4 s_ClipRect = Vector4.zero; - private Vector3[] s_RectMask = new Vector3[4]; - - private void SetClipRect(Material _mat, Vector4 _clipRect, bool _mask) + public void PerformMask(RectTransform _mask) + { + m_RectMask = _mask; + m_RectMaskEnable = _mask != null; + if (_mask != null) { - _mat.SetVector("_ClipRect", _clipRect); - _mat.SetFloat("_UseClipRect", _mask ? 1 : 0); + m_RectMaskPosition = _mask.position; + _mask.GetWorldCorners(s_RectMask); + s_ClipRect.x = s_RectMask[0].x; s_ClipRect.y = s_RectMask[0].y; + s_ClipRect.z = s_RectMask[2].x; s_ClipRect.w = s_RectMask[2].y; } - - public Animator GetAnimator() + foreach (var _renderer in m_Renderers) { - if (IsAnimatorControl && m_Animators.Count > 0) + var _mat = _renderer.material; + SetClipRect(_mat, s_ClipRect, m_RectMaskEnable); + } + } + + private void GetComponent() + { + transform.GetComponentsInChildren(true, m_Renderers); + IsAnimatorControl = false; + TraverseChild(transform); + } + + private void TraverseChild(Transform parent) + { + ParticleSystem particle = parent.GetComponent<ParticleSystem>(); + if (particle != null) + { + if (particle.main.duration > duration && !IsAnimatorControl) { - return m_Animators[0]; + duration = particle.main.duration; } - return null; + m_Particles.Add(particle); } - - private void LateUpdate() + Animator animator = parent.GetComponent<Animator>(); + if (animator != null) { - if (m_RectMask != null && (m_RectMaskPosition != m_RectMask.position)) - { - m_RectMaskPosition = m_RectMask.position; - PerformMask(m_RectMask); - } + m_Animators.Add(animator); + AnimatorStateInfo state = animator.GetCurrentAnimatorStateInfo(0); + duration = state.length > duration ? state.length : duration; + IsAnimatorControl = true; } - - private void OnDisable() + foreach (Transform child in parent) { - m_RectMask = null; + TraverseChild(child); } } + + private Vector4 s_ClipRect = Vector4.zero; + private Vector3[] s_RectMask = new Vector3[4]; + + private void SetClipRect(Material _mat, Vector4 _clipRect, bool _mask) + { + _mat.SetVector("_ClipRect", _clipRect); + _mat.SetFloat("_UseClipRect", _mask ? 1 : 0); + } + + public Animator GetAnimator() + { + if (IsAnimatorControl && m_Animators.Count > 0) + { + return m_Animators[0]; + } + return null; + } + + private void LateUpdate() + { + if (m_RectMask != null && (m_RectMaskPosition != m_RectMask.position)) + { + m_RectMaskPosition = m_RectMask.position; + PerformMask(m_RectMask); + } + } + + private void OnDisable() + { + m_RectMask = null; + } } diff --git a/Main/Core/GameEngine/Launch/GetVersionInfoTask.cs b/Main/Core/GameEngine/Launch/GetVersionInfoTask.cs index 0a60fb8..77cee0b 100644 --- a/Main/Core/GameEngine/Launch/GetVersionInfoTask.cs +++ b/Main/Core/GameEngine/Launch/GetVersionInfoTask.cs @@ -2,7 +2,6 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; using System; using System.Collections.Generic; using System.IO; diff --git a/Main/Core/GameEngine/Launch/LaunchInHot.cs b/Main/Core/GameEngine/Launch/LaunchInHot.cs index bde58e2..dabf573 100644 --- a/Main/Core/GameEngine/Launch/LaunchInHot.cs +++ b/Main/Core/GameEngine/Launch/LaunchInHot.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; using System; using System.Collections.Generic; using System.IO; diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs index b425993..3d87900 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H01_System/DTC0102_tagCDBPlayer.cs @@ -1,5 +1,4 @@ 锘縰sing UnityEngine; -using vnxbqy.UI; using System; //01 02 鐜╁鍒濆鍖�#tagCDBPlayer diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H02_PlayerTalk/DTC0212_tagNotifyCode.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H02_PlayerTalk/DTC0212_tagNotifyCode.cs index e700d22..72e08ed 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H02_PlayerTalk/DTC0212_tagNotifyCode.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H02_PlayerTalk/DTC0212_tagNotifyCode.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //02 12 锟斤拷锟斤拷锟斤拷示#tagNotifyCode diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0316_tagPackResetOK.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0316_tagPackResetOK.cs index 73c9c77..15cc47c 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0316_tagPackResetOK.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H03_MainCharacter/DTC0316_tagPackResetOK.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //03 16 锟斤拷锟斤拷锟斤拷锟斤拷锟缴癸拷#tagPackResetOK diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0403_tagPlayerLoginLoadOK.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0403_tagPlayerLoginLoadOK.cs index aad146a..c006fc4 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0403_tagPlayerLoginLoadOK.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H04_Scene/DTC0403_tagPlayerLoginLoadOK.cs @@ -1,7 +1,6 @@ using UnityEngine; using System.Collections; using System; -using vnxbqy.UI; public class DTC0403_tagPlayerLoginLoadOK : DtcBasic { diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0704_tagRolePackRefresh.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0704_tagRolePackRefresh.cs index b7bc1a4..2f56c40 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0704_tagRolePackRefresh.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0704_tagRolePackRefresh.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //07 04 锟斤拷锟角憋拷锟斤拷刷锟斤拷#tagRolePackRefresh diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0706_tagUseItemSuccess.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0706_tagUseItemSuccess.cs index ab0fc9b..1bed9d8 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0706_tagUseItemSuccess.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0706_tagUseItemSuccess.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //07 06 锟斤拷锟绞癸拷锟斤拷锟狡凤拷晒锟�#tagUseItemSuccess public class DTC0706_tagUseItemSuccess : DtcBasic diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0707_tagItemCountRefresh.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0707_tagItemCountRefresh.cs index 124efa8..5a6810d 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0707_tagItemCountRefresh.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0707_tagItemCountRefresh.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //07 07 锟斤拷品锟斤拷锟斤拷刷锟斤拷#tagItemCountRefresh diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0709_tagClearItem.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0709_tagClearItem.cs index 800548e..c70ced1 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0709_tagClearItem.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0709_tagClearItem.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //07 09 锟斤拷锟斤拷锟狡�#tagClearItem diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0711_tagClearItemPack.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0711_tagClearItemPack.cs index 680248d..47176d8 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0711_tagClearItemPack.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0711_tagClearItemPack.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //07 11 锟斤拷毡锟斤拷锟�#tagClearItemPack diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0724_tagRolePackCanUseCount.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0724_tagRolePackCanUseCount.cs index d380375..146cc34 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0724_tagRolePackCanUseCount.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0724_tagRolePackCanUseCount.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //07 24 锟斤拷锟角憋拷锟斤拷锟窖匡拷锟斤拷锟斤拷锟斤拷#tagRolePackCanUseCount diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0725_tagRolePackRefreshEx.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0725_tagRolePackRefreshEx.cs index 8cac3c1..ded66fb 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0725_tagRolePackRefreshEx.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/H07_PlayerItem/DTC0725_tagRolePackRefreshEx.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; //07 25 锟斤拷锟角憋拷锟斤拷刷锟铰o拷通知锟斤拷锟斤拷锟斤拷品锟斤拷 #tagRolePackRefreshEx diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA204_tagMCVPackRefresh.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA204_tagMCVPackRefresh.cs index 36268cc..a2fc02a 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA204_tagMCVPackRefresh.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA204_tagMCVPackRefresh.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; // A2 04 锟斤拷锟解背锟斤拷锟斤拷品刷锟斤拷 #tagMCVPackRefresh diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA205_tagMCVPackClear.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA205_tagMCVPackClear.cs index 807ba6f..924b3c1 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA205_tagMCVPackClear.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA205_tagMCVPackClear.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; // A2 05 锟斤拷锟解背锟斤拷锟斤拷品锟斤拷锟� #tagMCVPackClear diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA206_tagMCAutoItemCountRefresh.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA206_tagMCAutoItemCountRefresh.cs index 3c8a4f4..246d5dc 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA206_tagMCAutoItemCountRefresh.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA2_Package/DTCA206_tagMCAutoItemCountRefresh.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; // A2 06 鑷姩杞寲涓哄搴旂墿鍝両D涓暟鍒锋柊 #tagMCAutoItemCountRefresh diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA362_tagMCMailList.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA362_tagMCMailList.cs index fb3173a..95a581d 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA362_tagMCMailList.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA362_tagMCMailList.cs @@ -1,5 +1,4 @@ // A3 62 閭欢鍒楄〃 #tagMCMailList -using vnxbqy.UI; public class DTCA362_tagMCMailList : DtcBasic { diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA363_tagMCMailStateChange.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA363_tagMCMailStateChange.cs index 15f3173..797e1ff 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA363_tagMCMailStateChange.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA3_Function/DTCA363_tagMCMailStateChange.cs @@ -1,5 +1,4 @@ // A3 63 閭欢鐘舵�佸彉鏇� #tagMCMailStateChange -using vnxbqy.UI; public class DTCA363_tagMCMailStateChange : DtcBasic { diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs index 4fd1fb9..f72ba4c 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA801_tagMCGiveAwardInfo.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; // A8 01 鑾峰緱濂栧姳淇℃伅 #tagMCGiveAwardInfo public class DTCA801_tagMCGiveAwardInfo : DtcBasic { diff --git a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA809_tagMCItemDayUseCntInfo.cs b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA809_tagMCItemDayUseCntInfo.cs index 54e77e9..82dce76 100644 --- a/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA809_tagMCItemDayUseCntInfo.cs +++ b/Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA809_tagMCItemDayUseCntInfo.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using vnxbqy.UI; // A8 09 閫氱煡鐗╁搧褰撴棩宸蹭娇鐢ㄦ鏁� #tagMCItemDayUseCntInfo public class DTCA809_tagMCItemDayUseCntInfo : DtcBasic { diff --git a/Main/SDK/SDKUtils.cs b/Main/SDK/SDKUtils.cs index 40480ca..5de29d2 100644 --- a/Main/SDK/SDKUtils.cs +++ b/Main/SDK/SDKUtils.cs @@ -601,7 +601,7 @@ // case CodeA2U.ExitGame: // if (ChannelPlatform == E_ChannelPlatform.Free) // { -// vnxbqy.UI.WindowCenter.Instance.Open<vnxbqy.UI.ExitGameWin>(); +// WindowCenter.Instance.Open<ExitGameWin>(); // } // else // { diff --git a/Main/System/Chat/ChatChannelCell.cs b/Main/System/Chat/ChatChannelCell.cs index 49ea85d..a64b4dd 100644 --- a/Main/System/Chat/ChatChannelCell.cs +++ b/Main/System/Chat/ChatChannelCell.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System.Collections; +锘縰sing System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; diff --git a/Main/System/Chat/ChatExtraOneCell.cs b/Main/System/Chat/ChatExtraOneCell.cs index f3f4c29..7bf4a9f 100644 --- a/Main/System/Chat/ChatExtraOneCell.cs +++ b/Main/System/Chat/ChatExtraOneCell.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System.Collections; +锘縰sing System.Collections; using System.Collections.Generic; using UnityEngine; using EnhancedUI.EnhancedScroller; diff --git a/Main/System/Chat/ChatFriendCell.cs b/Main/System/Chat/ChatFriendCell.cs index 8817c3c..5d0432f 100644 --- a/Main/System/Chat/ChatFriendCell.cs +++ b/Main/System/Chat/ChatFriendCell.cs @@ -2,47 +2,43 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; -using vnxbqy.UI; -namespace EnhancedUI.EnhancedScroller -{ - // public class ChatFriendCell : ScrollerUI - // { - // [SerializeField] RichText m_ChatText; - // [SerializeField] Text m_VipText; - // [SerializeField] Text m_NameText; - // [SerializeField] AvatarCell m_ChatIcon; - // [SerializeField] ImageFitterText m_ImageFitter; - - // public override void Refresh(CellView cell) - // { - // var _index = cell.index; - // int _playerId = ChatCtrl.Inst.PteChatID; - // var _list = ChatCtrl.Inst.GetChatInfo(_playerId); - // if (_list != null && _index < _list.Count) - // { - // ChatFriendData chat = _list[_index]; - // m_ChatText.text = chat.content; - // if (type == ScrollerDataType.Header) - // { - // m_ChatText.AutoNewLine = false; - // if (m_ChatText.preferredWidth > m_ChatText.rectTransform.rect.width) - // { - // m_ChatText.alignment = TextAnchor.UpperLeft; - // } - // else - // { - // m_ChatText.alignment = TextAnchor.UpperRight; - // } - // m_ChatText.AutoNewLine = true; - // } - // m_ImageFitter.FiterRealTxtWidth = m_ChatText.alignment == TextAnchor.UpperRight; - // m_VipText.text = chat.vipLv > 0 ? StringUtility.Contact("V", chat.vipLv) : string.Empty; - // m_NameText.text = chat.name; - // m_ChatIcon.InitUI(AvatarHelper.GetAvatarModel(chat.player, chat.face, chat.facePic, chat.job)); - // m_ChatText.text = chat.content; - // } - // } - // } -} +//public class ChatFriendCell : ScrollerUI +//{ +// [SerializeField] RichText m_ChatText; +// [SerializeField] Text m_VipText; +// [SerializeField] Text m_NameText; +// [SerializeField] AvatarCell m_ChatIcon; +// [SerializeField] ImageFitterText m_ImageFitter; + +// public override void Refresh(CellView cell) +// { +// var _index = cell.index; +// int _playerId = ChatCtrl.Inst.PteChatID; +// var _list = ChatCtrl.Inst.GetChatInfo(_playerId); +// if (_list != null && _index < _list.Count) +// { +// ChatFriendData chat = _list[_index]; +// m_ChatText.text = chat.content; +// if (type == ScrollerDataType.Header) +// { +// m_ChatText.AutoNewLine = false; +// if (m_ChatText.preferredWidth > m_ChatText.rectTransform.rect.width) +// { +// m_ChatText.alignment = TextAnchor.UpperLeft; +// } +// else +// { +// m_ChatText.alignment = TextAnchor.UpperRight; +// } +// m_ChatText.AutoNewLine = true; +// } +// m_ImageFitter.FiterRealTxtWidth = m_ChatText.alignment == TextAnchor.UpperRight; +// m_VipText.text = chat.vipLv > 0 ? StringUtility.Contact("V", chat.vipLv) : string.Empty; +// m_NameText.text = chat.name; +// m_ChatIcon.InitUI(AvatarHelper.GetAvatarModel(chat.player, chat.face, chat.facePic, chat.job)); +// m_ChatText.text = chat.content; +// } +// } +//} diff --git a/Main/System/Chat/ChatItemCell.cs b/Main/System/Chat/ChatItemCell.cs index 2425910..99ca228 100644 --- a/Main/System/Chat/ChatItemCell.cs +++ b/Main/System/Chat/ChatItemCell.cs @@ -3,14 +3,11 @@ using UnityEngine; using UnityEngine.UI; -namespace vnxbqy.UI +public class ChatItemCell : CellView { - public class ChatItemCell : CellView - { - [SerializeField] List<ItemCell> m_Items; - public List<ItemCell> items { get { return m_Items; } } - [SerializeField] List<Image> m_ItemEquips; - public List<Image> itemEquips { get { return m_ItemEquips; } } - } + [SerializeField] List<ItemCell> m_Items; + public List<ItemCell> items { get { return m_Items; } } + [SerializeField] List<Image> m_ItemEquips; + public List<Image> itemEquips { get { return m_ItemEquips; } } } diff --git a/Main/System/Chat/ChatManager.cs b/Main/System/Chat/ChatManager.cs index 08809cd..a1c46b2 100644 --- a/Main/System/Chat/ChatManager.cs +++ b/Main/System/Chat/ChatManager.cs @@ -4,7 +4,6 @@ using System.Text; using System; using System.Text.RegularExpressions; -using vnxbqy.UI; using System.Linq; diff --git a/Main/System/Chat/ChatRecentlyCell.cs b/Main/System/Chat/ChatRecentlyCell.cs index a1afa8b..5299288 100644 --- a/Main/System/Chat/ChatRecentlyCell.cs +++ b/Main/System/Chat/ChatRecentlyCell.cs @@ -1,58 +1,58 @@ -锘縰sing vnxbqy.UI; -using System.Collections; +锘縰sing System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; -using EnhancedUI.EnhancedScroller; - public class ChatRecentlyCell : ScrollerUI + + +public class ChatRecentlyCell : ScrollerUI +{ + [SerializeField] Image m_PlayerBG; + [SerializeField] Image m_Select; + [SerializeField] Text m_PlayerName; + [SerializeField] Text m_Lv; + [SerializeField] Image m_LvSign; + [SerializeField] Text m_LvText; + [SerializeField] Button m_DetailBtn; + + public override void Refresh(CellView cell) { - [SerializeField] Image m_PlayerBG; - [SerializeField] Image m_Select; - [SerializeField] Text m_PlayerName; - [SerializeField] Text m_Lv; - [SerializeField] Image m_LvSign; - [SerializeField] Text m_LvText; - [SerializeField] Button m_DetailBtn; - - public override void Refresh(CellView cell) - { - // TODO YYL - // var _playerId = cell.index; - // var _dict = friendModel.GetFriendInfoDict((byte)GroupType.RecentContact); - // FriendPlayer _friendPlayer = null; - // if (_dict != null && _dict.ContainsKey((uint)_playerId)) - // { - // _friendPlayer = _dict[(uint)_playerId]; - // } - // else if (friendModel.tempFriendData != null && friendModel.tempFriendData.PlayerID == _playerId) - // { - // _friendPlayer = friendModel.tempFriendData; - // } - // if (_friendPlayer == null) - // { - // return; - // } - // m_Select.SetActive(_playerId == ChatCtrl.Inst.PteChatID); - // m_PlayerName.text = _friendPlayer.PlayerName; - // m_LvSign.SetActive(false); - // var _lv = _friendPlayer.LV ; - // m_LvText.text = (_lv > 0 ? _lv : _friendPlayer.LV).ToString(); - // m_DetailBtn.onClick.RemoveAllListeners(); - // m_DetailBtn.onClick.AddListener(() => - // { - // PlayerDetails.ShowPlayerDetails(_playerId, null); - // }); - // SetOnline(_friendPlayer.OnlineType == 1); - } - - private void SetOnline(bool _online) - { - m_PlayerBG.material = _online ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); - m_LvSign.material = _online ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); - m_Lv.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); - m_LvText.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); - m_PlayerName.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); - } + // TODO YYL + // var _playerId = cell.index; + // var _dict = friendModel.GetFriendInfoDict((byte)GroupType.RecentContact); + // FriendPlayer _friendPlayer = null; + // if (_dict != null && _dict.ContainsKey((uint)_playerId)) + // { + // _friendPlayer = _dict[(uint)_playerId]; + // } + // else if (friendModel.tempFriendData != null && friendModel.tempFriendData.PlayerID == _playerId) + // { + // _friendPlayer = friendModel.tempFriendData; + // } + // if (_friendPlayer == null) + // { + // return; + // } + // m_Select.SetActive(_playerId == ChatCtrl.Inst.PteChatID); + // m_PlayerName.text = _friendPlayer.PlayerName; + // m_LvSign.SetActive(false); + // var _lv = _friendPlayer.LV ; + // m_LvText.text = (_lv > 0 ? _lv : _friendPlayer.LV).ToString(); + // m_DetailBtn.onClick.RemoveAllListeners(); + // m_DetailBtn.onClick.AddListener(() => + // { + // PlayerDetails.ShowPlayerDetails(_playerId, null); + // }); + // SetOnline(_friendPlayer.OnlineType == 1); } + private void SetOnline(bool _online) + { + m_PlayerBG.material = _online ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); + m_LvSign.material = _online ? MaterialUtility.GetUIDefaultGraphicMaterial() : MaterialUtility.GetDefaultSpriteGrayMaterial(); + m_Lv.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); + m_LvText.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); + m_PlayerName.color = _online ? UIHelper.GetUIColor(TextColType.NavyBrown) : UIHelper.GetUIColor(TextColType.White, true); + } +} + diff --git a/Main/System/Chat/ChatTrailCell.cs b/Main/System/Chat/ChatTrailCell.cs index dd4fd5f..7431452 100644 --- a/Main/System/Chat/ChatTrailCell.cs +++ b/Main/System/Chat/ChatTrailCell.cs @@ -1,43 +1,43 @@ -锘縰sing vnxbqy.UI; -using System.Collections; +锘縰sing System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; -using EnhancedUI.EnhancedScroller; - public class ChatTrailCell : ScrollerUI - { - [SerializeField] Image chatIcon; - [SerializeField] RichText chatText; - public override void Refresh(CellView cell) + +public class ChatTrailCell : ScrollerUI +{ + [SerializeField] Image chatIcon; + [SerializeField] RichText chatText; + + public override void Refresh(CellView cell) + { + ChatData _data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, cell.index); + if (_data == null) { - ChatData _data = ChatCenter.Instance.GetChatData(ChatManager.Instance.presentChatType, cell.index); - if (_data == null) - { - return; - } - if (_data.infoList != null) - { - chatText.SetExtenalData(_data.infoList); - } - chatIcon.SetActive(true); - if (_data.type == ChatInfoType.Invite) - { - chatIcon.SetSprite("ChatIcon_Invite"); - } - else if (_data.type == ChatInfoType.System) - { - chatIcon.SetSprite("ChatIcon_System"); - } - else if (_data.type == ChatInfoType.Friend) - { - chatIcon.SetSprite("ChatIcon_System"); - } - else - { - chatIcon.SetActive(false); - } - chatText.text = _data.type == ChatInfoType.Friend ? _data.content.Replace(ChatManager.KILL_IDENTIFY, string.Empty) : _data.content; + return; } + if (_data.infoList != null) + { + chatText.SetExtenalData(_data.infoList); + } + chatIcon.SetActive(true); + if (_data.type == ChatInfoType.Invite) + { + chatIcon.SetSprite("ChatIcon_Invite"); + } + else if (_data.type == ChatInfoType.System) + { + chatIcon.SetSprite("ChatIcon_System"); + } + else if (_data.type == ChatInfoType.Friend) + { + chatIcon.SetSprite("ChatIcon_System"); + } + else + { + chatIcon.SetActive(false); + } + chatText.text = _data.type == ChatInfoType.Friend ? _data.content.Replace(ChatManager.KILL_IDENTIFY, string.Empty) : _data.content; } +} diff --git a/Main/System/GMCommand/GMCmdManager.cs b/Main/System/GMCommand/GMCmdManager.cs index e7a86b0..53f8f27 100644 --- a/Main/System/GMCommand/GMCmdManager.cs +++ b/Main/System/GMCommand/GMCmdManager.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System.Collections.Generic; +锘縰sing System.Collections.Generic; using System.Text; using System; diff --git a/Main/System/GMCommand/GMCmdPanel.cs b/Main/System/GMCommand/GMCmdPanel.cs index a55fc9a..ff6ded7 100644 --- a/Main/System/GMCommand/GMCmdPanel.cs +++ b/Main/System/GMCommand/GMCmdPanel.cs @@ -5,83 +5,80 @@ using UnityEngine.Events; -namespace vnxbqy.UI +public class GMCmdPanel : UIBase { - public class GMCmdPanel : UIBase + + [SerializeField] + private ScrollerController _cmdCtrl; + + [SerializeField] + private Button _closeBtn; + + GMCmdManager _cmdModel; + GMCmdManager cmdModel{ get { return GMCmdManager.Instance; } } + + protected override void OnPreOpen() + { + base.OnPreOpen(); + _cmdCtrl.OnRefreshCell += RefreshCmdCell; + + _closeBtn.onClick.AddListener(OnClickCloseBtn); + + CreateCmdCell(); + } + + protected override void OnOpen() + { + base.OnOpen(); + this.transform.SetAsLastSibling(); + } + + + private void CreateCmdCell() + { + _cmdCtrl.Refresh(); + var allKeys = GmCmdConfig.dic.Keys; + foreach (var key in allKeys) + { + _cmdCtrl.AddCell(ScrollerDataType.Header, key); + } + _cmdCtrl.Restart(); + } + + private void RefreshCmdCell(ScrollerDataType type, CellView cell) + { + Button cellBtn = cell.GetComponent<Button>(); + Text cmdText = cell.transform.Find("Text").GetComponent<Text>(); + GmCmdConfig gmCmdModel = GmCmdConfig.Get(cell.index); + if (gmCmdModel == null) + return; + + cmdText.text = gmCmdModel.Cmd + "=" + gmCmdModel.ParamSet; + cellBtn.onClick.RemoveAllListeners(); + cellBtn.onClick.AddListener(() => { OnClickCmdCell(gmCmdModel.ParamSet); }); + } + + private void OnClickCmdCell(string paramSet) + { + SplitLongGMCmd(paramSet); + } + + public void SplitLongGMCmd(string value) { - [SerializeField] - private ScrollerController _cmdCtrl; - - [SerializeField] - private Button _closeBtn; - - GMCmdManager _cmdModel; - GMCmdManager cmdModel{ get { return GMCmdManager.Instance; } } - - protected override void OnPreOpen() + string[] longCmdArray = value.Split('|'); + for (int i = 0; i < longCmdArray.Length; i++) { - base.OnPreOpen(); - _cmdCtrl.OnRefreshCell += RefreshCmdCell; - - _closeBtn.onClick.AddListener(OnClickCloseBtn); - - CreateCmdCell(); + cmdModel.OnSendGMQuest(longCmdArray[i].Trim()); } - protected override void OnOpen() - { - base.OnOpen(); - this.transform.SetAsLastSibling(); - } - - - private void CreateCmdCell() - { - _cmdCtrl.Refresh(); - var allKeys = GmCmdConfig.dic.Keys; - foreach (var key in allKeys) - { - _cmdCtrl.AddCell(ScrollerDataType.Header, key); - } - _cmdCtrl.Restart(); - } - - private void RefreshCmdCell(ScrollerDataType type, CellView cell) - { - Button cellBtn = cell.GetComponent<Button>(); - Text cmdText = cell.transform.Find("Text").GetComponent<Text>(); - GmCmdConfig gmCmdModel = GmCmdConfig.Get(cell.index); - if (gmCmdModel == null) - return; - - cmdText.text = gmCmdModel.Cmd + "=" + gmCmdModel.ParamSet; - cellBtn.onClick.RemoveAllListeners(); - cellBtn.onClick.AddListener(() => { OnClickCmdCell(gmCmdModel.ParamSet); }); - } - - private void OnClickCmdCell(string paramSet) - { - SplitLongGMCmd(paramSet); - } - - public void SplitLongGMCmd(string value) - { - - string[] longCmdArray = value.Split('|'); - for (int i = 0; i < longCmdArray.Length; i++) - { - cmdModel.OnSendGMQuest(longCmdArray[i].Trim()); - } - - - } - - public void OnClickCloseBtn() - { - CloseWindow(); - } } + + public void OnClickCloseBtn() + { + CloseWindow(); + } + } diff --git a/Main/System/GMCommand/GMInputWin.cs b/Main/System/GMCommand/GMInputWin.cs index 8a3351b..8987326 100644 --- a/Main/System/GMCommand/GMInputWin.cs +++ b/Main/System/GMCommand/GMInputWin.cs @@ -3,166 +3,163 @@ using UnityEngine; using UnityEngine.UI; -namespace vnxbqy.UI +public class GMInputWin : UIBase { - public class GMInputWin : UIBase - { - [SerializeField] - private ScrollerController _cmdCtrl; + [SerializeField] + private ScrollerController _cmdCtrl; - [SerializeField] - private InputField _inputCmd; + [SerializeField] + private InputField _inputCmd; - [SerializeField] - private Button _closeBtn; + [SerializeField] + private Button _closeBtn; - [SerializeField] - private Button _lookBtn; + [SerializeField] + private Button _lookBtn; - [SerializeField] - private Button _sendBtn; + [SerializeField] + private Button _sendBtn; - [SerializeField] - private Button _gmInfoBtn; + [SerializeField] + private Button _gmInfoBtn; - [SerializeField] - private Button _clearBtn; + [SerializeField] + private Button _clearBtn; - [SerializeField] - private Button achieveJumpTestBtn; + [SerializeField] + private Button achieveJumpTestBtn; - [SerializeField] - private GameObject _cmdContent; + [SerializeField] + private GameObject _cmdContent; - private List<string> recordCmdlist; + private List<string> recordCmdlist; - GMCmdManager cmdModel { get { return GMCmdManager.Instance; } } + GMCmdManager cmdModel { get { return GMCmdManager.Instance; } } - protected override void OnPreOpen() + protected override void OnPreOpen() + { + base.OnPreOpen(); + _cmdCtrl.OnRefreshCell += RefreshCmdCell; + _closeBtn.onClick.AddListener(OnClickCloseBtn); + _lookBtn.onClick.AddListener(OnClickLookBtn); + _sendBtn.onClick.AddListener(() => { OnClickSendBtn(); }); + _gmInfoBtn.onClick.AddListener(OnClickGMInfoBtn); + _clearBtn.onClick.AddListener(OnClickClearBtn); + achieveJumpTestBtn.AddListener(ClickAchieveJumpBtn); + _cmdContent.SetActive(false); + } + + protected override void OnOpen() + { + base.HandleOpen(); + this.transform.SetAsLastSibling(); + } + protected void LateUpdate() + { + if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) { - base.OnPreOpen(); - _cmdCtrl.OnRefreshCell += RefreshCmdCell; - _closeBtn.onClick.AddListener(OnClickCloseBtn); - _lookBtn.onClick.AddListener(OnClickLookBtn); - _sendBtn.onClick.AddListener(() => { OnClickSendBtn(); }); - _gmInfoBtn.onClick.AddListener(OnClickGMInfoBtn); - _clearBtn.onClick.AddListener(OnClickClearBtn); - achieveJumpTestBtn.AddListener(ClickAchieveJumpBtn); + OnClickSendBtn(); + } + } + + private void CreateCmdCell() + { + _cmdCtrl.Refresh(); + int i = 0; + for (i = recordCmdlist.Count - 1; i > -1; i--) + { + _cmdCtrl.AddCell(ScrollerDataType.Header, i); + } + _cmdCtrl.Restart(); + } + + private void RefreshCmdCell(ScrollerDataType type, CellView cell) + { + Button cellBtn = cell.GetComponent<Button>(); + Text cmdText = cell.transform.Find("Text").GetComponent<Text>(); + string cmdStr = recordCmdlist[cell.index]; + cmdText.text = cmdStr; + cellBtn.onClick.RemoveAllListeners(); + cellBtn.onClick.AddListener(() => + { + OnClickCmdCell(cmdStr); + }); + } + + private void OnClickCmdCell(string paramSet) + { + _inputCmd.text = paramSet; + } + + private void OnClickGMInfoBtn() + { + ServerTipDetails.OpenGMPanel(); + } + + private void OnClickLookBtn() + { + if (_cmdContent.gameObject.activeInHierarchy) + { _cmdContent.SetActive(false); } - - protected override void OnOpen() + else { - base.HandleOpen(); - this.transform.SetAsLastSibling(); + _cmdContent.SetActive(true); + recordCmdlist = cmdModel.GetRecordCmdlist(); + CreateCmdCell(); } - protected void LateUpdate() - { - if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) - { - OnClickSendBtn(); - } - } - - private void CreateCmdCell() - { - _cmdCtrl.Refresh(); - int i = 0; - for (i = recordCmdlist.Count - 1; i > -1; i--) - { - _cmdCtrl.AddCell(ScrollerDataType.Header, i); - } - _cmdCtrl.Restart(); - } - - private void RefreshCmdCell(ScrollerDataType type, CellView cell) - { - Button cellBtn = cell.GetComponent<Button>(); - Text cmdText = cell.transform.Find("Text").GetComponent<Text>(); - string cmdStr = recordCmdlist[cell.index]; - cmdText.text = cmdStr; - cellBtn.onClick.RemoveAllListeners(); - cellBtn.onClick.AddListener(() => - { - OnClickCmdCell(cmdStr); - }); - } - - private void OnClickCmdCell(string paramSet) - { - _inputCmd.text = paramSet; - } - - private void OnClickGMInfoBtn() - { - ServerTipDetails.OpenGMPanel(); - } - - private void OnClickLookBtn() - { - if (_cmdContent.gameObject.activeInHierarchy) - { - _cmdContent.SetActive(false); - } - else - { - _cmdContent.SetActive(true); - recordCmdlist = cmdModel.GetRecordCmdlist(); - CreateCmdCell(); - } - } - - private void OnClickSendBtn() - { - if (_inputCmd.text == null || _inputCmd.text == "" || _inputCmd.text == string.Empty) - return; - - // if (_inputCmd.text == "HappyXB") - // { - // WindowCenter.Instance.Open<HappyXBWin>(); - // return; - // } - // else if (_inputCmd.text == "TreasureFindHost") - // { - // WindowCenter.Instance.Open<TreasureFindHostWin>(); - // return; - // } - // if (_inputCmd.text.Equals("EnterFB 31250")) - // { - // cmdModel.OnSendGMQuest("SetFBStar 31250"); - // ClientGuardDungeon.RequestEnter(); - // return; - // } - - cmdModel.OnSendGMQuest(_inputCmd.text.Trim()); - cmdModel.SetRecordCmdlist(_inputCmd.text); - } - - - private void OnClickClearBtn() - { - cmdModel.ClearRecordCmdlist(); - OnClickLookBtn(); - } - - private void OnClickCloseBtn() - { - CloseWindow(); - } - - private void ClickAchieveJumpBtn() - { - // try - // { - // int achieveId = int.Parse(_inputCmd.text); - // ModelCenter.Instance.GetModel<AchievementModel>().GotoCompleteAchievement(achieveId); - // } - // catch (Exception ex) - // { - // } - } - } + + private void OnClickSendBtn() + { + if (_inputCmd.text == null || _inputCmd.text == "" || _inputCmd.text == string.Empty) + return; + + // if (_inputCmd.text == "HappyXB") + // { + // WindowCenter.Instance.Open<HappyXBWin>(); + // return; + // } + // else if (_inputCmd.text == "TreasureFindHost") + // { + // WindowCenter.Instance.Open<TreasureFindHostWin>(); + // return; + // } + // if (_inputCmd.text.Equals("EnterFB 31250")) + // { + // cmdModel.OnSendGMQuest("SetFBStar 31250"); + // ClientGuardDungeon.RequestEnter(); + // return; + // } + + cmdModel.OnSendGMQuest(_inputCmd.text.Trim()); + cmdModel.SetRecordCmdlist(_inputCmd.text); + } + + + private void OnClickClearBtn() + { + cmdModel.ClearRecordCmdlist(); + OnClickLookBtn(); + } + + private void OnClickCloseBtn() + { + CloseWindow(); + } + + private void ClickAchieveJumpBtn() + { + // try + // { + // int achieveId = int.Parse(_inputCmd.text); + // ModelCenter.Instance.GetModel<AchievementModel>().GotoCompleteAchievement(achieveId); + // } + // catch (Exception ex) + // { + // } + } + } diff --git a/Main/System/GMCommand/MoveObj.cs b/Main/System/GMCommand/MoveObj.cs index 4255a23..1a8de81 100644 --- a/Main/System/GMCommand/MoveObj.cs +++ b/Main/System/GMCommand/MoveObj.cs @@ -2,53 +2,50 @@ using UnityEngine; using UnityEngine.UI; -namespace vnxbqy.UI +public class MoveObj : MonoBehaviour,IDragHandler,IBeginDragHandler,IEndDragHandler { - public class MoveObj : MonoBehaviour,IDragHandler,IBeginDragHandler,IEndDragHandler + private Vector3 vec3; + private Vector3 pos; + public const string GMInputPos_Key = "GMInputPos"; + private float[] gmInputPos = new float[3]; + + + private void OnEnable() { - private Vector3 vec3; - private Vector3 pos; - public const string GMInputPos_Key = "GMInputPos"; - private float[] gmInputPos = new float[3]; - - - private void OnEnable() + if (LocalSave.GetFloatArray(GMInputPos_Key) != null) { - if (LocalSave.GetFloatArray(GMInputPos_Key) != null) - { - gmInputPos = LocalSave.GetFloatArray(GMInputPos_Key); - transform.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(gmInputPos[0], gmInputPos[1], gmInputPos[2]); - } + gmInputPos = LocalSave.GetFloatArray(GMInputPos_Key); + transform.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(gmInputPos[0], gmInputPos[1], gmInputPos[2]); } - - - public void OnBeginDrag(PointerEventData eventData) - { - GameObject _moveObj = eventData.pointerDrag; - vec3 = Input.mousePosition; - pos = transform.GetComponent<RectTransform>().anchoredPosition3D; - } - - public void OnDrag(PointerEventData eventData) - { - Vector3 off = Input.mousePosition - vec3; - vec3 = Input.mousePosition; - pos = pos + off; - - if (pos.x > -506 && pos.y > -318 && pos.x < 515 && pos.y < 336) - { - transform.GetComponent<RectTransform>().anchoredPosition3D = pos; - gmInputPos[0] = pos.x; - gmInputPos[1] = pos.y; - gmInputPos[2] = pos.z; - LocalSave.SetFloatArray(GMInputPos_Key, gmInputPos); - } - } - - public void OnEndDrag(PointerEventData eventData) - { - Debug.Log(pos.x + "鍜�" + pos.y); - } - } + + + public void OnBeginDrag(PointerEventData eventData) + { + GameObject _moveObj = eventData.pointerDrag; + vec3 = Input.mousePosition; + pos = transform.GetComponent<RectTransform>().anchoredPosition3D; + } + + public void OnDrag(PointerEventData eventData) + { + Vector3 off = Input.mousePosition - vec3; + vec3 = Input.mousePosition; + pos = pos + off; + + if (pos.x > -506 && pos.y > -318 && pos.x < 515 && pos.y < 336) + { + transform.GetComponent<RectTransform>().anchoredPosition3D = pos; + gmInputPos[0] = pos.x; + gmInputPos[1] = pos.y; + gmInputPos[2] = pos.z; + LocalSave.SetFloatArray(GMInputPos_Key, gmInputPos); + } + } + + public void OnEndDrag(PointerEventData eventData) + { + Debug.Log(pos.x + "鍜�" + pos.y); + } + } diff --git a/Main/System/KnapSack/Logic/ItemModel.cs b/Main/System/KnapSack/Logic/ItemModel.cs index 055d5fc..833bc56 100644 --- a/Main/System/KnapSack/Logic/ItemModel.cs +++ b/Main/System/KnapSack/Logic/ItemModel.cs @@ -1,185 +1,184 @@ -锘縰sing vnxbqy.UI; -using System; +锘縰sing System; using System.Collections.Generic; - public class ItemModel - { - public readonly PackType packType; +public class ItemModel +{ + public readonly PackType packType; - public ItemConfig config { get; private set; } - public ItemInfo itemInfo { get; private set; } - public int score { get; private set; } - public Dictionary<int, List<int>> useDataDict { get; private set; } + public ItemConfig config { get; private set; } + public ItemInfo itemInfo { get; private set; } + public int score { get; private set; } + public Dictionary<int, List<int>> useDataDict { get; private set; } - public string guid { get { return itemInfo == null ? string.Empty : itemInfo.guid; } } - public int itemId { get { return itemInfo == null ? 0 : itemInfo.itemId; } } - public int count { get { return itemInfo == null ? 0 : itemInfo.count; } } - public int gridIndex { get { return itemInfo == null ? 0 : itemInfo.index; } } - public bool isAuction { get { return itemInfo == null ? false : itemInfo.isAuction == 1; } } - public int preItemCount { get; private set; } + public string guid { get { return itemInfo == null ? string.Empty : itemInfo.guid; } } + public int itemId { get { return itemInfo == null ? 0 : itemInfo.itemId; } } + public int count { get { return itemInfo == null ? 0 : itemInfo.count; } } + public int gridIndex { get { return itemInfo == null ? 0 : itemInfo.index; } } + public bool isAuction { get { return itemInfo == null ? false : itemInfo.isAuction == 1; } } + public int preItemCount { get; private set; } - public int auctionSurplusTime { + public int auctionSurplusTime { - get { + get { + return 0; + /* + var createTime = GetUseDataFirstValue(50); + if (createTime > 0) + { + var overdueTime = TimeUtility.GetTime((uint)createTime) + new TimeSpan(GeneralDefine.acutionItemHour * TimeSpan.TicksPerHour); + return (int)(overdueTime).Subtract(TimeUtility.ServerNow).TotalSeconds; + } + else + { return 0; - /* - var createTime = GetUseDataFirstValue(50); - if (createTime > 0) - { - var overdueTime = TimeUtility.GetTime((uint)createTime) + new TimeSpan(GeneralDefine.acutionItemHour * TimeSpan.TicksPerHour); - return (int)(overdueTime).Subtract(TimeUtility.ServerNow).TotalSeconds; - } - else - { - return 0; - } - */ } + */ } + } - public int overdueSurplusTime { - get { - var surplusTime = 0; - if (config.ExpireTime > 0) - { - var createTime = GetUseDataFirstValue((int)ItemUseDataKey.createTime); - if (createTime > 0) - { - var seconds = GetUseDataFirstValue(48); - var overdueTime = DateTime.Now; - if (seconds != 0) - { - overdueTime = TimeUtility.GetTime((uint)createTime).AddSeconds(seconds); - } - else - { - overdueTime = TimeUtility.GetTime((uint)createTime).AddSeconds(config.ExpireTime); - } - - surplusTime = (int)(overdueTime).Subtract(TimeUtility.ServerNow).TotalSeconds; - } - } - - return surplusTime; - } - } - - public ItemModel(PackType type, ItemInfo info) - { - packType = type; - SetItemInfo(info); - } - - public void SetItemInfo(ItemInfo info) - { - if (itemInfo != null) - { - preItemCount = itemInfo.count; - } - - itemInfo = info; - config = ItemConfig.Get(info.itemId); - useDataDict = ConfigParse.Analysis(info.userData); - - var customCount = GetUseDataFirstValue((int)ItemUseDataKey.itemCount); - if (customCount > 0) - { - itemInfo.count = customCount; - } - + public int overdueSurplusTime { + get { + var surplusTime = 0; if (config.ExpireTime > 0) { var createTime = GetUseDataFirstValue((int)ItemUseDataKey.createTime); if (createTime > 0) { - var serverSurplusTime = GetUseDataFirstValue(48); - //ItemLogicUtility.Instance.SetItemEffectCDTime(info.guid, info.itemId, createTime, serverSurplusTime); + var seconds = GetUseDataFirstValue(48); + var overdueTime = DateTime.Now; + if (seconds != 0) + { + overdueTime = TimeUtility.GetTime((uint)createTime).AddSeconds(seconds); + } + else + { + overdueTime = TimeUtility.GetTime((uint)createTime).AddSeconds(config.ExpireTime); + } + + surplusTime = (int)(overdueTime).Subtract(TimeUtility.ServerNow).TotalSeconds; } } - this.score = info.gearScore;//ItemLogicUtility.Instance.GetEquipScore(itemId, useDataDict); + return surplusTime; } - - public void RefreshCount(int count) - { - if (itemInfo != null) - { - preItemCount = itemInfo.count; - } - - itemInfo.count = count; - } - - public List<int> GetUseData(int key) - { - List<int> list = null; - if (useDataDict != null) - { - useDataDict.TryGetValue(key, out list); - } - - return list; - } - - public int GetUseDataFirstValue(int key) - { - if (useDataDict != null && useDataDict.ContainsKey(key) && useDataDict[key].Count > 0) - { - return useDataDict[key][0]; - } - - return 0; - } - } - public class ItemInfo + public ItemModel(PackType type, ItemInfo info) { - public int index; //浣嶇疆绱㈠紩 + packType = type; + SetItemInfo(info); + } - public int itemId; - - public int count; //鐗╁搧鏁伴噺 - - public int isAuction;//鏄惁鎷嶅搧 - - public int remainHour; //鍓╀綑鏃堕棿(灏忔椂) - - public string userData;//size = UserDataLen - - public string guid; //鐗╁搧鐨勫疄渚婭D - public int gearScore; //璇勫垎 - - public ItemInfo() + public void SetItemInfo(ItemInfo info) + { + if (itemInfo != null) { - + preItemCount = itemInfo.count; } - public ItemInfo(H0725_tagRolePackRefreshEx.tagRoleItemRefresh serverItem) + itemInfo = info; + config = ItemConfig.Get(info.itemId); + useDataDict = ConfigParse.Analysis(info.userData); + + var customCount = GetUseDataFirstValue((int)ItemUseDataKey.itemCount); + if (customCount > 0) { - itemId = (int)serverItem.ItemID; - index = serverItem.ItemPlace; - count = serverItem.ItemCount; - remainHour = (int)serverItem.RemainHour; - userData = serverItem.UserData; - guid = serverItem.ItemGUID; - isAuction = serverItem.IsBind; - gearScore = (int)serverItem.GearScore; + itemInfo.count = customCount; } - public ItemInfo(H0704_tagRolePackRefresh serverItem) + if (config.ExpireTime > 0) { - itemId = (int)serverItem.ItemID; - index = serverItem.ItemPlace; - count = serverItem.ItemCount; - remainHour = (int)serverItem.RemainHour; - userData = serverItem.UserData; - guid = serverItem.ItemGUID; - isAuction = serverItem.IsBind; - gearScore = (int)serverItem.GearScore; + var createTime = GetUseDataFirstValue((int)ItemUseDataKey.createTime); + if (createTime > 0) + { + var serverSurplusTime = GetUseDataFirstValue(48); + //ItemLogicUtility.Instance.SetItemEffectCDTime(info.guid, info.itemId, createTime, serverSurplusTime); + } } + + this.score = info.gearScore;//ItemLogicUtility.Instance.GetEquipScore(itemId, useDataDict); + } + + public void RefreshCount(int count) + { + if (itemInfo != null) + { + preItemCount = itemInfo.count; + } + + itemInfo.count = count; + } + + public List<int> GetUseData(int key) + { + List<int> list = null; + if (useDataDict != null) + { + useDataDict.TryGetValue(key, out list); + } + + return list; + } + + public int GetUseDataFirstValue(int key) + { + if (useDataDict != null && useDataDict.ContainsKey(key) && useDataDict[key].Count > 0) + { + return useDataDict[key][0]; + } + + return 0; + } + +} + +public class ItemInfo +{ + public int index; //浣嶇疆绱㈠紩 + + public int itemId; + + public int count; //鐗╁搧鏁伴噺 + + public int isAuction;//鏄惁鎷嶅搧 + + public int remainHour; //鍓╀綑鏃堕棿(灏忔椂) + + public string userData;//size = UserDataLen + + public string guid; //鐗╁搧鐨勫疄渚婭D + public int gearScore; //璇勫垎 + + public ItemInfo() + { } + public ItemInfo(H0725_tagRolePackRefreshEx.tagRoleItemRefresh serverItem) + { + itemId = (int)serverItem.ItemID; + index = serverItem.ItemPlace; + count = serverItem.ItemCount; + remainHour = (int)serverItem.RemainHour; + userData = serverItem.UserData; + guid = serverItem.ItemGUID; + isAuction = serverItem.IsBind; + gearScore = (int)serverItem.GearScore; + } + + public ItemInfo(H0704_tagRolePackRefresh serverItem) + { + itemId = (int)serverItem.ItemID; + index = serverItem.ItemPlace; + count = serverItem.ItemCount; + remainHour = (int)serverItem.RemainHour; + userData = serverItem.UserData; + guid = serverItem.ItemGUID; + isAuction = serverItem.IsBind; + gearScore = (int)serverItem.GearScore; + } + +} + diff --git a/Main/System/KnapSack/Logic/SinglePack.cs b/Main/System/KnapSack/Logic/SinglePack.cs index 1bc3dc2..ab4d294 100644 --- a/Main/System/KnapSack/Logic/SinglePack.cs +++ b/Main/System/KnapSack/Logic/SinglePack.cs @@ -2,384 +2,383 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using vnxbqy.UI; - public class SinglePack +public class SinglePack +{ + public readonly PackType type; + public int unlockedGridCount { get; private set; } + private Dictionary<int, ItemModel> items = new Dictionary<int, ItemModel>(); //key 鐗╁搧浣嶇疆绱㈠紩 + private Dictionary<int, List<int>> itemIDs = new Dictionary<int, List<int>>(); //key 鐗╁搧ID锛氱墿鍝佷綅缃储寮� + public SinglePack(PackType type) { - public readonly PackType type; - public int unlockedGridCount { get; private set; } - private Dictionary<int, ItemModel> items = new Dictionary<int, ItemModel>(); //key 鐗╁搧浣嶇疆绱㈠紩 - private Dictionary<int, List<int>> itemIDs = new Dictionary<int, List<int>>(); //key 鐗╁搧ID锛氱墿鍝佷綅缃储寮� - public SinglePack(PackType type) - { - this.type = type; - } + this.type = type; + } - public bool HasItem(int itemID) - { - return itemIDs.ContainsKey(itemID); - } + public bool HasItem(int itemID) + { + return itemIDs.ContainsKey(itemID); + } - public ItemModel UpdateItem(ItemInfo itemInfo) + public ItemModel UpdateItem(ItemInfo itemInfo) + { + //瀛楀吀绱㈠紩涓虹墿鍝佷綅缃储寮� + var index = itemInfo.index; + if (!items.ContainsKey(index)) { - //瀛楀吀绱㈠紩涓虹墿鍝佷綅缃储寮� - var index = itemInfo.index; - if (!items.ContainsKey(index)) + items.Add(index, new ItemModel(type, itemInfo)); + } + else + { + //浣嶇疆涓婄殑鐗╁搧鍙樺寲锛屽厛绉婚櫎鍘熸潵鐨� + var itemID = items[index].itemId; + if (itemIDs.ContainsKey(itemID)) { - items.Add(index, new ItemModel(type, itemInfo)); - } - else - { - //浣嶇疆涓婄殑鐗╁搧鍙樺寲锛屽厛绉婚櫎鍘熸潵鐨� - var itemID = items[index].itemId; - if (itemIDs.ContainsKey(itemID)) + if (itemIDs[itemID].Contains(index)) { - if (itemIDs[itemID].Contains(index)) + if (itemIDs[itemID].Count == 1) { - if (itemIDs[itemID].Count == 1) - { - itemIDs.Remove(itemID); - } - else - { - itemIDs[itemID].Remove(index); - } - } - } - - items[index].SetItemInfo(itemInfo); - } - - //瀛楀吀绱㈠紩涓虹墿鍝両D - if (!itemIDs.ContainsKey(itemInfo.itemId)) - { - itemIDs.Add(itemInfo.itemId, new List<int>()); - } - - if (!itemIDs[itemInfo.itemId].Contains(itemInfo.index)) - { - itemIDs[itemInfo.itemId].Add(itemInfo.index); - } - - return items[index]; - } - - public void RemoveItem(int index) - { - if (items.ContainsKey(index)) - { - //瀛楀吀绱㈠紩涓虹墿鍝両D - var itemID = items[index].itemId; - if (itemIDs.ContainsKey(itemID)) - { - if (itemIDs[itemID].Contains(index)) - { - if (itemIDs[itemID].Count == 1) - { - itemIDs.Remove(itemID); - } - else - { - itemIDs[itemID].Remove(index); - } - } - } - - items.Remove(index); - } - - } - - public void SetOpenGridCount(int count) - { - unlockedGridCount = count; - } - - public ItemModel GetItemByIndex(int index) - { - ItemModel item = null; - items.TryGetValue(index, out item); - return item; - } - - public Dictionary<int, ItemModel> GetAllItems() - { - return items; - } - - /// <summary> - /// 鑾峰彇鎸囧畾ID鐨勪竴涓墿鍝� - /// </summary> - /// <param name="itemId"></param> - /// <param name="includeAuction"></param> - /// <returns></returns> - public ItemModel GetItemByID(int itemId, bool includeAuction = true) - { - //foreach (var item in items.Values) - //{ - // if (!includeAuction && item.isAuction) - // { - // continue; - // } - - // if (item.itemId == itemId) - // { - // return item; - // } - //} - - //return null; - - if (itemIDs.ContainsKey(itemId)) - { - foreach (var index in itemIDs[itemId]) - { - var item = items[index]; - if (!includeAuction && item.isAuction) - { - continue; - } - return item; - } - } - return null; - } - - /// <summary> - /// 鑾峰彇鍖呭唴鐨勬寚瀹欼D鐨勬墍鏈夌墿鍝� - /// </summary> - /// <param name="itemId"></param> - /// <param name="includeAuction"></param> - /// <returns></returns> - public List<ItemModel> GetItemsById(int itemId, bool includeAuction = true) - { - var list = new List<ItemModel>(); - //foreach (var item in items.Values) - //{ - // if (!includeAuction && item.isAuction) - // { - // continue; - // } - - // if (item.itemId == itemId) - // { - // list.Add(item); - // } - //} - - if (itemIDs.ContainsKey(itemId)) - { - foreach (var index in itemIDs[itemId]) - { - var item = items[index]; - if (!includeAuction && item.isAuction) - { - continue; - } - list.Add(item); - } - } - return list; - } - - public int GetCountById(int itemId, bool includeAuction = true) - { - var count = 0; - //foreach (var item in items.Values) - //{ - // if (!includeAuction && item.isAuction) - // { - // continue; - // } - - // if (item.itemId == itemId) - // { - // count += item.count; - // } - //} - - if (itemIDs.ContainsKey(itemId)) - { - foreach (var index in itemIDs[itemId]) - { - var item = items[index]; - if (!includeAuction && item.isAuction) - { - continue; - } - count += item.count; - } - } - return count; - } - - public List<ItemModel> GetItems(FilterParams filterParams) - { - var list = new List<ItemModel>(); - foreach (var item in items.Values) - { - var levelValid = filterParams.levels == null || filterParams.levels.Contains(item.config.LV); - if (!levelValid) - { - continue; - } - - var qualityValid = filterParams.qualitys == null || filterParams.qualitys.Contains(item.config.ItemColor); - if (!qualityValid) - { - continue; - } - - var typeValid = filterParams.itemTypes == null || filterParams.itemTypes.Contains(item.config.Type); - if (!typeValid) - { - continue; - } - - var equipTypeValid = filterParams.equipTypes == null || filterParams.equipTypes.Contains(item.config.EquipPlace); - if (!equipTypeValid) - { - continue; - } - - var jobValid = filterParams.jobs == null || filterParams.jobs.Contains(item.config.JobLimit); - if (!jobValid) - { - continue; - } - - //var auctionValid = filterParams.isAuction == item.isAuction; - //if (!auctionValid) - //{ - // continue; - //} - - var realmValid = filterParams.realmLimit == 0 || filterParams.realmLimit == item.config.RealmLimit; - if (!realmValid) - { - continue; - } - - list.Add(item); - } - - return list; - } - - public int GetCountByType(int type) - { - var count = 0; - foreach (var item in items.Values) - { - if (item.config.Type == type) - { - count += item.count; - } - } - - return count; - } - - /// <summary> - /// 寰楀埌鍚屼竴涓猧d鎸囧畾鏁伴噺鐨勭墿鍝佹牸瀛愬簭鍙� - /// </summary> - /// <param name="itemId"></param> - /// <param name="needCount"></param> - /// <param name="type"></param> - /// <returns></returns> - public List<int> GetItemIndexsAppointedCount(int itemId, int needCount, bool includeAuction = true) - { - //var goalItems = new List<ItemModel>(); - //foreach (var item in this.items.Values) - //{ - // if (!includeAuction && item.isAuction) - // { - // continue; - // } - - // if (item.itemId == itemId) - // { - // goalItems.Add(item); - // } - //} - - var itemIndexs = new List<int>(); - var count = 0; - //for (var i = 0; i < goalItems.Count; i++) - //{ - // if (count < needCount) - // { - // itemIndexs.Add(goalItems[i].gridIndex); - // count += goalItems[i].count; - // } - // else - // { - // break; - // } - - //} - - if (itemIDs.ContainsKey(itemId)) - { - foreach (var index in itemIDs[itemId]) - { - var item = items[index]; - if (!includeAuction && item.isAuction) - { - continue; - } - if (count < needCount) - { - itemIndexs.Add(index); - count += item.count; + itemIDs.Remove(itemID); } else { - break; + itemIDs[itemID].Remove(index); } } } - return itemIndexs; + + items[index].SetItemInfo(itemInfo); } - /// <summary> - /// 寰楀埌绗竴涓┖鏍间綅缃储寮� - /// </summary> - /// <param name="type"></param> - /// <returns></returns> - public int GetFirstEmptyGridIndex() + //瀛楀吀绱㈠紩涓虹墿鍝両D + if (!itemIDs.ContainsKey(itemInfo.itemId)) { - for (var index = 0; index < unlockedGridCount; index++) + itemIDs.Add(itemInfo.itemId, new List<int>()); + } + + if (!itemIDs[itemInfo.itemId].Contains(itemInfo.index)) + { + itemIDs[itemInfo.itemId].Add(itemInfo.index); + } + + return items[index]; + } + + public void RemoveItem(int index) + { + if (items.ContainsKey(index)) + { + //瀛楀吀绱㈠紩涓虹墿鍝両D + var itemID = items[index].itemId; + if (itemIDs.ContainsKey(itemID)) { - if (!items.ContainsKey(index)) + if (itemIDs[itemID].Contains(index)) { - return index; + if (itemIDs[itemID].Count == 1) + { + itemIDs.Remove(itemID); + } + else + { + itemIDs[itemID].Remove(index); + } } } - return -1; + items.Remove(index); } - public int GetEmptyGridCount() + } + + public void SetOpenGridCount(int count) + { + unlockedGridCount = count; + } + + public ItemModel GetItemByIndex(int index) + { + ItemModel item = null; + items.TryGetValue(index, out item); + return item; + } + + public Dictionary<int, ItemModel> GetAllItems() + { + return items; + } + + /// <summary> + /// 鑾峰彇鎸囧畾ID鐨勪竴涓墿鍝� + /// </summary> + /// <param name="itemId"></param> + /// <param name="includeAuction"></param> + /// <returns></returns> + public ItemModel GetItemByID(int itemId, bool includeAuction = true) + { + //foreach (var item in items.Values) + //{ + // if (!includeAuction && item.isAuction) + // { + // continue; + // } + + // if (item.itemId == itemId) + // { + // return item; + // } + //} + + //return null; + + if (itemIDs.ContainsKey(itemId)) { - return unlockedGridCount - items.Count; + foreach (var index in itemIDs[itemId]) + { + var item = items[index]; + if (!includeAuction && item.isAuction) + { + continue; + } + return item; + } } + return null; + } - public void Clear() + /// <summary> + /// 鑾峰彇鍖呭唴鐨勬寚瀹欼D鐨勬墍鏈夌墿鍝� + /// </summary> + /// <param name="itemId"></param> + /// <param name="includeAuction"></param> + /// <returns></returns> + public List<ItemModel> GetItemsById(int itemId, bool includeAuction = true) + { + var list = new List<ItemModel>(); + //foreach (var item in items.Values) + //{ + // if (!includeAuction && item.isAuction) + // { + // continue; + // } + + // if (item.itemId == itemId) + // { + // list.Add(item); + // } + //} + + if (itemIDs.ContainsKey(itemId)) { - items.Clear(); - itemIDs.Clear(); + foreach (var index in itemIDs[itemId]) + { + var item = items[index]; + if (!includeAuction && item.isAuction) + { + continue; + } + list.Add(item); + } } + return list; + } - public struct FilterParams + public int GetCountById(int itemId, bool includeAuction = true) + { + var count = 0; + //foreach (var item in items.Values) + //{ + // if (!includeAuction && item.isAuction) + // { + // continue; + // } + + // if (item.itemId == itemId) + // { + // count += item.count; + // } + //} + + if (itemIDs.ContainsKey(itemId)) { - public List<int> levels; - public List<int> qualitys; - public List<int> itemTypes; - public List<int> equipTypes; - public int realmLimit; - public bool isAuction; - public List<int> jobs; + foreach (var index in itemIDs[itemId]) + { + var item = items[index]; + if (!includeAuction && item.isAuction) + { + continue; + } + count += item.count; + } + } + return count; + } + + public List<ItemModel> GetItems(FilterParams filterParams) + { + var list = new List<ItemModel>(); + foreach (var item in items.Values) + { + var levelValid = filterParams.levels == null || filterParams.levels.Contains(item.config.LV); + if (!levelValid) + { + continue; + } + + var qualityValid = filterParams.qualitys == null || filterParams.qualitys.Contains(item.config.ItemColor); + if (!qualityValid) + { + continue; + } + + var typeValid = filterParams.itemTypes == null || filterParams.itemTypes.Contains(item.config.Type); + if (!typeValid) + { + continue; + } + + var equipTypeValid = filterParams.equipTypes == null || filterParams.equipTypes.Contains(item.config.EquipPlace); + if (!equipTypeValid) + { + continue; + } + + var jobValid = filterParams.jobs == null || filterParams.jobs.Contains(item.config.JobLimit); + if (!jobValid) + { + continue; + } + + //var auctionValid = filterParams.isAuction == item.isAuction; + //if (!auctionValid) + //{ + // continue; + //} + + var realmValid = filterParams.realmLimit == 0 || filterParams.realmLimit == item.config.RealmLimit; + if (!realmValid) + { + continue; + } + + list.Add(item); } - } \ No newline at end of file + return list; + } + + public int GetCountByType(int type) + { + var count = 0; + foreach (var item in items.Values) + { + if (item.config.Type == type) + { + count += item.count; + } + } + + return count; + } + + /// <summary> + /// 寰楀埌鍚屼竴涓猧d鎸囧畾鏁伴噺鐨勭墿鍝佹牸瀛愬簭鍙� + /// </summary> + /// <param name="itemId"></param> + /// <param name="needCount"></param> + /// <param name="type"></param> + /// <returns></returns> + public List<int> GetItemIndexsAppointedCount(int itemId, int needCount, bool includeAuction = true) + { + //var goalItems = new List<ItemModel>(); + //foreach (var item in this.items.Values) + //{ + // if (!includeAuction && item.isAuction) + // { + // continue; + // } + + // if (item.itemId == itemId) + // { + // goalItems.Add(item); + // } + //} + + var itemIndexs = new List<int>(); + var count = 0; + //for (var i = 0; i < goalItems.Count; i++) + //{ + // if (count < needCount) + // { + // itemIndexs.Add(goalItems[i].gridIndex); + // count += goalItems[i].count; + // } + // else + // { + // break; + // } + + //} + + if (itemIDs.ContainsKey(itemId)) + { + foreach (var index in itemIDs[itemId]) + { + var item = items[index]; + if (!includeAuction && item.isAuction) + { + continue; + } + if (count < needCount) + { + itemIndexs.Add(index); + count += item.count; + } + else + { + break; + } + } + } + return itemIndexs; + } + + /// <summary> + /// 寰楀埌绗竴涓┖鏍间綅缃储寮� + /// </summary> + /// <param name="type"></param> + /// <returns></returns> + public int GetFirstEmptyGridIndex() + { + for (var index = 0; index < unlockedGridCount; index++) + { + if (!items.ContainsKey(index)) + { + return index; + } + } + + return -1; + } + + public int GetEmptyGridCount() + { + return unlockedGridCount - items.Count; + } + + public void Clear() + { + items.Clear(); + itemIDs.Clear(); + } + + public struct FilterParams + { + public List<int> levels; + public List<int> qualitys; + public List<int> itemTypes; + public List<int> equipTypes; + public int realmLimit; + public bool isAuction; + public List<int> jobs; + } + +} \ No newline at end of file diff --git a/Main/System/KnapSack/New/ItemCell.cs b/Main/System/KnapSack/New/ItemCell.cs index b7d7ccf..488c701 100644 --- a/Main/System/KnapSack/New/ItemCell.cs +++ b/Main/System/KnapSack/New/ItemCell.cs @@ -1,72 +1,71 @@ 锘縰sing UnityEngine; using UnityEngine.UI; -using vnxbqy.UI; using System.Collections.Generic; using System; - public class ItemCell : CommonItemBaisc - { - private Button m_Reducebtn; - public Button reducebtn { - get { - if (m_Reducebtn == null) - { - LoadPrefab(); - m_Reducebtn = this.transform.GetComponent<Button>("Container_ItemCell/Btn_Reduce"); - } - return m_Reducebtn; - } - } - - Image m_AuctionIcon; - public Image auctionIcon - { - get +public class ItemCell : CommonItemBaisc +{ + private Button m_Reducebtn; + public Button reducebtn { + get { + if (m_Reducebtn == null) { - if (m_AuctionIcon == null) - { - LoadPrefab(); - m_AuctionIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Auction"); - } - return m_AuctionIcon; + LoadPrefab(); + m_Reducebtn = this.transform.GetComponent<Button>("Container_ItemCell/Btn_Reduce"); } - } - - Image m_TimeMark; - public Image timeMark - { - get - { - if (m_TimeMark == null) - { - LoadPrefab(); - m_TimeMark = this.transform.GetComponent<Image>("Container_ItemCell/Img_Time"); - } - return m_TimeMark; - } - } - - public override void Init(ItemModel model, bool isCompare = false) - { - base.Init(model, isCompare); - reducebtn.SetActive(false); - auctionIcon.SetActive(false); - // auctionIcon.SetActive(model.isAuction); - // if (model.isAuction) - // { - // auctionIcon.SetSprite(ItemLogicUtility.Instance.IsOverdue(model.guid) ? "Item_Auction_3" : "Item_Auction_1"); - // } - - timeMark?.SetActive(model.config.Type == 145 && model.config.CDTime > 0); - } - - public override void Init(ItemCellModel model) - { - base.Init(model); - reducebtn.SetActive(false); - auctionIcon.SetActive(false); - - timeMark?.SetActive(model.itemConfig.Type == 145 && model.itemConfig.CDTime > 0); + return m_Reducebtn; } } + Image m_AuctionIcon; + public Image auctionIcon + { + get + { + if (m_AuctionIcon == null) + { + LoadPrefab(); + m_AuctionIcon = this.transform.GetComponent<Image>("Container_ItemCell/Img_Auction"); + } + return m_AuctionIcon; + } + } + + Image m_TimeMark; + public Image timeMark + { + get + { + if (m_TimeMark == null) + { + LoadPrefab(); + m_TimeMark = this.transform.GetComponent<Image>("Container_ItemCell/Img_Time"); + } + return m_TimeMark; + } + } + + public override void Init(ItemModel model, bool isCompare = false) + { + base.Init(model, isCompare); + reducebtn.SetActive(false); + auctionIcon.SetActive(false); + // auctionIcon.SetActive(model.isAuction); + // if (model.isAuction) + // { + // auctionIcon.SetSprite(ItemLogicUtility.Instance.IsOverdue(model.guid) ? "Item_Auction_3" : "Item_Auction_1"); + // } + + timeMark?.SetActive(model.config.Type == 145 && model.config.CDTime > 0); + } + + public override void Init(ItemCellModel model) + { + base.Init(model); + reducebtn.SetActive(false); + auctionIcon.SetActive(false); + + timeMark?.SetActive(model.itemConfig.Type == 145 && model.itemConfig.CDTime > 0); + } +} + diff --git a/Main/System/KnapSack/VirtualPackManager.cs b/Main/System/KnapSack/VirtualPackManager.cs index 70e23e9..9072080 100644 --- a/Main/System/KnapSack/VirtualPackManager.cs +++ b/Main/System/KnapSack/VirtualPackManager.cs @@ -4,360 +4,357 @@ using System.Text; using UnityEngine; -namespace vnxbqy.UI + +public class VirtualPackManager : GameSystemManager<VirtualPackManager> { + Dictionary<PackType, List<VirtualPackItem>> virtualPackItems + = new Dictionary<PackType, List<VirtualPackItem>>(); + Dictionary<PackType, ObjectPool<VirtualPackItem>> m_VirtualItemPool + = new Dictionary<PackType, ObjectPool<VirtualPackItem>>(); + Dictionary<PackType, int> virtualPackCapacityDict = new Dictionary<PackType, int>(); - public class VirtualPackManager : GameSystemManager<VirtualPackManager> + public event Action<PackType> virtualPackRefresh; + int getA206Count = 0; //鏀跺埌浜嗗嚑娆206鍖� + bool isFrist = false; //鏄笉鏄涓�娆¤幏寰楄仛榄傜鐗� + Dictionary<int, int> noPackItemCountDict = new Dictionary<int, int>(); //鏃犻渶鑳屽寘鐨勭墿鍝佹暟閲忓埛鏂帮紝鑷姩杞寲涓烘暟鍊� + public event Action OnNoPackItemCountRefresh; + + public void OnBeforePlayerDataInitialize() { - Dictionary<PackType, List<VirtualPackItem>> virtualPackItems - = new Dictionary<PackType, List<VirtualPackItem>>(); - Dictionary<PackType, ObjectPool<VirtualPackItem>> m_VirtualItemPool - = new Dictionary<PackType, ObjectPool<VirtualPackItem>>(); - Dictionary<PackType, int> virtualPackCapacityDict = new Dictionary<PackType, int>(); - - public event Action<PackType> virtualPackRefresh; - int getA206Count = 0; //鏀跺埌浜嗗嚑娆206鍖� - bool isFrist = false; //鏄笉鏄涓�娆¤幏寰楄仛榄傜鐗� - Dictionary<int, int> noPackItemCountDict = new Dictionary<int, int>(); //鏃犻渶鑳屽寘鐨勭墿鍝佹暟閲忓埛鏂帮紝鑷姩杞寲涓烘暟鍊� - public event Action OnNoPackItemCountRefresh; - - public void OnBeforePlayerDataInitialize() + foreach (var packType in virtualPackItems.Keys) { - foreach (var packType in virtualPackItems.Keys) + var pool = m_VirtualItemPool[packType]; + var items = virtualPackItems[packType]; + foreach (var item in items) { - var pool = m_VirtualItemPool[packType]; - var items = virtualPackItems[packType]; + pool.Release(item); + } + } + virtualPackItems.Clear(); + noPackItemCountDict.Clear(); + getA206Count = 0; + isFrist = false; + } + + public void OnPlayerLoginOk() + { + isFrist = noPackItemCountDict.Count == 0; + } + + public override void Init() + { + base.Init(); + ParseConfig(); + m_VirtualItemPool.Add(PackType.GatherSoul, new ObjectPool<VirtualPackItem>(OnGetItem, OnReleaseItem)); + m_VirtualItemPool.Add(PackType.RunePack, new ObjectPool<VirtualPackItem>(OnGetItem, OnReleaseItem)); + DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; + DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk; + } + + public override void Release() + { + base.Release(); + DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize; + DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk; + } + + void ParseConfig() + { + var funcConfig = FuncConfigConfig.Get("RunePackageNum"); + virtualPackCapacityDict.Add(PackType.RunePack, int.Parse(funcConfig.Numerical1)); + } + + public bool IsVirtualPack(PackType packType) + { + switch (packType) + { + case PackType.GatherSoul: + case PackType.RunePack: + return true; + } + return false; + } + + public int GetPackCapacity(PackType packType) + { + if (virtualPackCapacityDict.ContainsKey(packType)) + { + return virtualPackCapacityDict[packType]; + } + return 0; + } + + public int GetPackRemainCount(PackType packType) + { + var capacity = GetPackCapacity(packType); + return capacity - GetPackItemCount(packType); + } + + public int GetPackItemCount(PackType packType) + { + if (virtualPackItems.ContainsKey(packType)) + { + return virtualPackItems[packType].Count; + } + return 0; + } + + public int GetItemCountById(PackType packType, int id) + { + var count = 0; + List<int> list; + if (TryGetItems(packType, out list)) + { + for (int i = 0; i < list.Count; i++) + { + VirtualPackItem item; + if (TryGetItem(packType, list[i], out item) + && item.id == id) + { + count++; + } + } + } + return count; + } + + public void GetItemIndexs(PackType packType, ref List<int> list) + { + list.Clear(); + List<VirtualPackItem> _list; + if (virtualPackItems.TryGetValue(packType, out _list)) + { + for (int i = 0; i < _list.Count; i++) + { + list.Add(_list[i].index); + } + } + } + + public bool TryGetItems(PackType packType, out List<int> list) + { + list = new List<int>(); + List<VirtualPackItem> _list; + if (virtualPackItems.TryGetValue(packType, out _list)) + { + for (int i = 0; i < _list.Count; i++) + { + list.Add(_list[i].index); + } + return true; + } + return false; + } + + public bool TryGetItem<T>(PackType packType, int packIndex, out T item) where T : VirtualPackItem + { + item = default(T); + if (virtualPackItems.ContainsKey(packType)) + { + var _index = virtualPackItems[packType].FindIndex((x) => + { + return x.index == packIndex; + }); + if (_index != -1) + { + item = virtualPackItems[packType][_index] as T; + } + return _index != -1; + } + return false; + } + + public void OnReceiveServerPack(HA204_tagMCVPackRefresh package) + { + var packType = (PackType)package.PackType; + if (!IsVirtualPack(packType)) + { + return; + } + List<VirtualPackItem> list; + if (!virtualPackItems.TryGetValue(packType, out list)) + { + list = new List<VirtualPackItem>(); + virtualPackItems.Add(packType, list); + } + SetVirtualItem(packType, ref list, package.VPacklItemList); + if (virtualPackRefresh != null) + { + virtualPackRefresh((PackType)package.PackType); + } + + } + + public void OnReceiveServerPack(HA205_tagMCVPackClear package) + { + var packType = (PackType)package.PackType; + if (!IsVirtualPack(packType)) + { + return; + } + List<VirtualPackItem> list; + if (virtualPackItems.TryGetValue(packType, out list)) + { + var pool = m_VirtualItemPool[packType]; + for (int i = 0; i < package.Count; i++) + { + var index = package.ItemPlaceList[i]; + var items = list.FindAll((x) => + { + return x.index == index; + }); foreach (var item in items) { + list.Remove(item); pool.Release(item); } } - virtualPackItems.Clear(); - noPackItemCountDict.Clear(); - getA206Count = 0; - isFrist = false; - } - - public void OnPlayerLoginOk() - { - isFrist = noPackItemCountDict.Count == 0; - } - - public override void Init() - { - base.Init(); - ParseConfig(); - m_VirtualItemPool.Add(PackType.GatherSoul, new ObjectPool<VirtualPackItem>(OnGetItem, OnReleaseItem)); - m_VirtualItemPool.Add(PackType.RunePack, new ObjectPool<VirtualPackItem>(OnGetItem, OnReleaseItem)); - DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; - DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk; - } - - public override void Release() - { - base.Release(); - DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize; - DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk; - } - - void ParseConfig() - { - var funcConfig = FuncConfigConfig.Get("RunePackageNum"); - virtualPackCapacityDict.Add(PackType.RunePack, int.Parse(funcConfig.Numerical1)); - } - - public bool IsVirtualPack(PackType packType) - { - switch (packType) - { - case PackType.GatherSoul: - case PackType.RunePack: - return true; - } - return false; - } - - public int GetPackCapacity(PackType packType) - { - if (virtualPackCapacityDict.ContainsKey(packType)) - { - return virtualPackCapacityDict[packType]; - } - return 0; - } - - public int GetPackRemainCount(PackType packType) - { - var capacity = GetPackCapacity(packType); - return capacity - GetPackItemCount(packType); - } - - public int GetPackItemCount(PackType packType) - { - if (virtualPackItems.ContainsKey(packType)) - { - return virtualPackItems[packType].Count; - } - return 0; - } - - public int GetItemCountById(PackType packType, int id) - { - var count = 0; - List<int> list; - if (TryGetItems(packType, out list)) - { - for (int i = 0; i < list.Count; i++) - { - VirtualPackItem item; - if (TryGetItem(packType, list[i], out item) - && item.id == id) - { - count++; - } - } - } - return count; - } - - public void GetItemIndexs(PackType packType, ref List<int> list) - { - list.Clear(); - List<VirtualPackItem> _list; - if (virtualPackItems.TryGetValue(packType, out _list)) - { - for (int i = 0; i < _list.Count; i++) - { - list.Add(_list[i].index); - } - } - } - - public bool TryGetItems(PackType packType, out List<int> list) - { - list = new List<int>(); - List<VirtualPackItem> _list; - if (virtualPackItems.TryGetValue(packType, out _list)) - { - for (int i = 0; i < _list.Count; i++) - { - list.Add(_list[i].index); - } - return true; - } - return false; - } - - public bool TryGetItem<T>(PackType packType, int packIndex, out T item) where T : VirtualPackItem - { - item = default(T); - if (virtualPackItems.ContainsKey(packType)) - { - var _index = virtualPackItems[packType].FindIndex((x) => - { - return x.index == packIndex; - }); - if (_index != -1) - { - item = virtualPackItems[packType][_index] as T; - } - return _index != -1; - } - return false; - } - - public void OnReceiveServerPack(HA204_tagMCVPackRefresh package) - { - var packType = (PackType)package.PackType; - if (!IsVirtualPack(packType)) - { - return; - } - List<VirtualPackItem> list; - if (!virtualPackItems.TryGetValue(packType, out list)) - { - list = new List<VirtualPackItem>(); - virtualPackItems.Add(packType, list); - } - SetVirtualItem(packType, ref list, package.VPacklItemList); if (virtualPackRefresh != null) { - virtualPackRefresh((PackType)package.PackType); + virtualPackRefresh(packType); } - } + } - public void OnReceiveServerPack(HA205_tagMCVPackClear package) + + public void UpdateAutoItemCountRefresh(HA206_tagMCAutoItemCountRefresh netPack) + { + + ShowRewardWin(netPack);//vNetData涓璉temCount浼犵殑鏄鐗囨�绘暟锛岄渶瑕佸湪noPackItemCountDict鍐欏叆鏁版嵁涔嬪墠璁$畻宸�� + for (int i = 0; i < netPack.Count; i++) { - var packType = (PackType)package.PackType; - if (!IsVirtualPack(packType)) - { + noPackItemCountDict[(int)netPack.ItemCountList[i].ItemID] = (int)netPack.ItemCountList[i].ItemCount; + } + OnNoPackItemCountRefresh?.Invoke(); + } + + void ShowRewardWin(HA206_tagMCAutoItemCountRefresh vNetData) + { + getA206Count += 1; + if (ItemLogicUtility.Instance.hidePickItem) + return; + // if (ModelCenter.Instance.GetModel<GatheringSoulModel>().isOpenXBWin) + // return; + if (getA206Count <= 1 && !isFrist) + return; + + for (int i = 0; i < vNetData.ItemCountList.Length; i++) + { + int itemID = (int)vNetData.ItemCountList[i].ItemID; + int itemCount = (int)vNetData.ItemCountList[i].ItemCount; + if (noPackItemCountDict.ContainsKey(itemID) && noPackItemCountDict[itemID] > itemCount) return; - } - List<VirtualPackItem> list; - if (virtualPackItems.TryGetValue(packType, out list)) - { - var pool = m_VirtualItemPool[packType]; - for (int i = 0; i < package.Count; i++) - { - var index = package.ItemPlaceList[i]; - var items = list.FindAll((x) => - { - return x.index == index; - }); - foreach (var item in items) - { - list.Remove(item); - pool.Release(item); - } - } - if (virtualPackRefresh != null) - { - virtualPackRefresh(packType); - } - } + ItemLogicUtility.Instance.RefreshPickItem(PackType.Item, itemID.ToString()); } + } - public void UpdateAutoItemCountRefresh(HA206_tagMCAutoItemCountRefresh netPack) + public int GetNoPackItemCount(int id) + { + if (noPackItemCountDict.ContainsKey(id)) { + return noPackItemCountDict[id]; + } + return 0; + } - ShowRewardWin(netPack);//vNetData涓璉temCount浼犵殑鏄鐗囨�绘暟锛岄渶瑕佸湪noPackItemCountDict鍐欏叆鏁版嵁涔嬪墠璁$畻宸�� - for (int i = 0; i < netPack.Count; i++) + public Dictionary<int, int> GetAllNoPackItem() + { + return noPackItemCountDict; + } + + + + void SetVirtualItem(PackType packType, ref List<VirtualPackItem> list, HA204_tagMCVPackRefresh.tagMCVPackItem[] items) + { + var pool = m_VirtualItemPool[packType]; + for (int i = 0; i < items.Length; i++) + { + var item = list.Find((x) => { - noPackItemCountDict[(int)netPack.ItemCountList[i].ItemID] = (int)netPack.ItemCountList[i].ItemCount; + return x.index == items[i].ItemPlace; + }); + if (item != null) + { + item.Release(); } - OnNoPackItemCountRefresh?.Invoke(); - } - - void ShowRewardWin(HA206_tagMCAutoItemCountRefresh vNetData) - { - getA206Count += 1; - if (ItemLogicUtility.Instance.hidePickItem) - return; - // if (ModelCenter.Instance.GetModel<GatheringSoulModel>().isOpenXBWin) - // return; - if (getA206Count <= 1 && !isFrist) - return; - - for (int i = 0; i < vNetData.ItemCountList.Length; i++) + else { - int itemID = (int)vNetData.ItemCountList[i].ItemID; - int itemCount = (int)vNetData.ItemCountList[i].ItemCount; - if (noPackItemCountDict.ContainsKey(itemID) && noPackItemCountDict[itemID] > itemCount) - return; - ItemLogicUtility.Instance.RefreshPickItem(PackType.Item, itemID.ToString()); - } - } - - - public int GetNoPackItemCount(int id) - { - if (noPackItemCountDict.ContainsKey(id)) - { - return noPackItemCountDict[id]; - } - return 0; - } - - public Dictionary<int, int> GetAllNoPackItem() - { - return noPackItemCountDict; - } - - - - void SetVirtualItem(PackType packType, ref List<VirtualPackItem> list, HA204_tagMCVPackRefresh.tagMCVPackItem[] items) - { - var pool = m_VirtualItemPool[packType]; - for (int i = 0; i < items.Length; i++) - { - var item = list.Find((x) => + if (pool.inactivedCount > 0) { - return x.index == items[i].ItemPlace; - }); - if (item != null) - { - item.Release(); - } - else - { - if (pool.inactivedCount > 0) - { - item = pool.Get(); - list.Add(item); - } - } - if (item == null) - { - item = VirtualPackItem.Get(packType); + item = pool.Get(); list.Add(item); } - item.ParsePackItem(items[i].ItemPlace, items[i].ItemData); - - ItemLogicUtility.Instance.RefreshPickItem(packType, item.id.ToString()); } - } + if (item == null) + { + item = VirtualPackItem.Get(packType); + list.Add(item); + } + item.ParsePackItem(items[i].ItemPlace, items[i].ItemData); - static void OnGetItem(VirtualPackItem item) - { - - } - - static void OnReleaseItem(VirtualPackItem item) - { - item.Release(); + ItemLogicUtility.Instance.RefreshPickItem(packType, item.id.ToString()); } } - public abstract class VirtualPackItem + static void OnGetItem(VirtualPackItem item) { - public int index { get; private set; } - public int id { get; private set; } - - public int level { get; private set; } - - protected string dataString { get; set; } - - protected static StringBuilder sb = new StringBuilder(); - - public virtual void ParsePackItem(int index, uint data) - { - this.index = index; - - dataString = data.ToString(); - int delta = 10 - dataString.Length; - sb.Length = 0; - sb.Append('0', delta); - dataString = dataString.Insert(0, sb.ToString()); - - id = int.Parse(dataString.Substring(5, 5)); - level = int.Parse(dataString.Substring(2, 3)) + 1; - } - - public virtual void Release() - { - dataString = null; - } - - public static VirtualPackItem Get(PackType packType) - { - // switch (packType) - // { - // case PackType.RunePack: - // return new RuneItem(); - // } - return null; - } } - public struct VirtualItem + static void OnReleaseItem(VirtualPackItem item) { - public PackType packType; - public int itemId; - public int index; - public int level; + item.Release(); } } +public abstract class VirtualPackItem +{ + public int index { get; private set; } + + public int id { get; private set; } + + public int level { get; private set; } + + protected string dataString { get; set; } + + protected static StringBuilder sb = new StringBuilder(); + + public virtual void ParsePackItem(int index, uint data) + { + this.index = index; + + dataString = data.ToString(); + int delta = 10 - dataString.Length; + sb.Length = 0; + sb.Append('0', delta); + dataString = dataString.Insert(0, sb.ToString()); + + id = int.Parse(dataString.Substring(5, 5)); + level = int.Parse(dataString.Substring(2, 3)) + 1; + } + + public virtual void Release() + { + dataString = null; + } + + public static VirtualPackItem Get(PackType packType) + { + // switch (packType) + // { + // case PackType.RunePack: + // return new RuneItem(); + // } + return null; + } +} + +public struct VirtualItem +{ + public PackType packType; + public int itemId; + public int index; + public int level; +} + diff --git a/Main/System/Mail/MailGlobalCell.cs b/Main/System/Mail/MailGlobalCell.cs index 7da0aac..3cf95c8 100644 --- a/Main/System/Mail/MailGlobalCell.cs +++ b/Main/System/Mail/MailGlobalCell.cs @@ -1,50 +1,47 @@ 锘縰sing UnityEngine; -namespace vnxbqy.UI +public class MailGlobalCell : CellView { - public class MailGlobalCell : CellView + [SerializeField] ButtonEx btnMail; + [SerializeField] ImageEx imgState; + [SerializeField] ImageEx imgRed; + [SerializeField] TextEx txtTitle; + [SerializeField] TextEx txtDate; + MailManager model { get { return MailManager.Instance; } } + string uuid = string.Empty; + public void Display(int index, CellView cellView) { - [SerializeField] ButtonEx btnMail; - [SerializeField] ImageEx imgState; - [SerializeField] ImageEx imgRed; - [SerializeField] TextEx txtTitle; - [SerializeField] TextEx txtDate; - MailManager model { get { return MailManager.Instance; } } - string uuid = string.Empty; - public void Display(int index, CellView cellView) + MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1; + var list = model.GetSortMailScrList(mailCategory); + if (list == null || index < 0 || index >= list.Count) + return; + uuid = list[index]; + if (!model.TryGetMailData(uuid, out var mailData) || mailData == null) + return; + imgRed.SetActive(mailData.MailState == 1); + txtTitle.text = mailData.Title; + imgState.SetSprite(mailData.MailState == 2 || mailData.MailState == 3 ? "MailRead" : "MailNoRead"); + if (mailData.Items != null) { - MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1; - var list = model.GetSortMailScrList(mailCategory); - if (list == null || index < 0 || index >= list.Count) - return; - uuid = list[index]; - if (!model.TryGetMailData(uuid, out var mailData) || mailData == null) - return; - imgRed.SetActive(mailData.MailState == 1); - txtTitle.text = mailData.Title; - imgState.SetSprite(mailData.MailState == 2 || mailData.MailState == 3 ? "MailRead" : "MailNoRead"); - if (mailData.Items != null) - { - txtDate.text = model.FormatCreateMailTime(mailData.CreateDateTime); - } - else - { - int expiryDay = model.GetMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays); - txtDate.text = expiryDay > 0 ? Language.Get("Mail07", expiryDay) : model.FormatCreateMailTime(mailData.CreateDateTime); - } - btnMail.SetListener(OnClickButtonMail); + txtDate.text = model.FormatCreateMailTime(mailData.CreateDateTime); } - - private void OnClickButtonMail() + else { - model.nowUuid = uuid; - if (!model.TryGetMailData(uuid, out var mailData) || mailData == null) - return; - if (mailData.MailState == 1) - { - model.ReadMail(uuid); - } - UIManager.Instance.OpenWindow<MailInfoWin>(); + int expiryDay = model.GetMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays); + txtDate.text = expiryDay > 0 ? Language.Get("Mail07", expiryDay) : model.FormatCreateMailTime(mailData.CreateDateTime); } + btnMail.SetListener(OnClickButtonMail); } -} \ No newline at end of file + + private void OnClickButtonMail() + { + model.nowUuid = uuid; + if (!model.TryGetMailData(uuid, out var mailData) || mailData == null) + return; + if (mailData.MailState == 1) + { + model.ReadMail(uuid); + } + UIManager.Instance.OpenWindow<MailInfoWin>(); + } +} diff --git a/Main/System/Mail/MailInfoAwardItemCell.cs b/Main/System/Mail/MailInfoAwardItemCell.cs index 5795352..f430bc5 100644 --- a/Main/System/Mail/MailInfoAwardItemCell.cs +++ b/Main/System/Mail/MailInfoAwardItemCell.cs @@ -1,26 +1,23 @@ 锘縰sing UnityEngine; -namespace vnxbqy.UI +public class MailInfoAwardItemCell : CellView { - public class MailInfoAwardItemCell : CellView + [SerializeField] ItemCell itemCell; + [SerializeField] ImageEx imgHave; + MailManager model { get { return MailManager.Instance; } } + public void Display(int index, CellView cellView) { - [SerializeField] ItemCell itemCell; - [SerializeField] ImageEx imgHave; - MailManager model { get { return MailManager.Instance; } } - public void Display(int index, CellView cellView) - { - int mailState = cellView.info.Value.infoInt1;//0-鏈煡锛�1-鏈锛�2-宸茶锛�3-宸查锛� - if (!model.TryGetMailData(model.nowUuid, out MailData mailData) || mailData == null || mailData.Items == null) - return; - if (index < 0 || index >= mailData.Items.Count) - return; - MailItemData data = mailData.Items[index]; - itemCell.Init(new ItemCellModel((int)data.ItemID, true, (ulong)data.Count)); - itemCell.button.SetListener(() => ItemTipUtility.Show((int)data.ItemID)); - imgHave.SetActive(mailState == 3); + int mailState = cellView.info.Value.infoInt1;//0-鏈煡锛�1-鏈锛�2-宸茶锛�3-宸查锛� + if (!model.TryGetMailData(model.nowUuid, out MailData mailData) || mailData == null || mailData.Items == null) + return; + if (index < 0 || index >= mailData.Items.Count) + return; + MailItemData data = mailData.Items[index]; + itemCell.Init(new ItemCellModel((int)data.ItemID, true, (ulong)data.Count)); + itemCell.button.SetListener(() => ItemTipUtility.Show((int)data.ItemID)); + imgHave.SetActive(mailState == 3); - MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1; - var list = model.GetSortMailScrList(mailCategory); - } + MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1; + var list = model.GetSortMailScrList(mailCategory); } -} \ No newline at end of file +} diff --git a/Main/System/Mail/MailInfoWin.cs b/Main/System/Mail/MailInfoWin.cs index b93e4ea..f746ba8 100644 --- a/Main/System/Mail/MailInfoWin.cs +++ b/Main/System/Mail/MailInfoWin.cs @@ -1,133 +1,124 @@ 锘縰sing UnityEngine; -namespace vnxbqy.UI +public class MailInfoWin : UIBase { - public class MailInfoWin : UIBase + [SerializeField] TextEx txtDate; + [SerializeField] TextEx txtTitle; + [SerializeField] Transform transNoAward; + [SerializeField] RichText txtNoAwardInfo; + [SerializeField] Transform transAward; + [SerializeField] RichText txtAwardInfo; + [SerializeField] ScrollerController scrAwardItem; + [SerializeField] TextEx txtExpiryDate; + [SerializeField] ButtonEx btnHave; + [SerializeField] ButtonEx btnDelete; + MailData nowMailData; + bool isHasAward = false; + MailManager model { get { return MailManager.Instance; } } + + protected override void InitComponent() { - [SerializeField] TextEx txtDate; - [SerializeField] TextEx txtTitle; - [SerializeField] Transform transNoAward; - [SerializeField] RichText txtNoAwardInfo; - [SerializeField] Transform transAward; - [SerializeField] RichText txtAwardInfo; - [SerializeField] ScrollerController scrAwardItem; - [SerializeField] TextEx txtExpiryDate; - [SerializeField] ButtonEx btnHave; - [SerializeField] ButtonEx btnDelete; - MailData nowMailData; - bool isHasAward = false; - MailManager model { get { return MailManager.Instance; } } + base.InitComponent(); + btnHave.SetListener(OnClickHaveButton); + btnDelete.SetListener(OnClickDeleteButton); + } - protected override void InitComponent() + protected override void OnPreOpen() + { + scrAwardItem.OnRefreshCell += OnRefreshLowRewardCell; + model.OnUpdateMailListEvent += OnUpdateMailListEvent; + model.OnUpdateMailStateChangeEvent += OnUpdateMailStateChangeEvent; + } + + protected override void OnOpen() + { + UpdateDataInfo(); + Display(); + CreateScrAward(); + } + + protected override void OnPreClose() + { + scrAwardItem.OnRefreshCell -= OnRefreshLowRewardCell; + model.OnUpdateMailListEvent -= OnUpdateMailListEvent; + model.OnUpdateMailStateChangeEvent -= OnUpdateMailStateChangeEvent; + } + + private void OnClickHaveButton() + { + if (model.nowUuid == null || model.nowUuid == string.Empty) { - base.InitComponent(); - btnHave.SetListener(OnClickHaveButton); - btnDelete.SetListener(OnClickDeleteButton); + Debug.Log("褰撳墠鏌ョ湅鐨勯偖浠舵病鏈塙UID"); + return; } - - protected override void OnPreOpen() + model.ClaimMail(model.nowUuid); + } + private void OnClickDeleteButton() + { + if (model.nowUuid == null || model.nowUuid == string.Empty) { - scrAwardItem.OnRefreshCell += OnRefreshLowRewardCell; - model.OnUpdateMailListEvent += OnUpdateMailListEvent; - model.OnUpdateMailStateChangeEvent += OnUpdateMailStateChangeEvent; + Debug.Log("褰撳墠鏌ョ湅鐨勯偖浠舵病鏈塙UID"); + return; } + model.DeleteMail(model.nowUuid); + UIManager.Instance.CloseWindow<MailInfoWin>(); + //閭欢鍒犻櫎鎴愬姛 + SysNotifyMgr.Instance.ShowTip("Mail01"); + } - protected override void OnOpen() - { - UpdateDataInfo(); - Display(); - CreateScrAward(); - } + private void OnUpdateMailStateChangeEvent() + { + UpdateDataInfo(); + Display(); + CreateScrAward(); + } - protected override void OnPreClose() - { - scrAwardItem.OnRefreshCell -= OnRefreshLowRewardCell; - model.OnUpdateMailListEvent -= OnUpdateMailListEvent; - model.OnUpdateMailStateChangeEvent -= OnUpdateMailStateChangeEvent; - } + private void OnUpdateMailListEvent() + { + UpdateDataInfo(); + Display(); + CreateScrAward(); + } - private void OnClickHaveButton() + private void OnRefreshLowRewardCell(ScrollerDataType type, CellView cell) + { + var _cell = cell.GetComponent<MailInfoAwardItemCell>(); + _cell?.Display(cell.index, cell); + } + + private void CreateScrAward() + { + scrAwardItem.Refresh(); + if (isHasAward) { - if (model.nowUuid == null || model.nowUuid == string.Empty) + for (int i = 0; i < nowMailData.Items.Count; i++) { - Debug.Log("褰撳墠鏌ョ湅鐨勯偖浠舵病鏈塙UID"); - return; + CellInfo cellInfo = new CellInfo(); + cellInfo.infoInt1 = nowMailData.MailState; + scrAwardItem.AddCell(ScrollerDataType.Header, i); } - model.ClaimMail(model.nowUuid); } - private void OnClickDeleteButton() - { - if (model.nowUuid == null || model.nowUuid == string.Empty) - { - Debug.Log("褰撳墠鏌ョ湅鐨勯偖浠舵病鏈塙UID"); - return; - } - model.DeleteMail(model.nowUuid); - UIManager.Instance.CloseWindow<MailInfoWin>(); - //閭欢鍒犻櫎鎴愬姛 - SysNotifyMgr.Instance.ShowTip("Mail01"); - } + scrAwardItem.Restart(); + } - private void OnUpdateMailStateChangeEvent() - { - UpdateDataInfo(); - Display(); - CreateScrAward(); - } - - private void OnUpdateMailListEvent() - { - UpdateDataInfo(); - Display(); - CreateScrAward(); - } - - private void OnRefreshLowRewardCell(ScrollerDataType type, CellView cell) - { - var _cell = cell.GetComponent<MailInfoAwardItemCell>(); - _cell?.Display(cell.index, cell); - } - - private void CreateScrAward() - { - scrAwardItem.Refresh(); - if (isHasAward) - { - for (int i = 0; i < nowMailData.Items.Count; i++) - { - CellInfo cellInfo = new CellInfo(); - cellInfo.infoInt1 = nowMailData.MailState; - scrAwardItem.AddCell(ScrollerDataType.Header, i); - } - } - scrAwardItem.Restart(); - } - - private void Display() - { - if (nowMailData == null) - return; - transNoAward.SetActive(!isHasAward); - transAward.SetActive(isHasAward); - txtDate.text = model.FormatCreateMailTime(nowMailData.CreateDateTime); + private void Display() + { + if (nowMailData == null) + return; + transNoAward.SetActive(!isHasAward); + transAward.SetActive(isHasAward); + txtDate.text = model.FormatCreateMailTime(nowMailData.CreateDateTime); - if (nowMailData.IsTemplateMail()) + if (nowMailData.IsTemplateMail()) + { + string key = nowMailData.GetTemplateKey(); + if (MailConfig.HasKey(key)) { - string key = nowMailData.GetTemplateKey(); - if (MailConfig.HasKey(key)) - { - MailConfig config = MailConfig.Get(key); - var templateParams = nowMailData.GetTemplateParams(); - string content = string.Format(config.Content, templateParams.ToArray()); - txtTitle.text = config.Title; - txtNoAwardInfo.text = content; - txtAwardInfo.text = content; - } - else - { - txtTitle.text = nowMailData.Title; - txtNoAwardInfo.text = nowMailData.Text; - txtAwardInfo.text = nowMailData.Text; - } + MailConfig config = MailConfig.Get(key); + var templateParams = nowMailData.GetTemplateParams(); + string content = string.Format(config.Content, templateParams.ToArray()); + txtTitle.text = config.Title; + txtNoAwardInfo.text = content; + txtAwardInfo.text = content; } else { @@ -135,20 +126,26 @@ txtNoAwardInfo.text = nowMailData.Text; txtAwardInfo.text = nowMailData.Text; } - - int expiryDays = model.GetMailExpiryDays(nowMailData.CreateDateTime, nowMailData.LimitDays); - txtExpiryDate.text = expiryDays > 0 ? Language.Get("Mail07", expiryDays) : string.Empty; - } - - private void UpdateDataInfo() + else { - if (!model.TryGetMailData(model.nowUuid, out nowMailData)) - { - UIManager.Instance.CloseWindow<MailInfoWin>(); - } - isHasAward = nowMailData != null && nowMailData.Items != null; + txtTitle.text = nowMailData.Title; + txtNoAwardInfo.text = nowMailData.Text; + txtAwardInfo.text = nowMailData.Text; } + + int expiryDays = model.GetMailExpiryDays(nowMailData.CreateDateTime, nowMailData.LimitDays); + txtExpiryDate.text = expiryDays > 0 ? Language.Get("Mail07", expiryDays) : string.Empty; + + } + + private void UpdateDataInfo() + { + if (!model.TryGetMailData(model.nowUuid, out nowMailData)) + { + UIManager.Instance.CloseWindow<MailInfoWin>(); + } + isHasAward = nowMailData != null && nowMailData.Items != null; } } diff --git a/Main/System/Mail/MailManager.cs b/Main/System/Mail/MailManager.cs index 74b5968..39a03f0 100644 --- a/Main/System/Mail/MailManager.cs +++ b/Main/System/Mail/MailManager.cs @@ -3,332 +3,329 @@ using System.Linq; using UnityEngine; -namespace vnxbqy.UI +public class MailManager : GameSystemManager<MailManager> { - public class MailManager : GameSystemManager<MailManager> + /// <summary> + /// 閭欢鏁版嵁瀛楀吀锛屽瓨鍌ㄦ墍鏈夐偖浠惰鎯� + /// Key: 閭欢GUID(鍞竴鏍囪瘑) + /// Value: 閭欢璇︾粏鏁版嵁(MailData缁撴瀯浣�) + /// </summary> + Dictionary<string, MailData> mailDataDict = new Dictionary<string, MailData>(); + public MailCategory nowMailCategory = MailCategory.Personal; + public Redpoint parentRedpoint = new Redpoint(MainRedDot.MailRepoint); + public Redpoint tabRedpoint0; + public Redpoint tabRedpoint1; + public event Action OnUpdateMailListEvent;// 鏇存柊閭欢鍒楄〃鏁版嵁 + public event Action OnUpdateMailStateChangeEvent;// 鏇存柊閭欢鐘舵�佸彉鏇� + public readonly string dateFormat = "yyyy-MM-dd"; + public string nowUuid = string.Empty; + public override void Init() { - /// <summary> - /// 閭欢鏁版嵁瀛楀吀锛屽瓨鍌ㄦ墍鏈夐偖浠惰鎯� - /// Key: 閭欢GUID(鍞竴鏍囪瘑) - /// Value: 閭欢璇︾粏鏁版嵁(MailData缁撴瀯浣�) - /// </summary> - Dictionary<string, MailData> mailDataDict = new Dictionary<string, MailData>(); - public MailCategory nowMailCategory = MailCategory.Personal; - public Redpoint parentRedpoint = new Redpoint(MainRedDot.MailRepoint); - public Redpoint tabRedpoint0; - public Redpoint tabRedpoint1; - public event Action OnUpdateMailListEvent;// 鏇存柊閭欢鍒楄〃鏁版嵁 - public event Action OnUpdateMailStateChangeEvent;// 鏇存柊閭欢鐘舵�佸彉鏇� - public readonly string dateFormat = "yyyy-MM-dd"; - public string nowUuid = string.Empty; - public override void Init() - { - tabRedpoint0 = new Redpoint(MainRedDot.MailRepoint, GetTabRedpointId(MailCategory.Personal)); - tabRedpoint1 = new Redpoint(MainRedDot.MailRepoint, GetTabRedpointId(MailCategory.Global)); - DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitializeEvent; - } + tabRedpoint0 = new Redpoint(MainRedDot.MailRepoint, GetTabRedpointId(MailCategory.Personal)); + tabRedpoint1 = new Redpoint(MainRedDot.MailRepoint, GetTabRedpointId(MailCategory.Global)); + DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitializeEvent; + } - public override void Release() - { - DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitializeEvent; - } + public override void Release() + { + DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitializeEvent; + } - public void OnBeforePlayerDataInitializeEvent() - { - mailDataDict.Clear(); - } + public void OnBeforePlayerDataInitializeEvent() + { + mailDataDict.Clear(); + } - public bool HasNoReadMail(MailCategory category) - { - var list = GetMailList(category); - if (list.IsNullOrEmpty()) - return false; - - foreach (var guid in list) - { - if (mailDataDict.TryGetValue(guid, out var mailData) && mailData.MailState == 1) - return true; - } + public bool HasNoReadMail(MailCategory category) + { + var list = GetMailList(category); + if (list.IsNullOrEmpty()) return false; - } - public int GetTabRedpointId(MailCategory type) + foreach (var guid in list) { - return MainRedDot.MailRepoint * 10 + (int)type; + if (mailDataDict.TryGetValue(guid, out var mailData) && mailData.MailState == 1) + return true; } + return false; + } - public void UpdatePersonalRedPoint() + public int GetTabRedpointId(MailCategory type) + { + return MainRedDot.MailRepoint * 10 + (int)type; + } + + public void UpdatePersonalRedPoint() + { + if (tabRedpoint0 == null) + return; + tabRedpoint0.state = RedPointState.None; + if (HasNoReadMail(MailCategory.Personal)) { - if (tabRedpoint0 == null) - return; - tabRedpoint0.state = RedPointState.None; - if (HasNoReadMail(MailCategory.Personal)) + tabRedpoint0.state = RedPointState.Simple; + } + } + + public void UpdateGlobalRedPoint() + { + if (tabRedpoint1 == null) return; + tabRedpoint1.state = RedPointState.None; + if (HasNoReadMail(MailCategory.Global)) + { + tabRedpoint1.state = RedPointState.Simple; + } + } + + /// <summary> + /// 鏇存柊閭欢绾㈢偣鎻愮ず鐘舵�� + /// </summary> + public void UpdateRedPoint() + { + UpdatePersonalRedPoint(); + UpdateGlobalRedPoint(); + } + + public bool TryGetMailData(string uuid, out MailData mailData) + { + return mailDataDict.TryGetValue(uuid, out mailData); + } + public string FormatCreateMailTime(DateTime createDateTime) + { + TimeSpan diff = TimeUtility.ServerNow - createDateTime; + if (diff.TotalHours <= 24) + { + int hours = (int)Math.Floor(diff.TotalHours); + return Language.Get("Mail05", hours); + } + else + { + return createDateTime.ToString(dateFormat); + } + } + + //杩斿洖鏈夋晥鏈熷ぉ鏁�(姝f暟=宸茶繃鏈熷ぉ鏁帮紝璐熸暟=鍓╀綑澶╂暟) + public int GetMailExpiryDays(DateTime createDateTime, int limitDays) + { + DateTime expiryDate = createDateTime.AddDays(limitDays); + return (int)(TimeUtility.ServerNow - expiryDate).TotalDays; + } + + + public List<string> GetMailList(MailCategory mailCategory) + { + var result = new List<string>(); + foreach (var kvp in mailDataDict) + { + if (kvp.Value.Category == mailCategory) { - tabRedpoint0.state = RedPointState.Simple; + result.Add(kvp.Key); } } + return result; + } - public void UpdateGlobalRedPoint() + public List<string> GetSortMailScrList(MailCategory mailCategory) + { + List<string> resList = GetMailList(mailCategory); + return resList.OrderByDescending(guid => mailDataDict[guid].CreateDateTime).ToList(); + } + + /// <summary> + /// 鏇存柊閭欢鍒楄〃鏁版嵁 + /// </summary> + /// <param name="vNetData">浠庢湇鍔″櫒鎺ユ敹鐨勯偖浠跺垪琛ㄦ暟鎹寘</param> + public void UpdateMailList(HA362_tagMCMailList vNetData) + { + if (vNetData == null) return; + + // 鏇存柊閭欢鏁版嵁瀛楀吀 + foreach (var mail in vNetData.MailList) { - if (tabRedpoint1 == null) return; - tabRedpoint1.state = RedPointState.None; - if (HasNoReadMail(MailCategory.Global)) + var category = vNetData.IsServerMail == 1 ? MailCategory.Global : MailCategory.Personal; + var mailData = new MailData(); + + mailData.Category = category; + mailData.GUID = mail.GUID; + mailData.Type = mail.Type; + mailData.CreateTime = mail.CreateTime; + mailData.CreateDateTime = Convert.ToDateTime(UIHelper.GetTime(mail.CreateTime)); + mailData.LimitDays = mail.LimitDays; + mailData.Title = mail.Title; + mailData.Text = mail.Text; + mailData.MailState = mail.MailState; + + mailData.Items = mail.Items?.Select(i => new MailItemData { - tabRedpoint1.state = RedPointState.Simple; - } + ItemID = i.ItemID, + Count = i.Count, + IsBind = i.IsBind, + UserData = i.UserData + }).ToList(); + mailDataDict[mail.GUID] = mailData; } - /// <summary> - /// 鏇存柊閭欢绾㈢偣鎻愮ず鐘舵�� - /// </summary> - public void UpdateRedPoint() - { - UpdatePersonalRedPoint(); - UpdateGlobalRedPoint(); - } + UpdateRedPoint(); + OnUpdateMailListEvent?.Invoke(); + } - public bool TryGetMailData(string uuid, out MailData mailData) + /// <summary> + /// 鏇存柊閭欢鐘舵�佸彉鏇� + /// </summary> + /// <param name="vNetData">浠庢湇鍔″櫒鎺ユ敹鐨勯偖浠剁姸鎬佸彉鏇存暟鎹寘</param> + public void UpdateMailStateChange(HA363_tagMCMailStateChange vNetData) + { + if (vNetData == null || vNetData.MailList == null) return; + + foreach (var stateChange in vNetData.MailList) { - return mailDataDict.TryGetValue(uuid, out mailData); - } - public string FormatCreateMailTime(DateTime createDateTime) - { - TimeSpan diff = TimeUtility.ServerNow - createDateTime; - if (diff.TotalHours <= 24) + if (mailDataDict.TryGetValue(stateChange.GUID, out var mailData)) { - int hours = (int)Math.Floor(diff.TotalHours); - return Language.Get("Mail05", hours); - } - else - { - return createDateTime.ToString(dateFormat); - } - } - - //杩斿洖鏈夋晥鏈熷ぉ鏁�(姝f暟=宸茶繃鏈熷ぉ鏁帮紝璐熸暟=鍓╀綑澶╂暟) - public int GetMailExpiryDays(DateTime createDateTime, int limitDays) - { - DateTime expiryDate = createDateTime.AddDays(limitDays); - return (int)(TimeUtility.ServerNow - expiryDate).TotalDays; - } - - - public List<string> GetMailList(MailCategory mailCategory) - { - var result = new List<string>(); - foreach (var kvp in mailDataDict) - { - if (kvp.Value.Category == mailCategory) + if (stateChange.MailState == 4) { - result.Add(kvp.Key); + mailDataDict.Remove(stateChange.GUID); + continue; } + mailData.MailState = stateChange.MailState; + mailDataDict[stateChange.GUID] = mailData; } - return result; } - public List<string> GetSortMailScrList(MailCategory mailCategory) + UpdateRedPoint(); + OnUpdateMailStateChangeEvent?.Invoke(); + } + + + /// <summary> + /// 闃呰閭欢 + /// </summary> + /// <param name="GUID">閭欢GUID</param> + public void ReadMail(string GUID) + { + if (string.IsNullOrEmpty(GUID)) { - List<string> resList = GetMailList(mailCategory); - return resList.OrderByDescending(guid => mailDataDict[guid].CreateDateTime).ToList(); + Debug.LogError("闃呰閭欢GUID涓嶈兘涓虹┖"); + return; } + SendRequestMail(GUID, 0); + } - /// <summary> - /// 鏇存柊閭欢鍒楄〃鏁版嵁 - /// </summary> - /// <param name="vNetData">浠庢湇鍔″櫒鎺ユ敹鐨勯偖浠跺垪琛ㄦ暟鎹寘</param> - public void UpdateMailList(HA362_tagMCMailList vNetData) - { - if (vNetData == null) return; + /// <summary> + /// 棰嗗彇閭欢 + /// </summary> + /// <param name="GUID">閭欢GUID锛屼负绌烘椂鎵归噺棰嗗彇鎵�鏈夐偖浠�</param> + public void ClaimMail(string GUID = null) + { + SendRequestMail(GUID, 1); + } - // 鏇存柊閭欢鏁版嵁瀛楀吀 - foreach (var mail in vNetData.MailList) - { - var category = vNetData.IsServerMail == 1 ? MailCategory.Global : MailCategory.Personal; - var mailData = new MailData(); + /// <summary> + /// 鍒犻櫎閭欢 + /// </summary> + /// <param name="GUID">閭欢GUID锛屼负绌烘椂鎵归噺鍒犻櫎宸查鍙栨垨鏃犵墿鍝佺殑宸茶閭欢</param> + public void DeleteMail(string GUID = null) + { + SendRequestMail(GUID, 2); + } - mailData.Category = category; - mailData.GUID = mail.GUID; - mailData.Type = mail.Type; - mailData.CreateTime = mail.CreateTime; - mailData.CreateDateTime = Convert.ToDateTime(UIHelper.GetTime(mail.CreateTime)); - mailData.LimitDays = mail.LimitDays; - mailData.Title = mail.Title; - mailData.Text = mail.Text; - mailData.MailState = mail.MailState; - - mailData.Items = mail.Items?.Select(i => new MailItemData - { - ItemID = i.ItemID, - Count = i.Count, - IsBind = i.IsBind, - UserData = i.UserData - }).ToList(); - mailDataDict[mail.GUID] = mailData; - } - - UpdateRedPoint(); - OnUpdateMailListEvent?.Invoke(); - } - - /// <summary> - /// 鏇存柊閭欢鐘舵�佸彉鏇� - /// </summary> - /// <param name="vNetData">浠庢湇鍔″櫒鎺ユ敹鐨勯偖浠剁姸鎬佸彉鏇存暟鎹寘</param> - public void UpdateMailStateChange(HA363_tagMCMailStateChange vNetData) - { - if (vNetData == null || vNetData.MailList == null) return; - - foreach (var stateChange in vNetData.MailList) - { - if (mailDataDict.TryGetValue(stateChange.GUID, out var mailData)) - { - if (stateChange.MailState == 4) - { - mailDataDict.Remove(stateChange.GUID); - continue; - } - mailData.MailState = stateChange.MailState; - mailDataDict[stateChange.GUID] = mailData; - } - } - - UpdateRedPoint(); - OnUpdateMailStateChangeEvent?.Invoke(); - } - - - /// <summary> - /// 闃呰閭欢 - /// </summary> - /// <param name="GUID">閭欢GUID</param> - public void ReadMail(string GUID) - { - if (string.IsNullOrEmpty(GUID)) - { - Debug.LogError("闃呰閭欢GUID涓嶈兘涓虹┖"); - return; - } - SendRequestMail(GUID, 0); - } - - /// <summary> - /// 棰嗗彇閭欢 - /// </summary> - /// <param name="GUID">閭欢GUID锛屼负绌烘椂鎵归噺棰嗗彇鎵�鏈夐偖浠�</param> - public void ClaimMail(string GUID = null) - { - SendRequestMail(GUID, 1); - } - - /// <summary> - /// 鍒犻櫎閭欢 - /// </summary> - /// <param name="GUID">閭欢GUID锛屼负绌烘椂鎵归噺鍒犻櫎宸查鍙栨垨鏃犵墿鍝佺殑宸茶閭欢</param> - public void DeleteMail(string GUID = null) - { - SendRequestMail(GUID, 2); - } - - /// <summary> - /// 鍙戦�侀偖浠惰姹傚埌鏈嶅姟鍣� - /// </summary> - /// <param name="GUID">閭欢GUID</param> - /// <param name="ReqType">璇锋眰绫诲瀷 0-璁剧疆宸茶锛�1-棰嗗彇閭欢锛�2-鍒犻櫎閭欢</param> - public void SendRequestMail(string GUID, byte ReqType) - { - CA537_tagCMRequestMail pack = new CA537_tagCMRequestMail(); - pack.GUID = GUID; - pack.ReqType = ReqType; - GameNetSystem.Instance.SendInfo(pack); - } + /// <summary> + /// 鍙戦�侀偖浠惰姹傚埌鏈嶅姟鍣� + /// </summary> + /// <param name="GUID">閭欢GUID</param> + /// <param name="ReqType">璇锋眰绫诲瀷 0-璁剧疆宸茶锛�1-棰嗗彇閭欢锛�2-鍒犻櫎閭欢</param> + public void SendRequestMail(string GUID, byte ReqType) + { + CA537_tagCMRequestMail pack = new CA537_tagCMRequestMail(); + pack.GUID = GUID; + pack.ReqType = ReqType; + GameNetSystem.Instance.SendInfo(pack); + } - //娌℃湁涓�涓彲棰嗗彇鐨勪釜浜洪偖浠� - public bool IsCanHaveMail() - { - var personalMails = GetMailList(MailCategory.Personal); - return personalMails.Any(guid => - mailDataDict.TryGetValue(guid, out var mail) && - mail.MailState != 3 && - mail.Items != null && - mail.Items.Count > 0 - ); - } - } - - public enum MailCategory + //娌℃湁涓�涓彲棰嗗彇鐨勪釜浜洪偖浠� + public bool IsCanHaveMail() { - Personal = 0, // 涓汉閭欢 - Global = 1 // 鍏ㄦ湇閭欢 + var personalMails = GetMailList(MailCategory.Personal); + return personalMails.Any(guid => + mailDataDict.TryGetValue(guid, out var mail) && + mail.MailState != 3 && + mail.Items != null && + mail.Items.Count > 0 + ); } +} - public class MailItemData +public enum MailCategory +{ + Personal = 0, // 涓汉閭欢 + Global = 1 // 鍏ㄦ湇閭欢 +} + +public class MailItemData +{ + public uint ItemID; //鐗╁搧ID + public uint Count; //鏁伴噺 + public byte IsBind; //鏄惁缁戝畾 + public string UserData; //鑷畾涔夋暟鎹� +} + +public class MailData +{ + public MailCategory Category; + public string GUID; //閭欢GUID + public byte Type; //閭欢绫诲瀷锛屾殏鏃堕粯璁�0 + public string CreateTime; //鍒涘缓鏃堕棿 + public DateTime CreateDateTime; + public byte LimitDays; //鏈夋晥澶╂暟 + public string Title; //鏍囬 + public string Text; //鍐呭 + public byte MailState; //閭欢鐘舵�侊細 0-鏈煡锛�1-鏈锛�2-宸茶锛�3-宸查锛� + public List<MailItemData> Items; //鐗╁搧淇℃伅 + + /// <summary> + /// 鍒ゆ柇鏄惁涓烘ā鏉跨被鍨嬮偖浠� + /// </summary> + /// <returns>true-妯℃澘閭欢, false-鏅�氶偖浠�</returns> + public bool IsTemplateMail() { - public uint ItemID; //鐗╁搧ID - public uint Count; //鏁伴噺 - public byte IsBind; //鏄惁缁戝畾 - public string UserData; //鑷畾涔夋暟鎹� + if (string.IsNullOrEmpty(Title)) + return false; + + return Title.StartsWith("<T>") && Title.EndsWith("</T>"); } - public class MailData + /// <summary> + /// 鑾峰彇妯℃澘閭欢鐨勬ā鏉縦ey + /// </summary> + /// <returns>妯℃澘key锛屽鏋滀笉鏄ā鏉块偖浠惰繑鍥炵┖瀛楃涓�</returns> + public string GetTemplateKey() { - public MailCategory Category; - public string GUID; //閭欢GUID - public byte Type; //閭欢绫诲瀷锛屾殏鏃堕粯璁�0 - public string CreateTime; //鍒涘缓鏃堕棿 - public DateTime CreateDateTime; - public byte LimitDays; //鏈夋晥澶╂暟 - public string Title; //鏍囬 - public string Text; //鍐呭 - public byte MailState; //閭欢鐘舵�侊細 0-鏈煡锛�1-鏈锛�2-宸茶锛�3-宸查锛� - public List<MailItemData> Items; //鐗╁搧淇℃伅 + if (!IsTemplateMail()) + return string.Empty; - /// <summary> - /// 鍒ゆ柇鏄惁涓烘ā鏉跨被鍨嬮偖浠� - /// </summary> - /// <returns>true-妯℃澘閭欢, false-鏅�氶偖浠�</returns> - public bool IsTemplateMail() + // 妯℃澘鏍煎紡: <T>key</T> + // 璺宠繃寮�澶寸殑"<T>" (3瀛楃) + // 鍙栦腑闂撮儴鍒嗭紝鎬婚暱搴﹀噺鍘�"<T>"鍜�"</T>"鍏�7瀛楃 + const int prefixLength = 3; // "<T>"闀垮害 + const int suffixLength = 4; // "</T>"闀垮害 + return Title.Substring(prefixLength, Title.Length - (prefixLength + suffixLength)); + } + + /// <summary> + /// 鑾峰彇妯℃澘閭欢鐨勫弬鏁板垪琛� + /// </summary> + /// <returns>鍙傛暟鍒楄〃锛屽鏋滀笉鏄ā鏉块偖浠舵垨鍙傛暟涓虹┖鍒欒繑鍥炵┖鍒楄〃</returns> + public List<string> GetTemplateParams() + { + if (!IsTemplateMail() || string.IsNullOrEmpty(Text)) + return new List<string>(); + + try { - if (string.IsNullOrEmpty(Title)) - return false; - - return Title.StartsWith("<T>") && Title.EndsWith("</T>"); + // 鍙傛暟鏍煎紡涓篔SON鏁扮粍锛歔鍙傛暟1, 鍙傛暟2, ...] + return JsonUtility.FromJson<List<string>>(Text); } - - /// <summary> - /// 鑾峰彇妯℃澘閭欢鐨勬ā鏉縦ey - /// </summary> - /// <returns>妯℃澘key锛屽鏋滀笉鏄ā鏉块偖浠惰繑鍥炵┖瀛楃涓�</returns> - public string GetTemplateKey() + catch { - if (!IsTemplateMail()) - return string.Empty; - - // 妯℃澘鏍煎紡: <T>key</T> - // 璺宠繃寮�澶寸殑"<T>" (3瀛楃) - // 鍙栦腑闂撮儴鍒嗭紝鎬婚暱搴﹀噺鍘�"<T>"鍜�"</T>"鍏�7瀛楃 - const int prefixLength = 3; // "<T>"闀垮害 - const int suffixLength = 4; // "</T>"闀垮害 - return Title.Substring(prefixLength, Title.Length - (prefixLength + suffixLength)); - } - - /// <summary> - /// 鑾峰彇妯℃澘閭欢鐨勫弬鏁板垪琛� - /// </summary> - /// <returns>鍙傛暟鍒楄〃锛屽鏋滀笉鏄ā鏉块偖浠舵垨鍙傛暟涓虹┖鍒欒繑鍥炵┖鍒楄〃</returns> - public List<string> GetTemplateParams() - { - if (!IsTemplateMail() || string.IsNullOrEmpty(Text)) - return new List<string>(); - - try - { - // 鍙傛暟鏍煎紡涓篔SON鏁扮粍锛歔鍙傛暟1, 鍙傛暟2, ...] - return JsonUtility.FromJson<List<string>>(Text); - } - catch - { - return new List<string>(); - } + return new List<string>(); } } -} \ No newline at end of file +} diff --git a/Main/System/Mail/MailPersonalCell.cs b/Main/System/Mail/MailPersonalCell.cs index 1dad912..abcd8f8 100644 --- a/Main/System/Mail/MailPersonalCell.cs +++ b/Main/System/Mail/MailPersonalCell.cs @@ -1,50 +1,47 @@ 锘縰sing UnityEngine; -namespace vnxbqy.UI +public class MailPersonalCell : CellView { - public class MailPersonalCell : CellView + [SerializeField] ButtonEx btnMail; + [SerializeField] ImageEx imgState; + [SerializeField] ImageEx imgRed; + [SerializeField] TextEx txtTitle; + [SerializeField] TextEx txtDate; + MailManager model { get { return MailManager.Instance; } } + string uuid = string.Empty; + public void Display(int index, CellView cellView) { - [SerializeField] ButtonEx btnMail; - [SerializeField] ImageEx imgState; - [SerializeField] ImageEx imgRed; - [SerializeField] TextEx txtTitle; - [SerializeField] TextEx txtDate; - MailManager model { get { return MailManager.Instance; } } - string uuid = string.Empty; - public void Display(int index, CellView cellView) + MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1; + var list = model.GetSortMailScrList(mailCategory); + if (list == null || index < 0 || index >= list.Count) + return; + uuid = list[index]; + if (!model.TryGetMailData(uuid, out var mailData) || mailData == null) + return; + imgRed.SetActive(mailData.MailState == 1); + txtTitle.text = mailData.Title; + imgState.SetSprite(mailData.MailState == 2 || mailData.MailState == 3 ? "MailRead" : "MailNoRead"); + if (mailData.Items != null) { - MailCategory mailCategory = (MailCategory)cellView.info.Value.infoInt1; - var list = model.GetSortMailScrList(mailCategory); - if (list == null || index < 0 || index >= list.Count) - return; - uuid = list[index]; - if (!model.TryGetMailData(uuid, out var mailData) || mailData == null) - return; - imgRed.SetActive(mailData.MailState == 1); - txtTitle.text = mailData.Title; - imgState.SetSprite(mailData.MailState == 2 || mailData.MailState == 3 ? "MailRead" : "MailNoRead"); - if (mailData.Items != null) - { - txtDate.text = model.FormatCreateMailTime(mailData.CreateDateTime); - } - else - { - int expiryDay = model.GetMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays); - txtDate.text = expiryDay > 0 ? Language.Get("Mail07", expiryDay) : model.FormatCreateMailTime(mailData.CreateDateTime); - } - btnMail.SetListener(OnClickButtonMail); + txtDate.text = model.FormatCreateMailTime(mailData.CreateDateTime); } - - private void OnClickButtonMail() + else { - model.nowUuid = uuid; - if (!model.TryGetMailData(uuid, out var mailData) || mailData == null) - return; - if (mailData.MailState == 1) - { - model.ReadMail(uuid); - } - UIManager.Instance.OpenWindow<MailInfoWin>(); + int expiryDay = model.GetMailExpiryDays(mailData.CreateDateTime, mailData.LimitDays); + txtDate.text = expiryDay > 0 ? Language.Get("Mail07", expiryDay) : model.FormatCreateMailTime(mailData.CreateDateTime); } + btnMail.SetListener(OnClickButtonMail); } -} \ No newline at end of file + + private void OnClickButtonMail() + { + model.nowUuid = uuid; + if (!model.TryGetMailData(uuid, out var mailData) || mailData == null) + return; + if (mailData.MailState == 1) + { + model.ReadMail(uuid); + } + UIManager.Instance.OpenWindow<MailInfoWin>(); + } +} diff --git a/Main/System/Mail/MailWin.cs b/Main/System/Mail/MailWin.cs index 91da8dd..865aefd 100644 --- a/Main/System/Mail/MailWin.cs +++ b/Main/System/Mail/MailWin.cs @@ -1,172 +1,171 @@ 锘縰sing System; using UnityEngine; -namespace vnxbqy.UI + + +public class MailWin : UIBase { - public class MailWin : UIBase + [SerializeField] Transform transPersonal; + [SerializeField] Transform transGlobal; + [SerializeField] ScrollerController scrPersonal; + [SerializeField] ScrollerController scrGlobal; + [SerializeField] ButtonEx btnDeleteRead; + [SerializeField] ButtonEx btnClaimAll; + [SerializeField] ToggleEx togTab0; + [SerializeField] RedpointBehaviour rpTab0; + [SerializeField] ToggleEx togTab1; + [SerializeField] RedpointBehaviour rpTab1; + [SerializeField] Transform transNoMail; + MailManager model { get { return MailManager.Instance; } } + protected override void InitComponent() { - [SerializeField] Transform transPersonal; - [SerializeField] Transform transGlobal; - [SerializeField] ScrollerController scrPersonal; - [SerializeField] ScrollerController scrGlobal; - [SerializeField] ButtonEx btnDeleteRead; - [SerializeField] ButtonEx btnClaimAll; - [SerializeField] ToggleEx togTab0; - [SerializeField] RedpointBehaviour rpTab0; - [SerializeField] ToggleEx togTab1; - [SerializeField] RedpointBehaviour rpTab1; - [SerializeField] Transform transNoMail; - MailManager model { get { return MailManager.Instance; } } - protected override void InitComponent() - { - base.InitComponent(); - btnDeleteRead.SetListener(OnDeleteRead); - btnClaimAll.SetListener(OnClaimAll); - togTab0.SetListener(OnTab0); - togTab1.SetListener(OnTab1); - } + base.InitComponent(); + btnDeleteRead.SetListener(OnDeleteRead); + btnClaimAll.SetListener(OnClaimAll); + togTab0.SetListener(OnTab0); + togTab1.SetListener(OnTab1); + } - protected override void OnPreOpen() - { - model.OnUpdateMailListEvent += OnUpdateMailListEvent; - model.OnUpdateMailStateChangeEvent += OnUpdateMailStateChangeEvent; - scrPersonal.OnRefreshCell += OnRefreshPersonalCell; - scrGlobal.OnRefreshCell += OnRefreshGlobalCell; + protected override void OnPreOpen() + { + model.OnUpdateMailListEvent += OnUpdateMailListEvent; + model.OnUpdateMailStateChangeEvent += OnUpdateMailStateChangeEvent; + scrPersonal.OnRefreshCell += OnRefreshPersonalCell; + scrGlobal.OnRefreshCell += OnRefreshGlobalCell; - rpTab0.redpointId = model.GetTabRedpointId(MailCategory.Personal); - rpTab1.redpointId = model.GetTabRedpointId(MailCategory.Global); - transNoMail.SetActive(false); - } + rpTab0.redpointId = model.GetTabRedpointId(MailCategory.Personal); + rpTab1.redpointId = model.GetTabRedpointId(MailCategory.Global); + transNoMail.SetActive(false); + } - protected override void OnPreClose() - { - model.OnUpdateMailListEvent -= OnUpdateMailListEvent; - model.OnUpdateMailStateChangeEvent -= OnUpdateMailStateChangeEvent; - scrPersonal.OnRefreshCell -= OnRefreshPersonalCell; - scrGlobal.OnRefreshCell -= OnRefreshGlobalCell; - } + protected override void OnPreClose() + { + model.OnUpdateMailListEvent -= OnUpdateMailListEvent; + model.OnUpdateMailStateChangeEvent -= OnUpdateMailStateChangeEvent; + scrPersonal.OnRefreshCell -= OnRefreshPersonalCell; + scrGlobal.OnRefreshCell -= OnRefreshGlobalCell; + } - private void OnTab0(bool value) + private void OnTab0(bool value) + { + if (value) { - if (value) - { - transPersonal.SetActive(true); - transGlobal.SetActive(false); - model.nowMailCategory = MailCategory.Personal; - CreatePersonalScr(model.nowMailCategory); - } - } - - private void OnTab1(bool value) - { - if (value) - { - transPersonal.SetActive(false); - transGlobal.SetActive(true); - model.nowMailCategory = MailCategory.Global; - CreateGlobalScr(model.nowMailCategory); - } - } - - protected override void OnOpen() - { - togTab0.isOn = true; - togTab1.isOn = false; + transPersonal.SetActive(true); + transGlobal.SetActive(false); model.nowMailCategory = MailCategory.Personal; CreatePersonalScr(model.nowMailCategory); } + } - private void OnRefreshPersonalCell(ScrollerDataType type, CellView cell) + private void OnTab1(bool value) + { + if (value) { - var _cell = cell.GetComponent<MailPersonalCell>(); - _cell?.Display(cell.index, cell); + transPersonal.SetActive(false); + transGlobal.SetActive(true); + model.nowMailCategory = MailCategory.Global; + CreateGlobalScr(model.nowMailCategory); } + } - private void OnRefreshGlobalCell(ScrollerDataType type, CellView cell) - { - var _cell = cell.GetComponent<MailGlobalCell>(); - _cell?.Display(cell.index, cell); - } + protected override void OnOpen() + { + togTab0.isOn = true; + togTab1.isOn = false; + model.nowMailCategory = MailCategory.Personal; + CreatePersonalScr(model.nowMailCategory); + } - private void OnDeleteRead() - { - ConfirmCancel.ShowPopConfirm( - Language.Get("Mail101"), - Language.Get("Mail10"), - (bool isOk) => - { - if (isOk) - { - model.DeleteMail(); - //閭欢鍒犻櫎鎴愬姛 - SysNotifyMgr.Instance.ShowTip("Mail01"); - } - }); - } + private void OnRefreshPersonalCell(ScrollerDataType type, CellView cell) + { + var _cell = cell.GetComponent<MailPersonalCell>(); + _cell?.Display(cell.index, cell); + } - private void OnClaimAll() - { - if (!model.IsCanHaveMail()) + private void OnRefreshGlobalCell(ScrollerDataType type, CellView cell) + { + var _cell = cell.GetComponent<MailGlobalCell>(); + _cell?.Display(cell.index, cell); + } + + private void OnDeleteRead() + { + ConfirmCancel.ShowPopConfirm( + Language.Get("Mail101"), + Language.Get("Mail10"), + (bool isOk) => { - SysNotifyMgr.Instance.ShowTip("Mail02"); - return; - } - model.ClaimMail(); - } - - public void CreatePersonalScr(MailCategory mailCategory) - { - scrPersonal.Refresh(); - var list = model.GetSortMailScrList(mailCategory); - if (list != null) - { - for (int i = 0; i < list.Count; i++) + if (isOk) { - CellInfo cellInfo = new CellInfo(); - cellInfo.infoInt1 = (int)mailCategory; - scrPersonal.AddCell(ScrollerDataType.Header, i, cellInfo); + model.DeleteMail(); + //閭欢鍒犻櫎鎴愬姛 + SysNotifyMgr.Instance.ShowTip("Mail01"); } - } - scrPersonal.Restart(); - } - public void CreateGlobalScr(MailCategory mailCategory) - { - scrGlobal.Refresh(); - var list = model.GetSortMailScrList(mailCategory); - if (list != null) - { - for (int i = 0; i < list.Count; i++) - { - CellInfo cellInfo = new CellInfo(); - cellInfo.infoInt1 = (int)mailCategory; - scrGlobal.AddCell(ScrollerDataType.Header, i, cellInfo); - } - } - scrGlobal.Restart(); - } + }); + } - private void OnUpdateMailStateChangeEvent() + private void OnClaimAll() + { + if (!model.IsCanHaveMail()) { - RefreshScr(); + SysNotifyMgr.Instance.ShowTip("Mail02"); + return; } + model.ClaimMail(); + } - private void OnUpdateMailListEvent() + public void CreatePersonalScr(MailCategory mailCategory) + { + scrPersonal.Refresh(); + var list = model.GetSortMailScrList(mailCategory); + if (list != null) { - RefreshScr(); + for (int i = 0; i < list.Count; i++) + { + CellInfo cellInfo = new CellInfo(); + cellInfo.infoInt1 = (int)mailCategory; + scrPersonal.AddCell(ScrollerDataType.Header, i, cellInfo); + } } + scrPersonal.Restart(); + } + public void CreateGlobalScr(MailCategory mailCategory) + { + scrGlobal.Refresh(); + var list = model.GetSortMailScrList(mailCategory); + if (list != null) + { + for (int i = 0; i < list.Count; i++) + { + CellInfo cellInfo = new CellInfo(); + cellInfo.infoInt1 = (int)mailCategory; + scrGlobal.AddCell(ScrollerDataType.Header, i, cellInfo); + } + } + scrGlobal.Restart(); + } - private void RefreshScr() - { - var list = model.GetSortMailScrList(model.nowMailCategory); - if (list.IsNullOrEmpty()) - { - transNoMail.SetActive(true); - } - else - { - transNoMail.SetActive(false); - scrPersonal.m_Scorller.RefreshActiveCellViews(); - scrGlobal.m_Scorller.RefreshActiveCellViews(); - } + private void OnUpdateMailStateChangeEvent() + { + RefreshScr(); + } + + private void OnUpdateMailListEvent() + { + RefreshScr(); + } + + private void RefreshScr() + { + var list = model.GetSortMailScrList(model.nowMailCategory); + if (list.IsNullOrEmpty()) + { + transNoMail.SetActive(true); + } + else + { + transNoMail.SetActive(false); + scrPersonal.m_Scorller.RefreshActiveCellViews(); + scrGlobal.m_Scorller.RefreshActiveCellViews(); } } } diff --git a/Main/System/MainInterfacePanel/TaskAllocation.cs b/Main/System/MainInterfacePanel/TaskAllocation.cs deleted file mode 100644 index 91dda77..0000000 --- a/Main/System/MainInterfacePanel/TaskAllocation.cs +++ /dev/null @@ -1,162 +0,0 @@ -锘�//-------------------------------------------------------- -// [Author]: 绗簩涓栫晫 -// [ Date ]: Monday, November 06, 2017 -//-------------------------------------------------------- -using UnityEngine; -using System.Collections; -using UnityEngine.UI; -using System.Text; -using System.Text.RegularExpressions; -using System.Collections.Generic; -using System; -//鐢ㄤ簬浠诲姟鍒嗛厤 -namespace vnxbqy.UI -{ - - - public class TaskAllocation : Singleton<TaskAllocation> - - { - - private static StringBuilder textBuilder = new StringBuilder(); - private const string Info_Pattern = "{([a-zA-Z0-9_]+)}"; - public string GetTaskInfo(string val, int _item)//鐢ㄤ簬0820涓瓧鍏哥殑鍊兼浛鎹紙1瀛楃涓�2浠诲姟ID锛� - { - textBuilder.Length = 0; - int index = 0; - if (Regex.IsMatch(val, Info_Pattern)) - { - if (TaskManager.Instance.ReplaceDic.ContainsKey(_item)) - { - Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[_item]; - foreach (Match match in Regex.Matches(val, Info_Pattern)) - { - textBuilder.Append(val.Substring(index, match.Index - index)); - if (_dic.ContainsKey(match.Groups[1].Value)) - { - textBuilder.Append(_dic[match.Groups[1].Value]); - } - else - { - textBuilder.Append(0); - } - - index = match.Index + match.Length; - } - } - textBuilder.Append(val.Substring(index, val.Length - index)); - return textBuilder.ToString(); - } - else - { - return val; - } - } - - public int ForRingNumber()//鑾峰彇璧忛噾鐜暟 - { - if (TaskManager.Instance.ReplaceDic.ContainsKey(1)) - { - Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[1]; - if (_dic.ContainsKey("around_count")) - { - string str = "around_count"; - return _dic[str]; - - } - } - return 0; - } - public int ForRingAllNumber()//鑾峰彇璧忛噾鎬荤幆鏁� - { - if (TaskManager.Instance.ReplaceDic.ContainsKey(1)) - { - Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[1]; - if (_dic.ContainsKey("around_allcount")) - { - string str = "around_allcount"; - return _dic[str]; - - } - } - return 0; - } - - public int FairyAuNumber()//鑾峰彇浠欑洘鐜暟 - { - if (TaskManager.Instance.ReplaceDic.ContainsKey(1)) - { - Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[1]; - if (_dic.ContainsKey("around_count_family")) - { - string str = "around_count_family"; - return _dic[str]; - - } - } - return 0; - } - - public int FairyAuAllNumber()//鑾峰彇浠欑洘鎬荤幆鏁� - { - if (TaskManager.Instance.ReplaceDic.ContainsKey(1)) - { - Dictionary<string, int> _dic = TaskManager.Instance.ReplaceDic[1]; - if (_dic.ContainsKey("around_allcount_family")) - { - string str = "around_allcount_family"; - return _dic[str]; - - } - } - return 0; - } - // PlayerMainDate m_MainModel; - // PlayerMainDate mainModel { get { return m_MainModel ?? (m_MainModel = ModelCenter.Instance.GetModel<PlayerMainDate>()); } } - public void SkillTask(int TaskID)//鐢ㄤ簬瑙i攣琚姩鎶�鑳戒换鍔� - { - // int Gold = (int)UIHelper.GetMoneyCnt(1);//浠欑帀 - // if (mainModel.TaskId_Skill.Contains(TaskID)) - // { - // int Index = mainModel.TaskId_Skill.IndexOf(TaskID); - // int NeedMoney = mainModel.NeedFairyJade[Index]; - // string strNull = string.Format(Language.Get("PassiveSkillTask3"), NeedMoney); - // ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), strNull, (bool isOk) => - // { - // if (isOk) - // { - // if (Gold >= NeedMoney) - // { - // TaskManager.Instance.CompletionOfTask(TaskID); - // if (WindowCenter.Instance.IsOpen<SkillWin>()) - // { - // return; - // } - // WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.SkillFunc2Type2); - // } - // else - // { - // if (VersionConfig.Get().isBanShu) - // { - // SysNotifyMgr.Instance.ShowTip("GoldErr"); - // return; - // } - // WindowCenter.Instance.Open<RechargeTipWin>(); - // } - // } - // }); - // } - } - - DateTime m_TaskTime = DateTime.Now; - public DateTime TaskTime { - get { return m_TaskTime; } - set { m_TaskTime = value; } - } - - } - -} - - - diff --git a/Main/System/MainInterfacePanel/TaskAllocation.cs.meta b/Main/System/MainInterfacePanel/TaskAllocation.cs.meta deleted file mode 100644 index d064088..0000000 --- a/Main/System/MainInterfacePanel/TaskAllocation.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a473681297500234c97b387af8d2242b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/System/Message/HrefAnalysis.cs b/Main/System/Message/HrefAnalysis.cs index ecb0bde..5103744 100644 --- a/Main/System/Message/HrefAnalysis.cs +++ b/Main/System/Message/HrefAnalysis.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System; +锘縰sing System; using System.Collections; using System.Collections.Generic; using System.Text; diff --git a/Main/System/Message/RichFbEvent.cs b/Main/System/Message/RichFbEvent.cs deleted file mode 100644 index f8d48c4..0000000 --- a/Main/System/Message/RichFbEvent.cs +++ /dev/null @@ -1,32 +0,0 @@ -锘�// using vnxbqy.UI; -// using System; -// using System.Collections.Generic; - -// using UnityEngine; - -// public class RichFbEvent : TRichTextEvent -// { -// public RichFbEvent() -// { -// RichTextMgr.Inst.RegisterEvent(RichTextEventEnum.ENTERFB, this); -// } - -// public override bool Execute(RichTextEventEnum type, RichTextMgr.HrefInfo href) -// { -// switch (type) { -// case RichTextEventEnum.ENTERFB: { -// int id = 0; -// if(int.TryParse(href.mSplits["enterfb"],out id)) { -// ModelCenter.Instance.GetModel<DungeonModel>().SingleChallenge(id); -// } -// } -// break; -// } -// return false; -// } - -// public override string GetDisplay(RichTextEventEnum type, Dictionary<string, string> dic) -// { -// return string.Empty; -// } -// } diff --git a/Main/System/Message/RichFbEvent.cs.meta b/Main/System/Message/RichFbEvent.cs.meta deleted file mode 100644 index 0d0dcb4..0000000 --- a/Main/System/Message/RichFbEvent.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5b55bb9cef9a42347aea1c47525acec7 -timeCreated: 1508210667 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Main/System/Message/RichNormalEvent.cs b/Main/System/Message/RichNormalEvent.cs index 9e4ba47..61d2046 100644 --- a/Main/System/Message/RichNormalEvent.cs +++ b/Main/System/Message/RichNormalEvent.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System; +锘縰sing System; using System.Collections.Generic; using System.Text; diff --git a/Main/System/Message/RichShowPlayerEvent.cs b/Main/System/Message/RichShowPlayerEvent.cs index 69a18bb..b4c64af 100644 --- a/Main/System/Message/RichShowPlayerEvent.cs +++ b/Main/System/Message/RichShowPlayerEvent.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System; +锘縰sing System; using System.Collections.Generic; using UnityEngine; diff --git a/Main/System/Message/RichTableEvent.cs b/Main/System/Message/RichTableEvent.cs index 209a7cd..eb2a9d1 100644 --- a/Main/System/Message/RichTableEvent.cs +++ b/Main/System/Message/RichTableEvent.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System; +锘縰sing System; using System.Collections.Generic; using UnityEngine; diff --git a/Main/System/Message/RichViewItemUtility.cs b/Main/System/Message/RichViewItemUtility.cs index f44ba57..86333cb 100644 --- a/Main/System/Message/RichViewItemUtility.cs +++ b/Main/System/Message/RichViewItemUtility.cs @@ -1,218 +1,215 @@ -锘�// using System; -// using System.Collections; -// using System.Collections.Generic; -// using UnityEngine; -// namespace vnxbqy.UI -// { -// public static class RichViewItemUtility -// { -// static string s_CacheUserData = string.Empty; - -// static EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } } - -// public static void DisplayItem(int itemId, ItemTipUtility.CustomItemPlus itemplus) -// { -// if (ItemLogicUtility.Instance.IsRealmEquip(itemId) && itemplus.Preview != 1) -// { -// var itemConfig = ItemConfig.Get(itemId); -// Dictionary<int, int> gems = new Dictionary<int, int>(); -// Dictionary<int, bool> gemHoleActiveStates = new Dictionary<int, bool>(); -// if (itemplus.Stone != null) -// { -// for (int i = 0; i < itemplus.Stone.Length; i++) -// { -// gems.Add(i, itemplus.Stone[i]); -// if (i == 3) -// { -// gemHoleActiveStates.Add(i, itemplus.Stone[i] != 0); -// } -// } -// } - -// for (int i = 0; i < EquipGemModel.EQUIPGEM_HOLE_COUNT; i++) -// { -// if (i < 3) -// { -// gemHoleActiveStates.Add(i, equipGemModel.IsGemHoleOpen(i, itemplus.Star)); -// } -// } - -// var legendProperties = new List<Int2>(); -// var equipSkillList = new List<int>(); -// Dictionary<int, List<int>> useDataDict = null; -// if (!string.IsNullOrEmpty(itemplus.UserData)) -// { -// useDataDict = ConfigParse.Analysis(itemplus.UserData); -// if (useDataDict != null) -// { -// if(useDataDict.ContainsKey((int)ItemUseDataKey.legendAttrID) && useDataDict.ContainsKey((int)ItemUseDataKey.legendAttrValue)) -// { -// var count = Mathf.Min(useDataDict[(int)ItemUseDataKey.legendAttrID].Count, useDataDict[(int)ItemUseDataKey.legendAttrValue].Count); -// for (int i = 0; i < count; i++) -// { -// legendProperties.Add(new Int2(useDataDict[(int)ItemUseDataKey.legendAttrID][i], useDataDict[(int)ItemUseDataKey.legendAttrValue][i])); -// } -// } -// if (useDataDict.ContainsKey((int)ItemUseDataKey.equipSkills)) -// { -// equipSkillList = useDataDict[(int)ItemUseDataKey.equipSkills]; -// } - -// } -// } - -// List<Int2> trainProperties = new List<Int2>(); -// if (!itemplus.Wash.Equals(default(ItemTipUtility.CustomEquipWash))) -// { -// var washType = EquipTrainModel.GetTrainType(itemConfig.EquipPlace); -// var trainConfig = EquipWashConfig.Get(washType, 1); -// for (int i = 0; i < itemplus.Wash.Value.Length; i++) -// { -// var propertyType = i == 0 ? trainConfig.config.attType1 : i == 1 ? -// trainConfig.config.attType2 : trainConfig.config.attType3; -// trainProperties.Add(new Int2(propertyType, itemplus.Wash.Value[i])); -// } -// } - -// Dictionary<EquipSuitType, int> suitLevels = new Dictionary<EquipSuitType, int>(); -// suitLevels.Add(EquipSuitType.TwoSuit, -1); -// suitLevels.Add(EquipSuitType.FiveSuit, -1); -// suitLevels.Add(EquipSuitType.EightSuit, -1); - -// List<int> suitplaces = new List<int>(); - -// Dictionary<int, int> placeStars = new Dictionary<int, int>(); -// for (int i = 1; i <= 8; i++) -// { -// placeStars.Add(i, -1); -// } - -// if (itemplus.placeStars != null) -// { -// for (int i = 0; i < itemplus.placeStars.Length; i++) -// { -// placeStars[i + 1] = itemplus.placeStars[i]; -// } -// } - -// if (itemplus.suitPlaces != null && itemplus.suitLevels != null) -// { -// suitplaces.AddRange(itemplus.suitPlaces); -// suitLevels[EquipSuitType.TwoSuit] = itemplus.suitLevels[0]; -// suitLevels[EquipSuitType.FiveSuit] = itemplus.suitLevels[1]; -// suitLevels[EquipSuitType.EightSuit] = itemplus.suitLevels[2]; -// } -// else if (itemplus.Equips != null) -// { -// var stars = new List<int>(); -// for (int i = 0; i < itemplus.Equips.Length; i++) -// { -// var array = itemplus.Equips[i]; -// var config = ItemConfig.Get(array[0]); -// if (config.EquipPlace > 8) -// { -// continue; -// } -// stars.Add(array[1]); - -// placeStars[config.EquipPlace] = array[1]; - -// if (config.SuiteiD > 0) -// { -// suitplaces.Add(config.EquipPlace); -// } -// } - -// stars.Sort((int x, int y) => { return -x.CompareTo(y); }); - -// var twoSuitLevel = (suitplaces.Count > 1 && stars.Count > 1) ? stars[1] : -1; -// var fiveSuitLevel = (suitplaces.Count > 4 && stars.Count > 4) ? stars[4] : -1; -// var eightSuitLevel = (suitplaces.Count > 7 && stars.Count > 7) ? stars[7] : -1; - -// suitLevels[EquipSuitType.TwoSuit] = twoSuitLevel; -// suitLevels[EquipSuitType.FiveSuit] = fiveSuitLevel; -// suitLevels[EquipSuitType.EightSuit] = eightSuitLevel; -// } - -// ItemTipUtility.ShowCustomEquip(new ItemTipUtility.CustomEquipInfo() -// { -// itemId = itemId, -// job = itemConfig.JobLimit, -// strengthenLevel = itemplus.PlusLV, -// starLevel = itemplus.Star, -// gems = gems, -// legendProperties = legendProperties, -// score = ItemLogicUtility.Instance.GetEquipScore(itemId, useDataDict, true), -// gemHoleActiveStates = gemHoleActiveStates, -// suitLevels = suitLevels, -// suitPlaces = suitplaces, -// trainProperties = trainProperties, -// isEquiped = itemplus.Equipped == 1, -// placeStars = placeStars, -// equipSkillList = equipSkillList, -// }); -// } -// else -// { -// ItemTipUtility.Show(itemId); -// } -// } - -// public static void SendViewNotifyItem(string guid, string userdata) -// { -// s_CacheUserData = userdata; -// var pak = new CA905_tagCGQueryNotifyEquipDetailInfo(); -// pak.ItemGUID = guid; -// GameNetSystem.Instance.SendInfo(pak); -// } - -// public static void ReceivePackage(HA905_tagGCNotifyEquipDetailInfo package) -// { -// List<int[]> equips = null; -// if (package.ClassEquipCount > 0) -// { -// equips = new List<int[]>(); -// foreach (var equip in package.ClassEquipList) -// { -// equips.Add(new int[2] -// { -// (int)equip.ItemID, -// equip.Star, -// }); -// } -// } - -// ItemTipUtility.CustomItemPlus itemplus = new ItemTipUtility.CustomItemPlus() -// { -// ItemID = (int)package.ItemID, -// count = 1, -// Star = package.Star, -// PlusLV = package.PlusLV, -// EvolveLV = package.EvolveLV, -// Wash = new ItemTipUtility.CustomEquipWash() -// { -// LV = package.WashLV, -// Value = new int[3] -// { -// 0<package.WashValueList.Length?(int)package.WashValueList[0]:0, -// 1<package.WashValueList.Length?(int)package.WashValueList[1]:0, -// 2<package.WashValueList.Length?(int)package.WashValueList[2]:0, -// }, -// }, -// Equipped = 1, -// Stone = new int[4] -// { -// 0<package.StoneIDList.Length?(int)package.StoneIDList[0]:0, -// 1<package.StoneIDList.Length?(int)package.StoneIDList[1]:0, -// 2<package.StoneIDList.Length?(int)package.StoneIDList[2]:0, -// 3<package.StoneIDList.Length?(int)package.StoneIDList[3]:0, -// }, -// UserData = s_CacheUserData, -// Equips = equips == null ? null : equips.ToArray(), -// }; - -// DisplayItem((int)itemplus.ItemID, itemplus); -// } -// } -// } +锘縰sing System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +//public static class RichViewItemUtility +//{ +// static string s_CacheUserData = string.Empty; + +// static EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } } + +// public static void DisplayItem(int itemId, ItemTipUtility.CustomItemPlus itemplus) +// { +// if (ItemLogicUtility.Instance.IsRealmEquip(itemId) && itemplus.Preview != 1) +// { +// var itemConfig = ItemConfig.Get(itemId); +// Dictionary<int, int> gems = new Dictionary<int, int>(); +// Dictionary<int, bool> gemHoleActiveStates = new Dictionary<int, bool>(); +// if (itemplus.Stone != null) +// { +// for (int i = 0; i < itemplus.Stone.Length; i++) +// { +// gems.Add(i, itemplus.Stone[i]); +// if (i == 3) +// { +// gemHoleActiveStates.Add(i, itemplus.Stone[i] != 0); +// } +// } +// } + +// for (int i = 0; i < EquipGemModel.EQUIPGEM_HOLE_COUNT; i++) +// { +// if (i < 3) +// { +// gemHoleActiveStates.Add(i, equipGemModel.IsGemHoleOpen(i, itemplus.Star)); +// } +// } + +// var legendProperties = new List<Int2>(); +// var equipSkillList = new List<int>(); +// Dictionary<int, List<int>> useDataDict = null; +// if (!string.IsNullOrEmpty(itemplus.UserData)) +// { +// useDataDict = ConfigParse.Analysis(itemplus.UserData); +// if (useDataDict != null) +// { +// if (useDataDict.ContainsKey((int)ItemUseDataKey.legendAttrID) && useDataDict.ContainsKey((int)ItemUseDataKey.legendAttrValue)) +// { +// var count = Mathf.Min(useDataDict[(int)ItemUseDataKey.legendAttrID].Count, useDataDict[(int)ItemUseDataKey.legendAttrValue].Count); +// for (int i = 0; i < count; i++) +// { +// legendProperties.Add(new Int2(useDataDict[(int)ItemUseDataKey.legendAttrID][i], useDataDict[(int)ItemUseDataKey.legendAttrValue][i])); +// } +// } +// if (useDataDict.ContainsKey((int)ItemUseDataKey.equipSkills)) +// { +// equipSkillList = useDataDict[(int)ItemUseDataKey.equipSkills]; +// } + +// } +// } + +// List<Int2> trainProperties = new List<Int2>(); +// if (!itemplus.Wash.Equals(default(ItemTipUtility.CustomEquipWash))) +// { +// var washType = EquipTrainModel.GetTrainType(itemConfig.EquipPlace); +// var trainConfig = EquipWashConfig.Get(washType, 1); +// for (int i = 0; i < itemplus.Wash.Value.Length; i++) +// { +// var propertyType = i == 0 ? trainConfig.config.attType1 : i == 1 ? +// trainConfig.config.attType2 : trainConfig.config.attType3; +// trainProperties.Add(new Int2(propertyType, itemplus.Wash.Value[i])); +// } +// } + +// Dictionary<EquipSuitType, int> suitLevels = new Dictionary<EquipSuitType, int>(); +// suitLevels.Add(EquipSuitType.TwoSuit, -1); +// suitLevels.Add(EquipSuitType.FiveSuit, -1); +// suitLevels.Add(EquipSuitType.EightSuit, -1); + +// List<int> suitplaces = new List<int>(); + +// Dictionary<int, int> placeStars = new Dictionary<int, int>(); +// for (int i = 1; i <= 8; i++) +// { +// placeStars.Add(i, -1); +// } + +// if (itemplus.placeStars != null) +// { +// for (int i = 0; i < itemplus.placeStars.Length; i++) +// { +// placeStars[i + 1] = itemplus.placeStars[i]; +// } +// } + +// if (itemplus.suitPlaces != null && itemplus.suitLevels != null) +// { +// suitplaces.AddRange(itemplus.suitPlaces); +// suitLevels[EquipSuitType.TwoSuit] = itemplus.suitLevels[0]; +// suitLevels[EquipSuitType.FiveSuit] = itemplus.suitLevels[1]; +// suitLevels[EquipSuitType.EightSuit] = itemplus.suitLevels[2]; +// } +// else if (itemplus.Equips != null) +// { +// var stars = new List<int>(); +// for (int i = 0; i < itemplus.Equips.Length; i++) +// { +// var array = itemplus.Equips[i]; +// var config = ItemConfig.Get(array[0]); +// if (config.EquipPlace > 8) +// { +// continue; +// } +// stars.Add(array[1]); + +// placeStars[config.EquipPlace] = array[1]; + +// if (config.SuiteiD > 0) +// { +// suitplaces.Add(config.EquipPlace); +// } +// } + +// stars.Sort((int x, int y) => { return -x.CompareTo(y); }); + +// var twoSuitLevel = (suitplaces.Count > 1 && stars.Count > 1) ? stars[1] : -1; +// var fiveSuitLevel = (suitplaces.Count > 4 && stars.Count > 4) ? stars[4] : -1; +// var eightSuitLevel = (suitplaces.Count > 7 && stars.Count > 7) ? stars[7] : -1; + +// suitLevels[EquipSuitType.TwoSuit] = twoSuitLevel; +// suitLevels[EquipSuitType.FiveSuit] = fiveSuitLevel; +// suitLevels[EquipSuitType.EightSuit] = eightSuitLevel; +// } + +// ItemTipUtility.ShowCustomEquip(new ItemTipUtility.CustomEquipInfo() +// { +// itemId = itemId, +// job = itemConfig.JobLimit, +// strengthenLevel = itemplus.PlusLV, +// starLevel = itemplus.Star, +// gems = gems, +// legendProperties = legendProperties, +// score = ItemLogicUtility.Instance.GetEquipScore(itemId, useDataDict, true), +// gemHoleActiveStates = gemHoleActiveStates, +// suitLevels = suitLevels, +// suitPlaces = suitplaces, +// trainProperties = trainProperties, +// isEquiped = itemplus.Equipped == 1, +// placeStars = placeStars, +// equipSkillList = equipSkillList, +// }); +// } +// else +// { +// ItemTipUtility.Show(itemId); +// } +// } + +// public static void SendViewNotifyItem(string guid, string userdata) +// { +// s_CacheUserData = userdata; +// var pak = new CA905_tagCGQueryNotifyEquipDetailInfo(); +// pak.ItemGUID = guid; +// GameNetSystem.Instance.SendInfo(pak); +// } + +// public static void ReceivePackage(HA905_tagGCNotifyEquipDetailInfo package) +// { +// List<int[]> equips = null; +// if (package.ClassEquipCount > 0) +// { +// equips = new List<int[]>(); +// foreach (var equip in package.ClassEquipList) +// { +// equips.Add(new int[2] +// { +// (int)equip.ItemID, +// equip.Star, +// }); +// } +// } + +// ItemTipUtility.CustomItemPlus itemplus = new ItemTipUtility.CustomItemPlus() +// { +// ItemID = (int)package.ItemID, +// count = 1, +// Star = package.Star, +// PlusLV = package.PlusLV, +// EvolveLV = package.EvolveLV, +// Wash = new ItemTipUtility.CustomEquipWash() +// { +// LV = package.WashLV, +// Value = new int[3] +// { +// 0<package.WashValueList.Length?(int)package.WashValueList[0]:0, +// 1<package.WashValueList.Length?(int)package.WashValueList[1]:0, +// 2<package.WashValueList.Length?(int)package.WashValueList[2]:0, +// }, +// }, +// Equipped = 1, +// Stone = new int[4] +// { +// 0<package.StoneIDList.Length?(int)package.StoneIDList[0]:0, +// 1<package.StoneIDList.Length?(int)package.StoneIDList[1]:0, +// 2<package.StoneIDList.Length?(int)package.StoneIDList[2]:0, +// 3<package.StoneIDList.Length?(int)package.StoneIDList[3]:0, +// }, +// UserData = s_CacheUserData, +// Equips = equips == null ? null : equips.ToArray(), +// }; + +// DisplayItem((int)itemplus.ItemID, itemplus); +// } +//} diff --git a/Main/System/Message/SysNotifyMgr.cs b/Main/System/Message/SysNotifyMgr.cs index d6c6a95..849ff29 100644 --- a/Main/System/Message/SysNotifyMgr.cs +++ b/Main/System/Message/SysNotifyMgr.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System; +锘縰sing System; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; diff --git a/Main/System/Message/WordAnalysis.cs b/Main/System/Message/WordAnalysis.cs index 0144669..f2ec290 100644 --- a/Main/System/Message/WordAnalysis.cs +++ b/Main/System/Message/WordAnalysis.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System; +锘縰sing System; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; diff --git a/Main/System/Skill/FlipScroll.cs b/Main/System/Skill/FlipScroll.cs index d070ebf..5bc3342 100644 --- a/Main/System/Skill/FlipScroll.cs +++ b/Main/System/Skill/FlipScroll.cs @@ -7,312 +7,310 @@ using UnityEngine.UI; using UnityEngine.EventSystems; using System; -namespace vnxbqy.UI + +public class FlipScroll : MaskableGraphic, IBeginDragHandler, IEndDragHandler, IDragHandler { - public class FlipScroll : MaskableGraphic, IBeginDragHandler, IEndDragHandler, IDragHandler + public enum FlipDirEnum { - public enum FlipDirEnum - { - Horizon, - Vertical, + Horizon, + Vertical, + } + private int page = 0; + /// <summary> + /// 褰撳墠椤� + /// </summary> + public int Page { + get { return page; } + } + [SerializeField] + private FlipDirEnum flipType = FlipDirEnum.Horizon; + public FlipDirEnum FlipType { + get { + return flipType; } - private int page = 0; - /// <summary> - /// 褰撳墠椤� - /// </summary> - public int Page { - get { return page; } + set { + flipType = value; } - [SerializeField] - private FlipDirEnum flipType = FlipDirEnum.Horizon; - public FlipDirEnum FlipType { - get { - return flipType; + } + [SerializeField] + private bool m_Loop = false; + public bool loop { + get { + return m_Loop; + } + set { + m_Loop = value; + } + } + + [SerializeField] + private TweenType _tweenType = TweenType.Linear; + public TweenType tweenType { + get { return _tweenType; } + set { _tweenType = value; } + } + [SerializeField] + private float sensitive = 5.0f; + + public float Sensitive { + get { return sensitive; } + set { sensitive = value; } + } + [SerializeField] + public bool resetOnEnable = true; + + private bool tweening = false; + public bool IsTweening { get { return tweening; } } + [SerializeField] + private float _tweenTime = 1.0f; + public float TweenTime { + get { return _tweenTime; } + set { _tweenTime = value; } + } + + public RectTransform presentRT; + public RectTransform lastRT; + + private RectTransform presentFlipRT; + private RectTransform lastFlipRT; + + public event Action<int, RectTransform> OnRefreshData; + public event Action OnTweenCompt; + + public int pageCnt = 0; + [HideInInspector] + public bool locked = false; + + protected override void Awake() + { + base.Awake(); + if (presentRT == null || lastRT == null) return; + presentRT.SetActive(false); + lastRT.SetActive(false); + presentFlipRT = presentRT; + lastFlipRT = lastRT; + } + + protected override void OnEnable() + { + base.OnEnable(); + if (presentRT == null || lastRT == null || pageCnt == 0) return; + presentRT.SetActive(true); + lastRT.SetActive(true); + presentRT.localPosition = Vector3.zero; + if (resetOnEnable) { + switch (FlipType) { + case FlipDirEnum.Horizon: + lastRT.localPosition = rectTransform.localPosition.SetX(rectTransform.sizeDelta.x); + break; + case FlipDirEnum.Vertical: + lastRT.localPosition = rectTransform.localPosition.SetY(-rectTransform.sizeDelta.y); + break; } - set { - flipType = value; - } + page = 0; } - [SerializeField] - private bool m_Loop = false; - public bool loop { - get { - return m_Loop; - } - set { - m_Loop = value; - } - } + presentFlipRT = presentRT; + lastFlipRT = lastRT; + RefreshActive(); + } - [SerializeField] - private TweenType _tweenType = TweenType.Linear; - public TweenType tweenType { - get { return _tweenType; } - set { _tweenType = value; } - } - [SerializeField] - private float sensitive = 5.0f; + private Vector2 lastPos = Vector2.zero; + public void OnBeginDrag(PointerEventData eventData) + { + lastPos = eventData.position; + } - public float Sensitive { - get { return sensitive; } - set { sensitive = value; } - } - [SerializeField] - public bool resetOnEnable = true; - - private bool tweening = false; - public bool IsTweening { get { return tweening; } } - [SerializeField] - private float _tweenTime = 1.0f; - public float TweenTime { - get { return _tweenTime; } - set { _tweenTime = value; } - } - - public RectTransform presentRT; - public RectTransform lastRT; - - private RectTransform presentFlipRT; - private RectTransform lastFlipRT; - - public event Action<int, RectTransform> OnRefreshData; - public event Action OnTweenCompt; - - public int pageCnt = 0; - [HideInInspector] - public bool locked = false; - - protected override void Awake() - { - base.Awake(); - if (presentRT == null || lastRT == null) return; - presentRT.SetActive(false); - lastRT.SetActive(false); - presentFlipRT = presentRT; - lastFlipRT = lastRT; - } - - protected override void OnEnable() - { - base.OnEnable(); - if (presentRT == null || lastRT == null || pageCnt == 0) return; - presentRT.SetActive(true); - lastRT.SetActive(true); - presentRT.localPosition = Vector3.zero; - if (resetOnEnable) { - switch (FlipType) { - case FlipDirEnum.Horizon: - lastRT.localPosition = rectTransform.localPosition.SetX(rectTransform.sizeDelta.x); - break; - case FlipDirEnum.Vertical: - lastRT.localPosition = rectTransform.localPosition.SetY(-rectTransform.sizeDelta.y); - break; + public void OnEndDrag(PointerEventData eventData) + { + if (IsTweening || locked) return; + Vector2 nPos = lastPos - eventData.position; + switch (FlipType) { + case FlipDirEnum.Horizon: { + if (Math.Abs(nPos.x) < sensitive) return; + if (nPos.x > 0) { + FlipRight(); + } + else { + FlipLeft(); + } } + break; + case FlipDirEnum.Vertical: { + if (Math.Abs(nPos.y) < sensitive) return; + Vector3 pos = Vector3.zero; + if (nPos.y < 0) { + FlipLeft(); + } + else { + FlipRight(); + } + } + break; + } + } + + protected override void OnDisable() + { + tweening = false; + StopAllCoroutines(); + base.OnDisable(); + } + + + + + IEnumerator TweenPosition(Vector3 lPos, Vector3 nPos, Vector3 lastRtPos) + { + float time = 0; + Vector3 newPresentPos = Vector3.zero; + Vector3 newLastPos = Vector3.zero; + bool InView = false; + tweening = true; + while (time < _tweenTime) { + float per = 0; + switch (tweenType) { + case TweenType.Immediate: per = 1; break; + case TweenType.Linear: per = Linear(time / _tweenTime); break; + case TweenType.Smooth: per = Smooth(time / _tweenTime); break; + } + newPresentPos = Vector3.Lerp(lPos, nPos, per); + newLastPos = Vector3.Lerp(lastRtPos, Vector3.zero, per); + presentFlipRT.localPosition = newPresentPos; + lastFlipRT.localPosition = newLastPos; + time += Time.unscaledDeltaTime; + if (!InView) { + InView = InViewSide(); + } + if (tweenType == TweenType.Immediate) { + break; + } + yield return null; + } + tweening = false; + presentFlipRT.localPosition = nPos; + lastFlipRT.localPosition = Vector3.zero; + RectTransform temp = presentFlipRT; + presentFlipRT = lastFlipRT; + lastFlipRT = temp; + if (OnTweenCompt != null) OnTweenCompt(); + } + + public bool InViewSide() + { + switch (FlipType) { + case FlipDirEnum.Horizon: { + if (Vector3.Distance(Vector3.zero, lastFlipRT.localPosition) < lastFlipRT.sizeDelta.x + rectTransform.sizeDelta.x) { + if (OnRefreshData != null) { + lastFlipRT.SetActive(true); + OnRefreshData(page, lastFlipRT); + } + return true; + } + } + break; + case FlipDirEnum.Vertical: { + if (Vector3.Distance(Vector3.zero, lastFlipRT.localPosition) < lastFlipRT.sizeDelta.y + rectTransform.sizeDelta.y) { + if (OnRefreshData != null) { + lastFlipRT.SetActive(true); + OnRefreshData(page, lastFlipRT); + } + return true; + } + } + break; + } + return false; + } + + private float Linear(float val) + { + return Mathf.Lerp(0, 1, val); + } + + private float Smooth(float val) + { + float result = Mathf.SmoothStep(0, 1, val); + result = Mathf.Clamp(result, 0, 1); + return result; + } + + public void RefreshActive() + { + if (pageCnt == 0 || presentFlipRT == null) return; + if (OnRefreshData != null) { + presentFlipRT.SetActive(true); + OnRefreshData(page, presentFlipRT); + } + } + + public void FlipLeft() + { + if (IsTweening || pageCnt == 0) return; + Vector3 pos = Vector3.zero; + page--; + if (page < 0) { + if (loop) { + page = pageCnt - 1; + } + else { + page = 0; + return; + } + } + switch (FlipType) { + case FlipDirEnum.Horizon: { + lastFlipRT.localPosition = rectTransform.localPosition.SetX(-rectTransform.sizeDelta.x); + pos = rectTransform.localPosition.SetX(rectTransform.sizeDelta.x); + } + break; + case FlipDirEnum.Vertical: { + lastFlipRT.localPosition = rectTransform.localPosition.SetY(rectTransform.sizeDelta.y); + pos = rectTransform.localPosition.SetY(-rectTransform.sizeDelta.y); + } + break; + } + StartCoroutine(TweenPosition(presentFlipRT.localPosition, pos, lastFlipRT.localPosition)); + } + + public void FlipRight() + { + if (IsTweening || pageCnt == 0) return; + Vector3 pos = Vector3.zero; + page++; + if (page >= pageCnt) { + if (loop) { page = 0; } - presentFlipRT = presentRT; - lastFlipRT = lastRT; - RefreshActive(); - } - - private Vector2 lastPos = Vector2.zero; - public void OnBeginDrag(PointerEventData eventData) - { - lastPos = eventData.position; - } - - public void OnEndDrag(PointerEventData eventData) - { - if (IsTweening || locked) return; - Vector2 nPos = lastPos - eventData.position; - switch (FlipType) { - case FlipDirEnum.Horizon: { - if (Math.Abs(nPos.x) < sensitive) return; - if (nPos.x > 0) { - FlipRight(); - } - else { - FlipLeft(); - } - } - break; - case FlipDirEnum.Vertical: { - if (Math.Abs(nPos.y) < sensitive) return; - Vector3 pos = Vector3.zero; - if (nPos.y < 0) { - FlipLeft(); - } - else { - FlipRight(); - } - } - break; + else { + page = pageCnt - 1; + return; } } - - protected override void OnDisable() - { - tweening = false; - StopAllCoroutines(); - base.OnDisable(); - } - - - - - IEnumerator TweenPosition(Vector3 lPos, Vector3 nPos, Vector3 lastRtPos) - { - float time = 0; - Vector3 newPresentPos = Vector3.zero; - Vector3 newLastPos = Vector3.zero; - bool InView = false; - tweening = true; - while (time < _tweenTime) { - float per = 0; - switch (tweenType) { - case TweenType.Immediate: per = 1; break; - case TweenType.Linear: per = Linear(time / _tweenTime); break; - case TweenType.Smooth: per = Smooth(time / _tweenTime); break; + switch (FlipType) { + case FlipDirEnum.Horizon: { + lastFlipRT.localPosition = rectTransform.localPosition.SetX(rectTransform.sizeDelta.x); + pos = rectTransform.localPosition.SetX(-rectTransform.sizeDelta.x); } - newPresentPos = Vector3.Lerp(lPos, nPos, per); - newLastPos = Vector3.Lerp(lastRtPos, Vector3.zero, per); - presentFlipRT.localPosition = newPresentPos; - lastFlipRT.localPosition = newLastPos; - time += Time.unscaledDeltaTime; - if (!InView) { - InView = InViewSide(); + break; + case FlipDirEnum.Vertical: { + lastFlipRT.localPosition = rectTransform.localPosition.SetY(-rectTransform.sizeDelta.y); + pos = rectTransform.localPosition.SetY(rectTransform.sizeDelta.y); } - if (tweenType == TweenType.Immediate) { - break; - } - yield return null; - } - tweening = false; - presentFlipRT.localPosition = nPos; - lastFlipRT.localPosition = Vector3.zero; - RectTransform temp = presentFlipRT; - presentFlipRT = lastFlipRT; - lastFlipRT = temp; - if (OnTweenCompt != null) OnTweenCompt(); + break; } + StartCoroutine(TweenPosition(presentFlipRT.localPosition, pos, lastFlipRT.localPosition)); + } - public bool InViewSide() - { - switch (FlipType) { - case FlipDirEnum.Horizon: { - if (Vector3.Distance(Vector3.zero, lastFlipRT.localPosition) < lastFlipRT.sizeDelta.x + rectTransform.sizeDelta.x) { - if (OnRefreshData != null) { - lastFlipRT.SetActive(true); - OnRefreshData(page, lastFlipRT); - } - return true; - } - } - break; - case FlipDirEnum.Vertical: { - if (Vector3.Distance(Vector3.zero, lastFlipRT.localPosition) < lastFlipRT.sizeDelta.y + rectTransform.sizeDelta.y) { - if (OnRefreshData != null) { - lastFlipRT.SetActive(true); - OnRefreshData(page, lastFlipRT); - } - return true; - } - } - break; - } - return false; - } + public void OnDrag(PointerEventData eventData) + { - private float Linear(float val) - { - return Mathf.Lerp(0, 1, val); - } + } - private float Smooth(float val) - { - float result = Mathf.SmoothStep(0, 1, val); - result = Mathf.Clamp(result, 0, 1); - return result; - } - - public void RefreshActive() - { - if (pageCnt == 0 || presentFlipRT == null) return; - if (OnRefreshData != null) { - presentFlipRT.SetActive(true); - OnRefreshData(page, presentFlipRT); - } - } - - public void FlipLeft() - { - if (IsTweening || pageCnt == 0) return; - Vector3 pos = Vector3.zero; - page--; - if (page < 0) { - if (loop) { - page = pageCnt - 1; - } - else { - page = 0; - return; - } - } - switch (FlipType) { - case FlipDirEnum.Horizon: { - lastFlipRT.localPosition = rectTransform.localPosition.SetX(-rectTransform.sizeDelta.x); - pos = rectTransform.localPosition.SetX(rectTransform.sizeDelta.x); - } - break; - case FlipDirEnum.Vertical: { - lastFlipRT.localPosition = rectTransform.localPosition.SetY(rectTransform.sizeDelta.y); - pos = rectTransform.localPosition.SetY(-rectTransform.sizeDelta.y); - } - break; - } - StartCoroutine(TweenPosition(presentFlipRT.localPosition, pos, lastFlipRT.localPosition)); - } - - public void FlipRight() - { - if (IsTweening || pageCnt == 0) return; - Vector3 pos = Vector3.zero; - page++; - if (page >= pageCnt) { - if (loop) { - page = 0; - } - else { - page = pageCnt - 1; - return; - } - } - switch (FlipType) { - case FlipDirEnum.Horizon: { - lastFlipRT.localPosition = rectTransform.localPosition.SetX(rectTransform.sizeDelta.x); - pos = rectTransform.localPosition.SetX(-rectTransform.sizeDelta.x); - } - break; - case FlipDirEnum.Vertical: { - lastFlipRT.localPosition = rectTransform.localPosition.SetY(-rectTransform.sizeDelta.y); - pos = rectTransform.localPosition.SetY(rectTransform.sizeDelta.y); - } - break; - } - StartCoroutine(TweenPosition(presentFlipRT.localPosition, pos, lastFlipRT.localPosition)); - } - - public void OnDrag(PointerEventData eventData) - { - - } - - public enum TweenType - { - Immediate, - Linear, - Smooth, - } + public enum TweenType + { + Immediate, + Linear, + Smooth, } } diff --git a/Main/System/Skill/ScrollerUI.cs b/Main/System/Skill/ScrollerUI.cs index d561f5b..cb1b01d 100644 --- a/Main/System/Skill/ScrollerUI.cs +++ b/Main/System/Skill/ScrollerUI.cs @@ -1,11 +1,8 @@ 锘縰sing UnityEngine; -namespace EnhancedUI.EnhancedScroller +public abstract class ScrollerUI : MonoBehaviour { - public abstract class ScrollerUI : MonoBehaviour - { - public ScrollerDataType type=ScrollerDataType.Header; + public ScrollerDataType type=ScrollerDataType.Header; - public abstract void Refresh(CellView cell); - } + public abstract void Refresh(CellView cell); } diff --git a/Main/System/Sound/SoundPlayer.cs b/Main/System/Sound/SoundPlayer.cs index 977d073..6c897a2 100644 --- a/Main/System/Sound/SoundPlayer.cs +++ b/Main/System/Sound/SoundPlayer.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using UnityEngine; -using vnxbqy.UI; using System; public class SoundPlayer : MonoBehaviour diff --git a/Main/System/Sound/SoundUtility.cs b/Main/System/Sound/SoundUtility.cs index fa93058..5b75600 100644 --- a/Main/System/Sound/SoundUtility.cs +++ b/Main/System/Sound/SoundUtility.cs @@ -9,176 +9,173 @@ using System.Collections.Generic; -namespace vnxbqy.UI + +public class SoundUtility { + static DateTime lastHitAudioPlayTime = DateTime.Now; + static int hitAudioTimeInterval = 50;//姣 - public class SoundUtility + static int hitAudioPoolMax = 2; + static int hitAudioCountPool = 2; + + static Dictionary<int, List<int>> jobHitAudio = new Dictionary<int, List<int>>() { + { 1,new List<int>(){101,102,103,104} }, + { 2,new List<int>(){146,147,148,149} }, + { 3,new List<int>(){101,102,103,104} }, + }; + + public static void PlayHitAudio(AudioSource _audioSource) { - static DateTime lastHitAudioPlayTime = DateTime.Now; - static int hitAudioTimeInterval = 50;//姣 + if (_audioSource == null) + { + return; + } - static int hitAudioPoolMax = 2; - static int hitAudioCountPool = 2; + if (hitAudioCountPool < hitAudioPoolMax) + { + hitAudioCountPool = Mathf.Clamp(hitAudioCountPool + (int)((DateTime.Now - lastHitAudioPlayTime).TotalMilliseconds / hitAudioTimeInterval), 0, hitAudioPoolMax); + } - static Dictionary<int, List<int>> jobHitAudio = new Dictionary<int, List<int>>() { - { 1,new List<int>(){101,102,103,104} }, - { 2,new List<int>(){146,147,148,149} }, - { 3,new List<int>(){101,102,103,104} }, + if (hitAudioCountPool > 0) + { + var job = PlayerDatas.Instance.baseData.Job; + if (jobHitAudio.ContainsKey(job)) + { + var audios = jobHitAudio[job]; + var index = UnityEngine.Random.Range(0, audios.Count); + SoundPlayer.Instance.PlayAudio(_audioSource, audios[index]); + lastHitAudioPlayTime = DateTime.Now; + hitAudioCountPool--; + } + } + } + + static Dictionary<int, int[]> fightRoars = new Dictionary<int, int[]>() { + { 1,new int[]{ 97,98,99 } }, + { 2,new int[]{ 142,143,144 } }, }; - public static void PlayHitAudio(AudioSource _audioSource) + public static void PlayFightRoar(AudioSource _audioSource, int _job) + { + var ableIndex = UnityEngine.Random.Range(0, 3); + if (ableIndex != 1) { - if (_audioSource == null) - { - return; - } - - if (hitAudioCountPool < hitAudioPoolMax) - { - hitAudioCountPool = Mathf.Clamp(hitAudioCountPool + (int)((DateTime.Now - lastHitAudioPlayTime).TotalMilliseconds / hitAudioTimeInterval), 0, hitAudioPoolMax); - } - - if (hitAudioCountPool > 0) - { - var job = PlayerDatas.Instance.baseData.Job; - if (jobHitAudio.ContainsKey(job)) - { - var audios = jobHitAudio[job]; - var index = UnityEngine.Random.Range(0, audios.Count); - SoundPlayer.Instance.PlayAudio(_audioSource, audios[index]); - lastHitAudioPlayTime = DateTime.Now; - hitAudioCountPool--; - } - } + return; } - static Dictionary<int, int[]> fightRoars = new Dictionary<int, int[]>() { - { 1,new int[]{ 97,98,99 } }, - { 2,new int[]{ 142,143,144 } }, - }; - - public static void PlayFightRoar(AudioSource _audioSource, int _job) + int[] audioList = null; + if (fightRoars.ContainsKey(_job)) { - var ableIndex = UnityEngine.Random.Range(0, 3); - if (ableIndex != 1) - { - return; - } - - int[] audioList = null; - if (fightRoars.ContainsKey(_job)) - { - audioList = fightRoars[_job]; - } - - if (audioList == null) - { - return; - } - - var randomIndex = UnityEngine.Random.Range(0, audioList.Length); - var audio = audioList[randomIndex]; - - SoundPlayer.Instance.PlayAudio(_audioSource, audio); - + audioList = fightRoars[_job]; } - static Dictionary<int, int> deadAudios = new Dictionary<int, int>() + if (audioList == null) { - { 1,100}, - { 2,145}, - { 3,100}, - }; - - public static void PlayDeadAudio(AudioSource _audioSource, int _job) - { - SoundPlayer.Instance.PlayAudio(_audioSource, deadAudios[_job]); + return; } - static Dictionary<int, int[]> stateFootAudios = new Dictionary<int, int[]>() - { - { 1,new int[]{ 130, 131, 132,133} }, - { 2,new int[]{ 134, 135, 136, 137 } }, - { 3,new int[]{ 138, 139, 140, 141 } }, - }; + var randomIndex = UnityEngine.Random.Range(0, audioList.Length); + var audio = audioList[randomIndex]; - static Dictionary<int, int[]> rideAudios = new Dictionary<int, int[]>(); - - static FootAudioType currentState = FootAudioType.Walk; - static int audioIndex = 0; - static Dictionary<int, DateTime> stateFootAudioLastPlayTimes = new Dictionary<int, DateTime>(); - - const float overTime = 2f; - - public static void PlayFootAudio(AudioSource _audioSource, FootAudioType _state, int _horseId = 0) - { - var stateInt = (int)_state; - if (!stateFootAudios.ContainsKey(stateInt)) - { - return; - } - - if (currentState != _state) - { - audioIndex = 0; - currentState = _state; - } - - if (stateFootAudioLastPlayTimes.ContainsKey(stateInt)) - { - var lastPlayTime = stateFootAudioLastPlayTimes[stateInt]; - if ((DateTime.Now - lastPlayTime).TotalSeconds > 2f) - { - audioIndex = 0; - } - } - else - { - audioIndex = 0; - } - - int[] audios = null; - switch (stateInt) - { - case 1: - case 3: - audios = stateFootAudios[(int)_state]; - break; - // case 2: - // if (rideAudios.ContainsKey(_horseId)) - // { - // audios = rideAudios[_horseId]; - // } - // else - // { - // var config = HorseConfig.Get(_horseId); - // audios = new int[config.RideAudios.Length]; - // Array.Copy(config.RideAudios, audios, config.RideAudios.Length); - // rideAudios[_horseId] = audios; - // } - // break; - default: - break; - } - - - if (audioIndex < audios.Length) - { - var audio = audios[audioIndex]; - SoundPlayer.Instance.PlayAudio(_audioSource, audio); - stateFootAudioLastPlayTimes[stateInt] = DateTime.Now; - audioIndex++; - } - - if (audioIndex >= audios.Length) - { - audioIndex = 0; - } - } + SoundPlayer.Instance.PlayAudio(_audioSource, audio); } + static Dictionary<int, int> deadAudios = new Dictionary<int, int>() + { + { 1,100}, + { 2,145}, + { 3,100}, + }; + + public static void PlayDeadAudio(AudioSource _audioSource, int _job) + { + SoundPlayer.Instance.PlayAudio(_audioSource, deadAudios[_job]); + } + + static Dictionary<int, int[]> stateFootAudios = new Dictionary<int, int[]>() + { + { 1,new int[]{ 130, 131, 132,133} }, + { 2,new int[]{ 134, 135, 136, 137 } }, + { 3,new int[]{ 138, 139, 140, 141 } }, + }; + + static Dictionary<int, int[]> rideAudios = new Dictionary<int, int[]>(); + + static FootAudioType currentState = FootAudioType.Walk; + static int audioIndex = 0; + static Dictionary<int, DateTime> stateFootAudioLastPlayTimes = new Dictionary<int, DateTime>(); + + const float overTime = 2f; + + public static void PlayFootAudio(AudioSource _audioSource, FootAudioType _state, int _horseId = 0) + { + var stateInt = (int)_state; + if (!stateFootAudios.ContainsKey(stateInt)) + { + return; + } + + if (currentState != _state) + { + audioIndex = 0; + currentState = _state; + } + + if (stateFootAudioLastPlayTimes.ContainsKey(stateInt)) + { + var lastPlayTime = stateFootAudioLastPlayTimes[stateInt]; + if ((DateTime.Now - lastPlayTime).TotalSeconds > 2f) + { + audioIndex = 0; + } + } + else + { + audioIndex = 0; + } + + int[] audios = null; + switch (stateInt) + { + case 1: + case 3: + audios = stateFootAudios[(int)_state]; + break; + // case 2: + // if (rideAudios.ContainsKey(_horseId)) + // { + // audios = rideAudios[_horseId]; + // } + // else + // { + // var config = HorseConfig.Get(_horseId); + // audios = new int[config.RideAudios.Length]; + // Array.Copy(config.RideAudios, audios, config.RideAudios.Length); + // rideAudios[_horseId] = audios; + // } + // break; + default: + break; + } + + + if (audioIndex < audios.Length) + { + var audio = audios[audioIndex]; + SoundPlayer.Instance.PlayAudio(_audioSource, audio); + stateFootAudioLastPlayTimes[stateInt] = DateTime.Now; + audioIndex++; + } + + if (audioIndex >= audios.Length) + { + audioIndex = 0; + } + } + } + diff --git a/Main/System/SystemSetting/SystemSetting.cs b/Main/System/SystemSetting/SystemSetting.cs index eada92d..7a24e2d 100644 --- a/Main/System/SystemSetting/SystemSetting.cs +++ b/Main/System/SystemSetting/SystemSetting.cs @@ -3,7 +3,6 @@ using UnityEngine; using UnityEngine.Events; using System; -using vnxbqy.UI; using System.Collections; using Cysharp.Threading.Tasks; diff --git a/Main/System/Task/TaskManager.cs b/Main/System/Task/TaskManager.cs index 648f27b..41632ab 100644 --- a/Main/System/Task/TaskManager.cs +++ b/Main/System/Task/TaskManager.cs @@ -5,7 +5,6 @@ using LitJson; using System.Text.RegularExpressions; using System.Text; -using vnxbqy.UI; //浠诲姟淇℃伅鐨勫瓨鍌� /** 浠诲姟缁撴瀯 */ @@ -239,7 +238,6 @@ { GlobalTimeEvent.Instance.secondEvent -= secondEvent; GlobalTimeEvent.Instance.secondEvent += secondEvent; - TaskAllocation.Instance.TaskTime = TimeUtility.ServerNow; isServerPrepare = true; TaskOverBool = false; } @@ -1488,11 +1486,6 @@ // } // if (UIManager.Instance.IsOpened<MysteriousMissionWin>()) - // { - // yield break; - // } - - // if (CrossServerUtility.IsCrossServer()) // { // yield break; // } diff --git a/Main/Utility/GMCommand.cs b/Main/Utility/GMCommand.cs index a510e91..67159b3 100644 --- a/Main/Utility/GMCommand.cs +++ b/Main/Utility/GMCommand.cs @@ -1,5 +1,4 @@ 锘縰sing UnityEngine; -using vnxbqy.UI; public class GMCommand : SingletonMonobehaviour<GMCommand> { diff --git a/Main/Utility/LanguageVerify.cs b/Main/Utility/LanguageVerify.cs index 853b568..74e6a5e 100644 --- a/Main/Utility/LanguageVerify.cs +++ b/Main/Utility/LanguageVerify.cs @@ -1,5 +1,4 @@ -锘縰sing vnxbqy.UI; -using System; +锘縰sing System; using System.Collections; using System.Collections.Generic; using System.Text; diff --git a/Main/Utility/UIUtility.cs b/Main/Utility/UIUtility.cs index 224e0d7..27be3a0 100644 --- a/Main/Utility/UIUtility.cs +++ b/Main/Utility/UIUtility.cs @@ -3,7 +3,7 @@ using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; -using vnxbqy.UI; + public static class UIUtility -- Gitblit v1.8.0