void OnMatchMakingGameContextCreated(Fresvii.AppSteroid.Models.GameContext gameContext)
        {
            if (latestGameContext == null)
            {
                latestGameContext = gameContext;
            }
            else if (latestGameContext.UpdatedCount == gameContext.UpdatedCount)
            {
                return;
            }
            else
            {
                latestGameContext = gameContext;
            }

            IDictionary valueDict = (IDictionary)gameContext.Value;

            if (valueDict.Contains("message"))
            {
                string msg = ((string)valueDict["message"]);

                logMessage += gameContext.UpdatedCount + ". " + gameContext.UpdatedBy.Name + " :\n" + msg + "\n\n";
            }
            else if (valueDict.Contains("quit"))
            {
                Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog("This match has quited.", delegate(bool del)
                {

                });

                Application.LoadLevel("FresviiSample");
            }
        }
        void OnMatchMakingGameContextCreated(Fresvii.AppSteroid.Models.GameContext gameContext)
        {
            if (latestGameContext == null)
            {
                latestGameContext = gameContext;
            }
            else if (latestGameContext.UpdatedCount == gameContext.UpdatedCount)
            {
                return;
            }
            else
            {
                latestGameContext = gameContext;
            }

            IDictionary valueDict = (IDictionary)gameContext.Value;

            if (valueDict.Contains("x") && valueDict.Contains("y"))
            {
                int x = (int)((long)valueDict["x"]);

                int y = (int)((long)valueDict["y"]);

                board[x][y] = turn;

                gameCount++;

                currentPiece.transform.position = squares[x + y * 3].transform.position;

                currentPiece.GetComponent<Renderer>().enabled = true;

                currentPiece.GetComponent<Renderer>().material.color = new Color(currentPiece.GetComponent<Renderer>().material.color.r, currentPiece.GetComponent<Renderer>().material.color.g, currentPiece.GetComponent<Renderer>().material.color.b, 1.0f);

                if (CheckWin())
                {
                    message.text = gameContext.UpdatedBy.Name + " Win!";

                    mode = Mode.Done;
                }
                else if (gameCount == 9)
                {
                    mode = Mode.Done;

                    message.text = "Draw";
                }
                else
                {
                    ChangeTurn();
                }
            }
            else if (valueDict.Contains("quit"))
            {
                mode = Mode.Quit;
            }
            else if (valueDict.Contains("restart"))
            {
                Start();
            }
        }
        void OnMatchMakingGameContextCreated(Fresvii.AppSteroid.Models.GameContext gameContext)
        {
            if (latestGameContext == null)
            {
                latestGameContext = gameContext;
            }
            else if (latestGameContext.UpdatedCount == gameContext.UpdatedCount)
            {
                return;
            }
            else
            {
                latestGameContext = gameContext;
            }

            Debug.Log("OnMatchMakingGameContextCreated " + gameContext.UpdatedBy.Name);

            logText.text += "#### OnMatchMakingGameContextCreated\n";

            IDictionary valueDict = (IDictionary)gameContext.Value;

            if (valueDict.Contains("Type"))
            {
                Debug.Log("has type : " + (string)valueDict["Type"]);

                if((string)valueDict["Type"] == "HostData" && gameContext.UpdatedBy.Id != FAS.CurrentUser.Id)
                {
                    networkHostInformation = new NetworkHostInformation();

                    if (valueDict.Contains("guid"))
                    {
                        Debug.Log((string)valueDict["guid"]);

                        networkHostInformation.userNat = true;

                        networkHostInformation.guid = (string)valueDict["guid"];

                        networkHostInformation.user = gameContext.UpdatedBy;

                        Network.Connect(networkHostInformation.guid, FASConfig.Instance.appId); // useNat
                    }
                    else
                    {
                        if (valueDict.Contains("ip") && valueDict.Contains("port"))
                        {
                            Debug.Log((string)valueDict["ip"]);

                            Debug.Log((string)valueDict["port"]);

                            networkHostInformation.ip = (string)valueDict["ip"];

                            networkHostInformation.port = int.Parse((string)valueDict["port"]);

                            networkHostInformation.userNat = false;

                            networkHostInformation.user = gameContext.UpdatedBy;

                            Network.Connect(networkHostInformation.ip, networkHostInformation.port, FASConfig.Instance.appId);
                        }
                    }

                    logText.text += "Host user is " + networkHostInformation.user.Name + "\n";
                }
                else if((string)valueDict["Type"] == "ClientConnected")
                {
                    Debug.Log("ClientConnected" + gameContext.UpdatedBy.Name);

                    logText.text += "Client connected : " + gameContext.UpdatedBy.Name + "\n";
                }
            }
        }