Example #1
0
 //заполнить данные о здании из бд
 public void TakeData(NetworkBuild build)
 {
     idBuild      = build.IdBuild;
     nameBuild    = build.nameBuild;
     aboutBuild   = build.aboutBuild;
     idStreetPath = build.IdStreetPath;
     priceBuild   = build.PriceBuild;
     enable       = build.Enable;
     place        = build.Place;
 }
Example #2
0
 //обновить данные о здании
 public void updateBuild(NetworkBuild build)
 {
     builds[build.IdBuild] = build;
 }
Example #3
0
    //заполнение массивов игроков, улиц, частей улиц и зданий, исходя из данных в базе данных
    public void GetEverithing()
    {
        players        = new NetworkPlayer[dataService.getPlayers().Count + 1];
        builds         = new NetworkBuild[dataService.getBuilds().Count + 1];
        streets        = new NetworkStreet[dataService.getStreets().Count + 1];
        paths          = new NetworkStreetPath[dataService.getStreetPaths().Count + 1];
        pathForBuys    = new List <NetworkPathForBuy>();
        govermentPaths = new List <NetworkGovermentPath>();

        foreach (Streets streetse in dataService.getStreets())
        {
            List <StreetPaths> streetPathses = dataService.getAllPathsOfStreet(streetse.IdStreet);
            int[] pathses = new int[streetPathses.Count];

            int k = 0;
            foreach (StreetPaths streetPathse in streetPathses)
            {
                PathsForBuy ifExist = dataService.getPathForBuyById(streetPathse.IdStreetPath);

                if (ifExist != null)
                {
                    List <Builds> buildses = dataService.getBuildsOnTheStreet(streetPathse.IdStreetPath);
                    int[]         buildes  = new int[buildses.Count];

                    int i = 0;
                    foreach (Builds buildse in buildses)
                    {
                        builds[buildse.IdBuild] = buildse.getNetworkBuild();
                        buildes[i] = buildse.IdBuild;
                        i++;
                    }

                    paths[streetPathse.IdStreetPath] = ifExist.GetNetworkPathForBuy(streetPathse, buildes);
                    pathForBuys.Add(ifExist.GetNetworkPathForBuy(streetPathse, buildes));
                }
                else
                {
                    List <Events> eventses = dataService.getEventsOnTheStreet(streetPathse.IdStreetPath);
                    Event[]       events   = new Event[eventses.Count];


                    int j = 0;
                    if (!streetPathse.NameOfPrefab.Equals("Court"))
                    {
                        events = new Event[eventses.Count + 1];
                        j++;
                    }

                    foreach (Events eventse in eventses)
                    {
                        events[j] = eventse.GetEvent();
                        j++;
                    }

                    paths[streetPathse.IdStreetPath] = streetPathse.GetNetworkGovermentPath(events);
                    if (streetPathse.NameOfPrefab.Equals("Court"))
                    {
                        court = streetPathse.GetNetworkGovermentPath(events);
                    }

                    govermentPaths.Add(streetPathse.GetNetworkGovermentPath(events));
                }

                pathses[k] = streetPathse.IdStreetPath;
                k++;
            }

            streets[streetse.IdStreet] = streetse.GetNetworkStreet(pathses);
        }

        foreach (Players player in dataService.getPlayers())
        {
            players[player.IdPlayer] = player.GetNetworkPlayer();
        }

        players[0] = new NetworkPlayer();
        streets[0] = new NetworkStreet(0, "", "", new int[1]);
        paths[0]   = new NetworkStreetPath(0, "", 0, 0, Vector3.zero, Vector3.zero, false, "");
        builds[0]  = new NetworkBuild(0, "", "", 0, 0, false, 0, 0);
    }