1. Stuck, Having problems with creating your mod? Let us help you: Mod Support

Unsolved show App in scenario automatically.

Discussion in 'Mod Support' started by bidwars, Nov 2, 2018.

  1. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    126
    I created a app that I would like to show automatically when I send data to it. It uses almost the exact same code as the RaceLap App. The RaceLap app shows up but not my custom app for the scenario. I am using the following code to trigger the app in my lua file.

    guihooks.trigger('PlaceChange', {one = "test",two = "test2", three="test3" } )


    Here the js file that should call the scope.On call for PlaceChange.

    .directive('Place', function () {
    return {
    template:
    '<div ng-class="{\'bngApp\' : data}" style="width: 100%; height: 100%; font-size: 1.4em;" ' +
    'layout="column" layout-align="start start">' +
    '<span ng-if="data">1st {{ data.one }} </span>' +
    '<span ng-if="data">2nd {{ data.two }} </span>' +
    '<span ng-if="data">3rd {{ data.three }} </span>' +
    '</div>',
    replace: true,
    link: function (scope, element, attrs) {
    scope.data = null;
    scope.$on('PlaceChange', function (event, data) {
    if(data === null) return;
    scope.$applyAsync(function () {
    scope.data = data;
    console.log('Testing to see if we get Data');
    });
    });

    scope.$on('ScenarioNotRunning', function () {
    scope.data = null;
    });
    }
    };
    });
     
  2. bidwars

    bidwars
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    126
    Figured out that this is controlled by a file in the setting folder. The file is called uiapps-layouts.json. You have to create a new file by using the function in the apps lua file.
    ui_apps.saveLayouts(layouts)

    This is working now.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice