Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: Can't get onopen function! && CustomEvent is not defined #1

Open
consolevn opened this issue Sep 17, 2022 · 1 comment
Open

iOS: Can't get onopen function! && CustomEvent is not defined #1

consolevn opened this issue Sep 17, 2022 · 1 comment

Comments

@consolevn
Copy link

consolevn commented Sep 17, 2022

@endel 11:37:08 [DEBUG]: D/ JS: Input Initialized!
11:37:08 [INFO]: builtin-standard|standard-vs|standard-fs|CC_RECEIVE_SHADOW1|CC_USE_FOG4|CC_USE_ACCURATE_FOG0|CC_SUPPORT_CASCADED_SHADOW_MAP1|CC_USE_DEBUG_VIEW0|CC_SHADOWMAP_FORMAT0|CC_SHADOWMAP_USE_LINEAR_DEPTH0|CC_USE_IBL0|CC_USE_DIFFUSEMAP0|CC_IBL_CONVOLUTED0|CC_USE_HDR1|CC_PIPELINE_TYPE0 compile succeed.
11:37:09 [INFO]: builtin-standard|standard-vs|standard-fs|CC_RECEIVE_SHADOW1|CC_USE_FOG4|CC_USE_ACCURATE_FOG0|CC_SUPPORT_CASCADED_SHADOW_MAP1|CC_FORWARD_ADD1|CC_USE_DEBUG_VIEW0|CC_SHADOWMAP_FORMAT0|CC_SHADOWMAP_USE_LINEAR_DEPTH0|CC_USE_IBL0|CC_USE_DIFFUSEMAP0|CC_IBL_CONVOLUTED0|CC_USE_HDR1|CC_PIPELINE_TYPE0 compile succeed.
11:37:09 [INFO]: builtin-standard|shadow-caster-vs:vert|shadow-caster-fs:frag|CC_RECEIVE_SHADOW1|CC_SUPPORT_CASCADED_SHADOW_MAP1|CC_SHADOWMAP_USE_LINEAR_DEPTH0|CC_SHADOWMAP_FORMAT0 compile succeed.
11:37:09 [INFO]: pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag compile succeed.
11:37:09 [INFO]: pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag|CC_RECEIVE_SHADOW1 compile succeed.
11:37:09 [INFO]: pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag|USE_INSTANCING1 compile succeed.
11:37:09 [INFO]: pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag|USE_INSTANCING1|CC_RECEIVE_SHADOW1 compile succeed.
11:37:09 [INFO]: builtin-standard|standard-vs|standard-fs|CC_USE_FOG4|CC_USE_ACCURATE_FOG0|CC_SUPPORT_CASCADED_SHADOW_MAP1|CC_USE_DEBUG_VIEW0|CC_SHADOWMAP_FORMAT0|CC_SHADOWMAP_USE_LINEAR_DEPTH0|CC_USE_IBL0|CC_USE_DIFFUSEMAP0|CC_IBL_CONVOLUTED0|CC_USE_HDR1|CC_PIPELINE_TYPE0|CC_FORCE_FORWARD_SHADING1 compile succeed.
11:37:09 [DEBUG]: D/ XMLHttpRequest_finalize, 0x7f946830df80 ...

11:37:09 [ERROR]: [SE_ERROR] (/Applications/CocosCreator/Creator/3.6.0/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/bindings/manual/jsb_websocket.cpp, 98): Can't get onopen function!
11:37:09 [DEBUG]: D/ JS: [ERROR]: Error attempting to consume seat reservation - ReferenceError: CustomEvent is not defined
11:37:09 [INFO]: builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add|CC_RENDER_MODE0|CC_INSTANCE_PARTICLE1|CC_USE_WORLD_SPACE1|ROTATION_OVER_TIME_MODULE_ENABLE0 compile succeed.
11:37:09 [INFO]: builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add|CC_RENDER_MODE0|CC_INSTANCE_PARTICLE1|CC_USE_WORLD_SPACE0|ROTATION_OVER_TIME_MODULE_ENABLE0 compile succeed.
Program ended with exit code: 9

@consolevn
Copy link
Author

  • Edit assets/Cocos-MMO/Scripts/Helpers/EventDispatcher.ts
import { EventTarget } from "cc";
export class EventDispatcher<T = void> extends EventTarget {

    private _eventName: string;

    constructor(eventName: string) {
        super();

        this._eventName = eventName;
    }

    public invoke(eventData: T) {

        console.log(`Event Dispatcher - Invoke Event - \"${this._eventName}\" with data: `, eventData);

        this.emit(this._eventName, {detail: eventData});
    }
}

Change all function
addEventListener to on
Example:
ChatManager.Instance.onQueueAdded.addEventListener('onQueueAdded', this.onQueueAdded); ---> ChatManager.Instance.onQueueAdded.on('onQueueAdded', this.onQueueAdded);

Chang all function
removeEventListener to off
Example:
ChatManager.Instance.onQueueAdded.removeEventListener('onQueueAdded', this.onQueueAdded); ---> ChatManager.Instance.onQueueAdded.off('onQueueAdded', this.onQueueAdded);

It worked on iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant