public void ResponseRRGetMap(ExtendedEventArgs eventArgs) { ResponseRRGetMapEventArgs args = eventArgs as ResponseRRGetMapEventArgs; GameManager.mapSeed = args.mapNumber; //Debug.Log("Get map seed from server! The number is " + args.mapNumber); }
public void ResponseRaceInit(ExtendedEventArgs eventArgs) { ResponseRaceInitEventArgs args = eventArgs as ResponseRaceInitEventArgs; if (args.status == 0) { Application.LoadLevel ("RRReadyScene"); } else { Join (); } }
public void ResponseLogin(ExtendedEventArgs eventArgs) { ResponseLoginEventArgs args = eventArgs as ResponseLoginEventArgs; if (args.status == 0) { Constants.USER_ID = args.user_id; } else { Debug.Log ("Login Failed"); } }
public void ResponseGameState(ExtendedEventArgs eventArgs) { ResponseLoginEventArgs args = eventArgs as ResponseLoginEventArgs; if (args.status == 0) { Constants.USER_ID = args.user_id; } else { Debug.Log("Response GameState Failed"); // Don't know what comment should be made here } }
public void ResponseRRStartGame(ExtendedEventArgs eventArgs) { Debug.Log ("ResponseRRStartGame has been called from Selection Manager.cs"); ResponseRRStartGameEventArgs args = eventArgs as ResponseRRStartGameEventArgs; if (args.status == 0) { Application.LoadLevel ("RRCountdownScene"); } else { // Join(); } }
public void ResponseLogin(ExtendedEventArgs eventArgs) { ResponseLoginEventArgs args = eventArgs as ResponseLoginEventArgs; if (args.status == 0) { Constants.USER_ID = args.user_id; } else { Debug.Log("Login Failed"); } }
public void ResponseRaceInit(ExtendedEventArgs eventArgs) { ResponseRaceInitEventArgs args = eventArgs as ResponseRaceInitEventArgs; if (args.status == 0) { Application.LoadLevel("RRReadyScene"); } else { Join(); } }
public void ResponseRRStartGame(ExtendedEventArgs eventArgs) { Debug.Log("ResponseRRStartGame has been called from Selection Manager.cs"); ResponseRRStartGameEventArgs args = eventArgs as ResponseRRStartGameEventArgs; if (args.status == 0) { Application.LoadLevel("RRCountdownScene"); } else { // Join(); } }
// Update is called once per frame void Update() { while (msgQueue.Count > 0) { ExtendedEventArgs args = msgQueue.Dequeue(); if (callbackList.ContainsKey(args.event_id)) { callbackList [args.event_id] (args); //Debug.Log("Processed Event No. " + args.event_id + " [" + args.GetType() + "]"); } else { //Debug.Log("Missing Event No. " + args.event_id + " [" + args.GetType() + "]"); } } }
public void ResponseRREndGame(ExtendedEventArgs eventArgs) { // Debug.Log ("ResponseEndGame Called in Running.cs 1"); ResponseRREndGameEventArgs args = eventArgs as ResponseRREndGameEventArgs; if (args.win == true) { PlayerPrefs.SetInt("Win", 1); } else { PlayerPrefs.SetInt("Win", 0); } PlayerPrefs.SetString("Winning Time", args.winningTime); // Debug.Log ("ResponseEndGame Called in Running.cs 2"); Application.LoadLevel("RREndScene"); }
public void ReadSocket() { if (!socketReady) { return; } if (theStream.DataAvailable) { byte[] buffer = new byte[2]; theStream.Read(buffer, 0, 2); short bufferSize = BitConverter.ToInt16(buffer, 0); buffer = new byte[bufferSize]; theStream.Read(buffer, 0, bufferSize); MemoryStream dataStream = new MemoryStream(buffer); short response_id = DataReader.ReadShort(dataStream); Debug.Log("response_id: " + response_id); //Debug.Log(response_id.GetType().ToString()); NetworkResponse response = NetworkResponseTable.get(response_id); if (response != null) { response.dataStream = dataStream; response.parse(); ExtendedEventArgs args = response.process(); if (args != null) { MessageQueue msgQueue = mainObject.GetComponent <MessageQueue>(); msgQueue.AddMessage(args.event_id, args); } } } }
public void AddMessage(int event_id, ExtendedEventArgs args) { msgQueue.Enqueue(args); }
public void ResponseRREndGame(ExtendedEventArgs eventArgs) { // Debug.Log ("ResponseEndGame Called in Running.cs 1"); ResponseRREndGameEventArgs args = eventArgs as ResponseRREndGameEventArgs; if (args.win == true) { PlayerPrefs.SetInt ("Win", 1); } else { PlayerPrefs.SetInt ("Win", 0); } PlayerPrefs.SetString ("Winning Time", args.winningTime); // Debug.Log ("ResponseEndGame Called in Running.cs 2"); Application.LoadLevel("RREndScene"); }