Skip to content

Commit

Permalink
Adding main menu window to configure extensions load order.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck committed Jul 10, 2023
1 parent a8f3230 commit 034efb6
Show file tree
Hide file tree
Showing 21 changed files with 528 additions and 97 deletions.
132 changes: 66 additions & 66 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: build-and-test

on:
push:
branches: [ "main", "dev" ]
branches: ["main", "dev"]
pull_request:
branches: [ "main", "dev" ]
branches: ["main", "dev"]

jobs:
test:
Expand All @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: "npm"

- run: npm ci
- run: npm run setup
Expand All @@ -45,20 +45,20 @@ jobs:
node-version: [19.x]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- run: npm ci
- run: npm run setup
- run: npm run typecheck
- run: npm run lint
- run: npm ci
- run: npm run setup
- run: npm run typecheck
- run: npm run lint

build:
runs-on: ubuntu-latest
Expand All @@ -68,61 +68,61 @@ jobs:
node-version: [19.x]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm ci
- run: npm run setup
- run: npm run pack:mod

- name: Install zip
uses: montudor/action-zip@v1

- name: Move build statics
run: |
mv target/xrf_build.log target/mod_package/xrf_build.log
mv target/README.md target/mod_package/README.md
- name: Archive build artifacts
working-directory: target/mod_package
run: zip -qq -r gamedata.release.zip gamedata/ bin/ xrf_build.log README.md

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: gamedata-release
path: target/mod_package/gamedata.release.zip
retention-days: 1
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- run: npm ci
- run: npm run setup
- run: npm run pack:mod

- name: Install zip
uses: montudor/action-zip@v1

- name: Move build statics
run: |
mv target/xrf_build.log target/mod_package/xrf_build.log
mv target/README.md target/mod_package/README.md
- name: Archive build artifacts
working-directory: target/mod_package
run: zip -qq -r gamedata.release.zip gamedata/ bin/ xrf_build.log README.md

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: gamedata-release
path: target/mod_package/gamedata.release.zip
retention-days: 1

upload-nightly:
if: ${{ github.ref_name == 'dev' && github.event_name != 'pull_request' }}
needs: [test, check, build]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@master
with:
name: gamedata-release

- name: Update nightly tag
uses: EndBug/latest-tag@latest
if: github.ref_name == 'dev'
id: update-nightly-tag
with:
ref: nightly

