[Update]增加多的假資料
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IDroneInfo, IDroneLocationInfo } from "./define/Interface";
|
||||
import { IDroneDetailValueInfo, IDroneInfo, IDroneLocationInfo, IDroneWeatherValueInfo } from "./define/Interface";
|
||||
|
||||
export const FakeDroneListInfo: Array<IDroneInfo> = [
|
||||
{
|
||||
@@ -94,3 +94,100 @@ export const FakeDroneDetail: Array<IDroneLocationInfo> = [
|
||||
locationE: `3'3'1.2""`
|
||||
},
|
||||
]
|
||||
|
||||
export const FakeDroneDetailValue: Array<IDroneDetailValueInfo> = [
|
||||
{
|
||||
id: 'Fly-A',
|
||||
high: '60公分',
|
||||
speed: '20m/s',
|
||||
acceleration: '1m/s',
|
||||
direction: '東南',
|
||||
pitch: 'J三小窩不知道peko',
|
||||
yaw: 'J三小窩不知道peko',
|
||||
roll: '45 degree',
|
||||
mode: 'auto'
|
||||
},
|
||||
{
|
||||
id: 'Fly-B',
|
||||
high: '6公尺',
|
||||
speed: '80m/s',
|
||||
acceleration: '2m/s',
|
||||
direction: '西北',
|
||||
pitch: 'J三小窩不知道peko',
|
||||
yaw: 'J三小窩不知道peko',
|
||||
roll: '90 degree',
|
||||
mode: 'manual'
|
||||
},
|
||||
{
|
||||
id: 'Fly-C',
|
||||
high: '30公分',
|
||||
speed: '7m/s',
|
||||
acceleration: '0.52m/s',
|
||||
direction: '南',
|
||||
pitch: 'J三小窩不知道peko',
|
||||
yaw: 'J三小窩不知道peko',
|
||||
roll: '33.33 degree',
|
||||
mode: 'loiter'
|
||||
},
|
||||
{
|
||||
id: 'Fly-D',
|
||||
high: '73公分',
|
||||
speed: '13m/s',
|
||||
acceleration: '0.8m/s',
|
||||
direction: '北北東',
|
||||
pitch: 'J三小窩不知道peko',
|
||||
yaw: 'J三小窩不知道peko',
|
||||
roll: '20 degree',
|
||||
mode: 'attitude'
|
||||
},
|
||||
{
|
||||
id: 'Fly-E',
|
||||
high: '30公尺',
|
||||
speed: '40m/s',
|
||||
acceleration: '8m/s',
|
||||
direction: '西',
|
||||
pitch: 'J三小窩不知道peko',
|
||||
yaw: 'J三小窩不知道peko',
|
||||
roll: '60 degree',
|
||||
mode: 'manual'
|
||||
},
|
||||
{
|
||||
id: 'Fly-F',
|
||||
high: '100公分',
|
||||
speed: '6.6m/s',
|
||||
acceleration: '3m/s',
|
||||
direction: '南',
|
||||
pitch: 'J三小窩不知道peko',
|
||||
yaw: 'J三小窩不知道peko',
|
||||
roll: '22.5 degree',
|
||||
mode: 'auto'
|
||||
},
|
||||
{
|
||||
id: 'Fly-G',
|
||||
high: '300公尺',
|
||||
speed: '200m/s',
|
||||
acceleration: '10m/s',
|
||||
direction: '北',
|
||||
pitch: 'J三小窩不知道peko',
|
||||
yaw: 'J三小窩不知道peko',
|
||||
roll: '0 degree',
|
||||
mode: 'auto'
|
||||
},
|
||||
{
|
||||
id: 'Fly-H',
|
||||
high: '45公分',
|
||||
speed: '0.8m/s',
|
||||
acceleration: '0.02m/s',
|
||||
direction: '南南西',
|
||||
pitch: 'J三小窩不知道peko',
|
||||
yaw: 'J三小窩不知道peko',
|
||||
roll: '10 degree',
|
||||
mode: 'attitude'
|
||||
}
|
||||
]
|
||||
|
||||
export const FakeWeatherValue: IDroneWeatherValueInfo = {
|
||||
atmosphericPressure: '1.2',
|
||||
windDirection: '西北',
|
||||
windSpeed: '20km/s'
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Drone_Event } from "./define/Event";
|
||||
import BaseComp from "./external/BaseComp";
|
||||
import { FakeDroneDetail, FakeDroneListInfo } from "./FakeData";
|
||||
import { FakeDroneDetail, FakeDroneDetailValue, FakeDroneListInfo, FakeWeatherValue } from "./FakeData";
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
@@ -9,21 +9,37 @@ export default class TestFakeData extends BaseComp {
|
||||
protected onLoad(): void {
|
||||
console.log('ken666::TestFakeData::onLoad()')
|
||||
|
||||
cc.tween(new cc.Node())
|
||||
.delay(1)
|
||||
.call(() => {
|
||||
console.log('ken666::delay3 send Drone_Event.DRONE_DETAIL')
|
||||
this.emit(Drone_Event.DRONE_DETAIL, FakeDroneDetail)
|
||||
})
|
||||
.start()
|
||||
|
||||
cc.tween(new cc.Node())
|
||||
.delay(3)
|
||||
.call(() => {
|
||||
console.log('ken666::delay3 send Drone_Event.DRONE_LIST')
|
||||
this.emit(Drone_Event.DRONE_LIST, FakeDroneListInfo)
|
||||
})
|
||||
.start()
|
||||
.start()
|
||||
|
||||
cc.tween(new cc.Node())
|
||||
.delay(1)
|
||||
cc.tween(new cc.Node())
|
||||
.delay(3)
|
||||
.call(() => {
|
||||
console.log('ken666::delay3 send Drone_Event.DRONE_DETAIL')
|
||||
this.emit(Drone_Event.DRONE_DETAIL, FakeDroneDetail)
|
||||
console.log('ken666::delay3 send Drone_Event.DRONE_DETAIL_VALUE')
|
||||
this.emit(Drone_Event.DRONE_DETAIL_VALUE, FakeDroneDetailValue)
|
||||
})
|
||||
.start()
|
||||
.start()
|
||||
|
||||
cc.tween(new cc.Node())
|
||||
.delay(3)
|
||||
.call(() => {
|
||||
console.log('ken666::delay3 send Drone_Event.WEATHER')
|
||||
this.emit(Drone_Event.WEATHER, FakeWeatherValue)
|
||||
})
|
||||
.start()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
export enum Drone_Event {
|
||||
DRONE_LIST = "DRONE_LIST",
|
||||
DRONE_CLICK = "DRONE_CLICK",
|
||||
DRONE_DETAIL = "DRONE_DETAIL"
|
||||
DRONE_DETAIL = "DRONE_DETAIL",
|
||||
DRONE_DETAIL_VALUE = "DRONE_DETAIL_VALUE",
|
||||
WEATHER = 'WEATHER'
|
||||
}
|
||||
@@ -11,6 +11,24 @@ export interface IDroneLocationInfo {
|
||||
locationE: string
|
||||
}
|
||||
|
||||
export interface IDroneDetailValueInfo {
|
||||
id: string
|
||||
high: string
|
||||
speed: string
|
||||
acceleration: string
|
||||
direction: string
|
||||
pitch: string
|
||||
yaw: string
|
||||
roll: string
|
||||
mode: string
|
||||
}
|
||||
|
||||
export interface IDroneWeatherValueInfo {
|
||||
atmosphericPressure: string
|
||||
windDirection: string
|
||||
windSpeed: string
|
||||
}
|
||||
|
||||
// export interface IRespose {
|
||||
// success: boolean
|
||||
// msg: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Drone_Event } from "../define/Event";
|
||||
import { IDroneInfo, IDroneLocationInfo } from "../define/Interface";
|
||||
import { IDroneDetailValueInfo, IDroneInfo, IDroneLocationInfo, IDroneWeatherValueInfo } from "../define/Interface";
|
||||
import EmitterBase from "../external/EmitterBase";
|
||||
import { Utils } from "../external/Utils";
|
||||
import { makeAutoObservable } from "../Library/mobx/mobx";
|
||||
@@ -15,10 +15,14 @@ export class CommonModel extends EmitterBase {
|
||||
|
||||
droneInfo: Array<IDroneInfo> = []
|
||||
droneDetail: Array<IDroneLocationInfo> = []
|
||||
droneDetailValue: Array<IDroneDetailValueInfo> = []
|
||||
weather: IDroneWeatherValueInfo = null
|
||||
constructor() {
|
||||
super();
|
||||
this.on(Drone_Event.DRONE_LIST, this.setDrone.bind(this))
|
||||
this.on(Drone_Event.DRONE_DETAIL, this.setDroneDetail.bind(this))
|
||||
this.on(Drone_Event.DRONE_DETAIL, this.setDroneDetailValue.bind(this))
|
||||
this.on(Drone_Event.DRONE_DETAIL, this.setWeather.bind(this))
|
||||
makeAutoObservable(this)
|
||||
}
|
||||
|
||||
@@ -33,6 +37,16 @@ export class CommonModel extends EmitterBase {
|
||||
console.log('setDroneDetail')
|
||||
this.droneDetail = Utils.deepClone(droneDetail)
|
||||
}
|
||||
|
||||
private setDroneDetailValue(droneDetailValue: Array<IDroneDetailValueInfo>) {
|
||||
console.log('setDroneDetail')
|
||||
this.droneDetailValue = Utils.deepClone(droneDetailValue)
|
||||
}
|
||||
|
||||
private setWeather(weather: IDroneWeatherValueInfo) {
|
||||
console.log('setDroneDetail')
|
||||
this.weather = Utils.deepClone(weather)
|
||||
}
|
||||
// async init() {
|
||||
// const response = await httpSender.sendGet<IRespose>('/api/front/index/init', { deviceType: DeviceTypeCode[Common.curSkin] })
|
||||
// if (response && response.success) {
|
||||
|
||||
Reference in New Issue
Block a user