0.0.19 • Published 3 years ago

zsqy-cold-site v0.0.19

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

#Cold-Site

一.Function

1.Library

export interface ILus {

  • 初始化
  • @param success:初始化成功回调事件
  • @param fail :初始化失败回调事件
  • Initialize(success: () => void, fail: () => void): void;

  • 启动

  • Launch(): IOperation;

  • 释放

  • Release(): void;

}

2.Congig

export interface IConfig {

  • 画布 id
  • elementId: string,

  • 事件

  • event: IEvent

  • 远端服务器地址

  • url: string,

  • 项目名称

  • projectName: string

  • 质量设置

  • quality: IQuality

  • 性能检查面板

  • usestats: boolean

    }

2.1 质量设置

export interface IQuality {

  • 启用动画
  • useanimation:boolean

  • 启用阴影效果

  • useshadow: boolean

    }

3.Operation

export interface IOperation {

  • 刷新数据
  • Refresh(): void

}

4.Event

export interface IEvent {

  • 引擎准备完毕回调
  • onReady(): void;

  • 点击模型事件回调

  • @param id 设备编号
  • @param name 设备名称
  • @param type 设备类型
  • onClickModelObservable(data: { id: number, name: string, type: number }): void;

  • //点击 UI 事件回调

  • @param id 设备编号
  • @param name 设备名称
  • @param type 设备类型
  • onClickSpriteObservable(data: { id: number, name: string, type: number }): void;

}

二.Sample-React

import { Instantiate, ILus, IOperation } from 'zsqy-cold-site';

...

let lus = Instantiate({
    elementId: "RenderCanvas",
    url: "http://X.XXX.XX.XXX:XXXX",
    projectName: "XXXXX",
    usestats: true,
    quality: {
      useshadow: false,
      useanimation: true,
      useadaptToDeviceRatio: true
    },
  ev
    event: {
    onReady: () => {
        console.log("场景配置完成")
            //拉取网络-刷新数据
            let op = this.state.op;
            if (op != null) {
            op.Refresh();
            }
        },
        onClickSpriteObservable: (data) => {
            //console.log(data);
        },
        onClickModelObservable: (data) => {
            //console.log(data);
        },
        }
    });

lus.Initialize(
  () => {
    this.setState({ op: lus.Launch() })
  },
  () => {
    console.log("初始化失败!");
  }
);

...

render() {
        return (<div>
               <div id="Stats-output"></div>
                < canvas id="RenderCanvas" />
                </div>)
        }

...

0.0.19

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago