public string Send(List<MemoryGameResult> data, string userSessionID, string gameSessionID, int isGameCompleted, int gameTime, int gameScore, short error)
 {
     try
     {
         GameServiceProxy GSP = new GameServiceProxy(EGameType.GT_MEMORY_GAME, "", userSessionID, gameSessionID, null);
         GSP.updateResults(isGameCompleted, gameTime, gameScore, error, "");
         return "OK";
     }
     catch (Exception e)
     {
         return "FAIL";
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// PageInfo class constructor. 
        /// </summary>
        /// <param name="e_game_type">Game type enum value.</param>
        /// <param name="style_name">A color name.</param>
        /// <param name="Master">An instance of Game.master page class.</param>
        /// <param name="Session">User State Session object.</param>
        public PageInfo(MasterPage Master, EGameType e_game_type, string style_name, string queryString, string userSessionID, string gameSessionID, HttpSessionState Session)
        {
            /**
             * Create new instance of GameServiceProxy class to provide access to web service methods.
             **/
            _GSP = new GameServiceProxy(e_game_type, queryString, userSessionID, gameSessionID, Session);

            /**
             * Get gameSessionID from web service.
             **/
            this.gameSessionID = _GSP.createGameSession();

            /**
             * Set Session parameters.
             */
            this.userSessionID = userSessionID;

            /**
             * Get XML data from service.
             **/
            _GSP.getXMLdata();

            /**
             * Setting private Game.master instance variable.
             **/
            _Master = new MasterProxy(Master);

            /**
             * Receive XmlDocument instance from GameServiceProxy.
             **/
            XMLDoc = _GSP.xmlData;

            /**
             * Convert XML to JSON string.
             **/
            JSONString = JsonConvert.SerializeXmlNode(XMLDoc);
            /**
             * Setting version string variable.
             */
            version = _getVersion();

            /**
             * Color postfixes for file names.
             **/
            string colorPostfix = "",
                   pathPostfix = "";

            /**
             * Setting color postfixes in depend on style_name value.
             **/
            switch (style_name)
            {
                case "orange":
                    colorPostfix = "orange";
                    pathPostfix = "-orange";
                    break;

                case "blue":
                    colorPostfix = "blue";
                    pathPostfix = "-blue";
                    break;

                case "cyan":
                    colorPostfix = "cyan";
                    pathPostfix = "-cyan";
                    break;

                case "purple":
                    colorPostfix = "purple";
                    pathPostfix = "-purple";
                    break;

                default:
                    colorPostfix = "default";
                    pathPostfix = "";
                    break;
            }

            /**
             * Launching private method to set public field values.
             **/
            setColorValues("css/css-game-" + colorPostfix + ".css", "images" + pathPostfix);

            /**
             * Launching private method to set field value in depend on e_game_type value.
             **/
            switch (e_game_type)
            {
                case EGameType.GT_FILL_IN_THE_BLANKS:
                    setGameTypeValues("Fill in the blanks", "css/fill_intheblank_style.css",
                          "css/fill-" + colorPostfix + ".css", "js-games/FillInTheBlanks.js");
                    break;

                case EGameType.GT_QUIZ_MAKER:
                    setGameTypeValues("Quiz Game", "css/quiz-game-style.css",
                          "css/quiz-" + colorPostfix + ".css", "js-games/QuizGame.js");
                    break;

                case EGameType.GT_MEMORY_GAME:
                    setGameTypeValues("Memory Game", "css/memory-game-style.css",
                          "css/memory-" + colorPostfix + ".css", "js-games/MemoryGame.js");
                    break;

                case EGameType.GT_WORD_SCRAMBLE:
                    setGameTypeValues("Word Scramble", "css/word-scramble-style.css",
                          "css/wordscramble-" + colorPostfix + ".css", "js-games/WordScramble.js");
                    break;

                case EGameType.GT_LABEL_GAME:
                    setGameTypeValues("Label Game", "css/label-game-style.css",
                          "css/label-" + colorPostfix + ".css", "js-games/LabelGame.js");
                    break;

                case EGameType.GT_LINE_MATCHING:
                    setGameTypeValues("Line Matching", "css/line-matching-style.css",
                          "css/line-" + colorPostfix + ".css", "js-games/LineMatching.js");
                    break;

                case EGameType.GT_SUPER_TYPER:
                    setGameTypeValues("Fast Typing Game", "css/fast-typing-style.css",
                          "css/fast-typing-" + colorPostfix + ".css", "js-games/SuperTyper.js");
                    break;
            }
        }
 public string Send(List<WordScrambleResult> data, string userSessionID, string gameSessionID, int isGameCompleted, int gameTime, int gameScore, short error)
 {
     string resultXml = "";
     try
     {
         XmlDocument document = transformToXml<WordScrambleResult>(data);
         resultXml = document.InnerXml;
         GameServiceProxy GSP = new GameServiceProxy(EGameType.GT_WORD_SCRAMBLE, "", userSessionID, gameSessionID, null);
         GSP.updateResults(isGameCompleted, gameTime, gameScore, error, document.InnerXml);
         return "OK";
     }
     catch (Exception e)
     {
         return "FAIL";
     }
 }
 public string Send(List<FillInTheBlanksResult> data, string userSessionID, string gameSessionID, int isGameCompleted, int gameTime, int gameScore, short error)
 {
     string resultXml = "";
     try
     {
         XmlDocument document = transformToXml<FillInTheBlanksResult>(data);
         resultXml = document.InnerXml;
         GameServiceProxy GSP = new GameServiceProxy(EGameType.GT_FILL_IN_THE_BLANKS, "", userSessionID, gameSessionID, null);
         GSP.updateResults(isGameCompleted, gameTime, gameScore, error, document.InnerXml);
         return "OK: " + resultXml;
     }
     catch (Exception e)
     {
         return "FAIL: " + resultXml;
     }
 }