예제 #1
0
        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);
        }
예제 #2
0
        public void ResponseRaceInit(ExtendedEventArgs eventArgs)
        {
            ResponseRaceInitEventArgs args = eventArgs as ResponseRaceInitEventArgs;

            if (args.status == 0) {
                Application.LoadLevel ("RRReadyScene");
            } else {
                Join ();
            }
        }
예제 #3
0
        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");
            }
        }
예제 #4
0
        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();
            }
        }
예제 #6
0
        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");
            }
        }
예제 #7
0
        public void ResponseRaceInit(ExtendedEventArgs eventArgs)
        {
            ResponseRaceInitEventArgs args = eventArgs as ResponseRaceInitEventArgs;

            if (args.status == 0)
            {
                Application.LoadLevel("RRReadyScene");
            }
            else
            {
                Join();
            }
        }
예제 #8
0
        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
            }
        }
예제 #9
0
        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();
            }
        }
예제 #10
0
        // 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() + "]");
                }
            }
        }
예제 #11
0
        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);
                    }
                }
            }
        }
예제 #13
0
 public void AddMessage(int event_id, ExtendedEventArgs args)
 {
     msgQueue.Enqueue(args);
 }
예제 #14
0
 public void AddMessage(int event_id, ExtendedEventArgs args)
 {
     msgQueue.Enqueue(args);
 }
예제 #15
0
        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");
        }
예제 #16
0
 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);
 }