Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Tip : GUIPanel
- {
- void OnConstruct() override
- {
- SetPosition( 417, 263 );
- }
- void OnDraw() override
- {
- GUIObject@ obj = GUI_GetFocusedObject();
- if( obj is null )
- return;
- int param = -1;
- #define CHECK_PARAM_PARENT #( className ) if( param == -1 && cast< className >( obj.Parent ) !is null ) param = cast< className >( obj.Parent ).Param
- //#define CHECK_PARENT #( className, p ) if( param == -1 && cast< className >( obj.Parent ) !is null ) param = p
- CHECK_PARAM_PARENT( BaseStat );
- CHECK_PARAM_PARENT( HealthStat );
- CHECK_PARAM_PARENT( ExtendedStat );
- CHECK_PARAM_PARENT( TraitLeft );
- CHECK_PARAM_PARENT( TraitRight );
- CHECK_PARAM_PARENT( Skill );
- if( param != -1 && CurTip != param )
- {
- CurTip = param;
- FindText( "Name" ).Text = MSG_GAME( STR_PARAM_NAME( param ) );
- FindText( "Desc" ).Text = FormatFormulas( MSG_GAME( STR_PARAM_DESC( param ) ) );
- FindText( "Math" ).Text = FormatFormulas( MSG_GAME( STR_PARAM_MATH( param ) ) );
- //FindPanel( "Image" ).SetBackgroundImage( GetConstantName( CONSTANTS_PICTURE, param ) );
- string@ image = MSG_GAME( STR_PARAM_PIC( param ) );
- GUIPanel@ uiImage = FindPanel( "Image" );
- if(image != "error"){
- uint width = uiImage.get_Width();
- uiImage.SetBackgroundImage(image);
- uiImage.SetActive(true);
- if(width < 1) uiImage.SetSize(0,0);
- }else{
- uiImage.SetActive(false);
- }
- }
- }
- }
- class Image : GUIPanel
- {
- void OnConstruct() override
- {
- SetPosition( 172, 45 );
- SetSize( 120, 135 );
- }
- }
- class Name : GUIText
- {
- void OnConstruct() override
- {
- SetPosition( 13, 12 );
- SetSize( 230, 30 );
- SetTextFont( FONT_THIN );
- SetTextColor( COLOR_SAND );
- }
- }
- class Desc : GUIText
- {
- void OnConstruct() override
- {
- SetPosition( 13, 45 );
- SetSize( 160, 134 );
- }
- }
- class Math : GUIText
- {
- void OnConstruct() override
- {
- SetActive( false );
- SetPosition( 13, 45 );
- SetSize( 160, 134 );
- }
- }
- class Switch : GUICheckBox
- {
- void OnConstruct() override
- {
- SetPosition( 251, 19 );
- SetSize( 16, 12 );
- SetPressedImage( "art/intrface/greenDot.png" );
- }
- void OnCheckedChanged() override
- {
- if( IsChecked ){
- Parent.Find("Desc").SetActive(false);
- Parent.Find("Math").SetActive(true);
- }else{
- Parent.Find("Desc").SetActive(true);
- Parent.Find("Math").SetActive(false);
- }
- PlaySound ("click10.ogg");
- }
- }
- class ImgSwitch : GUICheckBox
- {
- void OnConstruct() override
- {
- SetPosition( 274, 19 );
- SetSize( 16, 12 );
- SetPressedImage( "art/intrface/yellowDot.png" );
- }
- void OnCheckedChanged() override
- {
- if( IsChecked ){
- Parent.Find("Desc").SetSize(280, 134);
- Parent.Find("Math").SetSize(280, 134);
- Parent.Find("Image").SetSize(0,0);
- }else{
- Parent.Find("Desc").SetSize(160, 134);
- Parent.Find("Math").SetSize(160, 134);
- Parent.Find("Image").SetSize(120, 135);
- }
- PlaySound ("click10.ogg");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement