Help - Search - Members - Calendar
Full Version: Monster Code Snippet Thread
Scenyx Entertainment Community > Xbox1 Forums > Dashboard Forums > Official Team UIX Forums > User.Interface.X (UIX) Code
Little-G
ok, lots of goodies in here. i doubt anyone will read this but i still enjoy playing with the dash....

for proper BGMESH in any and every menu of the dash with a fully functional config option (improved code robbed from commemorative wink.gif :

IPB Image

start by opening your default.xap / default.xip

and right at the top underneath "DEF theXboxNetwork XboxNetwork" add :

CODE
DEF theBGMesh Layer
{
    viewpoint Viewpoint
    {
        fieldOfView 1.2
        position -500 0 0
    }

    children
    [
        DEF theBGMeshTransform Transform
        {
            children
            [
                DEF theBGMeshInline Inline
                {
                    preload true
                    url "bg_mesh/default.xap"
/*
                    function onLoad()
                    {
                        LoadBGMeshValues();
                    }
*/
                }
            ]
        }
    ]
}


then search for
CODE
ApplyDashStyle();

and paste
CODE
LoadBGMeshValues();
underneath

finally at the end of default.xap add

CODE
///////////////////////////////////////////DNA//////////////////////////////////////

function LoadBGMeshValues()
{
    var IniFile = new Settings;
    IniFile.SetIniSection( "BGMesh" );
    var c = theBGMeshInline.children[0];

    ///dna spinner
    var x = IniFile.GetIniValue( "BGMesh1-rpm" );
    var y = IniFile.GetIniValue( "BGMesh2-rpm" );
    var z = IniFile.GetIniValue( "BGMesh3-rpm" );
    //if((x == "") | (y == "") | (z == "")) { x = 2; y = 2; z = 2; }
    if((x == "") & (y == "") & (z == "")) { x = 2; y = 2; z = 2; }
    c.theDNA1.children[0].rpm = x;
    c.theDNA3.children[0].rpm = y;
    c.theDNA5.children[0].rpm = z;

    ///mesh and alpha
    var theDNA = IniFile.GetIniValue( "BGMesh" );
        var DNAAlpha = IniFile.GetIniValue( "Alpha" );

    if (theDNA == "chains")
    {
        c.DNA1_Mesh.url = "chain.xm";
        c.DNA3_Mesh.url = "chain.xm";
        c.DNA5_Mesh.url = "chain.xm";
        c.theDNA1.SetTranslation(-5400, 0, -5100);
        c.theDNA3.SetTranslation(0, 0, -5000);
        c.theDNA5.SetTranslation(4000, 0, -5100);
        c.theDNA1.SetAlpha(DNAAlpha);
        c.theDNA3.SetAlpha(DNAAlpha);
        c.theDNA5.SetAlpha(DNAAlpha);
    }
    
    else if (theDNA == "spirals")
    {
        c.DNA1_Mesh.url = "spirals.xm";
        c.DNA3_Mesh.url = "spirals.xm";
        c.DNA5_Mesh.url = "spirals.xm";
        c.theDNA1.SetAlpha(DNAAlpha);
        c.theDNA3.SetAlpha(DNAAlpha);
        c.theDNA5.SetAlpha(DNAAlpha);
    }

    else if (theDNA == "off")
    {
        c.theDNA1.SetAlpha(0);
        c.theDNA3.SetAlpha(0);
        c.theDNA5.SetAlpha(0);
    }

    else if (theDNA == "dna")
    {
        c.DNA1_Mesh.url = "Backing_dna.xm";
        c.DNA3_Mesh.url = "Backing_dna.xm";
        c.DNA5_Mesh.url = "Backing_dna.xm";
        c.DNAString1_Mesh.url = "Backing_dna_SIDES.xm";
        c.DNAString3_Mesh.url = "Backing_dna_SIDES.xm";
        c.DNAString5_Mesh.url = "Backing_dna_SIDES.xm";
        c.theDNA1.SetAlpha(DNAAlpha);
        c.theDNA3.SetAlpha(DNAAlpha);
        c.theDNA5.SetAlpha(DNAAlpha);
    }

    else if (theDNA == "squigles")
    {
        c.DNA1_Mesh.url = "Backing_squigles.xm";
        c.DNA3_Mesh.url = "Backing_squigles.xm";
        c.DNA5_Mesh.url = "Backing_squigles.xm";
        c.DNAString1_Mesh.url = "Backing_squigles_sides.xm";
        c.DNAString3_Mesh.url = "Backing_squigles_sides.xm";
        c.DNAString5_Mesh.url = "Backing_squigles_sides.xm";
        c.theDNA1.SetAlpha(DNAAlpha);
        c.theDNA3.SetAlpha(DNAAlpha);
        c.theDNA5.SetAlpha(DNAAlpha);
    }

    else if (theDNA == "corkscrews")
    {
        c.DNA1_Mesh.url = "corkscrews.xm";
        c.DNA3_Mesh.url = "corkscrews.xm";
        c.DNA5_Mesh.url = "corkscrews.xm";
        c.theDNA1.SetAlpha(DNAAlpha);
        c.theDNA3.SetAlpha(DNAAlpha);
        c.theDNA5.SetAlpha(DNAAlpha);
    }

    IniFile.CloseIniFile();
}

///////////////////////////////////////////DNA END//////////////////////////////////


now for default.xip / config.xip

search for
CODE
BuildMainList()


and add this to the function
CODE
    configList[i] = "BG Mesh:";
    configValues[i] = "c-BGMesh-BGMesh";
    configSelect[i] = "ToggleBGMesh()";
    i = i + 1;
    configList[i] = "BG Mesh Alpha:";
    configValues[i] = "c-BGMesh-Alpha";
    configSelect[i] = "ConfigKeyB()";
    i = i + 1;
    configList[i] = "Mesh 1 Rpm:";
    configValues[i] = "c-BGMesh-BGMesh1 rpm";
    configSelect[i] = "ConfigKeyB()";
    i = i + 1;
    configList[i] = "Mesh 2 Rpm:";
    configValues[i] = "c-BGMesh-BGMesh2 rpm";
    configSelect[i] = "ConfigKeyB()";
    i = i + 1;
    configList[i] = "Mesh 3 Rpm:";
    configValues[i] = "c-BGMesh-BGMesh3 rpm";
    configSelect[i] = "ConfigKeyB()";
    i = i + 1;


then at the very bottom of config.xap add
CODE
function ToggleBGMesh()
{
    var c = theConfigPanel.children[0].children[0];
    var b = c.theRightSlots.children[LV2Item].children[0].geometry.text;
    if(b.toLowerCase() == "chains") { RefreshMenu("spirals"); }
    else if(b.toLowerCase() == "off") { RefreshMenu("dna"); }
    else if(b.toLowerCase() == "dna") { RefreshMenu("chains"); }
    else if(b.toLowerCase() == "chains") { RefreshMenu("spirals"); }
    else if(b.toLowerCase() == "spirals") { RefreshMenu("squigles"); }
    else if(b.toLowerCase() == "squigles") { RefreshMenu("corkscrews"); }
    else if(b.toLowerCase() == "corkscrews") { RefreshMenu("off"); }
}


then you will need to create a xip file called "bg_mesh.xip"

save this as "default.xap" and add it to the .xip file along with "backing_dna.xm" "backing_dna_sides.xm" "backing_squiggles.xm" "backing_squiggles_sides.xm" "chain.xm" "corkscrews.xm" and "spirals.xm"

CODE
DEF theDNAwaver Transform
{
children
[


DEF theDNA1 Transform
{

children
[
Spinner
                {
                  rpm 0
                  axis 0 1 0
                  children
                  [

DEF DNA1 Transform
                {
                    children
                    [
                        Shape
                        {
                            appearance Appearance
                            {
                                material MaxMaterial
                                {
                                    name "MenuCell"
                                }
                            }
                            geometry DEF DNA1_Mesh Mesh { url "" }
                        }
                    ]

translation 0 0 0
                }

DEF DNAString1 Transform
                {
                    children
                    [
                        Shape
                        {
                            appearance Appearance
                            {
                                material MaxMaterial
                                {
                                    name "FlatSrfc/PodParts"
                                }
                            }
                            geometry DEF DNAString1_Mesh Mesh { url "" }
                        }
                    ]
translation 0 0 0

                }
]
}
]
scale 8 8 8
rotation 0 0 .5 0.1745330
translation -3900 0 -5100
}


DEF theDNA3 Transform
{
children
[

Spinner
                {
                  rpm 0
                  axis 0 1 0
                  children
                  [

DEF DNA3 Transform
                {
                    children
                    [
                        Shape
                        {
                            appearance Appearance
                            {
                                material MaxMaterial
                                {
                                    name "MenuCell"
                                }
                            }
                            geometry DEF DNA3_Mesh Mesh { url "" }
                        }
                    ]

translation 0 0 0
                }

DEF DNAString3 Transform
                {
                    children
                    [


                        Shape
                        {
                            appearance Appearance
                            {
                                material MaxMaterial
                                {
                                    name "FlatSrfc/PodParts"
                                }
                            }
                            geometry DEF DNAString3_Mesh Mesh { url "" }
                        }


                    ]
translation 0 0 0

                }
]
                        }


]
scale 9 9 9
rotation 0 0 1 -.523599
translation 0 0 -5000
}



DEF theDNA5 Transform
{
children
[
Spinner
                {
                  rpm 0
                  axis 0 1 0
                  children
                  [

DEF DNA5 Transform
                {
                    children
                    [
                        Shape
                        {
                            appearance Appearance
                            {
                                material MaxMaterial
                                {
                                    name "MenuCell"
                                }
                            }
                            geometry DEF DNA5_Mesh Mesh { url "" }
                        }
                    ]

translation 0 0 0
                }

DEF DNAString5 Transform
                {
                    children
                    [
                        Shape
                        {
                            appearance Appearance
                            {
                                material MaxMaterial
                                {
                                    name "FlatSrfc/PodParts"
                                }
                            }
                            geometry DEF DNAString5_Mesh Mesh { url "" }
                        }
                    ]
translation 0 0 0

                }
]
}

]
scale 8 8 8
rotation 0 0 .3 -0.1745330
translation 3000 0 -5100
}



]
}


and finally in uix.ini add
CODE
[BGMesh]
BGMesh=off
BGMesh1 rpm=2
BGMesh2 rpm=2
BGMesh3 rpm=2
Alpha=0.75


and you're done!

Who's for a working settings style menu? ohmy.gif ( again 99% of code from commemorative, i just finished it )

IPB Image

you'll want to save this as "settinngs_style_menu.xap" inside default.xip

CODE

var CurrentMenuItem;
var NumberOfMenuItems;
var CurrentMenuButton;
var ScrollPlaceHolder;
var TotalMenuItems;
var CurrentTitleName;
var theTextures;
var theMenuName;

DEF theGlobal Transform
{
    visible false
    children
      [
          Shape
          {
              appearance Appearance { material Material {  } }
              geometry DEF theCellWallMesh Mesh
          }
      ]
      scale 0 0 0
      translation 500 0 0
}

function GetCellWallType()
{
    var IniFile = new Settings;
    IniFile.SetIniSection( "Dashboard Settings" );
    var a = IniFile.GetIniValue( "Current Skin" );
    theCellWallMesh.url = "A:/skins/" + a + "/cellwall.xm";
}

function initialize() { GetCellWallType(); }

function UpdateSettingsStyleMenu()
{
    var x = theSettingsStyleMenu.children[0].children[0];

    var tempID = theGamesMenu.GetTitleID( CurrentMenuItem );
    var strIconPath = "E:\\UDATA\\" + tempID + "\\TitleImage.xbx";

         if( tempID != "NULL" ) { x.theIcons.children[0].appearance.texture.url = strIconPath; }
    else if( tempID == "NULL" ) { x.theIcons.children[0].appearance.texture.url = "xbox4.xbx"; }
    else if( tempID == "" ) { x.theIcons.children[0].appearance.texture.url = "xboxlogo.xbx"; }

    x.movearrow_up.visible = false;
    x.movearrow_dn.visible = false;
    x.movearrow_up.children[0].appearance.material.name = "NavType";
    x.movearrow_dn.children[0].appearance.material.name = "NavType";

    if (ScrollPlaceHolder > 0)
        x.movearrow_up.visible = true;
    if (ScrollPlaceHolder + NumberOfMenuItems < TotalMenuItems)
        x.movearrow_dn.visible = true;

    for (var i = 0; i < NumberOfMenuItems; i = i + 1)
    {
        if(i == CurrentMenuButton)
        {
            x.MenuButtons.children[i].children[0].appearance.material.name = "GameHilite";
            x.MenuButtons.children[i].children[0].appearance.texture.url = "GameHilite_01.xbx";
            x.MenuText.children[i].children[0].appearance.material.name = "Material #133";
            if(i == 0)
                x.movearrow_up.children[0].appearance.material.name = "Material #133";
            else if(i == 5)
                x.movearrow_dn.children[0].appearance.material.name = "Material #133";
        }
        else
        {
            x.MenuButtons.children[i].children[0].appearance.material.name = "GameHilite";
            x.MenuButtons.children[i].children[0].appearance.texture.url = "outline.xbx";
            x.MenuText.children[i].children[0].appearance.material.name = "NavType";
        }

        if(TotalMenuItems > i)
        {
            x.MenuText.children[i].children[0].geometry.text = theGamesMenu.GetTitleName(ScrollPlaceHolder + i);
        }
    }
    x.metaPanel.children[0].geometry.text = theGamesMenu.GetTitleName(CurrentMenuItem);
}

function StartSettingsStyleMenu()
{
    TotalMenuItems = theGamesMenu.titleCount;
    CurrentMenuItem = 0;
    NumberOfMenuItems = 6;
    CurrentMenuButton = 0;
    ScrollPlaceHolder = 0;
    //theMenuName = theGamesMenu.GetMenuName();
    var x = theSettingsStyleMenu.children[0].children[0];
    x.S_Home_text_games.children[0].geometry.text = theGamesMenu.GetMenuName();
    
    if(TotalMenuItems == 4)
    {
        x.S_Home_menubutton_07.visible = false;
        x.S_Home_text_05.visible = false;

        x.S_Home_menubutton_06.visible = false;
        x.S_Home_text_06.visible = false;
    }
    else if(TotalMenuItems == 5)
    {
        x.S_Home_menubutton_07.visible = true;
        x.S_Home_text_05.visible = true;

        x.S_Home_menubutton_06.visible = false;
        x.S_Home_text_06.visible = false;
    }
    else
    {
        x.S_Home_menubutton_07.visible = true;
        x.S_Home_text_05.visible = true;

        x.S_Home_menubutton_06.visible = true;
        x.S_Home_text_06.visible = true;
    }

    UpdateSettingsStyleMenu();
}

DEF theSettingsStyleMenu Level
{
    archive "settings.xip"

    children
    [
        Inline
    {
                url "settings/default3.xap"

                function onLoad()
                {
            children[0].ClockIcon.visible = false;
            children[0].GlobeIcon.visible = false;
            children[0].StereoIcon.visible = false;
            children[0].MonoIcon.visible = false;
            children[0].FullscreenIcon.visible = false;
            children[0].LetterboxIcon.visible = false;
            children[0].WidescreenIcon.visible = false;
            children[0].LockIcon.visible = false;
            children[0].AutoOffIcon.visible = false;
            children[0].ConsoleIcon.visible = false;
            StartSettingsStyleMenu();
                }
    }
    ]
    shell Transform
    {
        scale 150 150 150
        translation 123.2 1.041 -190.3
        children
        [
            Waver
            {
                rpm 1.75
                children
                [
                    Shape
                    {
                        appearance Appearance
                        {
                            material MaxMaterial
                            {
                                name "InnerWall_01"
                            }
                            texture ImageTexture
                            {
                                alpha true
                                url "shell.xbx"
                            }
                        }
                        geometry USE theCellWallMesh
                    }
                    Shape
                    {
                        appearance Appearance
                        {
                            material MaxMaterial
                            {
                                name "InnerWall_02"
                            }
                        }
                        geometry Sphere
                        {
                            radius 1
                        }
                    }

                ]
            }
        ]
    }


    path Viewpoint
    {
    fieldOfView 1.275000
    orientation 0.130300 -0.991400 -0.007829 -0.121100
    position 123.300003 -0.918000 -151.600006
        jump false
    }

    control DEF theSettingsStyleMenuJoy Joystick
    {
        function OnADown()
        {
          PlaySoundA();
          theSettingsStyleMenu.children[0].children[0].MU_select_pod_HL.children[0].appearance.material.param = 1;
        theGamesMenu.LaunchTitle(CurrentMenuItem);
        }
    function OnBDown()
    {
        PlaySoundB();
                theSettingsSubMenuOut.Play();    
            theMainMenu.GoBackTo();
    }
        function OnLeftThumbMoveUp()
    {
        if (CurrentMenuItem == 0)
        {
            return;
        }
        else
        {
            PlaySoundMenuChange();
            //CurrentMenuItem = CurrentMenuItem - 1;
                    if (CurrentMenuButton == 0)
                    {
                        ScrollPlaceHolder = ScrollPlaceHolder - 1;
                    }
                    else
                    {
                        CurrentMenuButton = CurrentMenuButton - 1;
                    }
            CurrentMenuItem = CurrentMenuItem - 1;
            UpdateSettingsStyleMenu();
        }
    }
        function OnLeftThumbMoveDown()
    {
        if (CurrentMenuItem == TotalMenuItems - 1)
        {
            return;
        }
        else
        {
            PlaySoundMenuChange();
            //CurrentMenuItem = CurrentMenuItem + 1;
            if (CurrentMenuButton == ( NumberOfMenuItems - 1 ) )
                    {
                        ScrollPlaceHolder = ScrollPlaceHolder + 1;
                    }
                    else
                    {
                       CurrentMenuButton = CurrentMenuButton + 1;
                   }
            CurrentMenuItem = CurrentMenuItem + 1;
            UpdateSettingsStyleMenu();
        }
    }
    }
    function OnActivate()
    {
    StartSettingsStyleMenu();
    }
}


and then save this as "default3.xap" and add it to settings.xip

CODE
DEF orb_and_arm Transform
{
    children
    [
        DEF S_Home_podsocket_outer Transform
        {
            children
            [
                Shape
                {
                    appearance Appearance
                    {
                        material MaxMaterial
                        {
                            name "FlatSrfc/PodParts"
                        }
                    }
                    geometry DEF S_Home_podsocket_outer-FACES Mesh { url "S_Home_podsocket_outer-FACES.xm" }
                }
            ]
            rotation 0.862900 -0.357400 0.357400 -1.718000
            scale 0.448500 0.448500 0.448500
            scaleOrientation -0.904900 0.000000 -0.425600 -0.286900
            translation -12.850000 -4.989000 -10.460000
        }
        DEF S_Home_Arm_02 Transform
        {
            children
            [
                Shape
                {
                    appearance Appearance
                    {
                        material MaxMaterial
                        {
                            name "Cell_Light"
                        }
                    }
                    geometry DEF S_Home_Arm_02-FACES Mesh { url "S_Home_Arm_02-FACES.xm" }
                }
            ]
            rotation 0.000000 1.000000 0.000000 -0.881400
            scale 1.330000 1.000000 1.000000
            scaleOrientation 0.000000 -1.000000 0.000000 -0.253100
            translation -6.863000 -9.317000 -5.357000
        }
        DEF S_Home_Arm_01 Transform
        {
            children
            [
                Shape
                {
                    appearance Appearance
                    {
                        material MaxMaterial
                        {
                            name "Cell_Light"
                        }
                    }
                    geometry DEF S_Home_Arm_01-FACES Mesh { url "S_Home_Arm_01-FACES.xm" }
                }
            ]
            rotation 0.000000 1.000000 0.000000 -0.881400
            scale 1.330000 1.000000 1.000000
            scaleOrientation 0.000000 -1.000000 0.000000 -0.253100
            translation -6.863000 -7.967000 -5.357000
        }
        DEF S_Home_tube_attachment_03 Transform
        {
            children
            [
                DEF S_Home_GameModule_142 Transform
                {
                    children
                    [
                        Shape
                        {
                            appearance Appearance
                            {
                                material MaxMaterial
Little-G
to save stupidly large posts.... http://pastebin.com/f53390490

and finally add "MEM_L2_sc_pod_icon-FACES.xm" from music_play_edit.xip to settings.xip.

--------------

to toggle whether background images are on or off read on:

replace
CODE
DEF theBackground
with
CODE
DEF theBackground Group
{
    children
    [
        DEF background0 Background{ skyColor 0 0 0  }
        DEF background1 Background{ skyColor 0 0 0 backdrop ImageTexture { url "background.xbx" }}
    ]
}

function LoadBackground()
{
    var IniFile = new Settings;
    IniFile.SetIniSection( "Backgrounds" );
    var a = IniFile.GetIniValue( "On" );
    IniFile.CloseIniFile();
    if( a == "true" )
        {
            theBackground.children[0].isBound = false;
            theBackground.children[1].isBound = true;
        }
        else if( a == "false" )
        {  
            theBackground.children[0].isBound = true;
            theBackground.children[1].isBound = false;
        }
}


then search for
CODE
ApplyDashStyle();
and add
CODE
LoadBackground();
beneath.

then in default.xip / config.xap add [/code]
CODE
    configList[i] = "Enable Backgrounds:";
    configValues[i] = "c-Backgrounds-On";
    configSelect[i] = "ToggleTF()";
    i = i + 1;[code]
to
CODE
BuildMainList()


and finally in uix.ini add
CODE
[Backgrounds]
On = True"


--------------

this will toggle the amount of floating in the dash and submenus, to simply on or off.....

in default.xip / default.xap search for
CODE
function ApplyDashStyle()
and just after the first bracket of the function add
CODE
WaverCheck();
then comment out all of the instances of
CODE
theScreen.MotionStart();
below.

then add
CODE
function WaverCheck()
{    
    var IniFile = new Settings;
    IniFile.SetIniSection( "Dash Waver" );
    var a = IniFile.GetIniValue( "On" );
    IniFile.CloseIniFile();
    
    if( a == "true" ) { theScreen.MotionStart(); }
    else if( a == "false" ) { theScreen.MotionStop(); }
}
to the bottom of the .xap

next is config.xap, and you'll need to add
CODE
    configList[i] = "Floating Dash:";
    configValues[i] = "c-Dash Waver-On";
    configSelect[i] = "ToggleTF()";
    i = i + 1;


and finally in uix.ini add
CODE
[Dash Waver]
On = true


see http://forums.xbox-scene.com/index.php?showtopic=634001 for how to get the Music_play_ediit_with_subs working and have the old dropdown menus
edwardar
Ok, hope someone reads this. I've decided to reinstall UIX as my default dash, because it looks so great and reminds me of the original!


I love the look of the games menu above, and made the modification to the files as explained, but it hasn't changed the menu in UIX.

Is there some way I have to alter UIX to "activate" this menu, or is that built in to the code above already?

Thanks,

Ted
Mattie
I haven't worked with it for a while, but do try clearing the cache first
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.