コード例 #1
0
        public void FinishedLoading(string url)
        {
            string command  = "";
            string command2 = "var div = document.createElement('div'); div.style.zIndex = 1000002; div.style.position = 'absolute'; div.style.height = '100vh'; div.style.width = '100vw'; div.style.backgroundColor = 'white'; document.body.insertBefore(div, document.body.childNodes[0]);div.id = 'loadingDiv';";

            InAppBrowser.ExecuteJS(command2);
            if (stepInGame == 0)
            {
                StartCoroutine(CreateGame());
                // command = "var interval1 = setInterval(function(){ try { document.getElementsByClassName('Landing__cta CreateGame')[0].click(); console.log('worked1'); clearInterval(interval1);} catch { console.log('timeout1');}; }, 100);";
                // InAppBrowser.ExecuteJS("console.log('here');");
                // command = "document.getElementsByClassName('Landing__cta CreateGame')[0].click();";
                stepInGame++;
            }
            else if (stepInGame == 1)
            {
                command = "var interval = setInterval(function(){ try { document.getElementsByClassName('MenuBar')[0].style.display = 'None'; document.getElementsByClassName('ToolBoxToast')[0].style.display = 'None'; document.getElementsByClassName('prettyButton')[0].click(); document.getElementById('loadingDiv').style.display = 'none'; console.log('worked'); " + navigationJSV2 + " clearInterval(interval);} catch { console.log('timeout');}; }, 10);";
                stepInGame--;
                string gameCode = url.Split('/')[url.Split('/').Length - 1];
                character.SetGame(currentGameName, gameCode);
                // get from the url the game code
                // we need to set the collider from the beggining -> we use prc to send to our other characterScript instances that we are on a game - with a game name
                // when we collider with another characterscript we check if they are in game and their game name and their code. We enable button to join and then we join
            }
            InAppBrowser.ExecuteJS(command);
        }
コード例 #2
0
        IEnumerator CreateGame()
        {
            yield return(new WaitForSeconds(1.5f));

            string command = "var interval1 = setInterval(function(){ try { document.getElementsByClassName('Landing__cta CreateGame')[0].click(); console.log('worked1'); clearInterval(interval1);} catch { console.log('timeout1');}; }, 10);";

            InAppBrowser.ExecuteJS(command);
        }
コード例 #3
0
 void OnMessageFromJS(string jsMessage)
 {
     if (jsMessage.Equals("ping"))
     {
         Debug.Log("Ping message received!");
         InAppBrowser.ExecuteJS(javaScriptCode);
     }
 }
コード例 #4
0
 //Listener : check if webstrate page is loaded
 void OnMessageFromJS(string jsMessage)
 {
     if (jsMessage.Equals("pageLoaded"))
     {
         Debug.Log("PageLoaded message received!");
         InAppBrowser.ExecuteJS(javaScriptString);
         ui.Hide(screenshotPreview);
     }
 }