void OnAfterBoardDrawn() { // Debug.Log ("NGUICarShow:OnAfterBoardDrawn"); string ownedCarList = PlayerPrefs.GetString("OwnedCarList", "0:0:1:POLICE_CAR, 0:0:3:AMBULANCE, 0:0:2:LORRY_TRUCK, 0:0:4:FIRE_FIGHTING_TRUCK, 0:0:5:GARBAGE_TRUCK"); string[] carListArray = ownedCarList.Split(','); ownedCarListInsanityCarInfo = new List<CarInsanityCarInfo>(); int i = 0; foreach(string carInfo in carListArray) { if(carInfo != ""){ string[] carInfoArray = carInfo.Split(':'); CarInsanityCarInfo c = new CarInsanityCarInfo(); c.ID = Convert.ToInt32(carInfoArray[0]); //ID c.playerID = Convert.ToInt32(carInfoArray[1]); //Player_ID c.carID = Convert.ToInt32(carInfoArray[2]); //Car_ID c.name = carInfoArray[3]; //name ownedCarListInsanityCarInfo.Add(c); i++; } } // Debug.Log ("ownedCarListInsanityCarInfo.Count:"+ownedCarListInsanityCarInfo.Count); // carGameObject.SetActiveRecursively(true); foreach(CarInsanityCarInfo ownedCar in ownedCarListInsanityCarInfo) { if(ownedCar.carID == carID) { lockingCar.SetActiveRecursively(false); } } }
void OnCarSelectingChanged(CarInsanityCarInfo car) { // Debug.Log ("NGUIMatchRoomTalentLock.OnCarSelectingChanged:"+car.isTalentOpened.ToString()); lockIcon.enabled = !car.isTalentOpened; }
void Start() { // string carList = PlayerPrefs.GetString("CarList", "0:0:1:POLICE_CAR, 0:0:3:AMBULANCE, 0:0:2:LORRY_TRUCK, 0:0:4:FIRE_FIGHTING_TRUCK, 0:0:5:GARBAGE_TRUCK"); // string ownedCarList = PlayerPrefs.GetString("OwnedCarList"); string allCarList = PlayerPrefs.GetString("AllCarList", "0:0:1:POLICE_CAR:0, 0:0:3:AMBULANCE:0, 0:0:2:LORRY_TRUCK:0, 0:0:4:FIRE_FIGHTING_TRUCK:0, 0:0:5:GARBAGE_TRUCK:0, 0:0:6:GODOFWEALTH_TRUCK:0, 0:0:7:HUMMER_TRUCK:0,0:0:8:MASCOT_TRUCK:0,0:0:9:OLDCLASS_TRUCK:0"); string[] carListArray = allCarList.Split(','); allCarInsanityCarInfo = new List<CarInsanityCarInfo>(); // int i = 0; foreach(string carInfo in carListArray) { if(carInfo != ""){ string[] carInfoArray = carInfo.Split(':'); CarInsanityCarInfo c = new CarInsanityCarInfo(); c.ID = Convert.ToInt32(carInfoArray[0]); //ID c.playerID = Convert.ToInt32(carInfoArray[1]); //Player_ID c.carID = Convert.ToInt32(carInfoArray[2]); //Car_ID c.name = carInfoArray[3]; //name c.isTalentOpened = Convert.ToBoolean(Convert.ToInt32(carInfoArray[4])); allCarInsanityCarInfo.Add(c); // i++; } } }
void OnCarSelectingChanged(CarInsanityCarInfo car) { // Debug.Log ("NGUIMatchRoomTalentIcon.OnCarSelectingChanged:"+((IconName)car.carID).ToString()); icon.spriteName = ((IconName)car.carID).ToString(); icon.MakePixelPerfect(); }
public void ReceiveByClientPortal_SelectCar(int roomIndex, int selectGUPID, int car_ID, int isTalentOpened, int p) { // Debug.Log("ReceiveByClientPortal_SelectCar - GUPID:"+selectGUPID+", Car:"+car_ID); Definition.RPCProcessState resultState = (Definition.RPCProcessState)p; if(resultState == Definition.RPCProcessState.SUCCESS) { if((this.matchRoom != null)) { if (this.matchRoom.GetComponent<Room>().roomIndex == roomIndex){ if(this.matchRoom.GetComponent<Room>().IsPlayerInRoom(selectGUPID)){ if(selectGUPID == this.playerInfo.GUPID) { isLockedOn = true; foreach(CarInsanityCarInfo c in allCarInsanityCarInfo) { if(c.carID == car_ID) { this.matchRoom.GetCarInsanityPlayer(selectGUPID).selectedCar = c; this.playerInfo.GetComponent<CarInsanityPlayer>().selectedCar = c; } } // this.actionState = MatchController.ActionState.CARSELECTED; OnCarSelected(); }else{ CarInsanityCarInfo othersCar = new CarInsanityCarInfo(); othersCar.carID = car_ID; othersCar.isTalentOpened = System.Convert.ToBoolean(isTalentOpened); othersCar.name = ((Definition.eCarID)car_ID).ToString(); this.matchRoom.GetCarInsanityPlayer(selectGUPID).selectedCar = othersCar; } }else{ // this.errorMsg = "player is not in the room!"; // Debug.Log(errorMsg); matchRoomSceneViewer.SelectCarErrorSceneSetting(); } }else{ // this.errorMsg = "Game index not match!"; // Debug.Log(errorMsg); matchRoomSceneViewer.SelectCarErrorSceneSetting(); } }else{ // this.errorMsg = "Game not available (it is null)!"; // Debug.Log(errorMsg); matchRoomSceneViewer.SelectCarErrorSceneSetting(); } }else if(resultState == Definition.RPCProcessState.PLAYERNOTINROOM){ // this.errorMsg = "PLAYERNOTINROOM"; // Debug.Log(errorMsg); matchRoomSceneViewer.SelectCarErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.ROOMNOTEXIST){ // this.errorMsg = "ROOMNOTEXIST"; // Debug.Log(errorMsg); matchRoomSceneViewer.SelectCarErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.PLAYERNOTEXIST){ // this.errorMsg = "PLAYERNOTEXIST"; // Debug.Log(errorMsg); matchRoomSceneViewer.SelectCarErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.UNAVAILABLE){ // this.errorMsg = "UNAVAILABLE"; // Debug.Log(errorMsg); matchRoomSceneViewer.SelectCarErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.FAIL){ // this.errorMsg = "FAIL"; // Debug.Log(errorMsg); matchRoomSceneViewer.SelectCarErrorSceneSetting(); }else{ // Debug.Log(p.ToString()); matchRoomSceneViewer.SelectCarErrorSceneSetting(); } }
public void ReceiveByClientPortal_StartMatch(int gupid, int roomIndex, string gameServerIP, int gameServerPort, int p) { // Debug.Log("ReceiveByClientPortal_StartMatch - IP:"+gameServerIP+", Port:"+gameServerPort); Definition.RPCProcessState resultState = (Definition.RPCProcessState)p; if(resultState == Definition.RPCProcessState.SUCCESS) { if(this.playerInfo.GUPID == gupid) { // 1. check game index // 2. check target user if((this.matchRoom!= null)) { if (this.matchRoom.GetComponent<Room>().roomIndex == roomIndex){ isLockedOn = false; isStartPlay = false; selectedCarInsanityCarInfo = new CarInsanityCarInfo(); StopCoroutine("StartCountDown"); playGameController.gameServerIP = gameServerIP; playGameController.gameServerPort = gameServerPort; this.StartingMatch(); OnAllPlayerSelectCar(); }else{ // this.errorMsg = "Game index not match!"; // Debug.Log(errorMsg); matchRoomSceneViewer.StartMatchErrorSceneSetting(); } }else{ // this.errorMsg = "Game not available (it is null)!"; // Debug.Log(errorMsg); matchRoomSceneViewer.StartMatchErrorSceneSetting(); } }else{ // this.errorMsg = "You are not the correct member."; // Debug.Log(errorMsg); matchRoomSceneViewer.StartMatchErrorSceneSetting(); } }else if(resultState == Definition.RPCProcessState.FAIL){ // this.errorMsg = "FAIL"; // Debug.Log(errorMsg); matchRoomSceneViewer.StartMatchErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.PLAYERNOTINROOM){ // this.errorMsg = "PLAYERNOTINROOM"; // Debug.Log(errorMsg); matchRoomSceneViewer.StartMatchErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.ROOMNOTEXIST){ // this.errorMsg = "ROOMNOTEXIST"; // Debug.Log(errorMsg); matchRoomSceneViewer.StartMatchErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.PLAYERNOTEXIST){ // this.errorMsg = "PLAYERNOTEXIST"; // Debug.Log(errorMsg); matchRoomSceneViewer.StartMatchErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.UNAVAILABLE){ // this.errorMsg = "UNAVAILABLE"; // Debug.Log(errorMsg); matchRoomSceneViewer.StartMatchErrorSceneSetting(); }else{ // Debug.Log(p.ToString()); matchRoomSceneViewer.StartMatchErrorSceneSetting(); } }
public void ReceiveByClientPortal_LeaveMatchRoom(int roomIndex, int leaverGUPID, int p, NetworkMessageInfo msgInfo) { Definition.RPCProcessState resultState = (Definition.RPCProcessState)p; // Debug.Log("ReceiveByClientPortal_LeaveMatchRoom"); if(resultState == Definition.RPCProcessState.SUCCESS) { if((this.matchRoom != null)) { if(this.matchRoom.GetComponent<Room>().roomIndex == roomIndex) { if(this.playerInfo.GUPID != leaverGUPID) { if(this.matchRoom.GetComponent<Room>().IsPlayerInRoom(leaverGUPID)) { GameUserPlayer leaver = this.matchRoom.GetComponent<Room>().GetPlayer(leaverGUPID); this.matchRoom.PlayerLeave(leaver); Destroy(leaver.gameObject); StopCoroutine("StartCountDown"); } }else{ // Debug.Log("you are left"); // Destroy(matchRoom.gameObject); selectedCarInsanityCarInfo = new CarInsanityCarInfo(); isLockedOn = false; isStartPlay = false; StopCoroutine("StartCountDown"); // this.actionState = MatchController.ActionState.LEFT; this.drawState = MatchController.DrawState.QUIT; this.isLeaving = true; OnLeaveFromMatchRoom(); } }else{ // this.errorMsg = "Game index not match!"; // Debug.Log(errorMsg); matchRoomSceneViewer.LeaveMatchErrorSceneSetting(); } }else{ // this.errorMsg = "Game not available (it is null)!"; // Debug.Log(errorMsg); matchRoomSceneViewer.LeaveMatchErrorSceneSetting(); } }else if(resultState == Definition.RPCProcessState.PLAYERNOTINROOM){ // this.errorMsg = "PLAYERNOTINROOM"; // Debug.Log(errorMsg); matchRoomSceneViewer.LeaveMatchErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.ROOMNOTEXIST){ // this.errorMsg = "ROOMNOTEXIST"; // Debug.Log(errorMsg); matchRoomSceneViewer.LeaveMatchErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.PLAYERNOTEXIST){ // this.errorMsg = "PLAYERNOTEXIST"; // Debug.Log(errorMsg); matchRoomSceneViewer.LeaveMatchErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.UNAVAILABLE){ // this.errorMsg = "UNAVAILABLE"; // Debug.Log(errorMsg); matchRoomSceneViewer.LeaveMatchErrorSceneSetting(); }else{ // Debug.Log(p.ToString()); matchRoomSceneViewer.LeaveMatchErrorSceneSetting(); } }
public void ReceiveByClientPortal_LoadCarList(int gupid, string carList, int p, NetworkMessageInfo msgInfo) { Definition.RPCProcessState resultState = (Definition.RPCProcessState)p; if(resultState == Definition.RPCProcessState.SUCCESS) { if(this.playerInfo.GUPID == gupid) { // Debug.Log("LoadCarList:"+carList); PlayerPrefs.SetString("OwnedCarList", carList); string[] carListArray = carList.Split(','); allCarInsanityCarInfo = new List<CarInsanityCarInfo>(); int i = 0; foreach(string carInfo in carListArray) { if(carInfo != ""){ string[] carInfoArray = carInfo.Split(':'); CarInsanityCarInfo c = new CarInsanityCarInfo(); c.ID = Convert.ToInt32(carInfoArray[0]); //ID c.playerID = Convert.ToInt32(carInfoArray[1]); //Player_ID c.carID = Convert.ToInt32(carInfoArray[2]); //Car_ID c.name = carInfoArray[3]; //name // Debug.Log("ReceiveByClientPortal_LoadCarList:"+carInfoArray[4]); c.isTalentOpened = Convert.ToBoolean(Convert.ToInt32(carInfoArray[4])); //isTalentOpened allCarInsanityCarInfo.Add(c); i++; } } // this.actionState = MatchController.ActionState.CARLISTLOADED; }else{ // this.errorMsg = "FAIL. You are not the correct member."; // Debug.Log(errorMsg); matchRoomSceneViewer.LoadCarErrorSceneSetting(); } }else if(resultState == Definition.RPCProcessState.UNAVAILABLE){ // this.errorMsg = "UNAVAILABLE"; // Debug.Log(errorMsg); matchRoomSceneViewer.LoadCarErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.PLAYERNOTEXIST){ // this.errorMsg = "USERNOTEXIST"; // Debug.Log(errorMsg); matchRoomSceneViewer.LoadCarErrorSceneSetting(); }else{ // Debug.Log(p.ToString()); matchRoomSceneViewer.LoadCarErrorSceneSetting(); } }
public void OnCarSelectingChanged(CarInsanityCarInfo car) { foreach(CarInsanityCarInfo ownedCar in allCarInsanityCarInfo) { if(ownedCar.carID == car.carID) { selectedCarInsanityCarInfo = ownedCar; return; } } selectedCarInsanityCarInfo = new CarInsanityCarInfo(); }
public void AutoMatchStart(int matchFilterMap, int matchFilterMaxPlayerNumber) { if(PlayerPrefs.GetString("GameType", "Single") == "Network") { networkView.RPC("SendToGameLobby_AutoMatch", RPCMode.Server, this.playerInfo.GUPID, matchFilterMap, matchFilterMaxPlayerNumber); } else { matchRoom = CreateMatchRoom(0, "Single", 4, matchFilterMap, "Single", this.playerInfo); lobbyController.EnteredMatchRoom(); JoinMatchRoom(0, "Single", matchFilterMap, "Single", 4, 0, "player", 0, "player", 0); // string carList = PlayerPrefs.GetString("CarList", "0:0:1:POLICE_CAR, 0:0:3:AMBULANCE, 0:0:2:LORRY_TRUCK, 0:0:4:FIRE_FIGHTING_TRUCK, 0:0:5:GARBAGE_TRUCK"); string carList = PlayerPrefs.GetString("OwnedCarList", "0:0:1:POLICE_CAR:0, 0:0:3:AMBULANCE:0, 0:0:2:LORRY_TRUCK:0, 0:0:4:FIRE_FIGHTING_TRUCK:0, 0:0:5:GARBAGE_TRUCK:0"); string[] carListArray = carList.Split(','); allCarInsanityCarInfo = new List<CarInsanityCarInfo>(); foreach(string carInfo in carListArray) { if(carInfo != ""){ string[] carInfoArray = carInfo.Split(':'); CarInsanityCarInfo c = new CarInsanityCarInfo(); c.ID = Convert.ToInt32(carInfoArray[0]); //ID c.playerID = Convert.ToInt32(carInfoArray[1]); //Player_ID c.carID = Convert.ToInt32(carInfoArray[2]); //Car_ID c.name = carInfoArray[3]; //name c.isTalentOpened = Convert.ToBoolean(Convert.ToInt32(carInfoArray[4])); //isTalentOpened allCarInsanityCarInfo.Add(c); } } for(int i = 1; i < 4; i++) { JoinMatchRoom(0, "Single", matchFilterMap, "Single", 4, i, "AI" + i.ToString(), 0, "player", 1); this.matchRoom.GetCarInsanityPlayer(i).selectedCar = allCarInsanityCarInfo[UnityEngine.Random.Range(0, allCarInsanityCarInfo.Count)]; } } }
public void StartLeaveRoom() { if(PlayerPrefs.GetString("GameType") == "Network") { networkView.RPC("SendToGameLobby_LeaveMatchRoom", RPCMode.Server, this.matchRoom.GetComponent<Room>().roomIndex, this.playerInfo.GUPID); }else{ selectedCarInsanityCarInfo = new CarInsanityCarInfo(); isLockedOn = false; isStartPlay = false; StopCoroutine("StartCountDown"); // this.actionState = MatchController.ActionState.LEFT; this.drawState = MatchController.DrawState.QUIT; this.isLeaving = true; OnLeaveFromMatchRoom(); } }
public void StartCarSelect() { // this.actionState = MatchController.ActionState.CARSELECTSTART; if(PlayerPrefs.GetString("GameType", "Single") == "Network") { networkView.RPC("SendToGameLobby_CarSelect", RPCMode.Server, this.matchRoom.GetComponent<Room>().roomIndex, this.playerInfo.GUPID, this.selectedCarInsanityCarInfo.carID, (this.selectedCarInsanityCarInfo.isTalentOpened) ? 1 : 0); } else { foreach(CarInsanityCarInfo c in allCarInsanityCarInfo) { if(c.carID == this.selectedCarInsanityCarInfo.carID) { this.matchRoom.GetCarInsanityPlayer(0).selectedCar = c; OnCarSelected(); } } isLockedOn = false; isStartPlay = false; selectedCarInsanityCarInfo = new CarInsanityCarInfo(); StopCoroutine("StartCountDown"); this.StartingMatch(); OnAllPlayerSelectCar(); } // this.actionState = MatchController.ActionState.CARSELECTING; }
public void Redirect() { // Debug.Log("CarInsanityPlayer - Redirect"); selectedCar = new CarInsanityCarInfo(); }