////////////////////////////////////////////////////////////////////////////
            ////////////////////////////////////////////////////////////////////////////

            /// <summary>
            /// On start
            /// </summary>
            void Start()
            {
                string l_View = "";

                l_View += "<bg>";
                l_View += " <modal show-event='show-delete-confirmation-modal' hide-event='hide-delete-confirmation-modal' size-delta-x='80' size-delta-y='40' click-off-closes='true'>";
                l_View += "  <vertical>";
                l_View += "   <vertical child-align='UpperCenter' preferred-width='80' preferred-height='26' pad='4'>";
                l_View += "    <text id='delete-confirmation-text' font-size='3.6' font-align='Center' overflow-mode='Overflow' word-wrapping='true' />";
                l_View += "   </vertical>";
                l_View += "   <horizontal preferred-width='80' preferred-height='12' spacing='6' pad-bottom='4' pad-left='4' pad-right='4'> ";
                l_View += "    <button text='Delete' font-size='3.4' stroke-color='#FF5555' preferred-width='30' on-click='confirm-delete-button-clicked' />";
                l_View += "    <button text='Cancel' font-size='3.4' preferred-width='30' click-event='hide-delete-confirmation-modal' />";
                l_View += "   </horizontal>";
                l_View += "  </vertical>";
                l_View += " </modal>";
                l_View += " <icon-button id='delete-button' icon='BeatSaberPlus.Plugins.GameTweaker.Resources.Delete.png' active='false' size-delta-x='7.25' size-delta-y='4.4' on-click='delete-button-clicked' pad='2' />";
                l_View += "</bg>";

                m_ParserParams = BSMLParser.instance.Parse(l_View, standardLevelDetailView.gameObject, this);

                var l_ActionButtons = standardLevelDetailView.transform.Find("ActionButtons");

                if (l_ActionButtons != null && l_ActionButtons)
                {
                    m_DeleteButton.transform.SetParent(l_ActionButtons, false);
                    m_DeleteButton.gameObject.SetActive(true);
                }
            }
Ejemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// On activation
        /// </summary>
        /// <param name="p_FirstActivation">Is the first activation ?</param>
        /// <param name="p_AddedToHierarchy">Activation type</param>
        /// <param name="p_ScreenSystemEnabling">Is screen system enabled</param>
        protected override sealed void DidActivate(bool p_FirstActivation, bool p_AddedToHierarchy, bool p_ScreenSystemEnabling)
        {
            /// Forward event
            base.DidActivate(p_FirstActivation, p_AddedToHierarchy, p_ScreenSystemEnabling);

            /// Bind singleton
            Instance = this as T;

            if (p_FirstActivation)
            {
                var l_UICode = GetViewContentDescription();

                /// Add loading modal & message modal code
                if (true)
                {
                    var l_Closure = l_UICode.LastIndexOf('<');
                    var l_NewCode = l_UICode.Substring(0, l_Closure);

                    l_NewCode += "<modal id='SDK_MessageModal' show-event='SDK_ShowMessageModal' hide-event='SDK_CloseMessageModal,CloseAllModals' move-to-center='true' size-delta-y='30' size-delta-x='85'>";
                    l_NewCode += "  <vertical pad='0'>";
                    l_NewCode += "    <text text='' id='SDK_MessageModal_Text' font-size='4' align='Center'/>";
                    l_NewCode += "    <primary-button text='Ok' click-event='SDK_CloseMessageModal'></primary-button>";
                    l_NewCode += "  </vertical>";
                    l_NewCode += "</modal>";

                    l_NewCode += "<modal id='SDK_ConfirmModal' show-event='SDK_ShowConfirmModal' hide-event='SDK_CloseConfirmModal,CloseAllModals' move-to-center='true' size-delta-y='30' size-delta-x='85'>";
                    l_NewCode += "  <vertical pad='0'>";
                    l_NewCode += "    <text id='SDK_ConfirmModal_Text' text=' ' font-size='4' align='Center'/>";
                    l_NewCode += "    <horizontal>";
                    l_NewCode += "      <primary-button text='Yes' id='SDK_ConfirmModal_Button'></primary-button>";
                    l_NewCode += "      <button text='No' click-event='SDK_CloseConfirmModal'></button>";
                    l_NewCode += "    </horizontal>";
                    l_NewCode += "  </vertical>";
                    l_NewCode += "</modal>";

                    l_NewCode += "<modal id='SDK_LoadingModal' show-event='SDK_ShowLoadingModal' hide-event='SDK_CloseLoadingModal,CloseAllModals' move-to-center='true' size-delta-y='30' size-delta-x='48'>";
                    l_NewCode += "    <text id='SDK_LoadingModal_Text' font-size='5.5' align='Center'/>";
                    l_NewCode += "</modal>";
                    l_NewCode += l_UICode.Substring(l_Closure);

                    l_UICode = l_NewCode;
                }

                /// Construct UI
                m_ParserParams = BSMLParser.instance.Parse(l_UICode, gameObject, this as T);

                /// Change state
                UICreated = true;

                /// Setup loading modal
                SDK.UI.ModalView.SetupLoadingControl(m_SDK_LoadingModal, out m_LoadingModal_Spinner);
                SDK.UI.ModalView.SetOpacity(m_SDK_MessageModal, 0.75f);
                SDK.UI.ModalView.SetOpacity(m_SDK_ConfirmModal, 0.75f);
                SDK.UI.ModalView.SetOpacity(m_SDK_LoadingModal, 0.75f);

                /// bind events
                m_SDK_ConfirmModal_Button.onClick.RemoveAllListeners();
                m_SDK_ConfirmModal_Button.onClick.AddListener(OnSDKConfirmModal);

                /// Call implementation
                OnViewCreation();
            }

            /// Call implementation
            OnViewActivation();
        }