mirror of
https://github.com/martindampier/draw-steel-retainer.git
synced 2026-07-22 05:44:15 +00:00
Add three action states for solo monsters
This commit is contained in:
parent
81b13a2c51
commit
3ecc583f4d
3 changed files with 72 additions and 8 deletions
|
|
@ -3,6 +3,7 @@ export const Yes = 'Yes';
|
|||
export const No = 'No';
|
||||
export const Red = 'red';
|
||||
export const Green = 'green';
|
||||
export const Orange = 'orange';
|
||||
export const Fill = 'fill';
|
||||
export const TableFormat = "| Name | Stamina |\n| :---- | ----: |\n| Monster | 15 |";
|
||||
export const TableFlag = ": |";
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { createPublicKey } from 'crypto';
|
||||
import Creature from 'lib/Models/Creature';
|
||||
import { INITIATIVE_VIEW, Red, Green, Yes, No, Fill } from 'lib/Models/Constants';
|
||||
import { INITIATIVE_VIEW, Red, Green, Orange, Yes, No, Fill } from 'lib/Models/Constants';
|
||||
import { ButtonComponent, ItemView, TextAreaComponent, WorkspaceLeaf, Setting, TextComponent, ExtraButtonComponent, DropdownComponent, Modal, App } from 'obsidian';
|
||||
import { isSharedArrayBuffer } from 'util/types';
|
||||
import { CreatureTypes } from 'lib/Models/CreatureTypes';
|
||||
|
|
@ -325,6 +325,23 @@ export class InitiativeView extends ItemView {
|
|||
actedButtonComp.onClick( () => {
|
||||
this.changeActedCell(row, actedButtonComp, actedButtonComp.extraSettingsEl.getText() == No);
|
||||
});
|
||||
if (creature.Type == "Solo") {
|
||||
let secondActedButtonComp = new ExtraButtonComponent(actedButtonCell);
|
||||
secondActedButtonComp.extraSettingsEl.setText(No);
|
||||
secondActedButtonComp.extraSettingsEl.addClass("trackerCellButtonStyle");
|
||||
secondActedButtonComp.extraSettingsEl.addClass("trackerCellButtonHalfHeight");
|
||||
actedButtonComp.extraSettingsEl.addClass("trackerCellButtonHalfHeight");
|
||||
secondActedButtonComp.onClick( () => {
|
||||
this.actedButtonTwoClick(row, secondActedButtonComp, secondActedButtonComp.extraSettingsEl.getText() == No);
|
||||
});
|
||||
actedButtonComp.onClick( () => {
|
||||
this.actedButtonOneClick(row, actedButtonComp, actedButtonComp.extraSettingsEl.getText() == No);
|
||||
});
|
||||
} else
|
||||
{
|
||||
actedButtonComp.extraSettingsEl.addClass("trackerCellButtonStyle");
|
||||
actedButtonComp.extraSettingsEl.addClass("trackerCellButtonFullHeight");
|
||||
}
|
||||
buttonCell = row.createEl('td', {cls: 'trackerTableCellStyle'});
|
||||
let removeButton = new ExtraButtonComponent(buttonCell);
|
||||
removeButton.extraSettingsEl.addClass("trackerCellRemoveButtonStyle");
|
||||
|
|
@ -432,6 +449,45 @@ export class InitiativeView extends ItemView {
|
|||
}
|
||||
}
|
||||
|
||||
actedButtonOneClick(row : HTMLTableRowElement, buttonComp : ExtraButtonComponent, hasActed : boolean) {
|
||||
this.soloActedButtonClickInner(row, buttonComp, hasActed, 1);
|
||||
}
|
||||
actedButtonTwoClick(row : HTMLTableRowElement, buttonComp : ExtraButtonComponent, hasActed : boolean) {
|
||||
this.soloActedButtonClickInner(row, buttonComp, hasActed, 0);
|
||||
}
|
||||
soloActedButtonClickInner(row : HTMLTableRowElement, buttonComp : ExtraButtonComponent, hasActed : boolean, child: number){
|
||||
let otherHasActed = row.children[3].children[child].textContent == "Yes";
|
||||
|
||||
if (hasActed)
|
||||
{
|
||||
buttonComp.extraSettingsEl.setText(Yes);
|
||||
if (otherHasActed)
|
||||
{
|
||||
row.children[3].addClass(Red);
|
||||
row.children[3].removeClass(Orange);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.children[3].addClass(Orange);
|
||||
}
|
||||
row.children[3].removeClass(Green);
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonComp.extraSettingsEl.setText(No);
|
||||
if (otherHasActed)
|
||||
{
|
||||
row.children[3].addClass(Orange);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.children[3].addClass(Green);
|
||||
row.children[3].removeClass(Orange);
|
||||
}
|
||||
row.children[3].removeClass(Red);
|
||||
}
|
||||
}
|
||||
|
||||
changeTriggeredActionCell(row : HTMLTableRowElement, buttonComp : ExtraButtonComponent, hasActed : boolean) {
|
||||
if (hasActed)
|
||||
{
|
||||
|
|
|
|||
21
styles.css
21
styles.css
|
|
@ -1,7 +1,12 @@
|
|||
.red{
|
||||
.green {
|
||||
background-color: var(--color-green);
|
||||
}
|
||||
.red {
|
||||
background-color: var(--color-red);
|
||||
}
|
||||
|
||||
}
|
||||
.orange{
|
||||
background-color: var(--color-orange);
|
||||
}
|
||||
|
||||
.hideStyle{
|
||||
display: none;
|
||||
|
|
@ -64,9 +69,6 @@
|
|||
.fontFifteen {
|
||||
font-size: 15px;
|
||||
}
|
||||
.green {
|
||||
background-color: var(--color-green);
|
||||
}
|
||||
|
||||
.Centered{
|
||||
margin-right: auto;
|
||||
|
|
@ -151,12 +153,17 @@
|
|||
padding: 5px;
|
||||
}
|
||||
.trackerCellButtonStyle {
|
||||
height: 55px;
|
||||
color: var(--color-base-00);
|
||||
background-color: transparent;
|
||||
font-weight: bolder;
|
||||
width: 100%;
|
||||
}
|
||||
.trackerCellButtonFullHeight{
|
||||
height: 55px;
|
||||
}
|
||||
.trackerCellButtonHalfHeight{
|
||||
height: 22.5px;
|
||||
}
|
||||
.trackerCellRemoveButtonStyle {
|
||||
text-align: center;
|
||||
height: 55px;
|
||||
|
|
|
|||
Loading…
Reference in a new issue