Пример #1
0
        public void PracticeGame()
        {
            // Debug.Log ("PracticeGame");
            SecurePlayerPrefs.SetString(GameTags.PRIVATE_TABLE_TYPE, "ghjghg");
            GameConstantData.GameType     = GameConstantData.Practice;
            GameConstantData.entryFee     = 0;
            GameConstantData.winingAmount = 0;
            GameConstantData.TokenLimit   = 4;
            GameConstantData.UserLimit    = 2;

            SecurePlayerPrefs.SetString(GameTags.OFFLINE, GameTags.OFFLINE);

            //		CreatePrivateTablePanel.SetActive (true);
            //		CreatePrivateTablePanel.GetComponent<CreatePrivateTable> ().ShowPopup ("Practice Game");
            SceneManager.LoadSceneAsync("GameScene");
        }
Пример #2
0
        public void PlayWithFrnds()
        {
            // Debug.Log ("PlayWithFrnds ");
            //print ("PlayWithFrnds working");

            GameConstantData.GameType   = GameConstantData.Private;
            GameConstantData.UserLimit  = 2;
            GameConstantData.TokenLimit = 4;
            SecurePlayerPrefs.SetString(GameTags.PRIVATE_TABLE_TYPE, GameTags.CREATE_TABLE);
            SecurePlayerPrefs.SetString(GameTags.GAME_TYPE, GameTags.PRIVATE);
            //		CreatePrivateTablePanel.SetActive (true);
            //		CreatePrivateTablePanel.GetComponent<CreatePrivateTablePanel> ().sh

            CreatePrivateTablePanel.SetActive(true);
            CreatePrivateTablePanel.GetComponent <CreatePrivateTable>().ShowPopup("Play With Friends");
            CreatePrivateTablePanel.GetComponent <CreatePrivateTable>().Earning = false;
        }
Пример #3
0
        void onSendTableCode(string code)
        {
            string s = SecurePlayerPrefs.GetString(GameTags.PRIVATE_TABLE_TYPE);

            if (s.Equals(GameTags.CREATE_TABLE))
            {
                try {
                    // Debug.Log ("CREATE_TABLE " + code);
                    CreatePrivateTatble.SetActive(true);
                    CreatePrivateTatble.GetComponent <PrivateTable> ().TableCode.GetComponent <Text> ().text = code;
                    loadingPanel.SetActive(false);
                } catch (System.Exception ex) {
                    // Debug.Log ("Exeception occur " + ex.Message);
                }
            }
            else if (s.Equals(GameTags.CHALLENGE_FRIEND))
            {
                RequestToJoinGame(code);
            }
        }
Пример #4
0
        public void one_on_one()
        {
            /*// Debug.Log ("one_on_one");
             *
             *
             *
             */

            SecurePlayerPrefs.SetString(GameTags.PRIVATE_TABLE_TYPE, "ghjghg");
            GameConstantData.GameType   = GameConstantData.OneToOne;
            GameConstantData.UserLimit  = 2;
            GameConstantData.TokenLimit = 4;
            SecurePlayerPrefs.SetString(GameTags.GAME_TYPE, GameTags.PUBLIC);
            //SecurePlayerPrefs.SetString (GameTags.PRIVATE_TABLE_TYPE, GameTags.CREATE_TABLE);

            CreatePrivateTablePanel.SetActive(true);
            CreatePrivateTablePanel.GetComponent <CreatePrivateTable>().ShowPopup("One on one");
            CreatePrivateTablePanel.GetComponent <CreatePrivateTable>().Earning = false;

            //		SelectAmountPanel.SetActive (true);
            //		SelectAmountPanel.GetComponent<SelectAmoutPanel> ().Showpopup ("One on one");
        }
Пример #5
0
        void Start()
        {
            CreatePrivateTablePanel.SetActive(false);
            QuitApplication.SetActive(false);
            SettingPanel.SetActive(false);
            ErrorMsgPanel.SetActive(false);
            ClosePanel.SetActive(false);

            GetUserID();

            SecurePlayerPrefs.SetString(GameTags.FACEBOOK_FRIEND, "");
            SecurePlayerPrefs.SetString(GameTags.CREATE_TABLE, "");
            SecurePlayerPrefs.SetString(GameTags.CHALLENGE_FRIEND, "");
            SecurePlayerPrefs.SetString(GameTags.PRIVATE_TABLE_TYPE, "");
            SecurePlayerPrefs.SetString(GameTags.OFFLINE, "");
            SecurePlayerPrefs.SetString(GameTags.CHALLENGE_FRIEND, "");
            SecurePlayerPrefs.SetString(GetPlayerDetailsTags.ROOM_ID, "");
            GameController.Message  = "";
            GameController.Message1 = "";

            SecurePlayerPrefs.SetInt(GameTime.LUDO_GAME, GameTime.ON);
            SecurePlayerPrefs.SetInt(GameTime.LUDO_GOLD, GameTime.ON);
        }
Пример #6
0
        private void ServerRequest(string response)
        {
            Debug.Log("response" + response);
            try
            {
                JSONNode node = JSON.Parse(response);

                if (node != null)
                {
                    string result = node["status"];

                    if (result.Equals("OK"))
                    {
                        try
                        {
                            JSONNode data1 = node["data"];
                            SecurePlayerPrefs.SetInt(GameTime.LUDO_GAME, int.Parse("" + data1["LUDO_GAME"]));
                            SecurePlayerPrefs.SetInt(GameTime.LUDO_GOLD, int.Parse("" + data1["LUDO_GOLD"]));
                            SecurePlayerPrefs.SetInt(GameTime.LUDO_PRIME_GAME, int.Parse("" + data1["LUDO_PRIME_GAME"]));


                            SecurePlayerPrefs.SetString(GameTime.LUDO_TEXT, "" + data1["LUDO_TEXT"]);
                            SecurePlayerPrefs.SetString(GameTime.LUDO_GOLD_TEXT, "" + data1["LUDO_GOLD_TEXT"]);
                            SecurePlayerPrefs.SetString(GameTime.LUDO_PRIME_TEXT, "" + data1["LUDO_PRIME_TEXT"]);
                        }
                        catch
                        {
                            Debug.Log("Message");
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                Debug.Log(ex.Message);
            }
        }
Пример #7
0
 public void moveGoti(int current, int next)
 {
     if (playerName.Equals(SecurePlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID)))
     {
         if (next != 0)
         {
             if (currentPosition == current)
             {
                 try
                 {
                     int        nextPos = initialPosition + next;
                     int        Object  = nextPos > 52 ? nextPos - 52 : nextPos;
                     GameObject pos     = GameObject.Find("" + Object);
                     transform.position = pos.transform.position;
                     currentPosition    = next;
                 }
                 catch (System.Exception ex)
                 {
                     // Debug.Log("moveGoti Exception " + ex.Message);
                 }
             }
         }
     }
 }
Пример #8
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         HidePopUp();
         if (CreatePrivateTablePanel.activeSelf)
         {
             SecurePlayerPrefs.SetString(GameTags.GAME_TYPE, "");
             CreatePrivateTablePanel.SetActive(false);
         }
         else if (SettingPanel.activeSelf)
         {
             SettingPanel.SetActive(false);
         }
         else if (ErrorMsgPanel.activeSelf)
         {
             ErrorMsgPanel.SetActive(false);
         }
         else
         {
             QuitApplication.SetActive(true);
         }
     }
 }
Пример #9
0
        public void ShareAction()
        {
            string msg = "your friend invited you to play Ludo First ever real chip ludo game. Download Now: " + SecurePlayerPrefs.GetString(Tags.APP_DOWNLOAD_URL);

            GameConstantData.shareText(msg);
        }
        //public void InviteFaceookFrnd ()
        //{

        //	string fbid = SecurePlayerPrefs.GetString (GetPlayerDetailsTags.PLAYER_FBID);
        //	if (fbid.Length > 1) {

        //		//print ("AddFriendAction working " + fbid);
        //		FB.Mobile.AppInvite (
        //			new Uri ("https://fb.me/" + fbid),
        //			new Uri ("https://play.google.com/store/apps/details?id=com.twist.Timepass"),
        //			delegate(IAppInviteResult result) {
        //				// Debug.Log (result.RawResult);
        //			}
        //		);
        //	}
        //}

        public void ShareCode()
        {
            int    entryFee  = GameConstantData.entryFee;
            string tableCode = TableCode.GetComponent <Text>().text;
            //// Debug.Log ("Entry fee "+entryFee);
            //Your friend "name" have invited you to play Ludo in a private room on Ludo Money. Please enter this code "code" to join your friend.
            //string s = "table joining fee " + entryFee + " Table code " + tableCode
            string s = "Your friend " + UserController.getInstance.Name + " have invited you to play Ludo in Rs." + GameConstantData.entryFee + " private room on Ludo Money. Please enter this code " + tableCode + " to join your friend at " + SecurePlayerPrefs.GetString(Tags.APP_DOWNLOAD_URL);

            GameConstantData.shareText(s);
        }
 public void ClosedPanelAction()
 {
     coin = 0;
     transform.gameObject.SetActive(false);
     SecurePlayerPrefs.SetString(GameTags.GAME_TYPE, "");
 }
        public void ShareAction()
        {
            ///string msg = "Enter this code to earn mony " + SecurePlayerPrefs.GetString (GetPlayerDetailsTags.REFREL_CODE);
            ///
            /// Sumit Kumar invited you to play Ludo Money. Please enter referral code 0975345and get free 50 Rs worth of coins. Please download the game from:
            string msg = UserController.getInstance.Name + " invited you to play Ludo Money-First ever real money ludo game.Enter referral code '" + SecurePlayerPrefs.GetString(GetPlayerDetailsTags.REFREL_CODE) + "' & get coin worth Rs." + SecurePlayerPrefs.GetString(Tags.REFERRAL_COIN_FOR_OLD_PLAYER) + ". Download Now: " + SecurePlayerPrefs.GetString(Tags.APP_DOWNLOAD_URL);

            GameConstantData.shareText(msg);
        }
 // Use this for initialization
 void Start()
 {
     refrelCode.text = SecurePlayerPrefs.GetString(GetPlayerDetailsTags.REFREL_CODE);
 }
Пример #14
0
        void onRecivedMassage(string sender, string msg)
        {
            // try {

            JSONNode s = JSON.Parse(msg);

            switch (s[ServerTags.TAG])
            {
            case ServerTags.ROOM_INFO:
            {
                JSONNode pl     = s[ServerTags.ROOM_DATA];
                string   player = UserController.getInstance.ID;
                for (int i = 0; i < pl.Count; i++)
                {
                    JSONNode data = pl[i];
                    if (player.Equals(data[ServerTags.PLAYER_ID]))
                    {
                        TakeSeat(data);
                    }
                }
                for (int i = 0; i < pl.Count; i++)
                {
                    JSONNode data = pl[i];
                    if (!player.Equals(data[ServerTags.PLAYER_ID]))
                    {
                        if (!checkUserExist(data[ServerTags.PLAYER_ID]))
                        {
                            GameObject chair = getEmptySeat(int.Parse(data["COLOR"]));
                            if (chair)
                            {
                                chair.SetActive(true);
                                chair.GetComponent <OpponentPlayer> ().empty          = false;
                                chair.GetComponent <OpponentPlayer> ().userName.text  = "" + UppercaseFirst(data[ServerTags.DISPLAY_NAME]);
                                chair.GetComponent <OpponentPlayer> ().total_match    = int.Parse(data[DeviceTags.TOTAL_MATCH]);
                                chair.GetComponent <OpponentPlayer> ().won_match      = int.Parse(data[DeviceTags.WON_MATCH]);
                                chair.GetComponent <OpponentPlayer> ().PlayerImageUrl = "" + data[DeviceTags.PIC];
                                chair.GetComponent <OpponentPlayer> ().DisPlayname    = "" + data[DeviceTags.DISPLAY_NAME];
                                chair.GetComponent <OpponentPlayer> ().Player_ID      = "" + data[ServerTags.PLAYER_ID];
                                chair.GetComponent <OpponentPlayer> ().updateData();
                                chair.GetComponent <OpponentPlayer> ().showGoti();
                                SecurePlayerPrefs.SetString(GetPlayerDetailsTags.OPPONENT_NAME, "" + data[DeviceTags.DISPLAY_NAME]);
                                SecurePlayerPrefs.SetString(GetPlayerDetailsTags.OPPONENT_IMAGE, "" + data[DeviceTags.PIC]);
                            }
                        }
                    }
                }
            }
            break;

            case ServerTags.DRAW_GAME:
            {
                drawGame.SetActive(true);
            }
            break;

            case ServerTags.WINNER_PLAYER:
            {
                string player_name = UserController.getInstance.ID;

                JSONNode node      = s["RESULT"];
                string   Wincoin   = s["VALUE"];
                string   playerId1 = "";
                // Debug.Log ("result is " + node.Count);
                for (int i = 0; i < node.Count; i++)
                {
                    JSONNode node1    = node[i];
                    string   playerId = node1["PLAYER_ID"];
                    playerId1 = playerId;
                    string position     = node1["POSITION"];
                    string DISPLAY_NAME = node1[ServerTags.DISPLAY_NAME];
                    string pic          = node1["PIC"];
                    WinnerPanel.SetActive(true);
                    //print ("playerId " + playerId + " position " + position);
                    if (position.Equals("1"))
                    {
                        if (playerId.Equals(player_name))
                        {
                            WinnerPanel.transform.Find("panel").Find("WinText").gameObject.SetActive(true);
                            WinnerPanel.GetComponent <winnerPanelScript> ().updateName(DISPLAY_NAME, Wincoin, true, pic);
                        }
                        else
                        {
                            WinnerPanel.transform.Find("panel").Find("WinText").gameObject.SetActive(false);
                            WinnerPanel.GetComponent <winnerPanelScript> ().updateName(DISPLAY_NAME, Wincoin, false, pic);
                        }
                    }
                    else
                    {
                        GameObject newCell = Instantiate(cell);
                        newCell.transform.SetParent(Container.transform);
                        newCell.transform.localScale = new Vector3(1, 1, 1);
                        newCell.GetComponent <LooserCell> ().updateLoserCell(DISPLAY_NAME, position);
                    }
                }
                if (player_name.Equals(playerId1))
                {
                    GameDelegate.StartClappingSound();
                    WinnerAnimation.SetActive(true);
                    WinnerAnimation.GetComponent <ParticleSystem> ().Clear();
                    WinnerAnimation.GetComponent <ParticleSystem> ().Play();
                }
            }
            break;

            case ServerTags.GOTI_WIN:
            {
                string player = UserController.getInstance.ID;
                if (!player.Equals(s[ServerTags.PLAYER_ID]))
                {
                    GameDelegate.StartClappingSound();
                    GotiWinAnimation.SetActive(true);
                    GotiWinAnimation.GetComponent <ParticleSystem> ().Clear();
                    GotiWinAnimation.GetComponent <ParticleSystem> ().Play();
                    StartCoroutine(StopGotiAnimation());
                }
            }
            break;

            case ServerTags.START_DEAL:
            {
                //print ("START_DEAL working");

                CreatePrivateTatble.SetActive(false);
                JoinGamePanel.SetActive(false);
                loadingPanel.SetActive(false);
                CurrentPlayer.GetComponent <PlayerScript> ().EnableChatBtn();

                WinnerPanel.SetActive(false);
                WinnerAnimation.SetActive(false);
                WinnerAnimation.GetComponent <ParticleSystem> ().Clear();
            }
            break;

            case ServerTags.ROOM_PRICE:
            {
                try {
                    string player = UserController.getInstance.ID;
                    if (player.Equals(s[ServerTags.PLAYER_ID]))
                    {
                        int fee = int.Parse(s[ServerTags.VALUES]);
                        if (fee > int.Parse(UserController.getInstance.Coin))
                        {
                            CoinValidationPanel.SetActive(true);
                        }
                    }
                } catch (System.Exception ex) {
                    // Debug.Log (ex.Message);
                }
            }
            break;

            case ServerTags.RESET_GOTI:
            {
                for (int i = 1; i < 72; i++)
                {
                    onMoveGoti(i);
                }
            }
            break;

            case ServerTags.TURN_MISS:
            {
                if (int.Parse(s[ServerTags.VALUES]) != 0)
                {
                    string player = UserController.getInstance.ID;
                    if (player.Equals(s[ServerTags.PLAYER_ID]))
                    {
                        string message = s["ROOM_MESSAGE"];
                        GameConstantData.showToast(transform, message);
                        CurrentPlayer.GetComponent <PlayerScript> ().MissTurn(s[ServerTags.PLAYER_ID]);
                    }
                    else
                    {
                        foreach (GameObject chair in OpponentArray)
                        {
                            chair.GetComponent <OpponentPlayer> ().MissTurn(s[ServerTags.PLAYER_ID]);
                        }
                    }
                }
                else
                {
                }
            }
            break;

            default:
                break;
            }
            // } catch (System.Exception ex) {
            //   Debug.Log (ex.Message);
            // }
        }
 IEnumerator sendData()
 {
     while (true)
     {
         int[] data_f = new int[3];
         data_f[2] = 8;
         int    data_len = (sizeof(int) * 3) + (SecurePlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID).Length *sizeof(char));
         byte[] data     = new byte[data_len];
         System.Buffer.BlockCopy(data_f, 0, data, 0, sizeof(int) * 3);
         System.Buffer.BlockCopy(SecurePlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID).ToCharArray(), 0, data, sizeof(int) * 3, SecurePlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID).Length *sizeof(char));
         listener.sendBytes(data, true);
         yield return(new WaitForSeconds(1.0f));
     }
 }
        private void OnEnable()
        {
            Invest.text = "";
            Earn.text   = "";

            string GAME_TYPE = SecurePlayerPrefs.GetString(GameTags.GAME_TYPE);

            DeSelectAll();
            closeAllbutton();
            if (GAME_TYPE.Equals(GameTags.PUBLIC))
            {
                ludoText.text      = SecurePlayerPrefs.GetString(GameTime.LUDO_TEXT);
                ludoGoldText.text  = SecurePlayerPrefs.GetString(GameTime.LUDO_GOLD_TEXT);
                ludoPrimeText.text = SecurePlayerPrefs.GetString(GameTime.LUDO_PRIME_TEXT);
                BottomPanel.SetActive(false);
                midTitle.text = "Play Ludo with Real Players \n*Select Amount and Press Play Now";

                if (SecurePlayerPrefs.GetInt(GameTime.LUDO_GAME) == 1)
                {
                    openbutton("100");
                    openbutton("50");
                    ludoText.text = "OPEN";
                }
                else
                {
                    ludoText.text = SecurePlayerPrefs.GetString(GameTime.LUDO_TEXT);
                }
                if (SecurePlayerPrefs.GetInt(GameTime.LUDO_GOLD) == 1)
                {
                    openbutton("500");
                    openbutton("250");
                    ludoGoldText.text = "OPEN";
                }
                else
                {
                    ludoGoldText.text = SecurePlayerPrefs.GetString(GameTime.LUDO_GOLD_TEXT);
                }
                if (SecurePlayerPrefs.GetInt(GameTime.LUDO_PRIME_GAME) == 1)
                {
                    openbutton("1000");
                    ludoPrimeText.text = "OPEN";
                }
                else
                {
                    ludoPrimeText.text = SecurePlayerPrefs.GetString(GameTime.LUDO_PRIME_TEXT);
                }
            }
            else if (GAME_TYPE.Equals(GameTags.PRIVATE))
            {
                BottomPanel.SetActive(true);
                ludoText.text      = "Select Table";
                ludoGoldText.text  = "Select Table";
                ludoPrimeText.text = "Select Table";
                midTitle.text      = "Play Ludo with Friends \n*Select Amount and Press Play Now";
                openbutton("1000");
                openbutton("500");
                openbutton("250");
                openbutton("100");
                openbutton("50");
                openbutton("20");
                openbutton("10");
            }
        }
