Перейти к публикации
Поиск в
  • Дополнительно...
Искать результаты, содержащие...
Искать результаты в...
  • Нужна помощь?

    Создайте тему в соответствующем разделе
    Не нужно писать всё в чат!
  • Загляните на торговую площадку

    Там вы можете купить
    всё что касается игровых серверов
  • Не хотите бан?

    Пожалуйста, ознакомьтесь с нашими правилами
    Не нарушайте порядок!
  • Продаёте или покупаете?

    Пользуйтесь услугами гаранта
    Мы сделаем вашу сделку безопасной

День добрый, нужна помощь в создании кастом меню для двух серверов. Для одного получилось сделать. А вот что бы 2 кнопки было не выходит.

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Рекомендованные сообщения

  • 0

там ничего сложного. в лайоте верстку добавляешь 2ю кнопку а потом в конифе дублируешь m_Play как то так. 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах





  • 0
11.07.2022 в 22:34, PsevdoGigant сказал:

там ничего сложного. в лайоте верстку добавляешь 2ю кнопку а потом в конифе дублируешь m_Play как то так. 

Может поможешь, за вознаграждение?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0
10.08.2022 в 11:26, Skif054 сказал:

Может поможешь, за вознаграждение?

так а ты верстку умеешь делать хотя бы? с кодом помогу

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0
12.08.2022 в 00:04, PsevdoGigant сказал:

так а ты верстку умеешь делать хотя бы? с кодом помогу

я делал с помощью мода mainmenu

main_menu.layout

FrameWidgetClass main_menu_root {
 visible 1
 ignorepointer 1
 position 0 0
 size 1 1
 halign center_ref
 valign center_ref
 hexactpos 1
 vexactpos 1
 hexactsize 0
 vexactsize 0
 priority 951
 {
  WrapSpacerWidgetClass play_panel_root {
   visible 1
   ignorepointer 1
   position 83.461 211.041
   size 560 400
   halign right_ref
   valign bottom_ref
   hexactpos 1
   vexactpos 1
   hexactsize 1
   vexactsize 1
   priority 3
   Padding 0
   Margin 0
   content_halign center
   content_valign bottom
   {
    WrapSpacerWidgetClass bottom {
     visible 1
     color 0 0 0 0.549
     position 0 0
     size 1 90
     halign center_ref
     valign bottom_ref
     hexactpos 1
     vexactpos 1
     hexactsize 0
     vexactsize 1
     style DayZDefaultPanel
     "no focus" 0
     "next left" "news_main"
     "next right" "news_main"
     "next up" ""
     "next down" "exit_button"
     Padding 0
     Margin 0
     "Size To Content H" 1
     "Size To Content V" 1
     {
      ButtonWidgetClass play {
       color 0 0 0 0
       position 0 0
       size 1 90
       halign center_ref
       valign bottom_ref
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 1
       style Empty
       "no focus" 0
       "next left" "news_main"
       "next right" "news_main"
       "next up" "choose_server"
       "next down" "play_video"
       {
        PanelWidgetClass play_panel {
         ignorepointer 1
         color 0 0 0 0
         position 0 0
         size 1 1
         hexactpos 0
         vexactpos 0
         hexactsize 0
         vexactsize 0
         style DayZDefaultPanel
         {
          TextWidgetClass play_label {
           clipchildren 0
           ignorepointer 1
           size 1 0.65
           halign center_ref
           valign center_ref
           hexactpos 1
           vexactpos 1
           hexactsize 0
           vexactsize 0
           text "Play Sunrise"
           font "gui/fonts/sdf_MetronLight42"
           "text halign" center
           "text valign" center
          }
         }
        }
       }
      }
     }
    }
    WrapSpacerWidgetClass bottom2 {
     visible 1
     color 0 0 0 0.549
     position 0 0
     size 1 90
     halign center_ref
     valign bottom_ref
     hexactpos 1
     vexactpos 1
     hexactsize 0
     vexactsize 1
     style DayZDefaultPanel
     "no focus" 0
     "next left" "news_main"
     "next right" "news_main"
     "next up" ""
     "next down" "exit_button"
     Padding 0
     Margin 0
     "Size To Content H" 1
     "Size To Content V" 1
     {
      ButtonWidgetClass play2 {
       color 0 0 0 0
       position 0 0
       size 1 90
       halign center_ref
       valign bottom_ref
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 1
       style Empty
       "no focus" 0
       "next left" "news_main"
       "next right" "news_main"
       "next up" "choose_server"
       "next down" "play_video"
       {
        PanelWidgetClass play_panel2 {
         ignorepointer 1
         color 0 0 0 0
         position 0 0
         size 1 1
         hexactpos 0
         vexactpos 0
         hexactsize 0
         vexactsize 0
         style DayZDefaultPanel
         {
          TextWidgetClass play_labe2 {
           clipchildren 0
           ignorepointer 1
           size 1 0.65
           halign center_ref
           valign center_ref
           hexactpos 1
           vexactpos 1
           hexactsize 0
           vexactsize 0
           text "Play Sunrise DM"
           font "gui/fonts/sdf_MetronLight42"
           "text halign" center
           "text valign" center
          }
         }
        }
       }
      }
     }
    }
    PanelWidgetClass play_panel_separator {
     ignorepointer 1
     color 0.7843 0 0 1
     position 10 10
     size 1 2
     hexactpos 1
     vexactpos 1
     hexactsize 0
     vexactsize 1
     style rover_sim_colorable
    }
    WrapSpacerWidgetClass top {
     ignorepointer 1
     color 0 0 0 0.549
     position 0 0
     size 1 48
     hexactpos 1
     vexactpos 1
     hexactsize 0
     vexactsize 1
     style DayZDefaultPanelSides
     "no focus" 1
     Padding 0
     Margin 0
     "Size To Content V" 1
     {
      FrameWidgetClass separator_top {
       ignorepointer 1
       position 10 10
       size 1 5
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 1
      }
      PanelWidgetClass character {
       visible 1
       ignorepointer 0
       position 0 0
       size 1 38
       halign center_ref
       valign bottom_ref
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 1
       style blank
       {
        TextWidgetClass character_name_text {
         clipchildren 0
         inheritalpha 1
         ignorepointer 1
         size 1 0.55
         halign center_ref
         valign center_ref
         hexactpos 1
         vexactpos 1
         hexactsize 0
         vexactsize 0
         font "gui/fonts/sdf_MetronLight24"
         "exact text" 0
         "text halign" center
         "text valign" center
        }
       }
      }
      ButtonWidgetClass customize_character {
       visible 1
       color 0 0 0 1
       position 0 0
       size 1 38
       halign center_ref
       valign bottom_ref
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 1
       style Default
       "no focus" 0
       "next left" ""
       "next right" ""
       "next up" "tutorials"
       "next down" "choose_server"
       {
        PanelWidgetClass customize_character_panel {
         ignorepointer 1
         color 0 0 0 0
         position 0 0
         size 1 1
         hexactpos 0
         vexactpos 0
         hexactsize 0
         vexactsize 0
         style DayZDefaultPanel
         {
          TextWidgetClass customize_character_label {
           ignorepointer 1
           size 1 22
           halign center_ref
           valign center_ref
           hexactpos 0
           vexactpos 0
           hexactsize 0
           vexactsize 1
           text "Change Character"
           font "gui/fonts/sdf_MetronLight24"
           "text halign" center
           "text valign" center
          }
         }
        }
       }
      }
      FrameWidgetClass separator_down {
       visible 1
       ignorepointer 1
       position 10 10
       size 1 7
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 1
      }
     }
    }
   }
  }
  FrameWidgetClass settings_panel_root {
   ignorepointer 1
   position 100 80
   size 260 40
   halign right_ref
   hexactpos 1
   vexactpos 1
   hexactsize 1
   vexactsize 1
   priority 3
   {
    ButtonWidgetClass settings_button {
     color 1 1 1 0
     position 0.25 0
     size 37 37
     halign right_ref
     valign center_ref
     hexactpos 0
     vexactpos 1
     hexactsize 1
     vexactsize 1
     fixaspect inside
     style Empty
     "no focus" 0
     "next left" "news_main"
     "next right" "exit_button"
     "next up" "play"
     "next down" "customize_character"
     font "gui/fonts/sdf_MetronLight24"
     switch normal
     {
      ImageWidgetClass settings_button_image {
       ignorepointer 1
       size 1 1
       halign center_ref
       valign center_ref
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 0
       image0 "set:dayz_gui image:settings"
       mode blend
       "src alpha" 1
      }
     }
    }
    ButtonWidgetClass exit_button {
     color 1 1 1 0
     size 37 37
     halign right_ref
     valign center_ref
     hexactpos 0
     vexactpos 1
     hexactsize 1
     vexactsize 1
     fixaspect inside
     style Empty
     "no focus" 0
     "next left" "settings_button"
     "next right" "play"
     "next up" "play"
     "next down" "customize_character"
     font "gui/fonts/sdf_MetronLight24"
     switch normal
     {
      ImageWidgetClass exit_button_image {
       ignorepointer 1
       size 1 1
       halign center_ref
       valign center_ref
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 0
       image0 "set:dayz_gui image:exit"
       mode blend
       "src alpha" 1
      }
     }
    }
   }
  }
  FrameWidgetClass social_panel_root {
   ignorepointer 1
   position 100 80
   size 560 200
   halign left_ref
   valign bottom_ref
   hexactpos 1
   vexactpos 1
   hexactsize 1
   vexactsize 1
   priority 3
   {
    ButtonWidgetClass custom_button1 {
     color 1 1 1 0
     position 0.25 0
     size 100 100
     halign left_ref
     valign center_ref
     hexactpos 0
     vexactpos 1
     hexactsize 1
     vexactsize 1
     fixaspect inside
     style Empty
     "no focus" 0
     font "gui/fonts/sdf_MetronLight24"
     switch normal
     {
      ImageWidgetClass custom_button1_image {
       ignorepointer 1
       size 1 1
       halign center_ref
       valign center_ref
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 0
       image0 "MainMenu/gui/imagesets/vk.edds"
       mode blend
       "src alpha" 1
       stretch 1
      }
     }
    }
    ButtonWidgetClass custom_button2 {
     color 1 1 1 0
     size 100 100
     halign left_ref
     valign center_ref
     hexactpos 0
     vexactpos 1
     hexactsize 1
     vexactsize 1
     fixaspect inside
     style Empty
     "no focus" 0
     "next right" "vk_button"
     font "gui/fonts/sdf_MetronLight24"
     switch normal
     {
      ImageWidgetClass custom_button2_image {
       ignorepointer 1
       size 1 1
       halign center_ref
       valign center_ref
       hexactpos 1
       vexactpos 1
       hexactsize 0
       vexactsize 0
       image0 "MainMenu/gui/imagesets/discord.edds"
       mode blend
       "src alpha" 1
       stretch 1
      }
     }
    }
   }
  }
  ImageWidgetClass dayz_logo {
   visible 1
   ignorepointer 1
   position 100 78
   size 600 330
   hexactpos 1
   vexactpos 1
   hexactsize 1
   vexactsize 1
   priority 2
   image0 "MainMenu/gui/imagesets/F_logo.edds"
   mode blend
   "src alpha" 1
   stretch 1
  }
  FrameWidgetClass character_rotation_frame {
   size 0.3 1
   halign center_ref
   valign center_ref
   hexactpos 1
   vexactpos 1
   hexactsize 0
   vexactsize 0
   priority 2
  }
  WrapSpacerWidgetClass Licensing {
   clipchildren 0
   position 100 0.062
   size 0.45 30
   valign bottom_ref
   hexactpos 1
   vexactpos 0
   hexactsize 0
   vexactsize 1
   priority 5
   Padding 8
   Margin 0
   "Size To Content H" 1
   "Size To Content V" 1
   content_valign center
   {
    TextWidgetClass version {
     visible 1
     clipchildren 0
     ignorepointer 1
     position 80 60
     size 1 0.5
     valign bottom_ref
     hexactpos 1
     vexactpos 1
     hexactsize 0
     vexactsize 0
     priority 2
     text "Modded main menu Sunrise"
     font "gui/fonts/sdf_MetronLight24"
     "exact text" 0
     "text valign" center
    }
   }
  }
 }
}

вторая кнопка в WORKBENCH отображается
А вот как в скрипте код прописать не понимаю

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0

@Skif054 кнопку то в лайауте ты сделал, а в скрипты дописать не надо?

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0
16.08.2022 в 16:59, paulmanz сказал:

@Skif054 кнопку то в лайауте ты сделал, а в скрипты дописать не надо?

 

так в этом и беда, не получается) сервер при запуске начинает ругаться. Поэтому и прошу помощи

Изменено пользователем Skif054 (история изменений)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0
53 минуты назад, Skif054 сказал:

так в этом и беда, не получается) сервер при запуске начинает ругаться. Поэтому и прошу помощи

на что?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0
6 минут назад, 123new сказал:

на что?

что ошибка в скрипте

//All modification was created by editing original DayZ mainmenu class
modded class MainMenu
{
	protected Widget				custom_button1;
	protected Widget				custom_button2;

	override Widget Init()
	{
		layoutRoot = GetGame().GetWorkspace().CreateWidgets( "MainMenu/gui/main_menu.layout" ); // Don't forget to change the path if you've changed the name of the folder or have replaced script into your modpack
		
		m_Play						= layoutRoot.FindAnyWidget( "play" );
		m_Play2						= layoutRoot.FindAnyWidget( "play2" );
		m_CustomizeCharacter		= layoutRoot.FindAnyWidget( "customize_character" );
		m_SettingsButton			= layoutRoot.FindAnyWidget( "settings_button" );
		m_Exit						= layoutRoot.FindAnyWidget( "exit_button" );

		custom_button1				= layoutRoot.FindAnyWidget( "custom_button1" );
		custom_button2				= layoutRoot.FindAnyWidget( "custom_button2" );

		m_Version					= TextWidget.Cast( layoutRoot.FindAnyWidget( "version" ) );
		m_CharacterRotationFrame	= layoutRoot.FindAnyWidget( "character_rotation_frame" );
		m_Mission					= MissionMainMenu.Cast( GetGame().GetMission() );
		m_LastFocusedButton			= m_Play;
		m_ScenePC					= m_Mission.GetIntroScenePC();
		
		if( m_ScenePC )
		{
			m_ScenePC.ResetIntroCamera();
		}
		
		m_PlayerName				= TextWidget.Cast( layoutRoot.FindAnyWidget("character_name_text") );
		
		m_Version.SetText( "Modded main menu Sunrise" ); //I'll appreciate if you leave this text for credits
		
		GetGame().GetUIManager().ScreenFadeOut(0);

		SetFocus( null );
		
		Refresh();
		
		GetDayZGame().GetBacklit().MainMenu_OnShow();
	
		g_Game.SetLoadState( DayZLoadState.MAIN_MENU_CONTROLLER_SELECT );
		
		return layoutRoot;
	}
	
	override bool OnClick( Widget w, int x, int y, int button )
	{
		if( button == MouseState.LEFT )
		{
			if( w == m_Play )
			{
				//ConnectFromServerBrowser is the dayz function allows to connect any server
				m_LastFocusedButton = m_Play;
				g_Game.ConnectFromServerBrowser( "0.0.0.0", 2362, "" ); // place YOUR IP and Port here
				return true;
			}

			if( w == m_Play2 )
			{
				//ConnectFromServerBrowser is the dayz function allows to connect any server
				m_LastFocusedButton = m_Play2;
				g_Game.ConnectFromServerBrowser( "0.0.0.0", 2342, "" ); // place YOUR IP and Port here
				return true;
			}
			
			else if ( w == m_CustomizeCharacter )
			{
				OpenMenuCustomizeCharacter();
				return true;
			}
			else if ( w == m_SettingsButton )
			{
				OpenSettings();
				return true;
			}
			else if ( w == m_Exit )
			{
				Exit();
				return true;
			}
			else if ( w == custom_button1 )
			{
				GetGame().OpenURL("https://vk.com/sunrisevanilla"); //Replace my links to yours. Opens any URL Page in browser
				return true;
			}
			else if ( w == custom_button2 )
			{
				GetGame().OpenURL("https://discord.gg/yP6aSDuRCE"); //Replace my links to yours. Opens any URL Page in browser
				return true;
			}			
		}
		return false;
	}
	
	bool IsFocusable( Widget w )
	{
		if( w )
		{
			if( w == m_Play ||w == m_Play2 || w == m_CustomizeCharacter || w == m_SettingsButton || w == m_Exit || w == custom_button1 || w == custom_button2 );
			{
				return true;
			}
		}
		return false;
	}

	override void LoadMods()
	{
		return;
	}
	
	/*override void Refresh()
	{
		string name;
		
		if( m_ScenePC )
		{
			OnChangeCharacter();
		}		
		
		m_Version.SetText( "Modded main menu Sunrise" ); //I'll appreciate if you leave this text for credits
	}	

	override void OnShow()
	{
		SetFocus( null );
		OnChangeCharacter();
		return;
	}	*/
	override void Play()
	{
		return;
	}

	override bool OnMouseButtonDown( Widget w, int x, int y, int button )
	{
		return false;
	}
}

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0
12 минут назад, Skif054 сказал:

что ошибка в скрипте

//All modification was created by editing original DayZ mainmenu class modded class MainMenu { protected Widget custom_button1; protected Widget custom_button2; override Widget Init() { layoutRoot = GetGame().GetWorkspace().CreateWidgets( "MainMenu/gui/main_menu.layout" ); // Don't forget to change the path if you've changed the name of the folder or have replaced script into your modpack m_Play = layoutRoot.FindAnyWidget( "play" ); m_Play2 = layoutRoot.FindAnyWidget( "play2" ); m_CustomizeCharacter = layoutRoot.FindAnyWidget( "customize_character" ); m_SettingsButton = layoutRoot.FindAnyWidget( "settings_button" ); m_Exit = layoutRoot.FindAnyWidget( "exit_button" ); custom_button1 = layoutRoot.FindAnyWidget( "custom_button1" ); custom_button2 = layoutRoot.FindAnyWidget( "custom_button2" ); m_Version = TextWidget.Cast( layoutRoot.FindAnyWidget( "version" ) ); m_CharacterRotationFrame = layoutRoot.FindAnyWidget( "character_rotation_frame" ); m_Mission = MissionMainMenu.Cast( GetGame().GetMission() ); m_LastFocusedButton = m_Play; m_ScenePC = m_Mission.GetIntroScenePC(); if( m_ScenePC ) { m_ScenePC.ResetIntroCamera(); } m_PlayerName = TextWidget.Cast( layoutRoot.FindAnyWidget("character_name_text") ); m_Version.SetText( "Modded main menu Sunrise" ); //I'll appreciate if you leave this text for credits GetGame().GetUIManager().ScreenFadeOut(0); SetFocus( null ); Refresh(); GetDayZGame().GetBacklit().MainMenu_OnShow(); g_Game.SetLoadState( DayZLoadState.MAIN_MENU_CONTROLLER_SELECT ); return layoutRoot; } override bool OnClick( Widget w, int x, int y, int button ) { if( button == MouseState.LEFT ) { if( w == m_Play ) { //ConnectFromServerBrowser is the dayz function allows to connect any server m_LastFocusedButton = m_Play; g_Game.ConnectFromServerBrowser( "0.0.0.0", 2362, "" ); // place YOUR IP and Port here return true; } if( w == m_Play2 ) { //ConnectFromServerBrowser is the dayz function allows to connect any server m_LastFocusedButton = m_Play2; g_Game.ConnectFromServerBrowser( "0.0.0.0", 2342, "" ); // place YOUR IP and Port here return true; } else if ( w == m_CustomizeCharacter ) { OpenMenuCustomizeCharacter(); return true; } else if ( w == m_SettingsButton ) { OpenSettings(); return true; } else if ( w == m_Exit ) { Exit(); return true; } else if ( w == custom_button1 ) { GetGame().OpenURL("https://vk.com/sunrisevanilla"); //Replace my links to yours. Opens any URL Page in browser return true; } else if ( w == custom_button2 ) { GetGame().OpenURL("https://discord.gg/yP6aSDuRCE"); //Replace my links to yours. Opens any URL Page in browser return true; } } return false; } bool IsFocusable( Widget w ) { if( w ) { if( w == m_Play ||w == m_Play2 || w == m_CustomizeCharacter || w == m_SettingsButton || w == m_Exit || w == custom_button1 || w == custom_button2 ); { return true; } } return false; } override void LoadMods() { return; } /*override void Refresh() { string name; if( m_ScenePC ) { OnChangeCharacter(); } m_Version.SetText( "Modded main menu Sunrise" ); //I'll appreciate if you leave this text for credits } override void OnShow() { SetFocus( null ); OnChangeCharacter(); return; } */ override void Play() { return; } override bool OnMouseButtonDown( Widget w, int x, int y, int button ) { return false; } }


