| | |
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | #if UNITY_EDITOR
|
| | | using UnityEditor;
|
| | | using UnityEditorInternal;
|
| | | #endif
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | [XLua.Hotfix]
|
| | |
| | | {
|
| | | [SerializeField] ScrollerController m_ActivityCtrl;
|
| | | [SerializeField] Button m_BtnClose;
|
| | | [SerializeField] Image m_TitleIcon;
|
| | | [SerializeField] List<CustomActivityDisplay> m_CustomActivitys;
|
| | | [SerializeField, HideInInspector] List<CustomActivityDisplay> m_CustomActivitys;
|
| | |
|
| | | Dictionary<int, bool> m_ActivitySpreadDict = new Dictionary<int, bool>();
|
| | |
|
| | |
| | | {
|
| | | var activityCell = cell as OpenServerActivityCell;
|
| | | var seconds = fairyLeagueModel.GetBeforeFirstLeagueTime();
|
| | | activityCell.title.text = TimeUtility.SecondsToHMS(seconds);
|
| | | activityCell.title.gameObject.SetActive(seconds > 0);
|
| | | activityCell.timer.text = TimeUtility.SecondsToHMS(seconds);
|
| | | activityCell.containerTimer.gameObject.SetActive(seconds > 0);
|
| | | }
|
| | | cell = m_ActivityCtrl.GetActiveCellView((int)OpenServerActivityCenter.OSActivityType.FairyGrabBossNotice);
|
| | | if (cell != null)
|
| | |
| | | var activityCell = cell as OpenServerActivityCell;
|
| | | var seconds = fairyGrabBossModel.GetNextSessionSeconds();
|
| | | bool isOpen = fairyGrabBossModel.IsOpen;
|
| | | activityCell.title.gameObject.SetActive(seconds > 0 || isOpen);
|
| | | activityCell.title.color = UIHelper.GetUIColor(TextColType.Green, true);
|
| | | activityCell.containerTimer.gameObject.SetActive(seconds > 0 || isOpen);
|
| | | if (seconds > 0)
|
| | | {
|
| | | activityCell.title.text = TimeUtility.SecondsToHMS(seconds);
|
| | | activityCell.timer.text = TimeUtility.SecondsToHMS(seconds);
|
| | | }
|
| | | else if (isOpen)
|
| | | {
|
| | | activityCell.title.text = Language.Get("FairyGrabBossOpened");
|
| | | activityCell.timer.text = Language.Get("FairyGrabBossOpened");
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | if (!m_ActivitySpreadDict.ContainsKey(sort) || !m_ActivitySpreadDict[sort]
|
| | | || (sort != 2 && sort != 0 && sort != 19))
|
| | | {
|
| | | height = 80;
|
| | | height = 114;
|
| | | return true;
|
| | | }
|
| | | }
|
| | |
| | | return (int)x.activityType == activityType;
|
| | | });
|
| | |
|
| | | bool customIcon = !string.IsNullOrEmpty(customActivity.titleIcon)
|
| | | || (customActivity.titleIcons != null && customActivity.titleIcons.Count > 0);
|
| | | _cell.title.color = UIHelper.GetUIColor(TextColType.NavyBrown);
|
| | |
|
| | | OperationBase operationBase;
|
| | | switch (activityType)
|
| | | {
|
| | | case 5:
|
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.MultipleExp, out operationBase))
|
| | | {
|
| | | _cell.title.text = Language.Get("ExpActivity_Text5", (operationBase as OperationMultiExp).GetMultipleCHS());
|
| | | }
|
| | | _cell.title.gameObject.SetActive(!customIcon);
|
| | | break;
|
| | | case 8:
|
| | | if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.MultipRealmPoint, out operationBase))
|
| | | {
|
| | | _cell.title.text = Language.Get("MultipleRealmPoint", Language.Get(StringUtility.Contact("Num_CHS_", (operationBase as OperationMultipleRealmPoint).multiplePractice)));
|
| | | }
|
| | | _cell.title.gameObject.SetActive(!customIcon);
|
| | | break;
|
| | | case 12:
|
| | | {
|
| | | var seconds = fairyLeagueModel.GetBeforeFirstLeagueTime();
|
| | | _cell.title.gameObject.SetActive(seconds > 0);
|
| | | _cell.containerTimer.gameObject.SetActive(seconds > 0);
|
| | | if (seconds > 0)
|
| | | {
|
| | | _cell.title.text = TimeUtility.SecondsToHMS(seconds);
|
| | | _cell.title.color = UIHelper.GetUIColor(TextColType.Green, true);
|
| | | _cell.timer.text = TimeUtility.SecondsToHMS(seconds);
|
| | | }
|
| | | }
|
| | | break;
|
| | |
| | | {
|
| | | var seconds = fairyGrabBossModel.GetNextSessionSeconds();
|
| | | bool isOpen = fairyGrabBossModel.IsOpen;
|
| | | _cell.title.gameObject.SetActive(seconds > 0 || isOpen);
|
| | | _cell.title.color = UIHelper.GetUIColor(TextColType.Green, true);
|
| | | _cell.containerTimer.gameObject.SetActive(seconds > 0 || isOpen);
|
| | | if (seconds > 0)
|
| | | {
|
| | | _cell.title.text = TimeUtility.SecondsToHMS(seconds);
|
| | | _cell.timer.text = TimeUtility.SecondsToHMS(seconds);
|
| | | }
|
| | | else if (isOpen)
|
| | | {
|
| | | _cell.title.text = Language.Get("FairyGrabBossOpened");
|
| | | _cell.timer.text = Language.Get("FairyGrabBossOpened");
|
| | | }
|
| | | }
|
| | | break;
|
| | | default:
|
| | | _cell.title.gameObject.SetActive(!customIcon);
|
| | | if (!customIcon)
|
| | | {
|
| | | _cell.title.text = Language.Get(StringUtility.Contact("OSActivityTitle_", _cell.index));
|
| | | }
|
| | | _cell.containerTimer.gameObject.SetActive(false);
|
| | | break;
|
| | | }
|
| | |
|
| | | _cell.activityType = activityType;
|
| | |
|
| | | _cell.titleImage.gameObject.SetActive(customIcon);
|
| | | _cell.titleEffect.StopImediatly();
|
| | | switch (activityType)
|
| | | {
|
| | | case 6:
|
| | | _cell.redpoint.redpointId = 20906 * 100 + extraValue;
|
| | | _cell.ChangeState(extraValue == giftModel.selectIndex && functionOrder == activityType
|
| | | ? TitleBtnState.Click : TitleBtnState.Normal);
|
| | | if (customIcon)
|
| | | {
|
| | | _cell.titleImage.SetSprite(customActivity.titleIcons[extraValue]);
|
| | | _cell.titleImage.SetNativeSize();
|
| | | }
|
| | | if (customActivity.titleEffectIds != null && extraValue < customActivity.titleEffectIds.Count)
|
| | | {
|
| | | _cell.titleEffect.effect = customActivity.titleEffectIds[extraValue];
|
| | | _cell.titleEffect.Play();
|
| | | }
|
| | | _cell.SetSelect(extraValue == giftModel.selectIndex && functionOrder == activityType);
|
| | | _cell.icon.SetSprite(StringUtility.Contact(customActivity.bottomIcon, extraValue));
|
| | | break;
|
| | | default:
|
| | | _cell.redpoint.redpointId = MainRedDot.REDPOINT_OPENSERVER * 100 + activityType;
|
| | | _cell.ChangeState(_cell.activityType == functionOrder ? TitleBtnState.Click : TitleBtnState.Normal);
|
| | | if (customIcon)
|
| | | {
|
| | | _cell.titleImage.SetSprite(customActivity.titleIcon);
|
| | | _cell.titleImage.SetNativeSize();
|
| | | }
|
| | | if (customActivity.titleEffectId != 0)
|
| | | {
|
| | | _cell.titleEffect.effect = customActivity.titleEffectId;
|
| | | _cell.titleEffect.Play();
|
| | | }
|
| | | _cell.SetSelect(_cell.activityType == functionOrder);
|
| | | _cell.icon.SetSprite(customActivity.bottomIcon);
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | case 0:
|
| | | _cell.redpoint.redpointId = ImpactRankModel.Redpoint_Key_ImpactRank * 100 + _type;
|
| | | _cell.titleTxt.text = Language.Get(StringUtility.Contact("ImpactRankType_", _type));
|
| | | _cell.ChangeState(_type == impactRankModel.presentSelectType ? TitleBtnState.Click : TitleBtnState.Normal);
|
| | | _cell.SetSelect(_type == impactRankModel.presentSelectType);
|
| | | break;
|
| | | case 2:
|
| | | _cell.redpoint.redpointId = 20902 * 100 + _type;
|
| | | _cell.titleTxt.text = Language.Get(StringUtility.Contact("OSRedEnvelopeType_", _type));
|
| | | _cell.ChangeState(_type == envelopeModel.selectType ? TitleBtnState.Click : TitleBtnState.Normal);
|
| | | _cell.SetSelect(_type == envelopeModel.selectType);
|
| | | break;
|
| | | case 19:
|
| | | _cell.redpoint.redpointId = 20919 * 100 + _type;
|
| | | _cell.titleTxt.text = Language.Get(StringUtility.Contact("FestivalRedpackType_", _type));
|
| | | _cell.ChangeState(_type == festivalRedpackModel.selectType ? TitleBtnState.Click : TitleBtnState.Normal);
|
| | | _cell.SetSelect(_type == festivalRedpackModel.selectType);
|
| | | break;
|
| | | }
|
| | | _cell.functionBtn.onClick.RemoveAllListeners();
|
| | |
| | | [Serializable]
|
| | | public struct CustomActivityDisplay
|
| | | {
|
| | | [Header("活动类型"), EnumLabel(typeof(OpenServerActivityCenter.OSActivityType))]
|
| | | public OpenServerActivityCenter.OSActivityType activityType;
|
| | | public string titleIcon;
|
| | | public int titleEffectId;
|
| | |
|
| | | public List<string> titleIcons;
|
| | | public List<int> titleEffectIds;
|
| | | public string bottomIcon;
|
| | | }
|
| | | }
|
| | |
|
| | | #if UNITY_EDITOR
|
| | | [CustomEditor(typeof(OpenServerActivityWin))]
|
| | | public class OpenServerActivityInspector : Editor
|
| | | {
|
| | | Dictionary<OpenServerActivityCenter.OSActivityType, string> activityDisplayNames
|
| | | = new Dictionary<OpenServerActivityCenter.OSActivityType, string>();
|
| | |
|
| | | ReorderableList reorderableList;
|
| | | private void OnEnable()
|
| | | {
|
| | | var prop = serializedObject.FindProperty("m_CustomActivitys");
|
| | | reorderableList = new ReorderableList(serializedObject, prop, true, true, true, true);
|
| | |
|
| | | reorderableList.elementHeight = 50;
|
| | |
|
| | | reorderableList.drawElementCallback =
|
| | | (rect, index, isActive, isFocused) =>
|
| | | {
|
| | | var element = prop.GetArrayElementAtIndex(index);
|
| | | rect.height -= 4;
|
| | | rect.y += 2;
|
| | | EditorGUI.PropertyField(rect, element);
|
| | | };
|
| | |
|
| | | reorderableList.drawElementBackgroundCallback = (rect, index, isActive, isFocused) =>
|
| | | {
|
| | | GUI.backgroundColor = Color.yellow;
|
| | | };
|
| | |
|
| | | reorderableList.drawHeaderCallback = (rect) =>
|
| | | EditorGUI.LabelField(rect, prop.displayName);
|
| | | }
|
| | |
|
| | | public override void OnInspectorGUI()
|
| | | {
|
| | | base.OnInspectorGUI();
|
| | | serializedObject.Update();
|
| | | reorderableList.DoLayoutList();
|
| | | serializedObject.ApplyModifiedProperties();
|
| | | }
|
| | | }
|
| | |
|
| | | [CustomPropertyDrawer(typeof(OpenServerActivityWin.CustomActivityDisplay))]
|
| | | public class CustomActivityDrawer : PropertyDrawer
|
| | | {
|
| | | static string[] enumDisplayNames = null;
|
| | |
|
| | | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
| | | {
|
| | | using (new EditorGUI.PropertyScope(position, label, property))
|
| | | {
|
| | | var rect = new Rect(position)
|
| | | {
|
| | | height = 20,
|
| | | };
|
| | |
|
| | | var serializedProperty = property.FindPropertyRelative("activityType");
|
| | | if (enumDisplayNames == null ||
|
| | | enumDisplayNames.Length != serializedProperty.enumNames.Length)
|
| | | {
|
| | | enumDisplayNames = new string[serializedProperty.enumNames.Length];
|
| | | var enumtype = typeof(OpenServerActivityCenter.OSActivityType);
|
| | | var index = 0;
|
| | | foreach (var enumName in serializedProperty.enumNames)
|
| | | {
|
| | | var enumfield = enumtype.GetField(enumName);
|
| | | var customAttributes = enumfield.GetCustomAttributes(typeof(HeaderAttribute), false);
|
| | | enumDisplayNames[index] = customAttributes.Length <= 0 ? enumName : ((HeaderAttribute)customAttributes[0]).header;
|
| | | index++;
|
| | | }
|
| | | }
|
| | |
|
| | | serializedProperty.enumValueIndex = EditorGUI.Popup(rect, serializedProperty.enumValueIndex, enumDisplayNames);
|
| | |
|
| | | rect = new Rect(position)
|
| | | {
|
| | | y = position.y + 20,
|
| | | height = 20,
|
| | | };
|
| | |
|
| | | serializedProperty = property.FindPropertyRelative("bottomIcon");
|
| | | serializedProperty.stringValue = EditorGUI.TextField(rect, "IconKey", serializedProperty.stringValue);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #endif
|
| | | }
|
| | |
|