enhance(reversi): 変則なしマッチングを可能に
This commit is contained in:
@@ -157,6 +157,7 @@ if ($i) {
|
||||
const invitations = ref<Misskey.entities.UserLite[]>([]);
|
||||
const matchingUser = ref<Misskey.entities.UserLite | null>(null);
|
||||
const matchingAny = ref<boolean>(false);
|
||||
const noIrregularRules = ref<boolean>(false);
|
||||
|
||||
function startGame(game: Misskey.entities.ReversiGameDetailed) {
|
||||
matchingUser.value = null;
|
||||
@@ -182,6 +183,7 @@ async function matchHeatbeat() {
|
||||
} else if (matchingAny.value) {
|
||||
const res = await misskeyApi('reversi/match', {
|
||||
userId: null,
|
||||
noIrregularRules: noIrregularRules.value,
|
||||
});
|
||||
|
||||
if (res != null) {
|
||||
@@ -199,10 +201,22 @@ async function matchUser() {
|
||||
matchHeatbeat();
|
||||
}
|
||||
|
||||
async function matchAny() {
|
||||
matchingAny.value = true;
|
||||
|
||||
matchHeatbeat();
|
||||
function matchAny(ev: MouseEvent) {
|
||||
os.popupMenu([{
|
||||
text: i18n.ts._reversi.allowIrregularRules,
|
||||
action: () => {
|
||||
noIrregularRules.value = false;
|
||||
matchingAny.value = true;
|
||||
matchHeatbeat();
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts._reversi.disallowIrregularRules,
|
||||
action: () => {
|
||||
noIrregularRules.value = true;
|
||||
matchingAny.value = true;
|
||||
matchHeatbeat();
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
function cancelMatching() {
|
||||
|
||||
Reference in New Issue
Block a user