Пример #17
0
        public void onJoinRoomDone(RoomEvent eventObj)
        {
            if (eventObj.getResult() == 0)
            {
                // Debug.Log("Join Success fully");
                if (WarpClient.GetInstance() != null)
                {
                    WarpClient.GetInstance().SubscribeRoom(eventObj.getData().getId());
                    if (GameConstantData.GameType == GameConstantData.OneToOne)
                    {
                        GameIDBg.SetActive(true);
                        GameID.text = "Game ID : " + eventObj.getData().getId();
                    }
                    else if (GameConstantData.GameType == GameConstantData.OneToFour)
                    {
                        GameIDBg.SetActive(true);
                        GameID.text = "Game ID : " + eventObj.getData().getId();
                    }
                    else if (GameConstantData.GameType == GameConstantData.Private)
                    {
                        GameIDBg.SetActive(true);
                        GameID.text = "Game ID : " + eventObj.getData().getId();
                    }
                    else
                    {
                        GameIDBg.SetActive(false);
                        GameID.text = " ";
                    }
                }
            }
            else
            {
                if (GameConstantData.GameType == GameConstantData.Practice)
                {
                    // Debug.Log("Join Fail Create Practice Game Again");
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add(Tags.GameType, GameConstantData.GameType);
                    dic.Add(Tags.GAME_ENTRY, GameConstantData.entryFee);
                    dic.Add(Tags.GAME_PRICE, GameConstantData.winingAmount);
                    dic.Add(Tags.UserLimit, GameConstantData.UserLimit);
                    dic.Add("TOKEN_LIMIT", GameConstantData.TokenLimit);
                    dic.Add(Tags.DOMAIN, Tags.URL);
                    WarpClient.GetInstance().CreateRoom("Practice", "Ludo", 1, dic);
                }
                if (GameConstantData.GameType == GameConstantData.OneToOne)
                {
                    // Debug.Log("Join Fail Create one2one Game Again");
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add(Tags.GameType, GameConstantData.GameType);
                    dic.Add(Tags.GAME_ENTRY, GameConstantData.entryFee);
                    dic.Add(Tags.GAME_PRICE, GameConstantData.winingAmount);
                    dic.Add("TOKEN_LIMIT", GameConstantData.TokenLimit);
                    dic.Add(Tags.UserLimit, GameConstantData.UserLimit);
                    dic.Add(Tags.DOMAIN, Tags.URL);
                    WarpClient.GetInstance().CreateRoom("One2One", "ludo", 2, dic);
                }
                if (GameConstantData.GameType == GameConstantData.OneToFour)
                {
                    // Debug.Log("Join Fail Create one2Four Game Again");
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add(Tags.GameType, GameConstantData.GameType);
                    dic.Add(Tags.GAME_ENTRY, GameConstantData.entryFee);
                    dic.Add(Tags.GAME_PRICE, GameConstantData.winingAmount);
                    dic.Add("TOKEN_LIMIT", GameConstantData.TokenLimit);
                    dic.Add(Tags.UserLimit, GameConstantData.UserLimit);
                    dic.Add(Tags.DOMAIN, Tags.URL);
                    WarpClient.GetInstance().CreateRoom("One2Four", "ludo", 4, dic);
                }

                if (GameConstantData.GameType == GameConstantData.Private)
                {
                    string playerType = SecurePlayerPrefs.GetString(GameTags.GAME_TYPE);
                    if (playerType.Equals(GameTags.CREATE_TABLE))
                    {
                        // Debug.Log("Join Fail Create private Game Again");
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        dic.Add(Tags.GameType, GameConstantData.GameType);
                        dic.Add(Tags.GAME_ENTRY, GameConstantData.entryFee);
                        dic.Add(Tags.GAME_PRICE, GameConstantData.winingAmount);
                        dic.Add("TOKEN_LIMIT", GameConstantData.TokenLimit);
                        dic.Add(Tags.UserLimit, GameConstantData.UserLimit);
                        dic.Add(Tags.DOMAIN, Tags.URL);
                        WarpClient.GetInstance().CreateRoom("private", "ludo", 2, dic);
                    }
                    if ((playerType.Equals(GameTags.JOIN_TABLE)))
                    {
                        // Debug.Log("Waiting for Join Again");
                    }
                }

                /*
                 *
                 * String tableType = SecurePlayerPrefs.GetString (GameTags.PRIVATE_TABLE_TYPE);
                 * //	GameController.showToast ("Try to create a room");
                 * if (WarpClient.GetInstance () != null) {
                 *
                 *  if ((tableType.Equals (GameTags.CREATE_TABLE)) || (tableType.Equals (GameTags.JOIN_TABLE) || (tableType.Equals (GameTags.CHALLENGE_FRIEND)))) {
                 *
                 *      GameConstantData.showToast (transform,"Invalid room id unable to join game!");
                 *  } else {
                 *
                 *      Dictionary<string,object> dic = new Dictionary <string,object> ();
                 *      dic.Add (Tags.GameType, GameConstantData.GameType);
                 *      dic.Add (Tags.GAME_ENTRY, GameConstantData.entryFee);
                 *      dic.Add (Tags.GAME_PRICE, GameConstantData.winingAmount);
                 *      dic.Add (Tags.UserLimit, GameConstantData.UserLimit);
                 *      WarpClient.GetInstance ().CreateRoom ("rummy", "game", GameConstantData.UserLimit, dic);
                 *  }
                 * }*/
            }
        }
