[suggestion] Simulate cocconJS prompt on preview

Discussion and feedback on Construct 2

Post » Thu May 29, 2014 2:03 pm

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:
Code: Select all
    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_);
        }
    };


What dya think?
B
68
S
22
G
14
Posts: 1,485
Reputation: 16,561

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests