示例#1
0
    public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId)
    {
        var count_players = NetworkServer.connections.Count;

        if (count_players <= startPositions.Count)
        {
            if (count_players == 2)
            {
                canvas.createBall();
                NetworkServer.Spawn(canvas.GetBall());
            }
            string player_tag = "racket_up";
            if (count_players == 1)
            {
                player_tag = "racket_down";
            }
            GameObject player = Instantiate(playerPrefab, startPositions[count_players - 1].position, Quaternion.identity);
            player.tag = player_tag;
            platform platform = player.GetComponent <platform>();
            platform.canvas = canvas;
            NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);
        }
        else
        {
            conn.Disconnect();
        }
    }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            platform platform = db.platforms.Find(id);

            db.platforms.Remove(platform);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
        public Vector2 Initialize(string filename)
        {
            Vector2 startLoc = new Vector2();
            platforms = new List<platform>();
            room = new Rectangle();

            StreamReader sr = new StreamReader(filename);
            String s = sr.ReadToEnd();
            String[] infile = s.Split(new string[] { " ", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            for (int x = 0; x < infile.Length; x++)
            {
                if (infile[x] == "Start")
                {
                    startLoc.X = Convert.ToInt32(infile[++x]);
                    startLoc.Y = Convert.ToInt32(infile[++x]);
                }

                if (infile[x] == "SolidPlat")
                {
                    platform temp1 = new platform();
                    temp1.soft = false;
                    temp1.shape = new Rectangle();

                    temp1.shape.X = Convert.ToInt32(infile[++x]);
                    temp1.shape.Y = Convert.ToInt32(infile[++x]);
                    temp1.shape.Width = Convert.ToInt32(infile[++x]);
                    temp1.shape.Height = Convert.ToInt32(infile[++x]);

                    platforms.Add(temp1);
                }

                if (infile[x] == "SoftPlat")
                {
                    platform temp1 = new platform();
                    temp1.soft = true;
                    temp1.shape = new Rectangle();

                    temp1.shape.X = Convert.ToInt32(infile[++x]);
                    temp1.shape.Y = Convert.ToInt32(infile[++x]);
                    temp1.shape.Width = Convert.ToInt32(infile[++x]);
                    temp1.shape.Height = Convert.ToInt32(infile[++x]);

                    platforms.Add(temp1);
                }

                if (infile[x] == "Room")
                {
                    room.X = Convert.ToInt32(infile[++x]);
                    room.Y = Convert.ToInt32(infile[++x]);
                    room.Width = Convert.ToInt32(infile[++x]);
                    room.Height = Convert.ToInt32(infile[++x]);
                }
            }

            return startLoc;
        }
示例#4
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        rb = GetComponent <Rigidbody2D>();
    }
示例#5
0
 public ActionResult Edit([Bind(Include = "platform_id,platform1")] platform platform)
 {
     if (ModelState.IsValid)
     {
         db.Entry(platform).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(platform));
 }
示例#6
0
 public Int64 SearchPlatform(string platformname)
 {
     using (OnlineShoppingDataClassesDataContext osdb = new OnlineShoppingDataClassesDataContext())
     {
         platform platform = (from p in osdb.platforms
                              where p.platformname.Equals(platformname.Trim(), StringComparison.InvariantCultureIgnoreCase)
                              select p).SingleOrDefault();
         return((platform == null) ? -1 : platform.platformID);
     }
 }
示例#7
0
        public platform GetPlatformByIgdb(int id_igdb)
        {
            platform plataforma = db.platform.Where(p => p.id_igdb == id_igdb).FirstOrDefault();

            if (plataforma != null)
            {
                return(plataforma);
            }
            return(null);
        }
示例#8
0
        public int?GetIdBySigla(string sigla)
        {
            platform plataforma = db.platform.Where(p => p.sigla == sigla).FirstOrDefault();

            if (plataforma == null)
            {
                return(null);
            }
            return(plataforma.id);
        }
示例#9
0
        public ActionResult Create([Bind(Include = "platform_id,platform1")] platform platform)
        {
            if (ModelState.IsValid)
            {
                db.platforms.Add(platform);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(platform));
        }
示例#10
0
 public Int64 AddPlatform(string platformname)
 {
     using (OnlineShoppingDataClassesDataContext osdb = new OnlineShoppingDataClassesDataContext())
     {
         platform p = new platform
         {
             platformname = platformname
         };
         osdb.platforms.InsertOnSubmit(p);
         osdb.SubmitChanges();
         return(p.platformID);
     }
 }
示例#11
0
        // GET: platforms/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            platform platform = db.platforms.Find(id);

            if (platform == null)
            {
                return(HttpNotFound());
            }
            return(View(platform));
        }