//All modification was created by editing original DayZ mainmenu class
modded class MainMenu
{
	protected Widget				custom_button1;
	protected Widget				custom_button2;

	override Widget Init()
	{
		layoutRoot = GetGame().GetWorkspace().CreateWidgets( "MainMenu/gui/main_menu.layout" ); // Don't forget to change the path if you've changed the name of the folder or have replaced script into your modpack
		
		m_Play						= layoutRoot.FindAnyWidget( "play" );
		m_Play2						= layoutRoot.FindAnyWidget( "play2" );
		m_CustomizeCharacter		= layoutRoot.FindAnyWidget( "customize_character" );
		m_SettingsButton			= layoutRoot.FindAnyWidget( "settings_button" );
		m_Exit						= layoutRoot.FindAnyWidget( "exit_button" );

		custom_button1				= layoutRoot.FindAnyWidget( "custom_button1" );
		custom_button2				= layoutRoot.FindAnyWidget( "custom_button2" );

		m_Version					= TextWidget.Cast( layoutRoot.FindAnyWidget( "version" ) );
		m_CharacterRotationFrame	= layoutRoot.FindAnyWidget( "character_rotation_frame" );
		m_Mission					= MissionMainMenu.Cast( GetGame().GetMission() );
		m_LastFocusedButton			= m_Play;
		m_ScenePC					= m_Mission.GetIntroScenePC();
		
		if( m_ScenePC )
		{
			m_ScenePC.ResetIntroCamera();
		}
		
		m_PlayerName				= TextWidget.Cast( layoutRoot.FindAnyWidget("character_name_text") );
		
		m_Version.SetText( "Modded main menu Sunrise" ); //I'll appreciate if you leave this text for credits
		
		GetGame().GetUIManager().ScreenFadeOut(0);

		SetFocus( null );
		
		Refresh();
		
		GetDayZGame().GetBacklit().MainMenu_OnShow();
	
		g_Game.SetLoadState( DayZLoadState.MAIN_MENU_CONTROLLER_SELECT );
		
		return layoutRoot;
	}
	
	override bool OnClick( Widget w, int x, int y, int button )
	{
		if( button == MouseState.LEFT )
		{
			if( w == m_Play )
			{
				//ConnectFromServerBrowser is the dayz function allows to connect any server
				m_LastFocusedButton = m_Play;
				g_Game.ConnectFromServerBrowser( "0.0.0.0", 2362, "" ); // place YOUR IP and Port here
				return true;
			}

			if( w == m_Play2 )
			{
				//ConnectFromServerBrowser is the dayz function allows to connect any server
				m_LastFocusedButton = m_Play2;
				g_Game.ConnectFromServerBrowser( "0.0.0.0", 2342, "" ); // place YOUR IP and Port here
				return true;
			}
			
			else if ( w == m_CustomizeCharacter )
			{
				OpenMenuCustomizeCharacter();
				return true;
			}
			else if ( w == m_SettingsButton )
			{
				OpenSettings();
				return true;
			}
			else if ( w == m_Exit )
			{
				Exit();
				return true;
			}
			else if ( w == custom_button1 )
			{
				GetGame().OpenURL("https://vk.com/sunrisevanilla"); //Replace my links to yours. Opens any URL Page in browser
				return true;
			}
			else if ( w == custom_button2 )
			{
				GetGame().OpenURL("https://discord.gg/yP6aSDuRCE"); //Replace my links to yours. Opens any URL Page in browser
				return true;
			}			
		}
		return false;
	}
	
	bool IsFocusable( Widget w )
	{
		if( w )
		{
			if( w == m_Play ||w == m_Play2 || w == m_CustomizeCharacter || w == m_SettingsButton || w == m_Exit || w == custom_button1 || w == custom_button2 );
			{
				return true;
			}
		}
		return false;
	}

	override void LoadMods()
	{
		return;
	}
	
	/*override void Refresh()
	{
		string name;
		
		if( m_ScenePC )
		{
			OnChangeCharacter();
		}		
		
		m_Version.SetText( "Modded main menu Sunrise" ); //I'll appreciate if you leave this text for credits
	}	

	override void OnShow()
	{
		SetFocus( null );
		OnChangeCharacter();
		return;
	}	*/
	override void Play()
	{
		return;
	}

	override bool OnMouseButtonDown( Widget w, int x, int y, int button )
	{
		return false;
	}
}

 

