Beispiel #1
0
        public void CheckVersions()
        {
            serverAPI.DoGet <PropertyVersion[]>("/properties/versions", data =>
            {
                foreach (var propertyVersion in data)
                {
                    var cacheString = PlayerPrefs.GetString(StorageKey(propertyVersion.propertyType), "");
                    if (cacheString.Length > 0)
                    {
                        var cache = JsonConvert.DeserializeObject <PropertyCache>(cacheString, serializerSettings);
                        if (cache.version == propertyVersion.version)
                        {
                            properties.Add(cache.type, cache);
                        }
                        else
                        {
                            UpdateProperties(propertyVersion.propertyType, propertyVersion.version);
                        }
                    }
                    else
                    {
                        UpdateProperties(propertyVersion.propertyType, propertyVersion.version);
                    }
                }

                versionsChecked = true;
            });
        }
 public void LoadBaseHeroes()
 {
     serverAPI.DoGet <List <HeroBase> >("/hero_base", data =>
     {
         baseHeroes = data;
         Debug.Log($"Loaded {baseHeroes.Count} base heroes");
     });
 }
 public void LoadTaskClusters()
 {
     serverAPI.DoGet <List <TaskCluster> >("/tasks", data =>
     {
         TaskClusters = data;
         Debug.Log($"Loaded {TaskClusters.Count} task clusters");
     });
 }
Beispiel #4
0
 private void LoadFight(long fightId, Action <FightResolved> onSuccess)
 {
     serverAPI.DoGet <FightResolved>($"/fight/{fightId}", data =>
     {
         cache.Add(data.id, data);
         onSuccess.Invoke(data);
     });
 }
Beispiel #5
0
 public void LoadBaseVehicles()
 {
     serverAPI.DoGet <VehicleBase[]>("/vehicle", data =>
     {
         baseVehicles = data;
         Debug.Log($"Loaded {baseVehicles.Length} base vehicles");
     });
 }
Beispiel #6
0
 private void ReloadExpeditions()
 {
     Debug.Log("Refreshing expeditions");
     serverAPI.DoGet <List <Expedition> >("/expedition/active", data =>
     {
         Consume(new PlayerActionResponse {
             expeditions = data
         });
     });
 }
        private async UniTask ReloadMission(Mission mission)
        {
            mission.CancellationTokenSource = new CancellationTokenSource();
            await UniTask.Delay(
                mission.NextUpdateTime - DateTime.Now,
                cancellationToken : mission.CancellationTokenSource.Token
                );

            mission.CancellationTokenSource = null;
            Debug.Log($"Updating mission {mission.id}");
            serverAPI.DoGet <Mission>($"/battle/mission/{mission.id}", Update);
        }
        private async UniTask ReloadMap(PlayerMap playerMap)
        {
            playerMap.CancellationTokenSource = new CancellationTokenSource();
            await UniTask.Delay(
                playerMap.ResetTime - DateTime.Now,
                cancellationToken : playerMap.CancellationTokenSource.Token
                );

            playerMap.CancellationTokenSource = null;
            Debug.Log($"Updating mission {playerMap.mapId}");
            serverAPI.DoGet <PlayerMap>($"/map/{playerMap.mapId}", data => Update(data, data.mapId == CurrentPlayerMap.mapId));
        }