UI mod - group manager

Discussion in 'Mod Discussions' started by SatanPetitCul, October 22, 2013.

  1. SatanPetitCul

    SatanPetitCul Active Member

    Messages:
    267
    Likes Received:
    197
    I would like to work on a ui mod, a group manager.

    [​IMG]

    I'm not too crazy, so i planned to start whith something basic.

    This group manager should display in the UI :
    • the groups which have been created
    • their composition (which unit, and how many)
    I would like also to have a basic interaction with the UI:
    • single click on a group => select the group
    • double click on the group => select the group and center the camera above it

    the problem is that i don't find the object to handle the groups, the units and the camera...

    Do someone know what object return the current created group ? and if this object exist what are the methods to return the units ? How can we apply a selection ? and finally how to move the camera ?
  2. Culverin

    Culverin Post Master General

    Messages:
    1,069
    Likes Received:
    582
    This is one of the more likely things Uber will build into the game.
    At least I hope it is.
    Quitch likes this.
  3. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I think a good start would be to read the whole live_game.js just to get an idea of how the whole ingame ui works.
    It definitely contains handling of some camera interaction and handling of selection events. I think it should be possible to capture what groups are created in those event handlers. Also you might be able to select the groups again if you can figure out what happens when the hotkeys for "select group" are pressed. Basically you'd need to simulate that when the button is clicked. However I am not sure if this is all possible with an ui mod right now.
  4. SatanPetitCul

    SatanPetitCul Active Member

    Messages:
    267
    Likes Received:
    197
    HTML:
    <div class="div_unit_selection_cont" data-bind="visible: showSelectionBar">
        <div>
            <div class="div_current_selection_cont">
                <!-- ko foreach: selectionList -->
                <div class="div_unit_selection" data-bind="click: function (data, event) { $parent.onSelectionDisplayClick($index(), event) }">             
                    <a href="#">
                        <img class="img_selected_unit" src="" data-bind="attr: { src: $data.icon }" style="-webkit-transform: scaleX(-1);"/>
                    </a>
                    <span class="span_selection_count" data-bind="text: $data.count"></span>
                </div>     
                <!-- /ko -->
            </div>
        </div>
    </div>
    I found the HTML part who describe the selection bar (the icons at the botom left which show the content of your selection).

    Unfortunately the following data bind still very mysterious for me.
    HTML:
    data-bind="click: function (data, event) { $parent.onSelectionDisplayClick($index(), event) }"
  5. SatanPetitCul

    SatanPetitCul Active Member

    Messages:
    267
    Likes Received:
    197
    And concerning the groups... nothing :(

    This feature should not be available into the ui. They are still handle by the engine ?
  6. Dementiurge

    Dementiurge Post Master General

    Messages:
    1,094
    Likes Received:
    693
    alpha/shared/js/api/select.js
    api.select.captureGroup(#) is directly bound to a key. It doesn't contain any unit information, though you can probably guess by looking at what units are currently selected, in the selectionViewModel in live_game.js.

    However, I don't think there's a UI event when a unit dies, so I don't know how you would clean those lists of the units that have died since the group was created.
  7. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I am not an expert on knockout, but I think that basically says: when the element is clicked call onSelectionDisplayClick and pass it the index of the clicked item. So search for onSelectionDisplayClick in the live_game.js?
  8. SatanPetitCul

    SatanPetitCul Active Member

    Messages:
    267
    Likes Received:
    197
    I clearly don't have the skills for this job. The UI stuff were ok, i achieved to figured out what i was doing, but here i have to admit everything looks like chinese for me :)
    Maybe i'll try back later but i don't have enough time now.

Share This Page