public void onBytes(byte[] msg)
 {
     try
     {
         int[]  data_f = new int[3];
         char[] data_c = new char[(msg.Length - (sizeof(int) * 3)) / sizeof(char)];
         System.Buffer.BlockCopy(msg, 0, data_f, 0, sizeof(int) * 3);
         System.Buffer.BlockCopy(msg, sizeof(int) * 3, data_c, 0, msg.Length - (sizeof(int) * 3));
         string sender = new string(data_c);
         if (!sender.Equals(SecurePlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID)))
         {
             //if (data_f[2] == 8)
             //{
             //    opponent = limit;
             //}
             GameDelegate.playerData(sender, data_f);
         }
         //}else{
         //    if(data_f[2]==8){
         //        player = limit;
         //    }
         //}
     }
     catch (System.Exception ed)
     {
         // Debug.Log(ed.Message);
     }
 }
        public void onSubscribeRoomDone(RoomEvent eventObj)
        {
            if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
            {
                // set room id in prefeb
                //SecurePlayerPrefs.SetString (GameTags.ROOM_ID, eventObj.getData ().getId ());
                // (eventObj.getData ().getId ());

                string roomID = eventObj.getData().getId();

                if (WarpClient.GetInstance() != null)
                {
                    //WarpClient.GetInstance ().GetLiveRoomInfo (eventObj.getData ().getId ());
                    //("onSubscribeRoomDone successful");
                    appwarp.joinGame();
                }
                if (GameConstantData.GameType == GameConstantData.Private)
                {
                    string playerType = SecurePlayerPrefs.GetString(GameTags.PRIVATE_TABLE_TYPE);
                    if (playerType.Equals(GameTags.CREATE_TABLE))
                    {
                        GameDelegate.showSendTableCode(roomID);
                    }
                }
                //			string tableType = SecurePlayerPrefs.GetString (GameTags.PRIVATE_TABLE_TYPE);
                //			if ((tableType.Equals (GameTags.CREATE_TABLE))) {
                //				// show create table popup
                //				GameDelegate.showSendTableCode (roomID);
                //				//SecurePlayerPrefs.SetString (GameTags.PRIVATE_TABLE_TYPE, "");
                //			}
            }
        }
 public void onChatReceived(ChatEvent eventObj)
 {
     // Debug.Log(eventObj.getSender() + "  :  " + eventObj.getMessage());
     if (WarpClient.GetInstance() != null)
     {
         GameDelegate.chatRecived(eventObj.getSender(), eventObj.getMessage());
     }
 }
Beispiel #4
0
        public override void diceRollDone(int value, JSONNode TurnValue)
        {
            if (base.isTimeOn)
            {
                //showArrow.SetActive (false);
                isRotateDice     = true;
                isOpponentActive = true;
                StartCoroutine(stopRotation(value, TurnValue));

                GameDelegate.showRollDice("" + value);
                //iTween.ScaleTo (PlayerDice, iTween.Hash ("scale", new Vector3 (1.5f, 1.5f, 1.5f), "speed", 8.0f, "easetype", "linear"));
            }
        }
        public void TapDiceAction()
        {
            if (base.isTimeOn)
            {
                //GetComponent<Button> ().enabled = false;
                showArrow.SetActive(false);

                LudoDice.GetComponent <Button>().enabled = false;
                isRotateDice = true;
                GameDelegate.showRollDice("" + base.dicNumber);
                StartCoroutine(stopRotation());
                iTween.ScaleTo(PlayerDice, iTween.Hash("scale", new Vector3(1.5f, 1.5f, 1.5f), "speed", 8.0f, "easetype", "linear"));
            }
        }
Beispiel #6
0
 public void numberSelection(GameObject btn)
 {
     try
     {
         int number = int.Parse(btn.transform.GetChild(0).GetComponent <Text>().text);
         GameDelegate.stopAnimation();
         GameDelegate.selectNumber(number);
         this.onHideButtonPanel();
         appwarp.userSelectGoti(this.GotiNumber, number);
         GameDelegate.StartDisableAllGoti();
     }
     catch (System.Exception ex)
     {
         // Debug.Log (ex.Message);
     }
 }
Beispiel #7
0
 public void numberSelection(GameObject btn)
 {
     try
     {
         int number = int.Parse(btn.transform.GetChild(0).GetComponent <Text>().text);
         GameDelegate.stopAnimation();
         GameDelegate.selectNumber(number);
         appwarp.userSelectGoti(index, number);
         Enable = false;
         removeOption();
         GameDelegate.StartDisableAllGoti();
     }
     catch (System.Exception ex)
     {
         // Debug.Log (ex.Message);
     }
 }
 public void moveGoti(int current, int next, int goti_number)
 {
     if (next >= 0)
     {
         for (int i = 0; i < goti.Length; i++)
         {
             if (goti[i].GetComponent <GotiScript>().index == goti_number)
             {
                 if (goti[i].GetComponent <GotiScript>().currentPosition != next)
                 {
                     // Debug.Log("Start Moving Goti");
                     goti[i].GetComponent <GotiScript>().currentPosition = next;
                     if (!goti[i].GetComponent <GotiScript>().isMoving)
                     {
                         StartCoroutine(moveGotiSteps(current, next, goti[i]));
                     }
                 }
                 break;
             }
         }
     }
     if (next == -1)
     {
         for (int i = 0; i < goti.Length; i++)
         {
             if (goti[i].GetComponent <GotiScript>().index == goti_number)
             {
                 goti[i].GetComponent <GotiScript>().currentPosition = next;
                 GameDelegate.showCloseGoti();
                 goti[i].GetComponent <GotiScript>().CellNumber      = -1;
                 goti[i].GetComponent <GotiScript>().currentPosition = -1;
                 goti[i].transform.position = goti[i].GetComponent <GotiScript>().InitialPositionVector;
                 //iTween.MoveTo (goti [i], goti [i].GetComponent<GotiScript> ().InitialPositionVector, 0.2f);
                 GameDelegate.showMoveGoti(-1);
                 break;
             }
         }
     }
 }
        IEnumerator moveGotiSteps(int current, int next, GameObject goti)
        {
            goti.GetComponent <GotiScript> ().isMoving = true;
            int i = current + 1;

            while (i <= goti.GetComponent <GotiScript> ().currentPosition)
            {
                int Object  = 0;
                int nextPos = 0;
                try {
                    if (i >= 51)
                    {
                        nextPos = goti.GetComponent <GotiScript> ().homeEntryPoint + i - 51;
                        Object  = nextPos;
                    }
                    else
                    {
                        nextPos = goti.GetComponent <GotiScript> ().initialPosition + i;
                        Object  = nextPos > 52 ? nextPos - 52 : nextPos;
                    }
                    // Debug.Log("Move Goti "+Object);
                    GameObject pos = GameObject.Find("" + Object);
                    goti.GetComponent <GotiScript> ().CellNumber = Object;
                    goti.transform.position = pos.transform.position;
                    GameDelegate.showMoveGoti(Object);
                    //goti.transform.position = Vector3.SmoothDamp(goti.transform.position,pos.transform.position,ref ss,0.2f);
                    //iTween.MoveTo (goti, pos.transform.position, 0.2f);
                } catch (System.Exception ex) {
                    // Debug.Log ("moveGotiSteps Exception " + ex.Message);
                }
                i++;
                yield return(new WaitForSeconds(0.2f));
            }

            goti.GetComponent <GotiScript> ().isMoving = false;
        }
        void onRecivedMassage(string sender, string msg)
        {
            try
            {
                JSONNode s = JSON.Parse(msg);


                switch (s[ServerTags.TAG])
                {
                case ServerTags.TURN:
                {
                    //// Debug.Log ("Player_ID " + Player_ID);

                    try
                    {
                        string player_name = userName.text;
                        isTimeOn = false;
                        time     = 0;
                        GameDelegate.showPlayerTurn(s[ServerTags.PLAYER]);

                        TimerBg.SetActive(false);
                        TimerText.GetComponent <Text>().text = "";
                        PlayerDice.SetActive(false);
                        CancelInvoke("StartTimer");
                        TotalTime  = 30;
                        lossSecond = 0;
                        ///TimerImage.GetComponent<Image> ().fillAmount = 0;
                        if (Player_ID.Equals(s[ServerTags.PLAYER]))
                        {
                            PlayerDice.SetActive(true);
                            TurnPlayer();
                            isTimeOn = true;
                            //if (Player_ID.Equals(SecurePlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID)) || Player_ID.Equals("BOT-COMPUTER"))
                            //{
                            InvokeRepeating("StartTimer", 0.0f, 1.0f);
                            //}
                        }
                        else
                        {
                            resetDices();
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log(ex.Message);
                    }
                }
                break;

                case ServerTags.WINNER_PLAYER:
                {
                    //string player_name = SecurePlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID);

                    //JSONNode node = s["RESULT"];
                    //string Wincoin = s["VALUE"];
                    //// Debug.Log("result is " + node.Count);
                    //JSONNode node1 = node[0];
                    //string playerId = node1["PLAYER_ID"];
                    //if (Player_ID.Equals(playerId))
                    //{
                    //    GameObject ss = Instantiate(GameObject.Find("CoinImage"));
                    //    ss.transform.SetParent(transform);
                    //    ss.transform.localScale = new Vector3(1f, 1f, 1f);
                    //    ss.transform.position = new Vector3(0.0f, 0.0f, 0.0f);
                    //    iTween.MoveTo(ss, transform.position, 1.0f);
                    //    Destroy(ss, 1.5f);

                    //}
                }
                break;



                case ServerTags.DICE_ROLL:
                {
                    //string player_name = userName.text;
                    try
                    {
                        if (Player_ID.Equals(s[ServerTags.PLAYER]))
                        {
                            this.dicNumber = int.Parse(s[ServerTags.VALUES]);
                            activeDice();
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log(ex.Message);
                    }
                }
                break;

                case ServerTags.FEE_SUBMIT:
                {
                    //string player_name = userName.text;
                    try
                    {
                        if (Player_ID.Equals(s[ServerTags.PLAYER]))
                        {
                            GameObject ss = Instantiate(GameObject.Find("CoinImage"));

                            ss.transform.SetParent(transform);
                            ss.transform.localScale = new Vector3(1f, 1f, 1f);

                            iTween.MoveTo(ss, investAmount.transform.position, 0.5f);
                            Destroy(ss, 1.5f);
                            investAmount.text = "Invest Amount  :" + " " + GameConstantData.entryFee;
                            earnAmount.text   = "Earn Amount :" + " " + GameConstantData.entryFee * 1.8;
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log(ex.Message);
                    }
                }
                break;

                case ServerTags.CHATTING_START:
                {
                    try
                    {
                        if (Player_ID.Equals(s[ServerTags.PLAYER_NAME]))
                        {
                            ShowChatBox(s[ServerTags.CHAT_MSG]);
                        }
                        else
                        {
                            Hide();
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log(ex.Message);
                    }
                }
                break;

                case ServerTags.EMOJI:
                {
                    try
                    {
                        if (Player_ID.Equals(s[ServerTags.PLAYER_NAME]))
                        {
                            string emoji_number = (s[ServerTags.EMOJI_NUMBER]);
                            ShowEmoji(emoji_number);
                            Emoji.SetActive(true);
                        }
                        else
                        {
                            hideEmoji();
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log(ex.Message);
                    }
                }
                break;

                case ServerTags.MOVE_GOTI:
                {
                    try
                    {
                        if (Player_ID.Equals(s[ServerTags.PLAYER]))
                        {
                            int to          = int.Parse(s[ServerTags.TO_POSITION]);
                            int from        = int.Parse(s[ServerTags.LAST_POSITION]);
                            int goti_number = int.Parse(s[ServerTags.FROM_POSITION]);
                            moveGoti(from, to, goti_number);
                            if (from == -1)
                            {
                                GameDelegate.openGoti();
                            }
                            if (to == -1)
                            {
                                GameDelegate.StartCutGotiSound();
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log(ex.Message);
                    }
                }
                break;

                case ServerTags.RESET_GOTI:
                {
                    try
                    {
                        if (Player_ID.Equals(s[ServerTags.PLAYER]))
                        {
                            int to          = int.Parse(s[ServerTags.TO_POSITION]);
                            int goti_number = int.Parse(s[ServerTags.INDEX]);
                            resetGoti(to, goti_number);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log(ex.Message);
                    }
                }
                break;

                case ServerTags.READY_GOTI:
                {
                    //string player_name = userName.text;
                    try
                    {
                        if (Player_ID.Equals(s[ServerTags.PLAYER]))
                        {
                            int position = int.Parse(s[ServerTags.POSITION]);
                            readyGoti(position);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log(ex.Message);
                    }
                }
                break;

                case DeviceTags.DICE_ROLL_DONE_COMPLETE:
                {
                    try
                    {
                        //string player_name = userName.text;
                        if (Player_ID.Equals(s[ServerTags.PLAYER]))
                        {
                            int      to        = int.Parse(s["VALUE"]);
                            JSONNode TurnValue = s["STEPS"];
                            diceRollDone(to, TurnValue);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        // Debug.Log("DICE_ROLL_DONE Exception " + ex.Message);
                    }
                }
                break;

                default:
                    break;
                }
            }catch (System.Exception ex) {
                // Debug.Log(ex.Message);
            }
        }
        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;
            }
        }
Beispiel #12
0
        public void TapGotiAction()
        {
            GameDelegate.hideButton();

            if (Enable)
            {
                GameDelegate.hideGotipanel();
                if (playerName == UserController.getInstance.ID)
                {
                    //// Debug.Log (" value is " + TurnValue.Count);
                    // Debug.Log (" value is " + TurnValue.ToString ());
                    if (TurnValue.Count > 1)
                    {
                        //removeOption ();
                        // Debug.Log ("Multiple Values ");
                        if (currentPosition == -1)
                        {
                            // Debug.Log ("Click on House goti");
                            if (userHasOne() && userHasSix())
                            {
                                GameDelegate.showButton(TurnValue, transform.gameObject);
                                // Debug.Log("call showButton");
                                //							Panel.SetActive (true);
                                //							Indicator.SetActive (true);
                                //							for (int i = 0; i < TurnValue.Count; i++) {
                                //								Button [i].SetActive (true);
                                //								Button [i].transform.GetChild (0).GetComponent<Text> ().text = TurnValue [i];
                                //							}
                            }
                            else
                            {
                                if (userHasSix())
                                {
                                    GameDelegate.stopAnimation();
                                    Enable = false;
                                    GameDelegate.showRemoveNumber(6);
                                    GameDelegate.selectNumber(6);
                                    appwarp.userSelectGoti(index, 6);
                                    // Debug.Log (" You have 6 ");
                                }
                                else if (userHasOne())
                                {
                                    GameDelegate.stopAnimation();
                                    GameDelegate.showRemoveNumber(1);
                                    GameDelegate.selectNumber(1);
                                    appwarp.userSelectGoti(index, 1);
                                    Enable = false;
                                    // Debug.Log (" You have 1 ");
                                }
                            }
                        }
                        else
                        {
                            //						GameDelegate.hideGotipanel ();
                            // Debug.Log ("Click on running goti. Show PopUp");

                            GameDelegate.showButton(TurnValue, transform.gameObject);
                            //						Panel.SetActive (true);
                            //
                            //						Indicator.SetActive (true);
                            //						for (int i = 0; i < TurnValue.Count; i++) {
                            //							Button [i].SetActive (true);
                            //							Button [i].transform.GetChild (0).GetComponent<Text> ().text = TurnValue [i];
                            //						}
                        }
                    }
                    else if (TurnValue.Count == 1)
                    {
                        // Debug.Log ("Have single value");
                        int number = int.Parse(TurnValue[0]);

                        if (currentPosition == -1)
                        {
                            if (number == 6 || number == 1)
                            {
                                GameDelegate.stopAnimation();
                            }
                            GameDelegate.selectNumber(number);
                            appwarp.userSelectGoti(index, number);
                            Enable = false;
                        }
                        if (currentPosition != -1)
                        {
                            GameDelegate.stopAnimation();
                            GameDelegate.selectNumber(number);
                            appwarp.userSelectGoti(index, number);
                            Enable = false;
                        }
                    }

                    // Debug.Log (" value is " + TurnValue.Count);
                    animator.GetComponent <Animation>().Stop();
                    animator.SetActive(false);
                    //print ("Tap on working " + index);
                }
            }
            else
            {
                // Debug.Log ("is not enable");
            }
        }
Beispiel #13
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);
            // }
        }
 public override void StartClockSound()
 {
     //// Debug.Log ("StartClockSound working");
     GameDelegate.StartTimerSound();
 }