Commit b4062341 authored by timel's avatar timel

fix: optimize mat store

parent a23b4d02
...@@ -110,18 +110,14 @@ class CardArray extends Array<CardState> implements ArrayCardState { ...@@ -110,18 +110,14 @@ class CardArray extends Array<CardState> implements ArrayCardState {
const genDuelCardArray = (cardStates: CardState[], zone: ygopro.CardZone) => { const genDuelCardArray = (cardStates: CardState[], zone: ygopro.CardZone) => {
const me = cloneDeep(new CardArray(...cardStates)); const me = cloneDeep(new CardArray(...cardStates));
me.zone = zone; me.zone = zone;
me.getController = () => (matStore.selfType == 1 ? 0 : 1); me.getController = () => (matStore.selfType === 1 ? 0 : 1);
const op = cloneDeep(new CardArray(...cardStates)); const op = cloneDeep(new CardArray(...cardStates));
op.zone = zone; op.zone = zone;
op.getController = () => (matStore.selfType == 1 ? 1 : 0); op.getController = () => (matStore.selfType === 1 ? 1 : 0);
const res = proxy({ const res = proxy({
me, me,
op, op,
of: (controller: number) => { of: (controller: number) => res[getWhom(controller)],
const tmp = res[getWhom(controller)];
tmp.__proto__ = CardArray.prototype; // 手动修复原型链
return tmp;
},
}); });
return res; return res;
}; };
......
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