Commit 5908057f authored by timel's avatar timel

fix: mat store log

parent b826b116
...@@ -34,31 +34,26 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -34,31 +34,26 @@ class CardArray extends Array<CardState> implements ArrayCardState {
counters: {}, counters: {},
idleInteractivities: [], idleInteractivities: [],
}); });
// methods /** 内部输出一些注释,等稳定了再移除这个log */
remove(sequence: number) { private logInside(name: string, obj: Record<string, any>) {
console.warn("remove", { console.warn("matStore", name, {
sequence,
zone: ygopro.CardZone[this.zone], zone: ygopro.CardZone[this.zone],
controller: getWhom(this.getController()), controller: getWhom(this.getController()),
...obj,
}); });
}
// methods
remove(sequence: number) {
this.logInside("remove", { sequence });
this.splice(sequence, 1); this.splice(sequence, 1);
} }
async insert(sequence: number, id: number) { async insert(sequence: number, id: number) {
console.warn("insert", { this.logInside("insert", { sequence, id });
sequence,
id,
zone: ygopro.CardZone[this.zone],
controller: getWhom(this.getController()),
});
const card = await this.genCard(this.getController(), id); const card = await this.genCard(this.getController(), id);
this.splice(sequence, 0, card); this.splice(sequence, 0, card);
} }
async add(ids: number[]) { async add(ids: number[]) {
console.warn("add", { this.logInside("add", { ids });
ids,
zone: ygopro.CardZone[this.zone],
controller: getWhom(this.getController()),
});
const cards = await Promise.all( const cards = await Promise.all(
ids.map(async (id) => this.genCard(this.getController(), id)) ids.map(async (id) => this.genCard(this.getController(), id))
); );
...@@ -69,13 +64,7 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -69,13 +64,7 @@ class CardArray extends Array<CardState> implements ArrayCardState {
id: number, id: number,
position?: ygopro.CardPosition position?: ygopro.CardPosition
) { ) {
console.warn("setOccupant", { this.logInside("setOccupant", { sequence, id, position });
sequence,
id,
position,
zone: ygopro.CardZone[this.zone],
controller: getWhom(this.getController()),
});
const meta = await fetchCard(id); const meta = await fetchCard(id);
const target = this[sequence]; const target = this[sequence];
target.occupant = meta; target.occupant = meta;
...@@ -87,24 +76,14 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -87,24 +76,14 @@ class CardArray extends Array<CardState> implements ArrayCardState {
sequence: number, sequence: number,
interactivity: CardState["idleInteractivities"][number] interactivity: CardState["idleInteractivities"][number]
) { ) {
console.warn("addIdleInteractivity", { this.logInside("addIdleInteractivity", { sequence, interactivity });
sequence,
interactivity,
zone: ygopro.CardZone[this.zone],
controller: getWhom(this.getController()),
});
this[sequence].idleInteractivities.push(interactivity); this[sequence].idleInteractivities.push(interactivity);
} }
clearIdleInteractivities() { clearIdleInteractivities() {
this.forEach((card) => (card.idleInteractivities = [])); this.forEach((card) => (card.idleInteractivities = []));
} }
setPlaceInteractivityType(sequence: number, interactType: InteractType) { setPlaceInteractivityType(sequence: number, interactType: InteractType) {
console.warn("setPlaceInteractivityType", { this.logInside("setPlaceInteractivityType", { sequence, interactType });
sequence,
interactType,
zone: ygopro.CardZone[this.zone],
controller: getWhom(this.getController()),
});
this[sequence].placeInteractivity = { this[sequence].placeInteractivity = {
interactType: interactType, interactType: interactType,
response: { response: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment