[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> = [
|
export const FakeDroneListInfo: Array<IDroneInfo> = [
|
||||||
{
|
{
|
||||||
@@ -94,3 +94,100 @@ export const FakeDroneDetail: Array<IDroneLocationInfo> = [
|
|||||||
locationE: `3'3'1.2""`
|
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 { Drone_Event } from "./define/Event";
|
||||||
import BaseComp from "./external/BaseComp";
|
import BaseComp from "./external/BaseComp";
|
||||||
import { FakeDroneDetail, FakeDroneListInfo } from "./FakeData";
|
import { FakeDroneDetail, FakeDroneDetailValue, FakeDroneListInfo, FakeWeatherValue } from "./FakeData";
|
||||||
const { ccclass, property } = cc._decorator;
|
const { ccclass, property } = cc._decorator;
|
||||||
|
|
||||||
@ccclass
|
@ccclass
|
||||||
@@ -9,6 +9,14 @@ export default class TestFakeData extends BaseComp {
|
|||||||
protected onLoad(): void {
|
protected onLoad(): void {
|
||||||
console.log('ken666::TestFakeData::onLoad()')
|
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())
|
cc.tween(new cc.Node())
|
||||||
.delay(3)
|
.delay(3)
|
||||||
.call(() => {
|
.call(() => {
|
||||||
@@ -18,10 +26,18 @@ export default class TestFakeData extends BaseComp {
|
|||||||
.start()
|
.start()
|
||||||
|
|
||||||
cc.tween(new cc.Node())
|
cc.tween(new cc.Node())
|
||||||
.delay(1)
|
.delay(3)
|
||||||
.call(() => {
|
.call(() => {
|
||||||
console.log('ken666::delay3 send Drone_Event.DRONE_DETAIL')
|
console.log('ken666::delay3 send Drone_Event.DRONE_DETAIL_VALUE')
|
||||||
this.emit(Drone_Event.DRONE_DETAIL, FakeDroneDetail)
|
this.emit(Drone_Event.DRONE_DETAIL_VALUE, FakeDroneDetailValue)
|
||||||
|
})
|
||||||
|
.start()
|
||||||
|
|
||||||
|
cc.tween(new cc.Node())
|
||||||
|
.delay(3)
|
||||||
|
.call(() => {
|
||||||
|
console.log('ken666::delay3 send Drone_Event.WEATHER')
|
||||||
|
this.emit(Drone_Event.WEATHER, FakeWeatherValue)
|
||||||
})
|
})
|
||||||
.start()
|
.start()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
export enum Drone_Event {
|
export enum Drone_Event {
|
||||||
DRONE_LIST = "DRONE_LIST",
|
DRONE_LIST = "DRONE_LIST",
|
||||||
DRONE_CLICK = "DRONE_CLICK",
|
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
|
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 {
|
// export interface IRespose {
|
||||||
// success: boolean
|
// success: boolean
|
||||||
// msg: string
|
// msg: string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Drone_Event } from "../define/Event";
|
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 EmitterBase from "../external/EmitterBase";
|
||||||
import { Utils } from "../external/Utils";
|
import { Utils } from "../external/Utils";
|
||||||
import { makeAutoObservable } from "../Library/mobx/mobx";
|
import { makeAutoObservable } from "../Library/mobx/mobx";
|
||||||
@@ -15,10 +15,14 @@ export class CommonModel extends EmitterBase {
|
|||||||
|
|
||||||
droneInfo: Array<IDroneInfo> = []
|
droneInfo: Array<IDroneInfo> = []
|
||||||
droneDetail: Array<IDroneLocationInfo> = []
|
droneDetail: Array<IDroneLocationInfo> = []
|
||||||
|
droneDetailValue: Array<IDroneDetailValueInfo> = []
|
||||||
|
weather: IDroneWeatherValueInfo = null
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.on(Drone_Event.DRONE_LIST, this.setDrone.bind(this))
|
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.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)
|
makeAutoObservable(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,6 +37,16 @@ export class CommonModel extends EmitterBase {
|
|||||||
console.log('setDroneDetail')
|
console.log('setDroneDetail')
|
||||||
this.droneDetail = Utils.deepClone(droneDetail)
|
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() {
|
// async init() {
|
||||||
// const response = await httpSender.sendGet<IRespose>('/api/front/index/init', { deviceType: DeviceTypeCode[Common.curSkin] })
|
// const response = await httpSender.sendGet<IRespose>('/api/front/index/init', { deviceType: DeviceTypeCode[Common.curSkin] })
|
||||||
// if (response && response.success) {
|
// if (response && response.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user