[suggestion] Simulate cocconJS prompt on preview

0 favourites
  • 1 posts
  • Hi Ashley,

    I'm working on a game using cocoonjs, and I had to use the CocoonJS.PromptKeyboard action.

    It's all working well on the device, but when testing on the computer basically nothing happens. Which is the expected behavior. But I think it would be nice to emulate this part like this:

        Acts.prototype.PromptKeyboard = function (title_, message_, initial_, type_, canceltext_, oktext_)
        {
            if(typeof cr_is_preview !== "undefined") {
                var text = prompt(message_, initial_); // maybe something to allow the layout to refresh before calling the prompt since it's blocking whereas the cocoon prompt isn't
                if(text !== null) {
                    input_text = text;
                    this.runtime.trigger(cr.plugins_.CJSAds.prototype.cnds.OnKeyboardOK, this);
                } else {
                    this.runtime.trigger(cr.plugins_.CJSAds.prototype.cnds.OnKeyboardCancelled, this);
                }
            } else {
    
                // original code
                if (!this.runtime.isCocoonJs)
                    return;
                
                var typestr = ["text", "num", "phone", "email", "url"][type_];
                
                CocoonJS["App"]["showTextDialog"](title_, message_, initial_, typestr, canceltext_, oktext_);
            }
        };
    [/code:2w354z8b]
    
    What dya think?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)