public void homesend() { scObject data = new scObject("homeReponse"); message mes = new message("home"); SendServerMessage(mes); }
private message buildMessage() { message m = new message("game"); scObject information = new scObject("header"); information.addInt("num_snake", playerList.players.Count); m.addSCObject(information); for (int i = 0; i < playerList.players.Count; i++) { m.addSCObject(playerList.players [i].snake.snakeToSCObject()); } //get the scoreboard list List <Pair <string, int> > tempboard = new List <Pair <string, int> >(); foreach (Player p in playerList.players) { string name = p.username; int score = p.snake.length(); tempboard.Add(new Pair <string, int> (name, score)); } tempboard.Sort(SortByScore); scoreboard = tempboard; return(m); }
//Listener for button Show me Data public void buttonListenerShowMeData() { string userPrefs = textCounty.text + "," + textMonth.text + "," + textYear.text + "," + textAccidentType.text; Debug.Log(userPrefs); scObject data = new scObject("userprefs"); data.addString("county", textCounty.text); data.addString("month", textMonth.text); data.addString("year", textYear.text); data.addString("accidentType", textAccidentType.text); message openDatamsg = new message("opendata"); openDatamsg.addSCObject(data); //TODO check dates if correct //object for construct correct message HandlePlayerQuery pq = new HandlePlayerQuery(); //Send the correct message message svrMessage = new message("ServerOpenDataRequest"); svrMessage = pq.messageOpenDataReady(openDatamsg); if (svrMessage != null) { UpdateInfoPanel(textCounty.text,svrMessage.getSCObject(0).getString("dateMY"), textAccidentType.text); SendServerMessage(svrMessage); } else { Debug.Log("THERE ARE EMPTY FIELDS..."); } }
public message receiveDestroy(message m) { scObject foodInfo = m.getSCObject("foodInfo"); float x = foodInfo.getFloat("xPos"); float y = foodInfo.getFloat("yPos"); List <Connection> clients = Server.Instance.getClients(); for (int i = 0; i < clients.Count; i++) { Server.Instance.sendClientMessage(clients[i], m); } GameObject[] fs = GameObject.FindGameObjectsWithTag("food"); foreach (GameObject f in fs) { if (f.transform.position.x == x && f.transform.position.y == y) { Destroy(f); } } return(m); }
//this function will be on a UI button public void logInAccount() { //Get username from Input field GameObject inputFieldObject = GameObject.Find("InputFieldUsernameLogin"); InputField inputField = inputFieldObject.GetComponent<InputField>(); string username = inputField.text; //Get Password inputFieldObject = GameObject.Find("InputFieldPasswordLogin"); inputField = inputFieldObject.GetComponent<InputField>(); string password = inputField.text; if (checkLoginInputFields(username,password)) { scObject data = new scObject("loginInfo"); data.addString("username", username); string nPass = calculateMD5Hash(password); data.addString("password", nPass); message mes = new message("login"); mes.addSCObject(data); SendServerMessage(mes); } else { //Error message GameObject errorTextOb = GameObject.Find("TextLoginError"); Text errorText = errorTextOb.GetComponent<Text>(); errorText.text = "*Please type your username and password."; } }
// ---------------------------------------------- UI 및 버튼 ---------------------------------------------- public void sendclose() { scObject data = new scObject("closeReponse"); message mes = new message("close"); SendServerMessage(mes); }
public void receiveScoreBoard(message m) { scObject info = m.getSCObject("info"); string names = info.getString("names"); string scs = info.getString("scs"); users.text = names; scores.text = scs; }
public player(controler_game controller_game_ref, scObject chanson) { _controller_game_ref = controller_game_ref; song = chanson; snd1 = Resources.Load("sounds/C3") as AudioClip; snd2 = Resources.Load("sounds/E3") as AudioClip; snd3 = Resources.Load("sounds/G3") as AudioClip; snd4 = Resources.Load("sounds/C4") as AudioClip; }
public void receiveUpdates(message m) { scObject foodInfo = m.getSCObject("foodInfo"); int type = foodInfo.getInt("type"); int x = foodInfo.getInt("xPos"); int y = foodInfo.getInt("yPos"); Spawn(type, x, y); }
private void sendRegister() { message m = new message("register"); scObject head = new scObject("register"); head.addString("username", username); head.addString("password", password); m.addSCObject(head); Client.Instance.SendServerMessage(m); }
public void SendDestroyOtherObject() { scObject data = new scObject("senddestroyotherobjectinfo"); data.addBool("SDOO", true); message mes = new message("senddestroyotherobject"); mes.addSCObject(data); SendServerMessage(mes); }
public void AllDeletePlantName() { scObject data = new scObject("alldeleteplantnameinfo"); data.addString("account", userName); message mes = new message("alldeleteplantname"); mes.addSCObject(data); SendServerMessage(mes); }
public void subtractionRank() { scObject data = new scObject("subtractionrankinfo"); data.addString("account", userName); message mes = new message("subtractionrank"); mes.addSCObject(data); SendServerMessage(mes); }
public void SendCardMessage(string plantname) { scObject data = new scObject("sendcardmessageinfo"); data.addBool("SCM", true); data.addString("plantname", plantname); message mes = new message("sendcardmessage"); mes.addSCObject(data); SendServerMessage(mes); }
public void TransferIP(string userip, string userName) { scObject data = new scObject("transferipinfo"); data.addString("battleip", userip); data.addString("account", userName); message mes = new message("transferip"); mes.addSCObject(data); SendServerMessage(mes); }
private void Transfer(string url, string userName) { scObject data = new scObject("urltransferinfo"); data.addString("url", url); data.addString("account", userName); message mes = new message("url"); mes.addSCObject(data); SendServerMessage(mes); }
public void receiveUpdates(message m) { scObject information = m.getSCObject("header"); int numSnakes = information.getInt("num_snake"); for (int i = 0; i < numSnakes - 1; i++) { playerList.players [i].snake.scObjectToSnake(m.getSCObject(playerList.players [i].username + "_snake")); } }
public void SendDestroyCastle() { Debug.Log("??"); scObject data = new scObject("senddestroycastleinfo"); data.addBool("SDC", true); message mes = new message("senddestroycastle"); mes.addSCObject(data); SendServerMessage(mes); }
public void GetItem(string userName, string itemName) // 아이템을 얻기 위해 서버로 얻을 계정과 아이템 정보 전달 (전에는 ItemCount) { scObject data = new scObject("itemcountinfo"); data.addString("account", userName); data.addString("itemName", itemName); message mes = new message("getItem"); mes.addSCObject(data); SendServerMessage(mes); Debug.Log("loginScene - GetItem Success."); } // userName이 가지고 있는 itemName
// Send only the snake of the user. private void sendUpdates() { message m = new message("lobby"); scObject lobby = new scObject("lobby"); lobby.addString("username", Client.Instance.username); lobby.addBool("ready", readied); m.addSCObject(lobby); Client.Instance.SendServerMessage(m); }
ScreenCapture sc = new ScreenCapture(); // sc 인스턴스화 public void SendTime(float time, string scenename) { scObject data = new scObject("sendtimeinfo"); data.addFloat("time", time); data.addString("account", userName); data.addString("scenename", scenename); message mes = new message("sendtime"); mes.addSCObject(data); SendServerMessage(mes); }
} // userName이 itemName 사용 public void ItemCountCheck(string userName, string itemName) { scObject data = new scObject("itemaccountcheckinfo"); data.addString("account", userName); data.addString("itemName", itemName); message mes = new message("ItemCountCheck"); mes.addSCObject(data); SendServerMessage(mes); Debug.Log("loginScene - ItemCountCheck Success."); } //userName이 itemName을 몇 개 소유했는지 확인. (전 버전은 itemaccountcheck 함수였음!)
public void SendPlantName(string plantname) { scObject data = new scObject("sendplantnameinfo"); data.addString("account", userName); data.addString("plantname", plantname); message mes = new message("sendplantname"); mes.addSCObject(data); SendServerMessage(mes); Debug.Log("loginScript Recieve " + plantname); }
private void Register(string userName, string p) { scObject data = new scObject("registerinfo"); data.addString("account", userName); //string nPass = calculateMD5Hash(p); data.addString("password", p); message mes = new message("register"); mes.addSCObject(data); SendServerMessage(mes); }
public void existurlcheck(string userName, string p) { scObject data = new scObject("urlcheckInfo"); data.addString("account", userName); //string nPass = calculateMD5Hash(p); data.addString("password", p); message mes = new message("urlcheck"); mes.addSCObject(data); SendServerMessage(mes); }
public message receiveUpdates(message m) { scObject snake = m.getSCObject("snake"); foreach (Player p in playerList.players) { if (p.username.Equals(snake.getString("username"))) { p.snake.scObjectToSnake(snake); } } return(buildMessage()); }
public void sendipaddress() { sendip = cSock.RemoteEndPoint.ToString(); message newMessage1000 = new message("SendipaddressResponse"); scObject data = new scObject("data"); data.addBool("response", true); data.addString("useripaddress", sendip); newMessage1000.addSCObject(data); serverTCP power = new serverTCP(); power.sendClientMessage(cSock, newMessage1000); }
public void UpdatePlantID(string userName, int plantPos, int plantID) { Debug.Log("loginScript - UpdatePlantID is called"); scObject data = new scObject("UpdatePlantIDInfo"); data.addString("account", userName); data.addInt("plantPos", plantPos); data.addInt("plantID", plantID); message mes = new message("UpdatePlantID"); mes.addSCObject(data); SendServerMessage(mes); }
public void SelectQuery(string userName, string columnName, string tableName) { Debug.Log("loginScript - SelectQuery is called"); scObject data = new scObject("SelectQueryInfo"); data.addString("account", userName); data.addString("columnName", columnName); data.addString("tableName", tableName); message mes = new message("SelectQuery"); mes.addSCObject(data); SendServerMessage(mes); }
public void UseItem(string userName, string itemName, int itemNum) // 아이템을 사용하기 위해 서버로 계정과 사용할 아이템 정보 전달 { scObject data = new scObject("useiteminfo"); data.addString("account", userName); data.addString("itemName", itemName); data.addInt("itemNum", itemNum); message mes = new message("UseItem"); mes.addSCObject(data); SendServerMessage(mes); Debug.Log("loginScene - UseItem Success."); } // userName이 itemName 사용
public void send() { message newMessage = new message("loginResponse"); scObject data = new scObject("data"); data.addBool("response", true); newMessage.addSCObject(data); sendClientMessage(clientSockets[0], newMessage); output.outToScreen("send 실행"); for (int i = 0; clientSockets.Count > i; i++) { output.outToScreen("" + clientSockets[i]); } }
public void Disconnect() { output.outToScreen("모든 클라이언트와 연결 끊기"); int i = 0; message Disconnet = new message("DisconnectResponse"); scObject data = new scObject("data"); data.addInt("disconnect", 1); Disconnet.addSCObject(data); for (i = 0; i < clientSockets.Count(); i++) { sendClientMessage(clientSockets[i], Disconnet); } }
public void logInAccount(string userName, string p) { scObject data = new scObject("loginInfo"); data.addString("account", userName); string nPass = calculateMD5Hash(p); data.addString("password", p); message mes = new message("login"); mes.addSCObject(data); SendServerMessage(mes); Debug.Log("loginScene - loginAccountSuccess."); }
//this method gets a raw message with the prefs of user //and returns a message ready to send to server or null public message messageOpenDataReady(message m) { //Initialize emptyDropdown = false; //INPUT string county, month, year, accidentType; //OUTPUT string elCounty,dateMY,table; //GET INPUT county = m.getSCObject(0).getString("county"); month = m.getSCObject(0).getString("month"); year = m.getSCObject(0).getString("year"); accidentType = m.getSCObject(0).getString("accidentType"); //PREPARE OUTPUT elCounty = getCountyInGreek(county); dateMY = getMonth(month) + "-" + year; table = getAccidentType(accidentType); //Build a ReadyTOSend message message newMes = new message("opendata"); scObject obj = new scObject("OpenDataObject"); obj.addString("county", elCounty); obj.addString("dateMY", dateMY); obj.addString("table", table); newMes.addSCObject(obj); //return it if (!emptyDropdown) { if(!accidentType.Equals("Lethals")) { int num; if(month.Equals("Select month") || year.Equals("Select year") || !(int.TryParse(year, out num))) { return null; } else { return newMes; } } return newMes; } else return null; }
public void clipNotes(int tick) { barsSprites.Add(instanceBar); barsSprites[(barsSprites.Count) - 1].transform.parent = instance.transform; instanceBar = (GameObject)Object.Instantiate(bar); if (!_modele_venyl_ref.note1 && !_modele_venyl_ref.note2 && !_modele_venyl_ref.note3 && !_modele_venyl_ref.note4 && _modele_venyl_ref.typeAccordSvt > 0) { _controller_game_ref.incrementToken(); } if (_modele_venyl_ref.note1) { notesSprites.Add(instance1); notesSprites[(notesSprites.Count) - 1].transform.parent = instance.transform; instance1 = new GameObject(); } if (_modele_venyl_ref.note2) { notesSprites.Add(instance2); notesSprites[(notesSprites.Count) - 1].transform.parent = instance.transform; instance2 = new GameObject(); } if (_modele_venyl_ref.note3) { notesSprites.Add(instance3); notesSprites[(notesSprites.Count) - 1].transform.parent = instance.transform; instance3 = new GameObject(); } if (_modele_venyl_ref.note4) { notesSprites.Add(instance4); notesSprites[(notesSprites.Count) - 1].transform.parent = instance.transform; instance4 = new GameObject(); } bool temp = false; switch (_modele_venyl_ref.typeAccordSvt) { case 1: temp = _modele_venyl_ref.note1; _modele_venyl_ref.note1=_modele_venyl_ref.note2; _modele_venyl_ref.note2 = _modele_venyl_ref.note3; _modele_venyl_ref.note3 = _modele_venyl_ref.note4; _modele_venyl_ref.note4 = temp; break; case 2: temp = _modele_venyl_ref.note4; _modele_venyl_ref.note4 = _modele_venyl_ref.note3; _modele_venyl_ref.note3 = _modele_venyl_ref.note2; _modele_venyl_ref.note2 = _modele_venyl_ref.note1; _modele_venyl_ref.note1 = temp; break; case 3: temp = _modele_venyl_ref.note1; _modele_venyl_ref.note1=_modele_venyl_ref.note4; _modele_venyl_ref.note4=temp; temp = _modele_venyl_ref.note2; _modele_venyl_ref.note2=_modele_venyl_ref.note3; _modele_venyl_ref.note3=temp; break; } _modele_venyl_ref.typeAccordSvt=0; scObject note = new scObject(""); if (_modele_venyl_ref.note1) { _modele_venyl_ref.note1 = false; _modele_venyl_ref.nbNotes--; note = new scObject("note1"); note.addInt("time", tick); note.addInt("type", 1); note.addBool("deleted", false); _modele_venyl_ref.notes.addSCObject(note); } if (_modele_venyl_ref.note2) { _modele_venyl_ref.note2 = false; _modele_venyl_ref.nbNotes--; note = new scObject("note2"); note.addInt("time", tick); note.addInt("type", 2); note.addBool("deleted", false); _modele_venyl_ref.notes.addSCObject(note); } if (_modele_venyl_ref.note3) { _modele_venyl_ref.note3 = false; _modele_venyl_ref.nbNotes--; note = new scObject("note3"); note.addInt("time", tick); note.addInt("type", 3); note.addBool("deleted", false); _modele_venyl_ref.notes.addSCObject(note); } if (_modele_venyl_ref.note4) { _modele_venyl_ref.note4 = false; _modele_venyl_ref.nbNotes--; note = new scObject("note4"); note.addInt("time", tick); note.addInt("type", 4); note.addBool("deleted", false); _modele_venyl_ref.notes.addSCObject(note); } }
//this function will be on a UI button public void registerAccount() { string[] registryCredentials = new string[7]; /* 0 firstname 1 lastname 2 date of birth 3 email 4 username 5 password1 6 password2*/ //get firstname GameObject inputFieldObject = GameObject.Find("InputFieldFirstName"); InputField inputField = inputFieldObject.GetComponent<InputField>(); registryCredentials[0] = inputField.text; inputFieldObject = GameObject.Find("InputFieldLastName"); inputField = inputFieldObject.GetComponent<InputField>(); registryCredentials[1] = inputField.text; inputFieldObject = GameObject.Find("InputFieldDateOfBirth"); inputField = inputFieldObject.GetComponent<InputField>(); registryCredentials[2] = inputField.text; inputFieldObject = GameObject.Find("InputFieldEmail"); inputField = inputFieldObject.GetComponent<InputField>(); registryCredentials[3] = inputField.text; inputFieldObject = GameObject.Find("InputFieldUsername"); inputField = inputFieldObject.GetComponent<InputField>(); registryCredentials[4] = inputField.text; inputFieldObject = GameObject.Find("InputFieldPassword"); inputField = inputFieldObject.GetComponent<InputField>(); registryCredentials[5] = inputField.text; inputFieldObject = GameObject.Find("InputFieldRpassword"); inputField = inputFieldObject.GetComponent<InputField>(); registryCredentials[6] = inputField.text; GameObject errorTextOb = GameObject.Find("TextRegisterError"); Text errorText = errorTextOb.GetComponent<Text>(); GameObject test = GameObject.Find("InputFieldFirstName"); InputField firstName = test.GetComponent<InputField>(); firstName.ActivateInputField(); switch (checkRegisterForm(registryCredentials)) { /* Error Codes 0. send message to server(all ok) 1. not all forms filled 2. passwords not match 3. not correct email 4. not correct date of birth 5. weak password */ case 0: scObject data = new scObject("registerInfo"); data.addString("firstname", registryCredentials[0]); data.addString("lastname", registryCredentials[1]); data.addString("birthdate", registryCredentials[2]); data.addString("email", registryCredentials[3]); data.addString("username", registryCredentials[4]); string nPass = calculateMD5Hash(registryCredentials[5]); data.addString("password", nPass); message mes = new message("register"); mes.addSCObject(data); SendServerMessage(mes); errorText.text = ""; break; case 1: errorText.text = "*Please fill all the fields."; break; case 2: errorText.text = "*Passwords don't match."; break; case 3: errorText.text = "*Not valid email address."; break; case 4: errorText.text = "*Not valid birth of date (dd/mm/yyyy)."; break; case 5: errorText.text = "*Passwords need to be at least 8 characters."; break; } }
public void ui_loop() { float mod = ((Screen.width * 1.0f) / Screen.height)/3; GUI.skin = bt; if (_modele_game_ref.tick >= (600 * _modele_game_ref.difficulty)) { _modele_game_ref.tick = 0; _modele_game_ref.scoreTemp = _modele_game_ref.scoreP1; _modele_game_ref.hitTemp = _modele_game_ref.hit; _modele_game_ref.successTemp = _modele_game_ref.success; _modele_game_ref.chansons.addSCObject(_venyl.destroy()); _modele_game_ref.isPlaying = false; if (_modele_game_ref.manche % 2 != 0) { instanceMenu = (GameObject)Object.Instantiate(PochMenu); } else { scObject dataP1 = _modele_game_ref.scoreData.getSCObject((_modele_game_ref.manche - 2)); scObject dataP2 = new scObject(_modele_game_ref.manche.ToString()); if (_modele_game_ref.hit == 0) { _modele_game_ref.hit = 1; } dataP2.addInt("hit", _modele_game_ref.hit); dataP2.addInt("succes", _modele_game_ref.success); dataP2.addInt("score", _modele_game_ref.scoreP2); float scoreP1= ((dataP1.getInt("succes") * 1f) / dataP1.getInt("hit") * (dataP1.getInt("score"))); float scoreP2= (((dataP2.getInt("succes") * 1f) / dataP2.getInt("hit")) * (dataP2.getInt("score"))); instanceMeter = (GameObject)Object.Instantiate(meter); // afficher lorsque manche est paire??? if (scoreP2 < scoreP1) { lecteur=new player(this, _modele_game_ref.chansons.getSCObject( _modele_game_ref.chansons.getSCObjectCount()-2)); instanceMeter.transform.GetChild(0).transform.Rotate(0,0,(((scoreP1-scoreP2)/(scoreP1+scoreP2))*45)); } else { lecteur = new player(this, _modele_game_ref.chansons.getSCObject(_modele_game_ref.chansons.getSCObjectCount() - 1)); instanceMeter.transform.GetChild(0).transform.Rotate(0, 0, -(((scoreP2 - scoreP1) / (scoreP1 + scoreP2))*45)); } //instanceFen1 = (GameObject)Object.Instantiate(fenetre); //instanceFen2 = (GameObject)Object.Instantiate(fenetre); instanceBar1 = (GameObject)Object.Instantiate(bar1); instanceBar2 = (GameObject)Object.Instantiate(bar2); instanceBar1.transform.position = new Vector3(-4f, -4, 0); instanceBar2.transform.position = new Vector3(8, -4, 0); } } if (_modele_game_ref.tick == 0) { if (_modele_game_ref.manche == 0) { if (_modele_game_ref.howToPlaySt==0) { GUI.skin = bt; if (GUI.Button(new Rect((Screen.width / 2) - 235, 220, 210, 50), "Start Game") ) { Object.Destroy(instanceMenu); _venyl = new venyl(this); _modele_game_ref.manche++; _modele_game_ref.isPlaying = true; } if (_modele_game_ref.difficulty != 1) { GUI.skin = bt; if (GUI.Button(new Rect((Screen.width / 2) - 235, 280, 210, 50), "Normal")) { _modele_game_ref.difficulty = 1; } } else { GUI.skin = txt; if (GUI.Button(new Rect((Screen.width / 2) - 235, 280, 210, 40), "Normal")) { _modele_game_ref.difficulty = 1; } } if (_modele_game_ref.difficulty != 1.6f) { GUI.skin = bt; if (GUI.Button(new Rect((Screen.width / 2) - 235, 320, 210, 40), "Hard")) { _modele_game_ref.difficulty = 1.6f; } } else { GUI.skin = txt; if (GUI.Button(new Rect((Screen.width / 2) - 235, 320, 210, 40), "Hard")) { _modele_game_ref.difficulty = 1.6f; } } if (_modele_game_ref.difficulty != 2) { GUI.skin = bt; if (GUI.Button(new Rect((Screen.width / 2) - 235, 360, 210, 40), "Expert")) { _modele_game_ref.difficulty = 2; } } else { GUI.skin = txt; if (GUI.Button(new Rect((Screen.width / 2) - 235, 360, 210, 40), "Expert")) { _modele_game_ref.difficulty = 2; } } GUI.skin = bt; if (GUI.Button(new Rect((Screen.width / 2) - 235, 410, 210, 50), "How to play")) { _modele_game_ref.howToPlaySt ++; Object.Destroy(instanceMenu); instanceMenu = (GameObject)Object.Instantiate(HowTo); } if (GUI.Button(new Rect((Screen.width / 2) - 235, 470, 210, 50), "Exit game")) { Application.Quit(); } } else { if (GUI.Button(new Rect((Screen.width / 2) - 220, Screen.height - 103, 210, 50), "Back")) { if (_modele_game_ref.howToPlaySt == 1) { Object.Destroy(instanceMenu); instanceMenu = (GameObject)Object.Instantiate(PochMenu); _modele_game_ref.howToPlaySt--; } else { Object.Destroy(instanceMenu); instanceMenu = (GameObject)Object.Instantiate(HowTo); _modele_game_ref.howToPlaySt--; } } if (GUI.Button(new Rect((Screen.width / 2) , Screen.height - 103, 210, 50), "Next")) { if (_modele_game_ref.howToPlaySt == 1) { Object.Destroy(instanceMenu); instanceMenu = (GameObject)Object.Instantiate(HowTo2); _modele_game_ref.howToPlaySt++; } else { Object.Destroy(instanceMenu); instanceMenu = (GameObject)Object.Instantiate(PochMenu); _modele_game_ref.howToPlaySt=0; } } } } else if (_modele_game_ref.manche % 2 == 0) { GUI.skin = txt; scObject dataP1 = _modele_game_ref.scoreData.getSCObject((_modele_game_ref.manche - 2)); scObject dataP2 = new scObject(_modele_game_ref.manche.ToString()); if (_modele_game_ref.hit == 0) { _modele_game_ref.hit = 1; } dataP2.addInt("hit", _modele_game_ref.hit); dataP2.addInt("succes", _modele_game_ref.success); dataP2.addInt("score", _modele_game_ref.scoreP2); // afficher lorsque manche est paire??? if ((((dataP2.getInt("succes") * 1f) / dataP2.getInt("hit")) * (dataP2.getInt("score"))) < ((dataP1.getInt("succes") * 1f) / dataP1.getInt("hit") * (dataP1.getInt("score")))) { GUI.Label(new Rect((Screen.width - 200) / 2, 50, 200, 200), "Player 1 Win!!!!"); } else if ((((dataP2.getInt("succes") * 1f) / dataP2.getInt("hit")) * (dataP2.getInt("score"))) == ((dataP1.getInt("succes") * 1f) / dataP1.getInt("hit") * (dataP1.getInt("score")))) { GUI.Label(new Rect((Screen.width-200)/2, 50, 200, 200), "Tie!!!!"); } else { GUI.Label(new Rect((Screen.width - 200) / 2, 50, 200, 200), "Player 2 Win!!!!"); } GUI.Label(new Rect(10, 10, 200, 50), "Player 1"); GUI.Label(new Rect(155, 110, 200, 50),(dataP1.getInt("score")).ToString()+" Pts"); GUI.Label(new Rect(160, 170, 200, 50), (Mathf.Round((dataP1.getInt("succes") * 1f) / dataP1.getInt("hit") * 100f)).ToString() + " l 100"); instanceBar1.transform.localScale = new Vector3(2, ((dataP1.getInt("succes") * 1f) / dataP1.getInt("hit"))* 2, 1); //GUI.Label(new Rect(100, 200, 400, 200), "Normalised score: " + Mathf.Round(((dataP1.getInt("succes") * 1f) /dataP1.getInt("hit") * (dataP1.getInt("score")))).ToString() + "Pts"); GUI.Label(new Rect(Screen.width-210, 10, 200, 50), "Player 2"); GUI.Label(new Rect(Screen.width-400, 110, 200, 50), (dataP2.getInt("score")).ToString() + " Pts"); GUI.Label(new Rect(Screen.width-360, 170, 200, 50), (Mathf.Round((dataP2.getInt("succes") * 1f) / dataP2.getInt("hit") * 100f)).ToString() + " l 100"); instanceBar2.transform.localScale = new Vector3(2, ((dataP2.getInt("succes") * 1f) / dataP2.getInt("hit"))*2, 1); //GUI.Label(new Rect(600, 200, 400, 200), "Normalised score: " + Mathf.Round((((dataP2.getInt("succes") * 1f) / dataP2.getInt("hit")) * (dataP2.getInt("score")))).ToString() + "Pts"); GUI.skin = bt; if (GUI.Button(new Rect(Screen.width - (Screen.width / 3 * 2), Screen.height - 50, Screen.width / 3, 50), "Start New Game")) { Object.Destroy(instanceBar1); Object.Destroy(instanceBar2); Object.Destroy(instanceMeter); scObject dataScore = new scObject(_modele_game_ref.manche.ToString()); dataScore.addInt("hit", _modele_game_ref.hit); dataScore.addInt("succes", _modele_game_ref.success); dataScore.addInt("score", _modele_game_ref.scoreP2); _modele_game_ref.scoreData.addSCObject(dataScore); _modele_game_ref.hit = 0; _modele_game_ref.success = 0; _modele_game_ref.scoreP1 = 0; _modele_game_ref.multiplier = 1; _modele_game_ref.streak = 0; _modele_game_ref.manche++; _modele_game_ref.offTick = 0; _venyl = new venyl(this); _modele_game_ref.isPlaying = true; // t_timer.Start(); } if (GUI.Button(new Rect(Screen.width - (Screen.width / 3), Screen.height - 50, Screen.width / 3, 50), "Exit Game")) { Application.Quit(); } if (GUI.Button(new Rect(Screen.width - (Screen.width / 3 * 3), Screen.height - 50, Screen.width / 3, 50), "Credit")) { _modele_game_ref.credit = true; instanceMenu = (GameObject)Object.Instantiate(Credit); } if (_modele_game_ref.credit) { if (GUI.Button(new Rect(Screen.width - (Screen.width / 3 * 2), Screen.height - 100, Screen.width / 4, 50), "Close")) { _modele_game_ref.credit = false; Object.Destroy(instanceMenu); } } } else { if (GUI.Button(new Rect((Screen.width / 2) - 235, 250, 250, 50), "Switch Side")) { Object.Destroy(instanceMenu); scObject dataScore = new scObject(_modele_game_ref.manche.ToString()); if (_modele_game_ref.hit == 0) { _modele_game_ref.hit = 1; } dataScore.addInt("hit", _modele_game_ref.hit); dataScore.addInt("succes", _modele_game_ref.success); dataScore.addInt("score", _modele_game_ref.scoreP1); _modele_game_ref.scoreData.addSCObject(dataScore); _modele_game_ref.hit=0; _modele_game_ref.success=0; _modele_game_ref.scoreP1 = 0; _modele_game_ref.multiplier = 1; _modele_game_ref.streak = 0; _modele_game_ref.tick = 1; _modele_game_ref.manche++; _venyl = new venyl(this); _modele_game_ref.isPlaying = true; /// t_timer.Start(); } } } int hit = 1; if (_modele_game_ref.hit != 0) { hit = _modele_game_ref.hit; } if (_modele_game_ref.isPlaying) { //GUI.Label(new Rect(Screen.width-220, 40, 400, 200), "Raw Score:"); //GUI.Label(new Rect(600, 75, 400, 200), "P2 Raw Score:"); //GUI.Label(new Rect(Screen.width - 200, 125, 400, 200), "Notes Hit: "); //GUI.Label(new Rect(600, 125, 400, 200), "P1 Notes Hit: "); //GUI.Label(new Rect(Screen.width - 200, 175, 400, 200), "Final Score:"); // GUI.Label(new Rect(600, 175, 400, 200), "P1 Final Score:"); GUI.skin = txt; //GUI.Label(new Rect(600, 95, 400, 200), (scorePlayer2).ToString()); if (_modele_game_ref.manche % 2 == 1) { GUI.Label(new Rect(Screen.width - 600*mod, 150*((Screen.height*1f)/Screen.width), 200, 50), (_modele_game_ref.scoreP1).ToString()); if (_modele_game_ref.hit > 0) { //GUI.Label(new Rect(Screen.width - 200, 145, 400, 200), Mathf.Round((_modele_game_ref.success * 1f) / _modele_game_ref.hit * 100f).ToString() + " %"); //GUI.Label(new Rect(Screen.width - 200, 195, 400, 200), Mathf.Round((((_modele_game_ref.success * 1f) / _modele_game_ref.hit) * (scorePlayer1))).ToString() + " points"); } } else { GUI.Label(new Rect(Screen.width - 600 * mod, 150 * ((Screen.height * 1f) / Screen.width), 200, 50), (_modele_game_ref.scoreP2).ToString()); //GUI.Label(new Rect(Screen.width - 200, 145, 400, 200), Mathf.Round((_modele_game_ref.successTemp * 1f) / _modele_game_ref.hitTemp * 100f).ToString() + " %"); //GUI.Label(new Rect(Screen.width - 200, 195, 400, 200), Mathf.Round((((_modele_game_ref.successTemp * 1f) / _modele_game_ref.hitTemp) * (_modele_game_ref.scoreTemp))).ToString() + " points"); /*if (_modele_game_ref.hit > 0) { GUI.Label(new Rect(600, 145, 400, 200), Mathf.Round((_modele_game_ref.success * 1f) / _modele_game_ref.hit * 100f).ToString() + " %"); GUI.Label(new Rect(600, 195, 400, 200), Mathf.Round((((_modele_game_ref.success * 1f) / _modele_game_ref.hit) * (scorePlayer2))).ToString() + " points"); }*/ } /*GUI.Label(new Rect(500, 30, 400, 200), "Time:"); GUI.Label(new Rect(500, 50, 400, 200), Mathf.Round((_modele_game_ref.tick / 10f)).ToString());*/ _venyl.uiLoop(); } }
// Use this for initialization void Start() { /****************************/ message mes = new message("openDataResponse"); scObject data = new scObject("data"); data.addString("location", "Αγ. Παρασκεύη,Λ. Μεσογείων και Καποδιστρίου"); data.addString("time", "13:00 - 17:00"); data.addString("cause", "Αίτια αναφερόμενα στην οδό και τον καιρό"); data.addString("type", "Άλλο ή άγνωστο είδος"); data.addString("vehicle", "Φορτηγό κάτω των 3,5 τόνων"); data.addString("victim", "Επιβάτης"); data.addString("age", "55 +"); mes.addSCObject(data); scObject data1 = new scObject("data"); data1.addString("location", "13ο χλμ. Επ.Οδ. Ανδρίτσαινας-Θολου, Νέα Φιγαλεια"); data1.addString("time", "13:00 - 17:00"); data1.addString("cause", "Αίτια αναφερόμενα στην οδό και τον καιρό"); data1.addString("type", "Άλλο ή άγνωστο είδος"); data1.addString("vehicle", "I.X.E "); data1.addString("victim", "Οδηγός"); data1.addString("age", "55 +"); mes.addSCObject(data1); /* for(int i=0;i<40;i++) messageToScrollviewData(mes);*/ connect(); }