Skip to content

Commit

Permalink
perf: 天赋优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaviilee committed Nov 3, 2023
1 parent c573da1 commit a8d7b84
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 32 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
},
"dependencies": {
"@jx3box/jx3box-comment-ui": "^1.7.16",
"@jx3box/jx3box-common": "^7.9.15",
"@jx3box/jx3box-common-ui": "^7.7.5",
"@jx3box/jx3box-data": "^3.5.0",
"@jx3box/jx3box-common": "^8.0.2",
"@jx3box/jx3box-common-ui": "^7.8.8",
"@jx3box/jx3box-data": "^3.5.3",
"@jx3box/jx3box-dict": "^2.2.0",
"@jx3box/jx3box-editor": "^1.9.9",
"@jx3box/jx3box-macro": "^1.0.1",
"@jx3box/jx3box-talent": "^1.2.6",
"@jx3box/jx3box-talent": "^1.2.7",
"@jx3box/jx3box-talent2": "^1.5.7",
"axios": "^0.21.1",
"codemirror": "^5.62.2",
Expand Down
22 changes: 21 additions & 1 deletion src/assets/css/talent.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@
}
}

.m-talent__pop {
.m-talent__option {
.flex;
align-items: center;
justify-content: space-between;

.u-version {
font-size: 12px;
color: #999;
}
}

.selected {
.u-version {
color: @primary;
}
}
}


// 头部
.m-talent-header {
.clearfix;
Expand Down Expand Up @@ -216,4 +236,4 @@
.m-talent-op {
.mt(20px);
.x;
}
}
16 changes: 13 additions & 3 deletions src/views/Talent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@
<div class="m-talent-panel">
<div class="m-talent-version">
<span class="u-label">选择版本</span>
<el-select v-model="version" placeholder="请选择游戏版本" @change="reload">
<el-select
v-model="version"
placeholder="请选择游戏版本"
@change="reload"
popper-class="m-talent__pop"
>
<el-option
v-for="item in versions"
:key="item.version"
:label="item.name"
:value="item.version"
></el-option>
>
<div class="m-talent__option">
<span class="u-label">{{ item.name }}</span>
<span class="u-version">{{ item.version }}</span>
</div>
</el-option>
</el-select>
</div>
<div class="u-toolbar" v-if="isLogin">
Expand Down Expand Up @@ -300,7 +310,7 @@ export default {
},
components: {
talentDrawer,
AppLayout
AppLayout,
},
};
</script>
Expand Down
76 changes: 52 additions & 24 deletions src/views/Talent2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@
<div class="m-talent-panel">
<div class="m-talent-version">
<span class="u-label">选择版本</span>
<el-select v-model="version" placeholder="请选择游戏版本" @change="reload">
<el-select
v-model="version"
placeholder="请选择游戏版本"
@change="reload"
popper-class="m-talent__pop"
>
<el-option
v-for="item in versions"
:key="item.version"
:label="item.name"
:value="item.version"
></el-option>
>
<div class="m-talent__option">
<span class="u-label">{{ item.name }}</span>
<span class="u-version">{{ item.version }}</span>
</div>
</el-option>
</el-select>
</div>
<div class="u-toolbar" v-if="isLogin">
Expand Down Expand Up @@ -78,7 +88,9 @@
},
canOperate(index, 'left') ? '' : 'm-talent2-content-item-disabled',
item.pretab ? 'm-talent2-pretab' : '',
isMutex(item, index, i, 'left') ? 'm-talent2-content-item-disabled' : '',
isMutex(item, index, i, 'left')
? 'm-talent2-content-item-disabled'
: '',
]"
:key="i"
@mouseover="$set(item, 'on', true)"
Expand All @@ -99,9 +111,11 @@
? 'm-talent2-skill-unselected'
: 'm-talent2-unselected'
: '',
isMutex(item, index, i, 'left') ? item.type === 'skill'
isMutex(item, index, i, 'left')
? item.type === 'skill'
? 'm-talent2-skill-unselected'
: 'm-talent2-unselected' : '',
: 'm-talent2-unselected'
: '',
]"
>
<!-- HAS PARENT -->
Expand All @@ -126,7 +140,12 @@
:alt="item.name"
/>

<img v-if="isMutex(item, index, i, 'left')" class="u-mutex-img" src="../assets/img/talent2/mutex.png" alt="">
<img
v-if="isMutex(item, index, i, 'left')"
class="u-mutex-img"
src="../assets/img/talent2/mutex.png"
alt=""
/>
</div>
<!-- COUNT -->
<span
Expand Down Expand Up @@ -222,7 +241,9 @@
? 'm-talent2-content-item-disabled'
: '',
item.pretab ? 'm-talent2-pretab' : '',
isMutex(item, index, i, 'right') ? 'm-talent2-content-item-disabled' : '',
isMutex(item, index, i, 'right')
? 'm-talent2-content-item-disabled'
: '',
]"
:key="i"
@mouseover="$set(item, 'on', true)"
Expand Down Expand Up @@ -335,7 +356,7 @@
</div>
</div>

<div class="m-talent2-actions" :class="{'is-single': isSingle}">
<div class="m-talent2-actions" :class="{ 'is-single': isSingle }">
<div
class="reset-btn"
:class="!totalCount ? 'm-talent2-actions-btn-disabled' : 'm-talent2-actions-btn'"
Expand Down Expand Up @@ -530,25 +551,25 @@ export default {
isEditing: function () {
return !!this.currentSchema;
},
mutexObj: function ({ mutex }){
mutexObj: function ({ mutex }) {
const result = {};
// 遍历输入的二维数组
for (const subArr of mutex) {
for (const num of subArr) {
// 如果数字还不存在于结果对象中,就初始化为空数组
if (!result[num]) {
result[num] = [];
}
// 如果数字还不存在于结果对象中,就初始化为空数组
if (!result[num]) {
result[num] = [];
}
// 将当前数字所在的子数组中的其他数字添加到结果对象的对应数组中
const otherNums = subArr.filter(item => item !== num);
result[num] = result[num].concat(otherNums);
// 将当前数字所在的子数组中的其他数字添加到结果对象的对应数组中
const otherNums = subArr.filter((item) => item !== num);
result[num] = result[num].concat(otherNums);
}
}
return result;
}
},
},
methods: {
updateDrawer: function (val) {
Expand Down Expand Up @@ -679,7 +700,11 @@ export default {
canOperate = true;
}
} else if (this.begin === "right") {
if (this.rCount >= this.series_open_need && this.lCount >= 0 && this.lCount >= this.condition[rowIndex]) {
if (
this.rCount >= this.series_open_need &&
this.lCount >= 0 &&
this.lCount >= this.condition[rowIndex]
) {
canOperate = true;
}
}
Expand Down Expand Up @@ -822,7 +847,11 @@ export default {
canOperate = true;
}
} else if (this.begin === "left") {
if (this.lCount >= this.series_open_need && this.rCount >= 0 && this.rCount >= this.condition[rowIndex]) {
if (
this.lCount >= this.series_open_need &&
this.rCount >= 0 &&
this.rCount >= this.condition[rowIndex]
) {
canOperate = true;
}
}
Expand Down Expand Up @@ -978,7 +1007,6 @@ export default {
this.version = this.versions[0]?.version;
});
// this.version = "v20230912"
},
getTalents: function () {
fetch(__ossRoot + "data/talent2/" + this.version + ".json")
Expand Down Expand Up @@ -1089,7 +1117,7 @@ export default {
if (!arr) return false;
const _item = this.talentContent[key][rowIndex].find(i => i?.count);
const _item = this.talentContent[key][rowIndex].find((i) => i?.count);
// _item存在,证明该项已经加点,那么arr中的项就不能加点
if (_item) {
Expand Down Expand Up @@ -1117,7 +1145,7 @@ export default {
const _left = left.map((l) => {
if (l) {
this.$set(l, "on", false);
this.$set(l, 'count', 0);
this.$set(l, "count", 0);
}
return l;
});
Expand All @@ -1138,7 +1166,7 @@ export default {
const _right = right.map((r) => {
if (r) {
this.$set(r, "on", false);
this.$set(r, 'count', 0);
this.$set(r, "count", 0);
}
return r;
});
Expand All @@ -1159,7 +1187,7 @@ export default {
}
// 激活条件
this.condition = xfConfigs[val]?.condition || [0,5,10,15,20,25];
this.condition = xfConfigs[val]?.condition || [0, 5, 10, 15, 20, 25];
this.mutex = xfConfigs[val]?.mutex || [];
// 初始化code
Expand Down

0 comments on commit a8d7b84

Please sign in to comment.