mirror of
https://github.com/martindampier/draw-steel-retainer.git
synced 2026-07-22 05:44:15 +00:00
Update based on feedback
This commit is contained in:
parent
54f20197e0
commit
3cd75a6b86
5 changed files with 25 additions and 56 deletions
|
|
@ -164,7 +164,7 @@ export class InitiativeView extends ItemView {
|
|||
}
|
||||
//Create a HTML Table
|
||||
createTable(isHero: boolean) {
|
||||
let classes = "Centered" + (isHero ? " heroes" : " villains")
|
||||
let classes = "Centered" + (isHero ? " heroes" : " villains") + ' trackerTableStyle';
|
||||
if (isHero)
|
||||
{
|
||||
this.heroesTableEl = this.gridEl.createEl('table', {cls: classes});
|
||||
|
|
@ -174,12 +174,12 @@ export class InitiativeView extends ItemView {
|
|||
this.villainsTableEl = this.gridEl.createEl('table', {cls: classes});
|
||||
}
|
||||
let header = isHero ? this.heroesTableEl.createEl('tr') : this.villainsTableEl.createEl('tr');
|
||||
header.createEl('th', {text: 'Character', cls: 'name-Cell'});
|
||||
header.createEl('th', {text: 'Stamina', cls: 'stamina-Cell'});
|
||||
header.createEl('th', {text: 'TA', title: "Triggered Action"});
|
||||
header.createEl('th', {text: 'Acted'});
|
||||
header.createEl('th', {text: 'Character', cls: 'name-Cell trackerTableCellStyle'});
|
||||
header.createEl('th', {text: 'Stamina', cls: 'stamina-Cell trackerTableCellStyle'});
|
||||
header.createEl('th', {text: 'TA', title: "Triggered Action", cls: 'trackerTableCellStyle'});
|
||||
header.createEl('th', {text: 'Acted', cls: 'trackerTableCellStyle'});
|
||||
|
||||
let createButtonHeader = header.createEl('th');
|
||||
let createButtonHeader = header.createEl('th', { cls: 'trackerTableCellStyle'});
|
||||
let resetButtonComp = new ButtonComponent(createButtonHeader)
|
||||
resetButtonComp.setButtonText("Clear");
|
||||
resetButtonComp.setClass("headerButtonRight");
|
||||
|
|
@ -239,7 +239,7 @@ export class InitiativeView extends ItemView {
|
|||
this.villains.push(creature);
|
||||
let row = isHero ? this.heroesTableEl.createEl('tr', {cls: "Centered"}) : this.villainsTableEl.createEl('tr', {cls: "Centered"});
|
||||
row.id = isHero ? "Hero " + this.heroes.indexOf(creature) : "Villain " + this.villains.indexOf(creature);
|
||||
let nameCell = row.createEl('td', {text: creature.Name, cls: "Centered name-Cell"});
|
||||
let nameCell = row.createEl('td', {text: creature.Name, cls: "Centered name-Cell trackerTableCellStyle"});
|
||||
nameCell.createDiv({text: creature.Type?.toString(), cls: "verticalType topAlign"})
|
||||
nameCell.createEl("br");
|
||||
let nameCellDiv = nameCell.createDiv({cls: "condition-buttons"});
|
||||
|
|
@ -261,23 +261,23 @@ export class InitiativeView extends ItemView {
|
|||
button8.onClick( () => this.toggleColors(button8) )
|
||||
let button9 = new ExtraButtonComponent(nameCellDiv).setIcon("heart-crack").setTooltip("Weakened"); //Weakened
|
||||
button9.onClick( () => this.toggleColors(button9) )
|
||||
row.createEl('td', {text: "stamina", cls: "Centered stamina-Cell"})
|
||||
row.createEl('td', {text: "stamina", cls: "Centered stamina-Cell trackerTableCellStyle"})
|
||||
this.updateStamina(row, creature.CurrentStamina.toString(), creature.Type == CreatureTypes.Minion)
|
||||
let buttonCell = row.createEl('td', {cls: Green});
|
||||
let buttonCell = row.createEl('td', {cls: Green + " trackerTableCellStyle"});
|
||||
let buttonComp = new ButtonComponent(buttonCell);
|
||||
buttonComp.setButtonText(No);
|
||||
buttonComp.setClass(Fill);
|
||||
buttonComp.onClick( () => {
|
||||
this.changeTriggeredActionCell(row, buttonComp, buttonComp.buttonEl.getText() == No);
|
||||
});
|
||||
let actedButtonCell = row.createEl('td', {cls: Green});
|
||||
let actedButtonCell = row.createEl('td', {cls: Green + " trackerTableCellStyle"});
|
||||
let actedButtonComp = new ButtonComponent(actedButtonCell);
|
||||
actedButtonComp.setButtonText(No);
|
||||
actedButtonComp.setClass(Fill);
|
||||
actedButtonComp.onClick( () => {
|
||||
this.changeActedCell(row, actedButtonComp, actedButtonComp.buttonEl.getText() == No);
|
||||
});
|
||||
buttonCell = row.createEl('td');
|
||||
buttonCell = row.createEl('td', {cls: 'trackerTableCellStyle'});
|
||||
let removeButton = new ButtonComponent(buttonCell);
|
||||
removeButton.buttonEl.addClass("padded");
|
||||
removeButton.onClick(() => {this.removeRow(row)});
|
||||
|
|
|
|||
35
lib/main.ts
35
lib/main.ts
|
|
@ -21,32 +21,9 @@ export default class ForbiddenLandsCharacterSheet extends Plugin {
|
|||
this.activateView();
|
||||
});
|
||||
|
||||
// This adds a status bar item to the bottom of the app. Does not work on mobile apps.
|
||||
const statusBarItemEl = this.addStatusBarItem();
|
||||
statusBarItemEl.setText('Status Bar Text');
|
||||
|
||||
// this.addCommands();
|
||||
// This adds a settings tab so the user can configure letious aspects of the plugin
|
||||
this.addSettingTab(new RetainerSettingTab(this.app, this));
|
||||
}
|
||||
|
||||
// addCommands(){
|
||||
// this.addCommand({
|
||||
// id: "insert-initiative-table",
|
||||
// name: "Insert Initiative Table",
|
||||
// editorCallback: (editor: Editor) => {
|
||||
// editor.replaceRange(TableFormat, editor.getCursor());
|
||||
// }
|
||||
// });
|
||||
// // this.addCommand({
|
||||
// // id: 'import-table-to-tracker',
|
||||
// // name: 'Import Table To Tracker',
|
||||
// // editorCallback: (editor: Editor) => {
|
||||
// // this.importSelectionToTracker(editor);
|
||||
// // }
|
||||
// // });
|
||||
// }
|
||||
|
||||
importSelectionToTracker(editor: Editor){
|
||||
if(!(editor.somethingSelected())) {
|
||||
return;
|
||||
|
|
@ -94,31 +71,25 @@ export default class ForbiddenLandsCharacterSheet extends Plugin {
|
|||
const leaves = workspace.getLeavesOfType(INITIATIVE_VIEW);
|
||||
|
||||
if (leaves.length > 0) {
|
||||
// A leaf with our view already exists, use that
|
||||
leaf = leaves[0];
|
||||
|
||||
} else {
|
||||
// Our view could not be found in the workspace, create a new leaf
|
||||
// in the right sidebar for it
|
||||
|
||||
leaf = workspace.getRightLeaf(false);
|
||||
if (leaf != null)
|
||||
await leaf.setViewState({ type: INITIATIVE_VIEW, active: true });
|
||||
}
|
||||
|
||||
// "Reveal" the leaf in case it is in a collapsed sidebar
|
||||
if (leaf != null)
|
||||
workspace.revealLeaf(leaf);
|
||||
}
|
||||
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
console.log("Settings Loaded");
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
console.log("Settings Saved");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +108,7 @@ class RetainerSettingTab extends PluginSettingTab {
|
|||
|
||||
let div = containerEl.createDiv({cls: "rightAlign bottomSpace"});
|
||||
new ButtonComponent(div)
|
||||
.setButtonText("Add Player Character")
|
||||
.setButtonText("Add player character")
|
||||
.setClass("rightAlign")
|
||||
.onClick( () => {
|
||||
this.buildCharacterInput(containerEl)
|
||||
|
|
@ -155,8 +126,8 @@ class RetainerSettingTab extends PluginSettingTab {
|
|||
|
||||
let staminaInput = player.MaxStamina == undefined ? '' : player.MaxStamina.toString();
|
||||
let setting = new Setting(containerEl)
|
||||
.setName('Player Character')
|
||||
.setDesc('Set the PC\'s Name and Stamina')
|
||||
.setName('Player character')
|
||||
.setDesc('Set the PC\'s name and stamina')
|
||||
.addText(text => text
|
||||
.setPlaceholder('Name')
|
||||
.setValue(player.Name)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Draw Steel Retainer",
|
||||
"version": "1.0.6",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "This plugin creates a initiative tracker that can be used for the MCDM rpg Draw Steel.",
|
||||
"description": "Provides Director facing sidebar tools for the TTRPG Draw Steel",
|
||||
"author": "Herotek",
|
||||
"authorUrl": "https://github.com/MartinDampier/DrawSteelCompanion",
|
||||
"authorUrl": "https://github.com/MartinDampier",
|
||||
"fundingUrl": "https://ko-fi.com/herotek",
|
||||
"isDesktopOnly": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "draw-steel-initiative",
|
||||
"version": "0.1.0",
|
||||
"description": "This plugin creates a initiative tracker that can be used for the MCDM rpg Draw Steel.",
|
||||
"name": "draw-steel-retainer",
|
||||
"version": "1.0.6",
|
||||
"description": "Provides Dircetor orientated tools for the TTRPG Draw Steel",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
|
|
|
|||
14
styles.css
14
styles.css
|
|
@ -100,23 +100,21 @@
|
|||
}
|
||||
|
||||
.heroes {
|
||||
border-color: var(--color-green);
|
||||
border-width: 2px;
|
||||
border: 2px solid var(--color-green);
|
||||
}
|
||||
|
||||
.villains {
|
||||
border-color: var(--color-red);
|
||||
border-width: 2px;
|
||||
border: 2px solid var(--color-red);
|
||||
}
|
||||
table{
|
||||
border: 1px solid black;
|
||||
|
||||
.trackerTableStyle{
|
||||
border-collapse: collapse;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid black;
|
||||
.trackerTableCellStyle {
|
||||
border: 1px solid;
|
||||
border-collapse: collapse;
|
||||
padding: 5px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue