Ejemplo n.º 1
0
    public void JoinGame()
    {
        RoomInfo[] rooms = PhotonNetwork.GetRoomList();

        if (rooms.Length == 0)
        {
            Debug.Log("Room dos not exist");
        }
        else
        {
            foreach (RoomInfo room in rooms)
            {
                if (JoinedRoomName.text.Equals(room.Name))
                {
                    if (room.PlayerCount < room.MaxPlayers)
                    {
                        Debug.Log(room.PlayerCount);
                        currentroom.gameObject.SetActive(true);
                        menufindagame.gameObject.SetActive(false);
                        backbtn.gameObject.SetActive(false);
                        PhotonNetwork.JoinRoom(room.Name);
                    }
                    else
                    {
                        AndroidNativeFunctions.ShowToast("Room in max players !");
                        Debug.Log("Room in max players: " + room.PlayerCount);
                    }
                }
                else
                {
                    Debug.Log("Room dos not exist");
                }
            }
        }
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (buffer)
         {
             Application.Quit();
         }
         else
         {
             AndroidNativeFunctions.ShowToast("Press again to exit");
             buffer = true;
             StartCoroutine(bufferTime());
         }
     }
     if (Input.touches.Length > 1)
     {
         Globals.paused = false;
         pauseBtn.image.overrideSprite = null;
     }
     if (Globals.paused)
     {
         pauseBtn.image.overrideSprite = resumeSprite;
     }
     else
     {
         pauseBtn.image.overrideSprite = null;
     }
 }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     if (PlayerPrefs.GetInt("kill") == 1)
     {
         AndroidNativeFunctions.ShowToast("You Lost ! Please remove your headset");
         PlayerPrefs.SetInt("kill", 0);
     }
 }
Ejemplo n.º 4
0
    private void FailCapturePhoto(string msg)
    {
#if PLATFORM_ANDROID
        AndroidNativeFunctions.ShowToast(msg);
#endif
        uiToBeHidden.SetActive(true);
        uiToBeHidden2.SetActive(true);
        uiToBeHidden3.SetActive(true);
        uiToBeShown.SetActive(false);
    }
Ejemplo n.º 5
0
    private void SuccessCapturePhoto(string msg)
    {
#if PLATFORM_ANDROID
        AndroidNativeFunctions.ShowToast("Photo Saved to Gallery");
#endif
        uiToBeHidden.SetActive(true);
        uiToBeHidden2.SetActive(true);
        uiToBeHidden3.SetActive(true);
        uiToBeShown.SetActive(false);
    }
Ejemplo n.º 6
0
 public void ShowInterstitial()
 {
     if (this.interstitial.IsLoaded())
     {
         this.interstitial.Show();
     }
     else
     {
         AndroidNativeFunctions.ShowToast("Interstitial is not ready yet");
     }
 }
Ejemplo n.º 7
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape) && exit == true)
     {
         Application.Quit();
     }
     else if (Input.GetKeyDown(KeyCode.Escape) && exit == false)
     {
         exit = true;
         AndroidNativeFunctions.ShowToast("Press back button again to exit");
         StartCoroutine(cancelExit());
     }
 }
 public void FindInternetMatch()
 {
     if (matchNameJoinInput.text.Equals(""))
     {
         AndroidNativeFunctions.ShowToast("Please enter name of room");
         print("matchNameJoinInput + faragh");
     }
     else
     {
         lobbyManager.StartMatchMaker();
         lobbyManager.matchMaker.ListMatches(0, 10, matchNameJoinInput.text, true, 0, 0, lobbyManager.OnMatchList);
     }
 }
Ejemplo n.º 9
0
    void MovePlayer(Vector2 pos)
    {
        if (focus)
        {
            UnFocus();
        }
        StopCoroutine(StopMovement());
        StopCoroutine(Slash());
        StopCoroutine(Dash());
        // StopAllCoroutines();

        if (Player.GetComponent <PlayerAttribute>().EnoughStamina())
        {
            Player.GetComponent <PlayerAttribute>().Slash();
            bool tempIsRight = false;
            tempIsRight = (pos.x > Player.transform.position.x)?true:false;
            if (tempIsRight != isRight)
            {
                FlipPlayer();
            }

            DrawSlash(Player.GetComponent <PlayerAttribute>().PointSword.position, endPoint);
            Player.transform.position = endPoint;
            Player.GetComponent <PlayerAttribute>().CheckGroundManual();

            if (!Player.GetComponent <PlayerAttribute>().isGround)
            {
                StartCoroutine(StopMovement());
            }
            else
            {
                Rigidbody2D Rigid = Player.GetComponent <Rigidbody2D>();
                Player.GetComponent <PlayerAttribute>().gravityable = true;
                Rigid.constraints = RigidbodyConstraints2D.FreezeRotation;
            }

            if (enemy)
            {
                StartCoroutine(Slash());
            }
            else
            {
                StartCoroutine(Dash());
            }
        }
        else
        {
            AndroidNativeFunctions.ShowToast("Not Enough Stamina");
        }
    }
        public void OnClickCreateMatchmakingGame()
        {
            Debug.Log("Size selected" + roomSizeDropDown.value);
            switch (roomSizeDropDown.value)
            {
            case 0:
                roomSize = 8;
                break;

            case 1:
                roomSize = 10;
                break;

            case 2:
                roomSize = 12;
                break;

            case 3:
                roomSize = 14;
                break;
            }

            if (matchNameInput.text.Equals(""))
            {
                AndroidNativeFunctions.ShowToast("Please select Room Name");
                print("matchNameInput + faragh");
            }
            else
            {
                MenuFindAGame.SetActive(false);
                Debug.Log("CLICKED" + matchNameInput.text);
                Debug.Log("CLICKED" + roomSize);
                lobbyManager.StartMatchMaker();
                lobbyManager.matchMaker.CreateMatch(
                    matchNameInput.text,
                    (uint)roomSize,
                    true,
                    "", "", "", 0, 0,
                    lobbyManager.OnMatchCreate);

                lobbyManager.backDelegate   = lobbyManager.StopHost;
                lobbyManager._isMatchmaking = true;
                lobbyManager.DisplayIsConnecting();

                lobbyManager.SetServerInfo("Matchmaker Host", lobbyManager.matchHost);
                //NetManager.roomName = matchNameInput.text;
            }
        }
Ejemplo n.º 11
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (buffer)
         {
             Application.Quit();
         }
         else
         {
             AndroidNativeFunctions.ShowToast("Press again to exit");
             buffer = true;
             StartCoroutine(bufferTime());
         }
     }
 }
Ejemplo n.º 12
0
    public void Upgrade()
    {
        int poin = PlayerPrefs.GetInt("poin");

        if (poin > 0)
        {
            int level = PlayerPrefs.GetInt(key);
            PlayerPrefs.SetInt(key, level + 1);
            levelPoin.DecreesePoin();
            ShowLevel();
        }
        else
        {
            AndroidNativeFunctions.ShowToast("Not enough level poin");
        }
    }
Ejemplo n.º 13
0
 public void ClickPlay()
 {
     if (Application.internetReachability == NetworkReachability.NotReachable)
     {
         Debug.Log("Error. Check internet connection!");
         AndroidNativeFunctions.ShowToast("Please check your Internet connection!", false);
         //EditorUtility.DisplayDialog("Error", "Check internet connection!", "Ok");
     }
     else
     {
         menuplay.SetActive(true);
         bond.SetActive(true);
         play.SetActive(false);
         panel.SetActive(true);
         leaderboard.SetActive(false);
         options.SetActive(false);
     }
 }
Ejemplo n.º 14
0
 private void Update()
 {
     if (timeToCloseApp > (Time.time - 1.2f))
     {
         if (Input.GetKeyDown(KeyCode.Escape))
         {
             Application.Quit();
         }
     }
     else
     {
         if (Input.GetKeyDown(KeyCode.Escape))
         {
             timeToCloseApp = Time.time;
             AndroidNativeFunctions.ShowToast("double tab to exit app . . .", true);
         }
     }
 }
Ejemplo n.º 15
0
 public void OnClick_SelectBook()
 {
     if (TextButtonSelectBook.text.Equals("Delete this book"))
     {
         AndroidNativeFunctions.ShowAlert("This action will delete your book information and orther people can't acess it", "Remove book from SwapBook", "Sure", "Cancel", "", action => {
             if (action == DialogInterface.Positive)
             {
                 StartCoroutine(DeleteBookAPI(currentBookID.ToString(), callback => {
                     var TemList = new List <Transform>();
                     int x       = MarketPage.childCount;
                     for (int i = 0; i < x; i++)
                     {
                         TemList.Add(MyBookPage.GetChild(i));
                     }
                     for (int i = 0; i < x; i++)
                     {
                         Destroy(TemList[i].gameObject);
                     }
                     TemList.Clear();
                     x = MyBookSelectPage.childCount;
                     for (int i = 0; i < x; i++)
                     {
                         TemList.Add(MyBookSelectPage.GetChild(i));
                     }
                     for (int i = 0; i < x; i++)
                     {
                         Destroy(TemList[i].gameObject);
                     }
                     LoadBook();
                     UIManager.HideBookDetail();
                 }));
             }
         });
         return;
     }
     if (int.Parse(MyBookNumber.text) > 0)
     {
         UIManager.OnClick_Offer();
     }
     else
     {
         AndroidNativeFunctions.ShowToast("Your don't have any book to swap !");
     }
 }
Ejemplo n.º 16
0
 //PlayerName
 public void ChangeName()
 {
     if (PlayerName.text.Equals(""))
     {
         AndroidNativeFunctions.ShowToast("Name is required");
     }
     else if (PlayerName.text.Length < 4)
     {
         AndroidNativeFunctions.ShowToast("Name is too Short");
     }
     else
     {
         foreach (var item in l)
         {
             if (item.Equals(PlayerName.text))
             {
                 ok = false;
                 break;
             }
             else
             {
                 ok = true;
             }
         }
         if (!ok)
         {
             Debug.Log("Name already exist");
             AndroidNativeFunctions.ShowToast("Name already exist");
         }
         else
         {
             PhotonNetwork.playerName = PlayerName.text;
             nameplayer = PlayerName.text;
             GameObject lobbyCanvasObj = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;
             if (lobbyCanvasObj == null)
             {
                 return;
             }
             CurrentRoomCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <CurrentRoomCanvas>();
             lobbyCanvas.OnReadyButton();
         }
     }
 }
Ejemplo n.º 17
0
        public override void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
        {
            base.OnMatchList(success, extendedInfo, matches);
            if (success)
            {
                if (matches.Count != 0)
                {
                    //Debug.Log("A list of matches was returned");

                    //join the last server (just in case there are two...)
                    MenuFindAGame.SetActive(false);
                    LobbyManager.singleton.matchMaker.JoinMatch(matches[matches.Count - 1].networkId, "", "", "", 0, 0, OnMatchJoined);
                }
                else
                {
                    AndroidNativeFunctions.ShowToast("No matches in requested room!");
                    Debug.Log("No matches in requested room!");
                }
            }
            else
            {
                Debug.LogError("Couldn't connect to match maker");
            }
        }
Ejemplo n.º 18
0
 public void HandleAdLeftApplication(object sender, EventArgs args)
 {
     AndroidNativeFunctions.ShowToast("HandleAdLeftApplication event received");
 }
Ejemplo n.º 19
0
 public void HandleAdClosed(object sender, EventArgs args)
 {
     AndroidNativeFunctions.ShowToast("HandleAdClosed event received");
 }
Ejemplo n.º 20
0
 public void HandleAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
 {
     AndroidNativeFunctions.ShowToast("HandleFailedToReceiveAd event received with message: " + args.Message);
 }
Ejemplo n.º 21
0
 void ShowAlertAction(DialogInterface w)
 {
     AndroidNativeFunctions.ShowToast(w.ToString());
 }
Ejemplo n.º 22
0
    public void OnDone()
    {
        testdone = true;
        if (mainchamp == 3)
        {
            int x = PlayerPrefs.GetInt("c1");
            if (x == 0)
            {
                testdone = false;
            }
        }
        if (mainchamp == 4)
        {
            int xx = PlayerPrefs.GetInt("c2");
            if (xx == 0)
            {
                testdone = false;
            }
        }


        if (testdone)
        {
            Done.gameObject.SetActive(false);
            LobbyPanel.gameObject.SetActive(true);
            ChampionSelect.gameObject.SetActive(false);

            switch (mainchamp)
            {
            case 1:
                male_04.SetActive(true);
                female_03.SetActive(false);
                female_01.SetActive(false);
                male_03.SetActive(false);
                male_06.SetActive(false);
                break;

            case 0:
                male_04.SetActive(false);
                female_03.SetActive(false);
                female_01.SetActive(false);
                male_03.SetActive(true);
                male_06.SetActive(false);
                break;

            case 2:
                male_04.SetActive(false);
                female_03.SetActive(true);
                female_01.SetActive(false);
                male_03.SetActive(false);
                male_06.SetActive(false);
                break;

            case 3:
                male_04.SetActive(false);
                female_03.SetActive(false);
                female_01.SetActive(false);
                male_03.SetActive(false);
                male_06.SetActive(true);
                break;

            case 4:
                male_04.SetActive(false);
                female_03.SetActive(false);
                female_01.SetActive(true);
                male_03.SetActive(false);
                male_06.SetActive(false);
                break;
            }
        }
        else
        {
            AndroidNativeFunctions.ShowToast("You don't own this skin");
        }
    }
Ejemplo n.º 23
0
    void Window1()
    {
        if (GUI.Button(NewRect(5, 5, 40, 10), "Start App", style))
        {
            AndroidNativeFunctions.StartApp("com.google.android.youtube", false);
        }

        if (GUI.Button(NewRect(5, 20, 40, 10), "Get Installed Apps", style))
        {
            List <PackageInfo> packageInfo = AndroidNativeFunctions.GetInstalledApps();
            for (int i = 0; i < packageInfo.Count; i++)
            {
                print("firstInstallTime:" + packageInfo[i].firstInstallTime + " , lastUpdateTime: " + packageInfo[i].lastUpdateTime + " , packageName: " +
                      packageInfo[i].packageName + " , versionCode: " + packageInfo[i].versionCode + " ,  versionName: " + packageInfo[i].versionName);
            }
        }

        if (GUI.Button(NewRect(5, 35, 40, 10), "Get App Info", style))
        {
            PackageInfo packageInfo = AndroidNativeFunctions.GetAppInfo();
            //PackageInfo packageInfo = AndroidNativeFunctions.GetAppInfo("com.google.android.youtube");
            print("firstInstallTime:" + packageInfo.firstInstallTime + " , lastUpdateTime: " + packageInfo.lastUpdateTime + " , packageName: " +
                  packageInfo.packageName + " , versionCode: " + packageInfo.versionCode + " ,  versionName: " + packageInfo.versionName);
        }

        if (GUI.Button(NewRect(5, 50, 40, 10), "Get Device Info", style))
        {
            DeviceInfo deviceInfo = AndroidNativeFunctions.GetDeviceInfo();
            print(" CODENAME: " + deviceInfo.CODENAME + " , INCREMENTAL: " + deviceInfo.INCREMENTAL + " , RELEASE: " + deviceInfo.RELEASE
                  + " , SDK: " + deviceInfo.SDK);
        }

        if (GUI.Button(NewRect(5, 65, 40, 10), "Get Android ID", style))
        {
            print("Android ID: " + AndroidNativeFunctions.GetAndroidID());
        }

        if (GUI.Button(NewRect(55, 5, 40, 10), "Share Text", style))
        {
            AndroidNativeFunctions.ShareText("Hello World", "Subject", "Share Text");
        }

        if (GUI.Button(NewRect(55, 20, 40, 10), "Share Image", style))
        {
            AndroidNativeFunctions.ShareImage("Hello World", "Subject", "Share Text", shareTexture);
        }

        if (GUI.Button(NewRect(55, 35, 40, 10), "Show Progress Dialog", style))
        {
            AndroidNativeFunctions.ShowProgressDialog("Wait 2 seconds please");
            Invoke("HideProgressDialog", 2);
        }

        if (GUI.Button(NewRect(55, 50, 40, 10), "Show Toast", style))
        {
            AndroidNativeFunctions.ShowToast("Hello World", false);
        }

        if (GUI.Button(NewRect(55, 65, 40, 10), "Immersive Mode", style))
        {
            AndroidNativeFunctions.ImmersiveMode();
        }

        if (GUI.Button(NewRect(5, 80, 40, 10), "<<", style))
        {
            window = 3;
        }

        if (GUI.Button(NewRect(55, 80, 40, 10), ">>", style))
        {
            window = 2;
        }
    }
