//using at end of trening
        public MapResultPage(List <Plugin.Geolocator.Abstractions.Position> newTrening, MapPreparedData newTreningData, object mapPolyline)
        {
            InitializeComponent();

            resultRoad       = new List <Plugin.Geolocator.Abstractions.Position>(newTrening);
            resultData       = new MapPreparedData(newTreningData);
            workoutManager   = DBConnection.MainConnection.WorkoutItem;
            mapManager       = DBConnection.MainConnection.MapPoint;
            sendMapPointList = new List <MapPointItem>();

            //ToLocalTime

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                break;

            case Device.Android:
                this.Title = "Add";
                break;

            case Device.UWP:
                break;
            }

            ResultMap.DrawRoadAtStart(mapPolyline);
        }
Ejemplo n.º 2
0
        private DBConnection()
        {
            Client = new MobileServiceClient(Constants.ApplicationURL);

            const string offlineDbPath = @"localstore.db";
            var          store         = new MobileServiceSQLiteStore(offlineDbPath);

            store.DefineTable <WorkoutItem>();
            store.DefineTable <UserItem>();
            store.DefineTable <MapPointItem>();
            //Initializes the SyncContext using the default IMobileServiceSyncHandler.This class executes the async calls to synchronize the database
            Client.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler());

            WorkoutItem = new WorkoutItemManager(Client);
            MapPoint    = new MapPointManager(Client);
            UserItem    = new UserItemManager(Client);
            UserLogin   = DependencyService.Get <ILoginSupplier>();
        }
Ejemplo n.º 3
0
        public WorkoutListPage()
        {
            InitializeComponent();

            managerWorkout      = DBConnection.MainConnection.WorkoutItem;
            managerMapPoints    = DBConnection.MainConnection.MapPoint;
            StackLUWP.IsVisible = false;

            switch (Device.RuntimePlatform)
            {
            case Device.UWP:        //Windows:
                StackLUWP.IsVisible = true;

                var syncButton = new Button {
                    Text          = "Items synchronization",
                    HeightRequest = 30
                };
                syncButton.Clicked += OnRefreshButtonUWP;
                buttonsPanel.Children.Add(syncButton);
                break;
            }
        }
Ejemplo n.º 4
0
    public static void TurnOver()
    {
        dayNumber++;
        totalNumOfMeatToConsume = numberOfAvailSlaves + numberOfBusySlaves + numberOfInjuredSlaves;
        numberOfMeat           -= totalNumOfMeatToConsume;
        numberOfDeaths          = Mathf.RoundToInt(numberOfBusySlaves * Random.Range(0f, maxProbOfDeath));
        numberOfInjured         = Mathf.RoundToInt((numberOfBusySlaves - numberOfDeaths) * Random.Range(0f, maxProbOfInjure));
        numberOfAvailSlaves     = numberOfAvailSlaves + numberOfBusySlaves + numberOfInjuredSlaves - numberOfDeaths - numberOfInjured;
        numberOfInjuredSlaves   = numberOfInjured;
        if (numberOfBusySlaves > 0)
        {
            for (int i = 0; i < MapPointManager.countOfMapPoints; i++)
            {
                if (MapPointManager.requestExplore[i])
                {
                    MapPointManager.requestExplore[i] = false;
                    checkExploreSuccess = Random.Range(0f, 1f) > (1 - maxProbOfExploreSuccess);
                    if (checkExploreSuccess)
                    {
                        mapPointsCleared += 1;
                    }
                }
                if (MapPointManager.requestHunt[i])
                {
                    MapPointManager.requestHunt[i] = false;
                    totalNumOfMeatToCol           += numOfMeatToCol[i];
                }
            }
        }
        numberOfMeat      += totalNumOfMeatToCol;
        numberOfBusySlaves = 0;
        tmpNumbers[0].text = dayNumber.ToString();
        tmpNumbers[1].text = numberOfAvailSlaves.ToString();
        tmpNumbers[2].text = numberOfBusySlaves.ToString();
        tmpNumbers[3].text = numberOfInjuredSlaves.ToString();
        tmpNumbers[4].text = numberOfMeat.ToString();

        MapPointManager.displayMapPoints();
        reportTexts[0].text = numberOfInjured + " SLAVES GOT INJURED";
        reportTexts[1].text = numberOfDeaths + " SLAVES DIED";
        reportTexts[2].text = totalNumOfMeatToCol + " MEAT COLLECTED";
        reportTexts[3].text = totalNumOfMeatToConsume + " MEAT CONSUMED";
        if (checkExploreSuccess)
        {
            reportTexts[4].text = "EXPLORE SUCCEEDED";
        }
        else
        {
            reportTexts[4].text = "EXPLORE FAILED OR NO EXPLORE AT ALL";
        }
        checkExploreSuccess = false;
        dailyReport.SetActive(true);
        totalNumOfMeatToCol = 0;
        for (int i = 0; i < MapPointManager.slavesAssignedToPoints.Length; i++)
        {
            if (MapPointManager.slavesAssignedToPoints[i].activeSelf)
            {
                MapPointManager.slavesAssignedToPoints[i].GetComponent <TextMeshProUGUI>().text = "0";
                MapPointManager.slavesAssignedToPoints[i].SetActive(false);
            }
        }
    }