Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ node_modules

/content/panorama/scripts/custom_game/**/*.js
/game/scripts/vscripts/**/*.lua
!/game/scripts/vscripts/lib/timers.lua

# Dota 2 stuff
*.bin
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"css.lint.unknownProperties": "ignore"
}
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# ModDota template

A template for Dota 2 Custom Games built with modern technologies. It includes
A template for Dota 2 Custom Games built with modern technologies.

[This tutorial](https://moddota.com/scripting/Typescript/typescript-introduction/) explains how to set up and use the template.

The template includes:

- [TypeScript for Panorama](https://moddota.com/panorama/introduction-to-panorama-ui-with-typescript)
- [TypeScript for VScripts](https://typescripttolua.github.io/)
Expand All @@ -15,6 +19,21 @@ A template for Dota 2 Custom Games built with modern technologies. It includes

After that you can press `Ctrl+Shift+B` in VSCode or run `npm run dev` command in terminal to compile your code and watch for changes.

## Contents:

* **[src/common]:** TypeScript .d.ts type declaration files with types that can be shared between Panorama and VScripts
* **[src/vscripts]:** TypeScript code for Dota addon (Lua) vscripts. Compiles lua to game/scripts/vscripts.
* **[src/panorama]:** TypeScript code for panorama UI. Compiles js to content/panorama/scripts/custom_game

--

* **[game/*]:** Dota game directory containing files such as npc kv files and compiled lua scripts.
* **[content/*]:** Dota content directory containing panorama sources other than scripts (xml, css, compiled js)

--

* **[scripts/*]:** Repository installation scripts

## Continuous Integration

This template includes a [GitHub Actions](https://github.com/features/actions) [workflow](.github/workflows/ci.yml) that builds your custom game on every commit and fails when there are type errors.
Binary file added content/panorama/images/custom_game/tstl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion content/panorama/layout/custom_game/hud.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
<root>
<scripts>
<!-- Included JS script files go here -->
<include src="file://{resources}/scripts/custom_game/hud.js" />
</scripts>

<styles>
<!-- Included css style files go here -->
<include src="s2r://panorama/styles/dotastyles.css" />
<include src="file://{resources}/styles/custom_game/hud.css" />
</styles>
<snippets>

<snippets>
<!-- Snippets go here -->
</snippets>

<Panel hittest="false" class="MainHud">
<Panel id="ExamplePanel">

<Image id="BannerImage" src="file://{resources}/images/custom_game/tstl.png" />

<Label class="ExampleTitle" text="TypeScript Dota Addon template" />

<Label class="ExampleParagraph" text="This is an example text box! Close it to apply the 'panic' modifier to your hero. You can remove this panel in content/panorama/layout/custom_game/hud.xml" />

<Button id="CloseButton" onactivate="OnCloseButtonClicked()">
<Label text="Close" />
</Button>
</Panel>
</Panel>
</root>
7 changes: 0 additions & 7 deletions content/panorama/scripts/custom_game/hud.ts

This file was deleted.

10 changes: 0 additions & 10 deletions content/panorama/scripts/custom_game/manifest.ts

This file was deleted.

54 changes: 54 additions & 0 deletions content/panorama/styles/custom_game/hud.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,57 @@
width: 100%;
height: 100%;
}

#ExamplePanel {
width: 500px;
height: 500px;
/* Using a background image already in dota */
background-image: url("s2r://panorama/images/compendium/international2020/compendium/dashboard_panel_bg_psd.vtex");

horizontal-align: center;
vertical-align: center;
}

#ExamplePanel #BannerImage {
width: 200px;
height: 200px;
horizontal-align: center;
y: 40px;
}

#ExamplePanel .ExampleTitle {
horizontal-align: center;
font-size: 30px;
y: 260px;
}

#ExamplePanel .ExampleParagraph {
y: 320px;
margin-left: 30px;
margin-right: 30px;
}

#ExamplePanel #CloseButton {
width: 100px;
height: 50px;
background-color: rgb(228, 228, 228);
horizontal-align: center;
vertical-align: bottom;
y: -30px;
}

#ExamplePanel #CloseButton Label {
horizontal-align: center;
vertical-align: center;
color: black;
}

#ExamplePanel #CloseButton:hover {
background-color: rgb(0, 135, 245);
}

#ExamplePanel #CloseButton:hover Label {
color: white;
}


Loading