123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { _decorator, Component, sys } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('loading_view_auth')
- export class loading_view_auth extends Component {
- private m_cb = null
- start() {
- if(sys.platform != sys.Platform.WECHAT_GAME) {
- return
- }
-
- const windowInfo = wx.getWindowInfo()
- // console.log('windowInfo=',windowInfo)
- let bili = 1920 / windowInfo.screenHeight
- let width = 100
- let height = 35
- let left = windowInfo.screenWidth / 2 - width / 2
- let top = windowInfo.screenHeight / 2 + height / 2 + (90 / bili)
- let button = wx.createUserInfoButton({
- type: 'text',
- text: '允 许',
- style: {
- left: left,
- top: top,
- width: width,
- height: height,
- backgroundColor: '#3ADA62',
- color: '#ffffff',
- textAlign: 'center',
- borderRadius:4,
- fontSize: 17,
- lineHeight: height,
- }
- })
- button.onTap((res) => {
- // console.log('button_res=',res)
- button.destroy()
- if(this.m_cb) {
- this.m_cb()
- }
- })
- }
- initView(cb) {
- this.m_cb = cb
- }
- }
|