Exemplo n.º 1
0
        protected override void Initialize()
        {
            base.Initialize();

            sc = new ScreenController();
            ScreenController.set(Screen.LOAD);
        }
Exemplo n.º 2
0
 public void update(ref Socket ws)
 {
     if (GamePad.GetState(0).IsButtonDown(Buttons.Back))
     {
         ScreenController.set(Screen.ACTIVITY);
     }
     ;
 }
Exemplo n.º 3
0
        public void update(ref Socket ws)
        {
            if (activity.touch)
            {
                activity.touch = false;

                ScreenController.set(Screen.ACTIVITY);
            }
        }
Exemplo n.º 4
0
        public void update()
        {
            if (login.touch)
            {
                ScreenController.set(Screen.LOGIN);
            }

            if (register.touch)
            {
                ScreenController.set(Screen.REGISTER);
            }
        }
Exemplo n.º 5
0
        public void update(ref Socket ws)
        {
            if (GamePad.GetState(0).IsButtonDown(Buttons.Back))
            {
                ScreenController.set(Screen.ACTIVITY);
            }
            ;

            if (join.touch)
            {
                join.touch = false;

                ws.Emit("join", "ASD123"); //id.str
            }
        }
Exemplo n.º 6
0
        public void update(ref Socket ws)
        {
            if (GamePad.GetState(0).IsButtonDown(Buttons.Back))
            {
                ScreenController.set(Screen.HALL);
            }
            ;

            if (join.touch)
            {
                join.touch = false;
                ScreenController.set(Screen.JOIN_ACTIVITY);
            }
            else if (create.touch)
            {
                create.touch = false;
                ScreenController.set(Screen.CREATE_ACTIVITY);
            }
        }
Exemplo n.º 7
0
        public void update(ref Socket ws)
        {
            if (GamePad.GetState(0).IsButtonDown(Buttons.Back))
            {
                ScreenController.set(Screen.HOME);
            }
            ;

            if (register.touch)
            {
                register.touch = false;

                //ws.Emit("register", "asd", "123"); // JAJAJAJA

                if (user.str != "" && pass.str != "")
                {
                    ws.Emit("register", user.str, pass.str);
                }
            }
        }
Exemplo n.º 8
0
        public void update(ref Socket ws)
        {
            if (GamePad.GetState(0).IsButtonDown(Buttons.Back))
            {
                ScreenController.set(Screen.HOME);
            }
            ;

            if (login.touch)
            {
                login.touch = false;

                if (user.str != "" && pass.str != "")
                {
                    ws.Emit("login", user.str, pass.str);
                }
                else
                {
                    ws.Emit("login", "asd", "123");
                }
            }
        }
Exemplo n.º 9
0
        protected override void LoadContent()
        {
            IO.Options op = new IO.Options()
            {
                AutoConnect = true
            };
            ws = IO.Socket("http://192.168.0.12:8081", op);

            spriteBatch = new SpriteBatch(GraphicsDevice);

            font  = Content.Load <SpriteFont>("font/SourceCodePro48SB");
            point = createTexture(1, 1);

            corner_solid_ul = Content.Load <Texture2D>("corner_solid_ul");
            corner_solid_ur = Content.Load <Texture2D>("corner_solid_ur");
            corner_solid_dr = Content.Load <Texture2D>("corner_solid_dr");
            corner_solid_dl = Content.Load <Texture2D>("corner_solid_dl");

            corner_ul = Content.Load <Texture2D>("corner_ul");
            corner_ur = Content.Load <Texture2D>("corner_ur");
            corner_dr = Content.Load <Texture2D>("corner_dr");
            corner_dl = Content.Load <Texture2D>("corner_dl");

            stroke_ul = Content.Load <Texture2D>("stroke_ul");
            stroke_ur = Content.Load <Texture2D>("stroke_ur");
            stroke_dl = Content.Load <Texture2D>("stroke_dl");
            stroke_dr = Content.Load <Texture2D>("stroke_dr");

            icon_activity = Content.Load <Texture2D>("icon_activity");

            /*****************I'M GOING TO BUILD A WALL, AND MEXICO WILL PAY FOR IT*******************/
            #region Connection


            ws.On(Socket.EVENT_CONNECT, () => {
                output = "Connected";
                ScreenController.set(Screen.HOME);
            });

            ws.On("success", (data) => {
                System.Console.WriteLine("Data:" + data);
                if ((bool)data)
                {
                    output = "Registered!";
                    ScreenController.set(Screen.LOGIN);
                }
                else
                {
                    output = "Error en el Registro";
                }
            });

            ws.On("logged", (data) => {
                output = data.ToString();
                if ((bool)data)
                {
                    ScreenController.set(Screen.HALL);
                }
            });

            ws.On("profile", (data) => {
                var Json = data as JToken;

                //User.id = Json.Value<int>("id");
                User.name = Json.Value <string>("name");
                output    = "@" + User.name;
            });

            /*ws.On("text", (data) => {
             *
             *  var Json = data as JToken;
             *  output = "Loading Question";
             *
             *  ScreenController.setQuestion(
             *      Json.Value<string>("q"), Json.Value<string>("op1"),
             *      Json.Value<string>("op2"), Json.Value<string>("op3")
             *  );
             *
             *  ScreenController.set(Screen.GAME);
             * });*/

            ws.On("question", (data) => {
                var Jarray           = data as JArray;
                ScreenGame.questions = Jarray;

                output   = Jarray.Count.ToString();
                var Json = Jarray.First;

                ScreenController.setQuestion(
                    Json.Value <string>("q"), Json.Value <string>("op0"),
                    Json.Value <string>("op1"), Json.Value <string>("op2"),
                    Json.Value <string>("op3")
                    );

                ScreenController.set(Screen.GAME);
            });

            ws.On("finish", (data) => {
                ScreenController.set(Screen.FINISH);
            });

            #endregion
            /***************************************** THE WALL **************************************/
        }