//All modification was created by editing original DayZ mainmenu class
modded class MainMenu
{
	protected Widget				custom_button1;
	protected Widget				custom_button2;
	protected Widget				m_Play2;

	override Widget Init()
	{
		layoutRoot = GetGame().GetWorkspace().CreateWidgets( "MainMenu/gui/main_menu.layout" ); // Don't forget to change the path if you've changed the name of the folder or have replaced script into your modpack
		
		m_Play						= layoutRoot.FindAnyWidget( "play" );
		m_Play2						= layoutRoot.FindAnyWidget( "play2" );
		m_CustomizeCharacter		= layoutRoot.FindAnyWidget( "customize_character" );
		m_SettingsButton			= layoutRoot.FindAnyWidget( "settings_button" );
		m_Exit						= layoutRoot.FindAnyWidget( "exit_button" );

		custom_button1				= layoutRoot.FindAnyWidget( "custom_button1" );
		custom_button2				= layoutRoot.FindAnyWidget( "custom_button2" );

		m_Version					= TextWidget.Cast( layoutRoot.FindAnyWidget( "version" ) );
		m_CharacterRotationFrame	= layoutRoot.FindAnyWidget( "character_rotation_frame" );
		m_Mission					= MissionMainMenu.Cast( GetGame().GetMission() );
		m_LastFocusedButton			= m_Play;
		m_ScenePC					= m_Mission.GetIntroScenePC();
		
		if( m_ScenePC )
		{
			m_ScenePC.ResetIntroCamera();
		}
		
		m_PlayerName				= TextWidget.Cast( layoutRoot.FindAnyWidget("character_name_text") );
		
		m_Version.SetText( "Modded main menu Sunrise" ); //I'll appreciate if you leave this text for credits
		
		GetGame().GetUIManager().ScreenFadeOut(0);

		SetFocus( null );
		
		Refresh();
		
		GetDayZGame().GetBacklit().MainMenu_OnShow();
	
		g_Game.SetLoadState( DayZLoadState.MAIN_MENU_CONTROLLER_SELECT );
		
		return layoutRoot;
	}
	
	override bool OnClick( Widget w, int x, int y, int button )
	{
		if( button == MouseState.LEFT )
		{
			if( w == m_Play )
			{
				//ConnectFromServerBrowser is the dayz function allows to connect any server
				m_LastFocusedButton = m_Play;
				g_Game.ConnectFromServerBrowser( "0.0.0.0", 2362, "" ); // place YOUR IP and Port here
				return true;
			}

			if( w == m_Play2 )
			{
				//ConnectFromServerBrowser is the dayz function allows to connect any server
				m_LastFocusedButton = m_Play2;
				g_Game.ConnectFromServerBrowser( "0.0.0.0", 2342, "" ); // place YOUR IP and Port here
				return true;
			}
			
			else if ( w == m_CustomizeCharacter )
			{
				OpenMenuCustomizeCharacter();
				return true;
			}
			else if ( w == m_SettingsButton )
			{
				OpenSettings();
				return true;
			}
			else if ( w == m_Exit )
			{
				Exit();
				return true;
			}
			else if ( w == custom_button1 )
			{
				GetGame().OpenURL("https://vk.com/sunrisevanilla"); //Replace my links to yours. Opens any URL Page in browser
				return true;
			}
			else if ( w == custom_button2 )
			{
				GetGame().OpenURL("https://discord.gg/yP6aSDuRCE"); //Replace my links to yours. Opens any URL Page in browser
				return true;
			}			
		}
		return false;
	}
	
	bool IsFocusable( Widget w )
	{
		if( w )
		{
			if( w == m_Play ||w == m_Play2 || w == m_CustomizeCharacter || w == m_SettingsButton || w == m_Exit || w == custom_button1 || w == custom_button2 );
			{
				return true;
			}
		}
		return false;
	}

	override void LoadMods()
	{
		return;
	}
	
	/*override void Refresh()
	{
		string name;
		
		if( m_ScenePC )
		{
			OnChangeCharacter();
		}		
		
		m_Version.SetText( "Modded main menu Sunrise" ); //I'll appreciate if you leave this text for credits
	}	

	override void OnShow()
	{
		SetFocus( null );
		OnChangeCharacter();
		return;
	}	*/
	override void Play()
	{
		return;
	}

	override bool OnMouseButtonDown( Widget w, int x, int y, int button )
	{
		return false;
	}
}

если не работает - скрин ошибки или крашлог

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0

Спасибо! помогло)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
  • 0

А может кто подскажет как добавить кнопку " Сменить сервер"?

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас

×
×
  • Создать...

Важная информация

Используя этот сайт, вы автоматически обязуетесь соблюдать наши Правила и Политика конфиденциальности.
Чтобы сделать этот веб-сайт лучше, мы разместили cookies на вашем устройстве. Вы можете изменить свои настройки cookies, в противном случае мы будем считать, что вы согласны с этим.