void UpdatePlaceModify() { //영지 효과 퀘스트 보상 증가 placeModifyIncreaseIncome = 0f; for (int i = 0; i < TerritoryManager.Instance.myPlaceList.Count; i++) { PlaceData placeData = TerritoryManager.Instance.myPlaceList[i]; if (placeData.placeBaseData.type == "Battle_IncreaseQuestExpRatio") { float a = 0f; float.TryParse(placeData.placeBaseData.formula, out a); placeModifyIncreaseIncome += a * 0.01f * placeData.placeLevel; } } //영지 효과 - 퀘스트 레벨업 비용 감소 for (int i = 0; i < TerritoryManager.Instance.myPlaceList.Count; i++) { PlaceData placeData = TerritoryManager.Instance.myPlaceList[i]; if (placeData.placeBaseData.type == "Battle_IncreaseNeedQuestExpRatio") { float a = 0f; float.TryParse(placeData.placeBaseData.formula, out a); placeModifyReduceUpgradeCost = a * 0.01f * placeData.placeLevel; } } //Debug.Log(placeModifyReduceUpgradeCost + ", " + income); }
void UpdatePlaceBuff() { if (owner.team != BattleUnit.Team.Red) { return; } for (int i = 0; i < TerritoryManager.Instance.myPlaceList.Count; i++) { PlaceData placeData = TerritoryManager.Instance.myPlaceList[i]; string buffID = placeData.placeBaseData.buffID; if (string.IsNullOrEmpty(buffID)) { continue; } if (placeData.placeBaseData.type != "Battle") { continue; } int stack = placeData.placeLevel; Buff buff = buffList.Find(x => x.baseData != null && x.baseData.id == buffID); if (buff != null) { stack = placeData.placeLevel - buff.stack; } //Debug.Log(owner.heroData.baseData.id + ", " + placeData.placeID + ", " + placeData.placeLevel + ", " + stack + ", " + placeData.placeBaseData.buffID); AttachBuff(owner, buffID, stack); } }
public void LoadData(ObservableCollection <PlaceData> listOfPlaces) { string pathData = Properties.Settings.Default.Path + Properties.Settings.Default.DataFileName; string[] lines = System.IO.File.ReadAllLines(pathData, UTF8Encoding.UTF8); // , UTF8Encoding.UTF7 PositionSet positionSet; foreach (string line in lines) { PlaceData placeData = new PlaceData(); string[] data = line.Split('|'); placeData.PlaceIndex = Int32.Parse(data[0]); placeData.PlaceId = Int32.Parse(data[1]); placeData.PlaceName = data[2]; for (int i = 3; i < data.GetUpperBound(0); i = i + 2) { positionSet = new PositionSet(data[i].ConvertStringToVertex(), data[i + 1].ConvertStringToVertex()); placeData.PositionList.Add(positionSet); } listOfPlaces.Add(placeData); } }
//TO WORK WITH - WAY OF RETURNING PLACES public override void ReadData(LeaderboardData parent) { FirebaseDatabase.DefaultInstance.GetReference("LeaderBoard").GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { Debug.LogWarning("Reading data from firebase failed. Exception : " + task.Exception); return; } else if (task.IsCompleted) { DataSnapshot data = task.Result; PlaceData[] output = new PlaceData[3]; int i = 0; foreach (DataSnapshot d in data.Children) { int x = 0; int.TryParse(d.Value.ToString(), out x); output[i] = new PlaceData(); output[i].placePoints = x; i++; } parent.initComplete = true; parent.places = output; } }); }
private void GeneratePlaces(Coordinates currentLocation) { for (int i = 0; i < places.placeList.Count; i++) { PlaceData currentPlace = places.placeList[i]; GameObject temp = Instantiate(objectDatabase[currentPlace.objectModelID].iconObject); temp.name = currentPlace.namaTempat + " _ARZoneIcon"; IconObjectController iconController = temp.GetComponent <IconObjectController>(); if (iconController != null) { iconController.PlaceData = currentPlace; // if (FO.visitedPlace.Contains(currentPlace.namaTempat)) // { // iconController.canBeClicked = false; // } // else // { // iconController.canBeClicked = true; // } } goMap.dropPin(currentPlace.lat, currentPlace.lon, temp); Debug.Log("Dropping pin " + currentPlace.namaTempat); } }
public IHttpActionResult PostPlace(PlaceData data) { FlightPlace place = new FlightPlace(); DateTime Actual = DateTime.Now; place.Place_Owner_DNI = data.ClientDNI; place.Place_Owner_Name = data.ClientName; place.idFlight = data.idFlight; place.FP_Date = Actual; db.FlightPlaces.Add(place); try { db.SaveChanges(); } catch (DbUpdateException) { if (FlightPlaceExists(place.numPlace)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = place.numPlace }, place)); }
public void InitSlot(PlaceData data) { placeData = data; //placeData.onChangedPlaceLevel += OnChangedProductionAmount; placeData.onChangedProductionAmount += OnChangedProductionAmount; InitSlot(placeData.product); }
static public BasePokemon GetEncounter(Place newPlace) { PlaceData PlaceData = PlaceData.GetData(newPlace); PokemonData PokemonData = PokemonData.GetData(GetByRarity(PlaceData)); return(GetPokemon(PokemonData, PlaceData)); }
void CalculatePlaceBuffValue() { placeBuffValue = 0; for (int i = 0; i < TerritoryManager.Instance.myPlaceList.Count; i++) { PlaceData placData = TerritoryManager.Instance.myPlaceList[i]; if (placData.placeBaseData.type == "Collect") { if (placData.placeBaseData.fillter == product.id) { placeBuffValue += placData.power; } else if (placData.placeBaseData.fillter == "all") { placeBuffValue += placData.power; } } if (placData.placeBaseData.type == "CategoryCollect") { if (placData.placeBaseData.fillter == product.category) { placeBuffValue += placData.power; } else if (placData.placeBaseData.fillter == "all") { placeBuffValue += placData.power; } } } placeBuffValue = finalProductionAmount * (placeBuffValue * 0.01); }
public async Task CreatePlace(PlaceData placeData) { Place newPlace = new Place() { longitude = currentLongitude, latitude = currentLatitude, title = placeData.Title, description = placeData.Description, addedBy = placeData.addedBy, reviews = new List <Review>() }; //await AddMarkerAsync(newPlace); //line will be removed and place will be added when model gets it from broadcaster if (markerAdded) { await RemoveTemporaryMarkerAsync(); await model.AddPlaceAsync(newPlace); } else { throw new Exception("You forgot to choose a location!"); } }
public void ShowPlaceDataDetail(PlaceData data) { placeShowImage.sprite = data.placeImage; placeTitle.text = data.placeTitle; checkInTime.text = data.time.ToString(); placeDescription.text = data.placeDescription; }
static BasePokemon GetPokemon(PokemonData PokemonData, PlaceData Place) { BasePokemon Pokemon = new BasePokemon { Monster = PokemonData.GeneralInformation.Monster, Name = PokemonData.GeneralInformation.Name, Nature = Natures.GetRandomNature(), Level = GetLevel(Place, PokemonData), Ability = GetRandomAbility(PokemonData), isShiny = CheckForShiny(), Happiness = PokemonData.Breeding.BaseHappiness, Gender = GetRandomGender(PokemonData), TrainerInfo = new P_Trainer() { Place = Place.Place,//, //Time TrainerName = TrainerData.GetData().Name, TrainerID = TrainerData.GetData().ID }, EValues = new EffortValues(), DValues = GetGenes() }; Pokemon.Moves = GetMoveList(Pokemon); Pokemon.Experience = Experience.GetExperience(PokemonData.Breeding.LvlRate, Pokemon.Level); Pokemon.Stats = GetStats(Pokemon); ResetLiveStats(Pokemon); return(Pokemon); }
IEnumerator Start() { WebServerConnectManager.onWebServerResult += OnWebServerResult; while (!UnityEngine.SceneManagement.SceneManager.GetSceneByName("Territory").isLoaded) { yield return(null); } while (!SceneLobby.Instance) { yield return(null); } SceneLobby.Instance.OnChangedMenu += OnChangedMenu; List <string> keys = GameDataManager.placeBaseDataDic.Keys.ToList(); for (int i = 0; i < keys.Count; i++) { PlaceData data = new PlaceData(keys[i]); placeDataList.Add(data); } // 서버에서 해당 유저의 영지 소유 data 읽어오기 yield return(StartCoroutine(TerritoryServerConnect(territoryPHPConnectType.Reading, "test"))); isInitialized = true; }
private void Death() { PlaceData x = new PlaceData(); x.placePoints = GetComponent <TowerPoints>().points; Leaderboard.main.TryInsert(x); StartCoroutine(EDeath()); }
public void Clone(PlaceData pd) { this.placeTitle = pd.placeTitle; this.placeDescription = pd.placeDescription; this.city = pd.city; this.time = pd.time; this.placeImage = pd.placeImage; }
void SetupData() { data = new PlaceData[5]; data[0] = new PlaceData("place1", new Vector3(-240, -456, -450), new Vector3(14.1f, 55.7f, 0f)); data[1] = new PlaceData("place2", new Vector3(-429, -463, -300), new Vector3(14.1f, 55.7f, 0f)); data[2] = new PlaceData("place3", new Vector3(-278, -463, 175), new Vector3(14.1f, 55.7f, 0f)); data[3] = new PlaceData("place4", new Vector3(-150, -400, 10), new Vector3(14.1f, 55.7f, 0f)); data[4] = new PlaceData("place5", new Vector3(-119, -437, 415), new Vector3(14.1f, 55.7f, 0f)); }
private async void WriteData(PlaceData _newData) { await DatabaseReady(); if (TryHighScore(_newData)) { ServerWrite(); } }
/// <summary> 해당 영지가 서버에 저장되어있을 때 초기화해줌 </summary> public void InitPlace(PlaceData _placeData) { placeData = _placeData; placeData.onChangedPlaceLevel += OnChangedPlaceLevel; placeData.onChangedState += OnChangedState; placeState = placeData.placeState; }
PlaceListItem AddPlaceListItem(PlaceData data) { PlaceListItem item = Instantiate(placeItemPrefab, placesHolder) .GetComponent <PlaceListItem>(); item.Init(data); placesShown.Add(item); return(item); }
static Monster GetByRarity(PlaceData PlaceData) { float RandomNumber = Random.Range(0f, 100f); //Logger.Debug(MethodBase.GetCurrentMethod().DeclaringType, "RandomNumber = " + RandomNumber); List <int> Chances = new List <int>(); foreach (Place_MonsterTree Tree in PlaceData.MonsterTree) { Chances.Add(Tree.Rarity); } Chances.Sort(); int choosenRarity = 0; for (int i = 0; i < Chances.Count; i++) { if (Chances[i] >= RandomNumber) { choosenRarity = Chances[i]; break; } choosenRarity = Chances[Chances.Count - 1]; } //Logger.Debug(MethodBase.GetCurrentMethod().DeclaringType, "choosenRarity = " + choosenRarity); Monster newMonster = Monster.none; for (int i = 0; i < PlaceData.MonsterTree.Length; i++) { //Logger.Debug(MethodBase.GetCurrentMethod().DeclaringType, "MonsterRarity = " + PlaceData.MonsterTree[i].Rarity); if (PlaceData.MonsterTree[i].Rarity == choosenRarity) { //Logger.Debug(MethodBase.GetCurrentMethod().DeclaringType, "Rarity = " + PlaceData.MonsterTree[i].Rarity); newMonster = PlaceData.MonsterTree[i].Monster; } } if (newMonster != Monster.none) { return(newMonster); } else { Logger.Error(MethodBase.GetCurrentMethod().DeclaringType, "Could not find a fitting Monster - Please check the Method!"); return(PlaceData.MonsterTree[0].Monster); } }
public LeaderboardData(Database _firebaseDatabase) { places = new PlaceData[3]; initComplete = false; for (int i = 0; i < places.Length; i++) { places[i] = new PlaceData(); } database = _firebaseDatabase; }
/// <inheritdoc /> public async Task UpdateAsync(ChangePlacesInfoCommand command, CancellationToken cancellationToken) { PlaceData place = _chatData.FirstOrDefault(ch => ch.Id == command.PlaceId); if (place == null) { return; } place.Name = command.Name; }
//몬스터 사망하면 경험치 증가 void OnDieMonster(BattleUnit monster) { //유물에 의한 보정. (적 처치시 경험치 증가) float increaseRate = 0f; Artifact artifactExp = battleGroup.artifactController.artifactList.Find(x => x.baseData.type == "IncreaseExp"); if (artifactExp != null) { float a = 0f; float.TryParse(artifactExp.baseData.formula, out a); increaseRate = a * artifactExp.stack * 0.01f; //formula가 10 이렇게 되어 있음. (10%를 의미) } float increaseByPlace = 0f; for (int i = 0; i < TerritoryManager.Instance.myPlaceList.Count; i++) { PlaceData placeData = TerritoryManager.Instance.myPlaceList[i]; if (placeData.placeBaseData.type == "Battle_IncreaseExpRatio") { float a = 0f; float.TryParse(placeData.placeBaseData.formula, out a); increaseByPlace += a * placeData.placeLevel * 0.01f; } } double exp = monster.power * 5 * (1 + increaseRate) * (1 + increaseByPlace); if (monster is BattleHero) { BattleHero m = monster as BattleHero; if (m.isBoss) { //보스는 8분할 해서 줌. (경험치 구슬 8개 떨굼) exp = m.power * 5f * 0.125f; for (int i = 0; i < 8; i++) { SpawnLootObject(monster, exp); } } else { SpawnLootObject(monster, exp); } } if (showDebug) { Debug.Log("[" + battleGroup.battleType + "] " + monster.name + ". level: " + monster.heroData.level + " - die. exp : " + exp); } //totalExp += exp; }
public void Show() { for (int i = 0; i < TerritoryManager.Instance.placeDataList.Count; i++) { PlaceData place = TerritoryManager.Instance.placeDataList[i]; if (placeDic.ContainsKey(place.placeID)) { placeDic[place.placeID].InitPlace(place); } } }
public void OnPointerDown(PointerEventData eventData) { Debug.Log("Mouse detected"); GameObject enemy = Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; enemy.transform.SetParent(canvas.transform, false); PlaceData myPlace = new PlaceData(); myPlace.placePrefab = enemy; myPlace.CreatePlaceCallback(GlobalDataStore.places.Count); GlobalDataStore.AddPlaceToList(myPlace); }
static int GetLevel(PlaceData Place, PokemonData Pokemon) { for (int i = 0; i < Place.MonsterTree.Length; i++) { if (Place.MonsterTree[i].Monster == Pokemon.GeneralInformation.Monster) { return(Random.Range(Place.MonsterTree[i].Levels[0], Place.MonsterTree[i].Levels[1])); } } Logger.Error(MethodBase.GetCurrentMethod().DeclaringType, "For some Reason the choosen Monster is not present in the PlaceData. Method returns '1'."); return(1); }
/// <inheritdoc /> public async Task AddAsync(CreateDirectPlaceCommand command, CancellationToken cancellationToken) { var place = new PlaceData { Id = Guid.NewGuid(), Member = new MemberData { Id = command.To }, Name = command.To.ToString() }; _chatData.Add(place); }
static public void Encounter(Place newPlace) { PlaceData PlaceData = PlaceData.GetData(newPlace); Logger.Debug(MethodBase.GetCurrentMethod().DeclaringType, "Starting 'Encounter' ..."); Logger.Debug(MethodBase.GetCurrentMethod().DeclaringType, "Place: " + PlaceData.Name); PokemonData PokemonData = PokemonData.GetData(GetByRarity(PlaceData)); Logger.Debug(MethodBase.GetCurrentMethod().DeclaringType, "Monster: " + PokemonData.GeneralInformation.Name); BasePokemon Pokemon = GetPokemon(PokemonData, PlaceData); Pokemon_Party.AddPokemonToParty(Pokemon); }
private void CreatePlaceContent(int i) { GameObject place = Instantiate(placePrefab); PlaceData data = place.AddComponent <PlaceData>(); data.Clone(currentPlaceList[i]); place.transform.GetChild(1).GetComponent <Image>().sprite = data.placeImage; place.transform.GetChild(2).GetComponent <Text>().text = data.placeTitle; // add on click to place EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerDown; entry.callback.AddListener((eventData) => { ShowPlaceDataDetail(data); }); place.GetComponent <EventTrigger>().triggers.Add(entry); // set Parent to place place.transform.SetParent(placeList, false); }
void UpdatePlaceModify() { //영지 효과 퀘스트 보상 증가 placeModifyIncreaseAmount = 0f; for (int i = 0; i < TerritoryManager.Instance.myPlaceList.Count; i++) { PlaceData placeData = TerritoryManager.Instance.myPlaceList[i]; if (placeData.placeBaseData.type == "Battle_IncreaseArtifectPoint") { float a = 0f; float.TryParse(placeData.placeBaseData.formula, out a); placeModifyIncreaseAmount += a * 0.01f * placeData.placeLevel; } } //Debug.Log(placeModifyIncreaseAmount); }