- name: Publish nightly gamedata build
if: ${{ steps.update-nightly-tag.outcome == 'success' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload --clobber nightly gamedata.release.zip
- uses: actions/checkout@v3

- uses: actions/download-artifact@master
with:
name: gamedata-release

- name: Update nightly tag
uses: EndBug/latest-tag@latest
if: github.ref_name == 'dev'
id: update-nightly-tag
with:
ref: nightly

- name: Publish nightly gamedata build
if: ${{ steps.update-nightly-tag.outcome == 'success' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload --clobber nightly gamedata.release.zip
5 changes: 1 addition & 4 deletions cli/build/tsconfig.scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"../../src/engine/lib",
"../../src/engine/scripts",
"../../src/engine/extensions",
"../../src/extensions",
],
"exclude": [
"../../**/*.test.ts"
Expand All @@ -22,9 +21,7 @@
"luaTarget": "JIT",
"noImplicitGlobalVariables": true,
"noImplicitSelf": true,
"noResolvePaths": [
"xray16"
],
"noResolvePaths": ["xray16"],
"luaPlugins": [
{ "name": "./plugins/transform_luabind_class/plugin.ts" },
{ "name": "./plugins/global_declarations_transform.ts" },
Expand Down
6 changes: 2 additions & 4 deletions cli/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"available_locales": ["ukr", "eng", "pol", "rus"],
"resources": {
"mod_assets_base_folder": "..\\src\\resources\\",
"mod_assets_override_folders": [
"..\\..\\stalker-xrf-resources-extended"
],
"mod_assets_override_folders": ["..\\..\\stalker-xrf-resources-extended"],
"mod_assets_locales": {
"eng": ["..\\..\\stalker-xrf-resources-locale-eng"],
"ukr": ["..\\..\\stalker-xrf-resources-locale-ukr"],
Expand Down Expand Up @@ -43,7 +41,7 @@
"url": "https://gitlab.com/xray-forge/stalker-xrf-resources-extended.git",
"description": "Full base gamedata assets for custom game repacks"
},
"locale-eng":{
"locale-eng": {
"url": "https://gitlab.com/xray-forge/stalker-xrf-resources-locale-en.git",
"description": "English locale files, mainly game character voices"
},
Expand Down
1 change: 0 additions & 1 deletion src/engine/configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

- Used to configure game parameters and overwrite existing ones


## LTX vs TS

There is no major differences what to use for configuration files, both sides have pros/cons. <br/>
Expand Down
6 changes: 3 additions & 3 deletions src/engine/core/ui/debug/DebugDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

import { EDebugSection, sectionsMap } from "@/engine/core/ui/debug/types";
import { LuaLogger } from "@/engine/core/utils/logging";
import { resolveXmlFormPath } from "@/engine/core/utils/ui";
import { resolveXmlFile, resolveXmlFormPath } from "@/engine/core/utils/ui";
import { gameConfig } from "@/engine/lib/configs/GameConfig";
import { TKeyCode, TPath, TUIEvent } from "@/engine/lib/types";

Expand Down Expand Up @@ -48,10 +48,10 @@ export class DebugDialog extends CUIScriptWnd {
*/
public initControls(): void {
this.SetWndRect(new Frect().set(0, 0, gameConfig.UI.BASE_WIDTH, gameConfig.UI.BASE_HEIGHT));
this.Enable(true);

this.xml = new CScriptXmlInit();
this.xml = resolveXmlFile(base);

this.xml.ParseFile(resolveXmlFormPath(base));
this.xml.InitStatic("background", this);
this.xml.InitStatic("section_background", this);
this.xml.InitStatic("frame_menu_background", this);
Expand Down
20 changes: 17 additions & 3 deletions src/engine/core/ui/menu/MainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { registry } from "@/engine/core/database";
import { EventsManager } from "@/engine/core/managers/events/EventsManager";
import { EGameEvent } from "@/engine/core/managers/events/types";
import { DebugDialog } from "@/engine/core/ui/debug/DebugDialog";
import { ExtensionsDialog } from "@/engine/core/ui/menu/extensions/ExtensionsDialog";
import { LoadDialog } from "@/engine/core/ui/menu/load/LoadDialog";
import { MultiplayerMenu } from "@/engine/core/ui/menu/multiplayer/MultiplayerMenu";
import { MultiplayerGameSpy } from "@/engine/core/ui/menu/multiplayer_login/MultiplayerGamespy";
Expand Down Expand Up @@ -82,10 +83,8 @@ export class MainMenu extends CUIScriptWnd {
public uiLocalnetDialog: Optional<MultiplayerLocalnet> = null;
public uiGamespyDialog: Optional<MultiplayerGameSpy> = null;
public uiGameDebugDialog: Optional<DebugDialog> = null;
public uiGameExtensionsDialog: Optional<ExtensionsDialog> = null;

/**
* todo: Description.
*/
public constructor() {
super();

Expand Down Expand Up @@ -168,6 +167,7 @@ export class MainMenu extends CUIScriptWnd {
this.AddCallback("btn_quit_to_mm", ui_events.BUTTON_CLICKED, () => this.onButtonClickDisconnect(), this);
this.AddCallback("btn_ret", ui_events.BUTTON_CLICKED, () => this.onButtonClickReturnToGame(), this);
this.AddCallback("btn_lastsave", ui_events.BUTTON_CLICKED, () => this.onButtonClickLastSave(), this);
this.AddCallback("btn_extensions", ui_events.BUTTON_CLICKED, () => this.onButtonClickExtensions(), this);
this.AddCallback("btn_credits", ui_events.BUTTON_CLICKED, () => this.onButtonClickGameCredits(), this);

this.AddCallback("msg_box", ui_events.MESSAGE_BOX_OK_CLICKED, () => this.onMessageBoxOk(), this);
Expand Down Expand Up @@ -254,6 +254,20 @@ export class MainMenu extends CUIScriptWnd {
game.start_tutorial(gameTutorials.credits_seq);
}

/**
* On click extensions menu item button.
*/
public onButtonClickExtensions(): void {
if (this.uiGameExtensionsDialog === null) {
this.uiGameExtensionsDialog = new ExtensionsDialog(this);
}

this.uiGameExtensionsDialog.ShowDialog(true);

this.HideDialog();
this.Show(false);
}

/**
* todo: Description.
*/
Expand Down
34 changes: 34 additions & 0 deletions src/engine/core/ui/menu/extensions/ExtensionItemListEntry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
CUIListBoxItem,
CUITextWnd,
GetARGB,
GetFontLetterica16Russian,
GetFontLetterica18Russian,
LuabindClass,
} from "xray16";

import { TIndex, TName } from "@/engine/lib/types";

/**
* List entry of extensions options menu.
* Describes extension name and load order.
*/
@LuabindClass()
export class ExtensionItemListEntry extends CUIListBoxItem {
public uiInnerNameText: CUITextWnd;
public uiInnerSectionText: CUITextWnd;

public constructor(height: number, width: number, index: TIndex, name: TName) {
super(height);

this.SetTextColor(GetARGB(255, 170, 170, 170));

this.uiInnerNameText = this.GetTextItem();
this.uiInnerNameText.SetFont(GetFontLetterica18Russian());
this.uiInnerNameText.SetEllipsis(true);
this.uiInnerNameText.SetText(name);

this.uiInnerSectionText = this.AddTextField(tostring(index), width);
this.uiInnerSectionText.SetFont(GetFontLetterica16Russian());
}
}
Loading

0 comments on commit 034efb6

Please sign in to comment.