Skip to content

Commit

Permalink
feat: 生稀盐酸
Browse files Browse the repository at this point in the history
fix: 修改mumu12 config
  • Loading branch information
bakashigure committed Feb 11, 2024
1 parent 6a94871 commit 60eded1
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 24 deletions.
1 change: 0 additions & 1 deletion packages/main/coreLoader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ class CoreLoader {
}

public GetCoreInstanceByUUID(uuid: string): any {
console.log('type of this.MeoAsstPtr[uuid]', typeof this.MeoAsstPtr[uuid])
return this.MeoAsstPtr[uuid]
}

Expand Down
2 changes: 1 addition & 1 deletion packages/main/deviceDetector/adapters/winAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class WindowsAdapter implements EmulatorAdapter {
}

protected async getMumu12(e: Emulator): Promise<void> {
e.config = 'MuMuEmulator'
e.config = 'MuMuEmulator12'
e.displayName = 'MuMu模拟器12'
const emuPath = await getPnamePath('MuMuPlayer.exe') // 模拟器启动器路径
e.adbPath = path.resolve(emuPath, '../adb.exe') // 模拟器adb路径
Expand Down
2 changes: 1 addition & 1 deletion packages/main/hooks/asst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const hooks: IpcMainHandleEventCalleeProxy['CoreLoader'] = {
},
initCoreAsync(arg) {
const createStatus = core.CreateEx(arg.uuid) ?? false
if (!createStatus) logger.warn(`重复创建 ${JSON.stringify(arg)}`)
if (!createStatus) logger.warn(`Instance already exist! ${JSON.stringify(arg)}`)
if (!core.SetTouchMode(arg.uuid, arg.touch_mode))
logger.warn('Set touch mode failed', arg.touch_mode)
return core.AsyncConnect(arg.address, arg.uuid, arg.adb_path, arg.config)
Expand Down
8 changes: 4 additions & 4 deletions packages/renderer/src/components/Task/NewTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ const options: DropdownMixedOption[] = [
label: '无限肉鸽',
key: 'Roguelike',
},
// {
// label: '生息演算',
// key: 'ReclamationAlgorithm'
// }
{
label: '生息演算',
key: 'ReclamationAlgorithm',
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Fighting from './Fighting.vue'
import Infrast from './Infrast.vue'
import Mall from './Mall.vue'
import NoConfiguration from './NoConfiguration.vue'
import ReclamationAlgorithm from './ReclamationAlgorithm.vue'
import Recruit from './Recruit.vue'
import Rogue from './Rogue.vue'
import Shutdown from './Shutdown.vue'
Expand All @@ -20,6 +21,7 @@ const components: Record<string, Component> = {
Roguelike: Rogue,
Mall: Mall,
Shutdown: Shutdown,
ReclamationAlgorithm: ReclamationAlgorithm,
}
export default defineComponent({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<script setup lang="ts">
import { NButton, NCheckbox, NFormItem, NSelect } from 'naive-ui'
import { inject, ref } from 'vue'
import type { GetConfig } from './types'
const showModal = ref(false)
type RAConfig = GetConfig<'ReclamationAlgorithm'>
const props = defineProps<{
configurations: RAConfig
taskIndex: number
}>()
const updateTaskConfigurations = inject('update:configuration') as (
key: string,
value: any,
index: number
) => void
const configurationDisabled = inject('configurationDisabled') as {
re: boolean
nre: boolean
}
function handleUpdateConfiguration(key: string, value: any) {
updateTaskConfigurations(key, value, props.taskIndex)
}
const modeOptions = [
{
label: '刷分与建造点,进入战斗直接退出',
value: 0,
},
{
label: '刷赤金,联络员买水后基地锻造',
value: 1,
},
]
</script>

<template>
<div class="configuration-form">
<NFormItem
label="模式"
size="small"
label-align="left"
label-placement="left"
:show-feedback="false"
>
<NSelect
:disabled="configurationDisabled.re"
:value="props.configurations.mode"
:options="modeOptions"
@update:value="value => handleUpdateConfiguration('mode', value)"
/>
</NFormItem>
</div>
</template>

<style lang="less" scoped>
.mall-configuration {
text-align: left;
}
.item-group {
display: flex;
align-items: center;
}
</style>
1 change: 1 addition & 0 deletions packages/renderer/src/components/Task/results/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Game from './Game.vue'
import Infrast from './Infrast.vue'
import Mall from './Mall.vue'
import NoProgress from './NoProgress.vue'
import ReclamationAlgorithm from './ReclamationAlgorithm.vue'
import Recruit from './Recruit.vue'
import Rogue from './Rogue.vue'
import Shutdown from './Shutdown.vue'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<div>Shutdown Task Progress</div>
</template>
14 changes: 14 additions & 0 deletions packages/renderer/src/hooks/events/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,20 @@ export default function useCallbackEvents(): void {
deviceStore.updateDeviceStatus(uuid, 'disconnected')
break
}
case 'ConnectFailed': {
// FIXME: 这个事件中uuid是空字符串
// if (messages[uuid]) {
// messages[uuid].destroy()
// }
// const device = deviceStore.getDevice(uuid)
switch (data.why) {
case 'ConfigNotFound': {
showMessage(`不支持的设备配置`, { type: 'error', duration:0, closable:true }, true)
// deviceStore.updateDeviceStatus(uuid, 'disconnected')
break
}
}
}
default:
break
}
Expand Down
1 change: 1 addition & 0 deletions packages/renderer/src/store/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const useDeviceStore = defineStore<'device', DeviceState, {}, DeviceAction>('dev
origin.address = device.address
// origin.displayName = device.displayName
origin.commandLine = device.commandLine
origin.config = device.config ?? 'General'
}
}
},
Expand Down
24 changes: 12 additions & 12 deletions packages/renderer/src/store/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type NoTemplateTask =
| 'SSSCopilot'
| 'Depot'
| 'OperBox'
| 'ReclamationAlgorithm'
| 'Custom'
| 'SingleStep'
| 'VideoRecognition'
Expand Down Expand Up @@ -189,17 +188,17 @@ export const taskTemplate: {
},
results: {},
},
// ReclamationAlgorithm: {
// name: 'ReclamationAlgorithm',
// task_id: -1,
// title: '生息演算',
// status: 'idle',
// enable: false,
// configurations: {
// mode: 0
// },
// results: {}
// }
ReclamationAlgorithm: {
name: 'ReclamationAlgorithm',
task_id: -1,
title: '生息演算',
status: 'idle',
enable: false,
configurations: {
mode: 0
},
results: {}
}
}