Ejemplo n.º 24
0
 void ShowAlertListAction(string selectList)
 {
     AndroidNativeFunctions.ShowToast(selectList.ToString());
 }
Ejemplo n.º 25
0
 void ShowAlertInputAction(DialogInterface w, string t)
 {
     AndroidNativeFunctions.ShowToast(w.ToString() + " " + t);
 }
Ejemplo n.º 26
0
    public void OnClick_CreateRoom()
    {
        Debug.Log("Size selected" + roomSizeDropDown.value);
        switch (roomSizeDropDown.value)
        {
        case 0:
            roomSize = 8;
            break;

        case 1:
            roomSize = 10;
            break;

        case 2:
            roomSize = 12;
            break;

        case 3:
            roomSize = 14;
            break;
        }
        //MaxPlayers = (byte)roomSize
        RoomOptions roomOptions = new RoomOptions()
        {
            IsVisible = true, IsOpen = true, MaxPlayers = 3
        };

        RoomInfo[] rooms = PhotonNetwork.GetRoomList();
        if (RoomName.text.Equals(""))
        {
            AndroidNativeFunctions.ShowToast("Please select Room Name");
            print("matchNameInput + faragh");
        }
        else
        {
            if (rooms.Length == 0)
            {
                Debug.Log("Room dos not exist");

                if (PhotonNetwork.CreateRoom(RoomName.text, roomOptions, TypedLobby.Default))
                {
                    print("create room successfully sent.");
                    currentroom.gameObject.SetActive(true);
                    menufindagame.gameObject.SetActive(false);
                    backbtn.gameObject.SetActive(false);
                }
                else
                {
                    print("create room failed to send");
                }
            }
            else
            {
                foreach (RoomInfo room in rooms)
                {
                    if (RoomName.text.Equals(room.Name))
                    {
                        AndroidNativeFunctions.ShowToast("This room exists !");
                        Debug.Log("This room exists !");
                        break;
                    }
                    else
                    {
                        if (PhotonNetwork.CreateRoom(RoomName.text, roomOptions, TypedLobby.Default))
                        {
                            print("create room successfully sent.");
                            currentroom.gameObject.SetActive(true);
                            menufindagame.gameObject.SetActive(false);
                            backbtn.gameObject.SetActive(false);
                        }
                        else
                        {
                            print("create room failed to send");
                        }
                    }
                }
            }
        }
    }
 // This is not my code, warpped in a try catch incase something fails
 void ShowAlertAction(DialogInterface w)
 {
     try {
         AndroidNativeFunctions.ShowToast(w.ToString());
     } catch (System.Exception) { }
 }