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 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); } }
void OnEnable() { Topbarinfo.SetActive(true); online1On1.text = SecurePlayerPrefs.GetString(GameTime.ONLINE1ON1); online1On4.text = SecurePlayerPrefs.GetString(GameTime.ONLINE1ON4); friend.text = SecurePlayerPrefs.GetString(GameTime.FRIENDS); offline.text = SecurePlayerPrefs.GetString(GameTime.OFFLINE_TEXT); }
void Start() { // Debug.Log ("total coin = " + UserController.getInstance.Coin); //totalBalance.text = " "+ UserController.getInstance.Coin; CoinValidationPanel.SetActive(false); Application.runInBackground = true; Screen.sleepTimeout = SleepTimeout.NeverSleep; WinnerAnimation.SetActive(false); MessageText.SetActive(false); for (int i = 0; i < OpponentArray.Length; i++) { OpponentArray[i].GetComponent <OpponentPlayer> ().hideGoti(); OpponentArray[i].SetActive(false); } drawGame.SetActive(false); CreatePrivateTatble.SetActive(false); JoinGamePanel.SetActive(false); QuitGamePanel.SetActive(false); WinnerPanel.SetActive(false); ErrorMsgPanel.SetActive(false); string tableType = SecurePlayerPrefs.GetString(GameTags.PRIVATE_TABLE_TYPE); string FACEBOOK_FRIEND = SecurePlayerPrefs.GetString(GameTags.FACEBOOK_FRIEND); if (tableType.Equals(GameTags.CREATE_TABLE)) { loadingPanel.SetActive(true); loadingPanel.GetComponent <LoadingPanel> ().msgText.GetComponent <Text> ().text = "creating room please wait... "; CreatePrivateTatble.SetActive(false); } else if (tableType.Equals(GameTags.JOIN_TABLE)) { JoinGamePanel.SetActive(true); } else if (FACEBOOK_FRIEND.Equals(GameTags.FACEBOOK_FRIEND)) { loadingPanel.SetActive(true); loadingPanel.GetComponent <LoadingPanel> ().msgText.GetComponent <Text> ().text = "Waiting for your friend to join table..."; } else if (tableType.Equals(GameTags.CHALLENGE_FRIEND)) { loadingPanel.SetActive(true); // Debug.Log ("CHALLENGE_FRIEND created game scene"); loadingPanel.GetComponent <LoadingPanel> ().msgText.GetComponent <Text> ().text = "Waiting for your friend to join table..."; } else if (tableType.Equals(GameTags.FB_FRIEND_ONLINE)) { loadingPanel.SetActive(true); // Debug.Log ("FB_FRIEND_ONLINE created game scene"); loadingPanel.GetComponent <LoadingPanel> ().msgText.GetComponent <Text> ().text = "Waiting for your friend to join table..."; } else { loadingPanel.SetActive(true); loadingPanel.GetComponent <LoadingPanel> ().msgText.GetComponent <Text> ().text = "Searching opponent please wait..."; } }
public void onUserResumed(string a, bool b, string c) { if (c.Equals(SecurePlayerPrefs.GetString(GetPlayerDetailsTags.PLAYER_ID))) { m_apppwarp.ConnectionAbort.SetActive(false); m_apppwarp.OpponentConnectionAbort.SetActive(false); } else { m_apppwarp.OpponentConnectionAbort.SetActive(false); } }
public void onErrorMessage(string msg) { string playerType = SecurePlayerPrefs.GetString(GameTags.PRIVATE_TABLE_TYPE); if (playerType.Equals(GameTags.JOIN_TABLE)) { } else { loadingPanel.SetActive(true); loadingPanel.GetComponent <LoadingPanel> ().msgText.GetComponent <Text> ().text = msg; } }
public void EnableChatBtn() { string ofline = SecurePlayerPrefs.GetString(GameTags.OFFLINE); if (ofline.Equals(GameTags.OFFLINE)) { } else { //ChatBtn.SetActive (true); //EmojiBtn.SetActive (true); } }
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)); } }
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); } }
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); } } } } }
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; } }
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); * } * }*/ } }
// Use this for initialization void Start() { refrelCode.text = SecurePlayerPrefs.GetString(GetPlayerDetailsTags.REFREL_CODE); }
//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 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); }
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); }
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"); } }