function hasTemplate(task_name: Task['name']): task_name is Exclude<Task['name'], NoTemplateTask> {
Expand All @@ -218,6 +217,7 @@ const defaultTaskConf: typeof taskTemplate = {
Award: _.cloneDeep(taskTemplate.Award),
Roguelike: _.cloneDeep(taskTemplate.Roguelike),
Shutdown: _.cloneDeep(taskTemplate.Shutdown),
ReclamationAlgorithm: _.cloneDeep(taskTemplate.ReclamationAlgorithm)
}

export const defaultTask = Object.values(defaultTaskConf)
Expand Down
1 change: 1 addition & 0 deletions packages/types/device/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ export interface NativeDevice {
adbPath?: string
tag?: string
commandLine?: string
config?: EmulatorName
}
1 change: 1 addition & 0 deletions packages/types/game/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type * from './infrast'
export type * from './recruit'
export type * from './rogue'
export * from './rogue'
export type * from './reclamation_algorithm'

export type ClientType = 'Official' | 'Bilibili' | 'txwy' | 'YoStarEN' | 'YoStarJP' | 'YoStarKR'
// 客户端资源类型, b服和官服都是CN
Expand Down
4 changes: 4 additions & 0 deletions packages/types/game/reclamation_algorithm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export type ReclamationAlgorithmType = 0 | 1
// 模式,可选项。默认 0
// 0 - 刷分与建造点,进入战斗直接退出
// 1 - 刷赤金,联络员买水后基地锻造
6 changes: 5 additions & 1 deletion packages/types/task/callbackInfo/ConnectionInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
type ConnectFailedWhy = 'ConfigNotFound' | 'Connection command failed to exec' | 'Uuid command failed to exec' | 'Display command failed to exec' | 'ConfigNotFound'

export type ConnectionInfoMapper = {
Reconnecting: {
why: ''
Expand All @@ -22,7 +24,7 @@ export type ConnectionInfoMapper = {
}
}
ConnectFailed: {
why: string // "ConfigNotFound" | "Connection command failed to exec" | "Uuid command failed to exec" | "Display command failed to exec"
why: ConnectFailedWhy
details: {
adb: string
address: string
Expand Down Expand Up @@ -89,11 +91,13 @@ export type ConnectionInfoMapper = {
height: number
}
}

}

type ConnectionInfoWhat = keyof ConnectionInfoMapper

type ConnectionInfoCallbackTemplate<What extends ConnectionInfoWhat> = {
why?: ConnectionInfoMapper[What]['why']
uuid: string
what: What
}
Expand Down
9 changes: 5 additions & 4 deletions packages/types/task/mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
Facility,
MizukiSquadType,
PhantomSquadType,
ReclamationAlgorithmType,
RolesType,
Server,
} from '@type/game'
Expand Down Expand Up @@ -122,10 +123,6 @@ export type CoreTaskObjectMapper = {
OperBox: {
enable?: boolean
}
ReclamationAlgorithm: {
enable?: boolean
mode: 0 | 1
}
Custom: {
enable?: boolean
task_names: string[]
Expand Down Expand Up @@ -153,6 +150,10 @@ export type CoreTaskObjectMapper = {
enable?: boolean
filename: string
}
ReclamationAlgorithm: {
enable?: boolean
mode: ReclamationAlgorithmType
}
// Debug?
}

Expand Down

0 comments on commit 60eded1

Please sign in to comment.