Пример #18
0
        public void onConnectDone(ConnectEvent eventObj)
        {
            //WarpClient.GetInstance().initUDP();
            Debug.Log("Connection " + eventObj.getResult());

            switch (eventObj.getResult())
            {
            case WarpResponseResultCode.SUCCESS:
            {
                m_apppwarp.GameStart = true;
                appwarp.sessionID    = WarpClient.GetInstance().GetSessionId();
                // Debug.Log("Player join appwarp");
                m_apppwarp.newConnection = false;
                GameController.Message   = "Waiting for opponent ";
                // Debug.Log("GameConstantData.GameType " + GameConstantData.GameType);

                if (GameConstantData.GameType == GameConstantData.Practice)
                {
                    // Debug.Log("Create Practice Game");
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add(Tags.GameType, GameConstantData.GameType);
                    dic.Add(Tags.GAME_ENTRY, GameConstantData.entryFee);
                    dic.Add(Tags.GAME_PRICE, GameConstantData.winingAmount);
                    dic.Add(Tags.UserLimit, GameConstantData.UserLimit);
                    dic.Add("TOKEN_LIMIT", GameConstantData.TokenLimit);
                    dic.Add(Tags.DOMAIN, Tags.URL);
                    WarpClient.GetInstance().CreateRoom("Practice", "Ludo", 1, dic);
                }
                if (GameConstantData.GameType == GameConstantData.OneToOne)
                {
                    // Debug.Log("Join One2One Game");
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add(Tags.GameType, GameConstantData.GameType);
                    dic.Add(Tags.GAME_ENTRY, GameConstantData.entryFee);
                    dic.Add(Tags.GAME_PRICE, GameConstantData.winingAmount);
                    dic.Add("TOKEN_LIMIT", GameConstantData.TokenLimit);
                    dic.Add(Tags.UserLimit, GameConstantData.UserLimit);
                    dic.Add(Tags.DOMAIN, Tags.URL);
                    WarpClient.GetInstance().JoinRoomWithProperties(dic);
                }

                if (GameConstantData.GameType == GameConstantData.OneToFour)
                {
                    // Debug.Log("Join One2Four Game");
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add(Tags.GameType, GameConstantData.GameType);
                    dic.Add(Tags.GAME_ENTRY, GameConstantData.entryFee);
                    dic.Add(Tags.GAME_PRICE, GameConstantData.winingAmount);
                    dic.Add("TOKEN_LIMIT", GameConstantData.TokenLimit);
                    dic.Add(Tags.UserLimit, GameConstantData.UserLimit);
                    dic.Add(Tags.DOMAIN, Tags.URL);
                    WarpClient.GetInstance().JoinRoomWithProperties(dic);
                }
                string playerType = SecurePlayerPrefs.GetString(GameTags.PRIVATE_TABLE_TYPE);
                if (GameConstantData.GameType == GameConstantData.Private)
                {
                    if (playerType.Equals(GameTags.CREATE_TABLE))
                    {
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        dic.Add(Tags.GameType, GameConstantData.GameType);
                        dic.Add(Tags.GAME_ENTRY, GameConstantData.entryFee);
                        dic.Add(Tags.GAME_PRICE, GameConstantData.winingAmount);
                        dic.Add("TOKEN_LIMIT", GameConstantData.TokenLimit);
                        dic.Add(Tags.UserLimit, GameConstantData.UserLimit);
                        dic.Add(Tags.DOMAIN, Tags.URL);
                        // Debug.Log("Create Private Game");
                        WarpClient.GetInstance().CreateRoom("private", "ludo", 2, dic);
                    }
                    if ((playerType.Equals(GameTags.JOIN_TABLE)))
                    {
                        // Debug.Log("Waiting for Join ");
                    }
                }


                // Debug.Log ("Player join appwarp " + playerType);
                if ((playerType.Equals(GameTags.JOIN_TABLE)))
                {
                    // Debug.Log ("join table  ");
                }
                else if ((playerType.Equals(GameTags.FB_FRIEND_ONLINE)))
                {
                    // Debug.Log ("join FB_FRIEND_ONLINE  ");
                    if (WarpClient.GetInstance() != null)
                    {
                        WarpClient.GetInstance().JoinRoom(SecurePlayerPrefs.GetString(GetPlayerDetailsTags.ROOM_ID));
                    }
                }
            }
            break;

            case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:
            {
                GameDelegate.changeSocketConnection(false);
                tempConnectionError = true;
                //// Debug.Log ("Weak connection");
                // ("Weak connection");
                // GameController.Message = "Recovering Connection";
                //GameController.Message1 = "Recovering Connection ";
                //if (WarpClient.GetInstance() != null)
                //{
                //    WarpClient.GetInstance().RecoverConnection();
                //}
            }
            break;

            case WarpResponseResultCode.SUCCESS_RECOVERED:
            {
                // ("Connection recover");
                GameController.Message1 = "";
                // GameController.Message = "Recovering Connection success ";
                GameDelegate.changeSocketConnection(true);
                tempConnectionError = false;
                //// Debug.Log ("Recover connection");
            }
            break;

            case WarpResponseResultCode.CONNECTION_ERR:
            {
                // Debug.Log ("CONNECTION_ERR  has been occur");
                //GameController.showErrorMsgl ();
                GameController.Message = " Connection error ";
                GameDelegate.changeSocketConnection(false);
            }
            break;

            case WarpResponseResultCode.AUTH_ERROR:
            {
                // Debug.Log ("AUTH_ERROR has been occur");
                //GameController.showErrorMsgl ();
                //ErroeMsg ();
                GameDelegate.changeSocketConnection(false);
                //UnityMainThreadDispatcher.Instance().Enqueue(ErroeMsg());
                //				GetComponent<GameScene> ().reconnectPanel.SetActive (true);

                GameController.Message = "Server not responding. try again";
            }
            break;

            case WarpResponseResultCode.BAD_REQUEST:
            {
                GameController.Message = "Server not responding. try again";

                // Debug.Log ("BAD_REQUEST has been occur");
                if (m_apppwarp.newConnection)
                {
                    // Debug.Log("refresh connection");
                    string player_name = UserController.getInstance.ID;
                    WarpClient.GetInstance().Disconnect();
                    WarpClient.GetInstance().Connect(player_name, "");
                }
                else
                {
                    GameDelegate.changeSocketConnection(false);
                }
                //GameController.showErrorMsgl ();
                //				GetComponent<GameScene> ().reconnectPanel.SetActive (true);
                //ErroeMsg();

                //UnityMainThreadDispatcher.Instance().Enqueue(ErroeMsg());
            }
            break;

            default:


                break;
            }
        }
Пример #19
0
 void Start()
 {
     soundOn = SecurePlayerPrefs.GetInt(GameTags.SOUND_ON);
     //// Debug.Log ("soundOn " + soundOn);
 }
 public void JoinTableAction()
 {
     GameConstantData.entryFee = coin;
     SecurePlayerPrefs.SetString(GameTags.PRIVATE_TABLE_TYPE, GameTags.JOIN_TABLE);
     SceneManager.LoadSceneAsync("GameScene");
 }