示例#12
0
        public void TesteSalvarJogoView()
        {
            IgdbService        igdb     = new IgdbService();
            DadosGameResponse  response = igdb.DadosJogo(428).FirstOrDefault();
            PlatformRepository pr       = new PlatformRepository();
            List <DadosDeveloperPublisherResponse> devs = igdb.DadosDeveloperPublisher(response.Developers.ToArray());
            List <DadosDeveloperPublisherResponse> pubs = igdb.DadosDeveloperPublisher(response.Publishers.ToArray());

            GameDataView gameDataView = GameDataView.init();

            gameDataView.Titulo      = response.Name;
            gameDataView.Descricao   = response.Summary;
            gameDataView.CloudnaryId = response.Cover.CloudinaryId;

            foreach (DadosDeveloperPublisherResponse dev in devs)
            {
                gameDataView.ListaDeveloper.Add(new developerPublisher {
                    name = dev.Name
                });
            }

            foreach (DadosDeveloperPublisherResponse pub in pubs)
            {
                gameDataView.ListaPublisher.Add(new developerPublisher {
                    name = pub.Name
                });
            }

            foreach (ReleaseDate lancamento in response.ReleaseDates)
            {
                platform plataforma = pr.GetPlatformByIgdb(lancamento.Platform);
                if (plataforma != null)
                {
                    DateTime data = new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(Convert.ToDouble(Convert.ToDouble(lancamento.Date)));
                    gameDataView.Platforms.Add(new game_platform {
                        id_platform  = plataforma.id,
                        release_date = data,
                        id_region    = lancamento.Region
                    });
                }
            }

            GameRepository gameRepository = new GameRepository();

            gameRepository.Adicionar(gameDataView);
        }
    // Use this for initialization
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        //DrawDefaultInspector();

        platform myScript = (platform)target;

        if (GUILayout.Button("Build Platform"))
        {
            myScript.GeneratePlatform();
        }
        if (GUILayout.Button("Destroy Platform"))
        {
            myScript.DestroyExistingTiles();
        }
    }
示例#14
0
        public async Task TesteMetacritic()
        {
            GamesEntities        db    = new GamesEntities();
            List <game_platform> games = db.game_platform.Where(gp => gp.metacritic == null).ToList();

            foreach (game_platform g in games)
            {
                GameEntity jogo       = db.game.Find(g.id_game);
                platform   plataforma = db.platform.Find(g.id_platform);
                string     sigla;
                switch (plataforma.sigla)
                {
                case "PS1":
                    sigla = "PS";
                    break;

                case "PSVITA":
                    sigla = "VITA";
                    break;

                default:
                    sigla = plataforma.sigla;
                    break;
                }
                try {
                    var metacritic = await Metacritic.SearchFor().Games().UsingTextAsync(jogo.name);

                    var resultado = metacritic.Where(m => m.Platform == sigla).Where(m => m.Name == jogo.name).FirstOrDefault();
                    if (resultado != null)
                    {
                        g.metacritic      = resultado.Score;
                        db.Entry(g).State = EntityState.Modified;
                    }
                }
                catch (Exception ex) {
                }
            }
            db.SaveChanges();
        }
示例#15
0
    void Start()
    {
        if (AutoDetectPlatform)
        {
            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                Platform = platform.WebGL;
            }
            if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
            {
                Platform = platform.Standalone;
            }
        }

        if (Platform == platform.Standalone)
        {
            client = new ClientWS();

            client.ChooseOpenMethod(onOpen);
            client.ChooseCloseMethod(onClose);
            client.ChooseMessageMethod(onMessage);
            client.ChooseErrorMethod(onError);
        }
    }
示例#16
0
 // Use this for initialization
 void Start()
 {
     plat = GetComponentInParent<platform>();
 }
示例#17
0
        public async Task <ActionResult> PreencherDadosGameIgdbJquery(int id_igdb, int Id = 0)
        {
            IgdbService       igdb     = new IgdbService();
            DadosGameResponse response = igdb.DadosJogo(id_igdb).FirstOrDefault();
            List <DadosDeveloperPublisherResponse> devs = new List <DadosDeveloperPublisherResponse>();
            List <DadosDeveloperPublisherResponse> pubs = new List <DadosDeveloperPublisherResponse>();
            List <DadosGenreResponse> genres            = new List <DadosGenreResponse>();
            List <ReleaseDate>        lancamentos       = new List <ReleaseDate>();

            PlatformRepository pr = new PlatformRepository();

            if (response.Developers != null && response.Developers.Count > 0)
            {
                devs = igdb.DadosDeveloperPublisher(response.Developers.ToArray());
            }
            if (response.Publishers != null && response.Publishers.Count > 0)
            {
                pubs = igdb.DadosDeveloperPublisher(response.Publishers.ToArray());
            }
            if (response.Genres != null && response.Genres.Count > 0)
            {
                genres = igdb.DadosGenre(response.Genres.ToArray());
            }
            if (response.ReleaseDates != null && response.ReleaseDates.Count > 0)
            {
                lancamentos = response.ReleaseDates;
            }

            GameDataView gameDataView = GameDataView.GetGameDataView();

            gameDataView.Id        = Id;
            gameDataView.id_igdb   = id_igdb;
            gameDataView.Titulo    = response.Name;
            gameDataView.Descricao = response.Summary;

            if (response.Cover != null)
            {
                gameDataView.Imagem      = gameDataView.BigCoverUrl + response.Cover.CloudinaryId + ".jpg";
                gameDataView.CloudnaryId = response.Cover.CloudinaryId;
            }
            else
            {
                gameDataView.Imagem = "/Content/ps.png";
            }

            gameDataView.InitListas();

            foreach (DadosDeveloperPublisherResponse dev in devs)
            {
                gameDataView.ListaDeveloper.Add(new developerPublisher {
                    name    = dev.Name,
                    id_igdb = dev.Id
                });
            }

            foreach (DadosDeveloperPublisherResponse pub in pubs)
            {
                gameDataView.ListaPublisher.Add(new developerPublisher {
                    name    = pub.Name,
                    id_igdb = pub.Id
                });
            }

            foreach (DadosGenreResponse genre in genres)
            {
                gameDataView.ListaGenre.Add(new genre {
                    id_igdb = genre.Id,
                    name    = genre.Name
                });
            }

            try {
                var buscaMetacritic = await Metacritic.SearchFor().Games().UsingTextAsync(response.Name);

                foreach (ReleaseDate lancamento in lancamentos)
                {
                    platform plataforma = pr.GetPlatformByIgdb(lancamento.Platform);
                    int?     meta       = null;
                    if (plataforma != null)
                    {
                        string sigla;
                        switch (plataforma.sigla)
                        {
                        case "PS1":
                            sigla = "PS";
                            break;

                        case "PSVITA":
                            sigla = "VITA";
                            break;

                        default:
                            sigla = plataforma.sigla;
                            break;
                        }

                        var resultado = buscaMetacritic.Where(m => m.Platform == sigla).Where(m => m.Name.ToLowerInvariant() == response.Name.ToLowerInvariant()).FirstOrDefault();
                        if (resultado != null)
                        {
                            meta = resultado.Score;
                        }

                        DateTime data = new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(Convert.ToDouble(Convert.ToDouble(lancamento.Date)));
                        gameDataView.Platforms.Add(new game_platform {
                            id_platform  = plataforma.id,
                            release_date = data,
                            metacritic   = meta,
                            id_region    = lancamento.Region
                        });
                    }
                }
            }
            catch (Exception ex) {
            }

            return(PartialView("FormGameView", gameDataView));
        }
示例#18
0
        public void Teste()
        {
            GamesEntities        db    = new GamesEntities();
            IgdbService          igdb  = new IgdbService();
            List <game_platform> games = db.game_platform.Where(gp => gp.release_date == null).Where(gp => gp.id_status == 1).ToList();

            foreach (game_platform g in games)
            {
                GameEntity jogo = db.game.Find(g.id_game);
                try {
                    platform          plataforma = db.platform.Find(g.id_platform);
                    DadosGameResponse dados      = igdb.DadosJogo(jogo.id_igdb.Value).FirstOrDefault();
                    ReleaseDate       lancamento;
                    if (g.id_region == null)
                    {
                        lancamento = dados.ReleaseDates.Where(r => r.Region == 8).Where(r => r.Platform == plataforma.id_igdb).FirstOrDefault();
                        if (lancamento == null)
                        {
                            lancamento = dados.ReleaseDates.Where(r => r.Region == 2).Where(r => r.Platform == plataforma.id_igdb).FirstOrDefault();
                        }
                        if (lancamento != null)
                        {
                            g.id_region = lancamento.Region;
                        }
                    }
                    else
                    {
                        lancamento = dados.ReleaseDates.Where(r => r.Region == g.id_region).Where(r => r.Platform == plataforma.id_igdb).FirstOrDefault();
                        if (lancamento == null)
                        {
                            lancamento = dados.ReleaseDates.Where(r => r.Region == 8).Where(r => r.Platform == plataforma.id_igdb).FirstOrDefault();
                        }
                        if (lancamento == null)
                        {
                            lancamento = dados.ReleaseDates.Where(r => r.Region == 2).Where(r => r.Platform == plataforma.id_igdb).FirstOrDefault();
                        }
                        if (lancamento == null)
                        {
                            if (plataforma.id != 7)
                            {
                                lancamento = dados.ReleaseDates.Where(r => r.Region == 8).Where(r => r.Platform == 45).FirstOrDefault();
                                if (lancamento == null)
                                {
                                    lancamento = dados.ReleaseDates.Where(r => r.Region == 2).Where(r => r.Platform == 45).FirstOrDefault();
                                }
                            }
                        }
                    }
                    if (lancamento != null)
                    {
                        if (lancamento.Date != null)
                        {
                            DateTime data = new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(Convert.ToDouble(Convert.ToDouble(lancamento.Date)));
                            g.release_date    = data;
                            db.Entry(g).State = EntityState.Modified;
                        }
                    }
                }
                catch (Exception ex) {
                    Console.Write(jogo.name + " " + ex.Message);
                }
            }
            db.SaveChanges();
        }
示例#19
0
 // Use this for initialization
 void Start()
 {
     plat = GetComponentInParent <platform>();
 }
 public Int64 AddPlatform(string platformname)
 {
     using (OnlineShoppingDataClassesDataContext osdb = new OnlineShoppingDataClassesDataContext())
     {
         platform p = new platform
         {
             platformname = platformname
         };
         osdb.platforms.InsertOnSubmit(p);
         osdb.SubmitChanges();
         return p.platformID;
     }
 }
示例#21
0
 EqualsValueClause(
     platform != PlatformDetectionType.Any