public void RetrieveAssetBasedOnPlantIdTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.RetrieveAssetBasedOnPlantId(2); Assert.IsNotNull(result); }
private IEnumerable <TextObject> GetCommonNameTexts(PlantInfo plantInfo, RectObject labelRect) { var yPos = GetCommonNameYPositon(labelRect.Height, _config.CommonFontY, _config.OffsetFromTop); if (plantInfo.CommonName.Length < _config.CommonCharLengthThreshhold) { return(new [] { CreateTextObject(plantInfo.CommonName, labelRect, _config.OffsetFromLeft, yPos, _config.CommonFontY, _config.CommonFontName) }); } if (plantInfo.CommonName.Contains(" ")) { var segs = plantInfo.CommonName.Split(' '); var firstLine = segs[0]; var secondLine = segs.Skip(1).Aggregate((i, j) => i + " " + j); return(new [] { CreateTextObject(firstLine, labelRect, _config.OffsetFromLeft, yPos, _config.CommonFontY, _config.CommonFontName), CreateTextObject(secondLine, labelRect, _config.OffsetFromLeft, yPos - _config.CommonFontY - _config.CommonNameLineSpacing, _config.CommonFontY, _config.CommonFontName), }); } return(new [] { CreateTextObject(plantInfo.CommonName, labelRect, _config.OffsetFromLeft, yPos, _config.CommonFontY * .9, _config.CommonFontName) }); }
public void RetrieveEquipmentInfoTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.RetrieveEquipmentInfo(2); Assert.IsNotNull(result); }
public void GetZoneTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.GetZone(); Assert.IsNotNull(result); }
public void RetrieveAssetTest1() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.RetrieveAsset(); Assert.IsNotNull(result); }
public void RetrieveBuildingTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.RetrieveBuilding(1); Assert.IsNotNull(result); }
private XmlNode CreatePlant(XmlDocument document, PlantInfo plant) { XmlNode plantNode = document.CreateElement("plant"); // Attributes string id = plant.RsmlID != null && plant.RsmlID != "" ? plant.RsmlID : plant.RelativeID; plantNode.Attributes.Append(document.CreateAttribute("ID")).InnerText = id; if (plant.Label != "") { plantNode.Attributes.Append(document.CreateAttribute("label")).InnerText = plant.Label; } // Properties if (plant.Properties != null && plant.Properties.Count > 0) { plantNode.AppendChild(CreateProperties(document, plant.Properties)); } // Roots foreach (RootInfo root in plant.Roots) { plantNode.AppendChild(CreateRoot(document, root)); } // Annotations if (plant.Annotations != null && plant.Annotations.Count > 0) { plantNode.AppendChild(CreateAnnotations(document, plant.Annotations)); } return(plantNode); }
public void RetriveDepartmentDetailsTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.RetriveDepartmentDetails(1); Assert.IsNotNull(result); }
public override object MeasurePlant(PlantInfo plant) { double totalLaterals = 0.0; double totalAngle = 0.0; foreach (RootInfo info in plant) { if (info.Spline != null) { if (plant.GetParent(info) == null) { totalAngle += Math.Abs((double)rootEmergenceHandler.MeasureRoot(info, plant.GetParent(info))); totalLaterals++; } } } if (totalLaterals > 0) { return(Math.Round(totalAngle / totalLaterals, 2)); } else { return(null); } }
public async Task <PlantInfo> Put(PlantInfo plantInfo) { plantInfo.CreatedBy = UserId; var userId = await _userService.GetUserIdAsync(UserId); plantInfo.UserId = userId; if (plantInfo.Origin != null && plantInfo.Origin.OriginId == 0) { plantInfo.Origin.UserId = userId; plantInfo.Origin = await _originService.AddOrUpdateOriginAsync(plantInfo.Origin, UserId); } var plantInfoResult = await _plantInfoService.AddOrUpdatePlantInfoAsync(plantInfo); if (plantInfo.Photos != null && plantInfo.Photos.Any()) { foreach (var photo in plantInfo.Photos) { photo.TypeId = plantInfoResult.PlantInfoId; } plantInfoResult.Photos = await _photoService.AddOrUpdatePhotosAsync(plantInfo.Photos); } return(plantInfoResult); }
public void ShowPlantInfo(PlantInfo info) { plantInfoAnimator.SetBool("plantInfoActive", true); container.SetActive(true); this.plantNameText.text = info.plantName; this.plantDescriptionText.text = info.plantDescription; }
public void Harvested(Quality quality, PlantDefinition def) { if (mHarvestCounts == null) { mHarvestCounts = new Dictionary <string, PlantInfo>(); } if (!mHarvestCounts.TryGetValue(def.PlantName, out PlantInfo value)) { value = new PlantInfo(); value.HarvestablesCount = 1; value.BestQuality = quality; mHarvestCounts.Add(def.PlantName, value); } else { value.HarvestablesCount++; if (quality > value.BestQuality) { value.BestQuality = quality; } } if (quality > mBestQualityHarvested) { mBestQualityHarvested = quality; } mNumberThingsHarvested++; TestForNewLifetimeOpp(); }
public override object MeasurePlant(PlantInfo plant) { Point source = default(Point); double totalX = 0.0, totalY = 0.0; double count = 0; foreach (RootInfo root in plant) { if (root.RelativeID == "1.1") { source = root.Spline.Start; } SampledSpline s = root.Spline; foreach (Point p in s.SampledPoints) { totalX += p.X; totalY += p.Y; ++count; } } return(String.Format("{0}, {1}", Math.Round(totalX / count - source.X, 3), Math.Round(totalY / count - source.Y, 3))); }
public void IsDeviceAvailableTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.IsDeviceAvailable("782bfgytfdhy"); Assert.IsTrue(result); }
public void RetrieveAssetByPlantIdTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.RetrieveAssetByPlantId("Department", 2); Assert.IsNotNull(result); }
public void GetTagMappingDetailsOnPlantIdTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.GetTagMappingDetailsOnPlantId(2); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(List <TagMappingDetails>)); }
public void PlowField() { //if something is already there, destroy it currentPlant = null; harvestable = false; spriteRenderer.sprite = plowedTileSprite; itemActionTaken = ItemAction.Plow; }
public async Task <bool> RemovePlantInfoAsync(PlantInfo plantInfo) { var result = await _httpClient.DeleteAsync($"/api/plantinfo/{plantInfo.PlantInfoId}"); _ = await ReadResult(result); return(true); }
public void GetCountryTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.GetCountry(); Assert.IsNotNull(result); Assert.IsTrue(result.Count > 0); }
public void retrieveSinglePlantInfoTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.retrieveSinglePlantInfo("2"); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(PlantInfoModel)); }
public void RetrievePlantInfoTest() { var plantSetUpDal = new PlantInfo(); var result = plantSetUpDal.RetrievePlantInfo(); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(List <PlantInfoModel>)); }
public override object MeasurePlant(PlantInfo plant) { double min = Int32.MaxValue; double max = Int32.MinValue; HashSet <Point> rootPoints = new HashSet <Point>(); foreach (RootInfo root in plant) { SampledSpline s = root.Spline; Point[] splinePoints = s.Rasterise(); foreach (Point p in splinePoints) { rootPoints.Add(p); if (p.Y < min) { min = p.Y; } if (p.Y > max) { max = p.Y; } } } List <int>[] xs = new List <int> [(int)max - (int)min + 1]; for (int i = 0; i < xs.Length; i++) { xs[i] = new List <int>(); } foreach (Point p in rootPoints) { xs[(int)p.Y - (int)min].Add((int)p.X); } int widthmax = int.MinValue; for (int pos = 0; pos < xs.Length; pos++) { if (xs[pos].Count > 0) { int submin = xs[pos].Min(); int submax = xs[pos].Max(); int width = submax - submin + 1; if (widthmax < width) { widthmax = width; } } } return(widthmax); }
private void GetPlantSeed() { indexOfPlant = goblinInventory.GetFirstIndexOfElementOfType(goblinAction); if (indexOfPlant != -1) { plantInfo = goblinInventory.GetItemAtIndex(indexOfPlant).item.plant; } goblinInventory.UpdateAllSprites(); }
public void UpdatePlantInfoTest() { var testData = TestData.getPlant(); var plantSetUpDal = new PlantInfo(); var result = true;// plantSetUpDal.UpdatePlantInfo(1, testData); Assert.IsNotNull(result); Assert.IsTrue(result); }
public void AddBuildingTest() { var testData = TestData.getBuilding(); var plantSetUpDal = new PlantInfo(); var result = 1; //plantSetUpDal.AddBuilding(testData); Assert.IsNotNull(result); Assert.AreNotEqual(result, 0); }
public override bool TakeAction() { PlantType pType = (PlantType)Enum.Parse(typeof(PlantType), plantType.ToString()); UserPlantQuality userPlantQuality = new GameDataCacheSet <UserPlantQuality>().FindKey(ContextUser.UserID, generalID, pType); if (userPlantQuality != null) { plantQualityType = (short)userPlantQuality.PlantQuality; } else { UserPlantQuality plant = new UserPlantQuality() { UserID = ContextUser.UserID, GeneralID = generalID, PlantQuality = PlantQualityType.PuTong, PlantType = pType, RefreshNum = 0, RefreshDate = DateTime.Now, }; new GameDataCacheSet <UserPlantQuality>().Add(plant); plantQualityType = 1; } PlantQualityType qualityType = (PlantQualityType)Enum.Parse(typeof(PlantQualityType), plantQualityType.ToString()); short generalLv = 0; userGeneral = new GameDataCacheSet <UserGeneral>().FindKey(ContextUser.UserID, generalID); if (userGeneral == null) { ErrorCode = LanguageManager.GetLang().ErrorCode; return(false); } if (pType == PlantType.Experience) { generalLv = ContextUser.UserLv; } else if (pType == PlantType.GameGoin) { generalLv = userGeneral.GeneralLv; } plantInfo = new ConfigCacheSet <PlantInfo>().FindKey(generalLv, plantType, qualityType); double addNum = FestivalHelper.SurplusPurchased(ContextUser.UserID, FestivalType.ManorAddition);//活动加成 rewardNum = plantInfo.GainNum; UserLand land = new GameDataCacheSet <UserLand>().FindKey(ContextUser.UserID, landPostion); if (land != null && land.IsRedLand == 1) { rewardNum = MathUtils.Addition(rewardNum, (int)(rewardNum * 0.2), int.MaxValue); } if (land != null && land.IsBlackLand == 1) { rewardNum = MathUtils.Addition(rewardNum, (int)(rewardNum * 0.4), int.MaxValue); } rewardNum = (rewardNum * addNum).ToInt(); return(true); }
private PlantInfo ReadPlant(XmlNode plantNode, string RelativeID) { PlantInfo plant = new PlantInfo() { Roots = new List <RootInfo>() }; // Attributes XmlAttribute id = plantNode.Attributes["ID"] == null ? plantNode.Attributes["id"] : plantNode.Attributes["ID"]; if (id != null) { plant.RsmlID = id.InnerText; } XmlAttribute label = plantNode.Attributes["label"]; if (label != null) { plant.Label = label.InnerText; } // RelativeID plant.RelativeID = RelativeID; // If no id was supplied in the rsml file, use the relative ID. if (plant.RsmlID == null) { plant.RsmlID = RelativeID; } // Plant properties XmlNode propertiesNode = plantNode.SelectSingleNode("properties"); if (propertiesNode != null) { plant.Properties = ReadProperties(propertiesNode); } // Roots int rootID = 1; foreach (XmlNode rootNode in plantNode.SelectNodes("root")) { plant.Roots.Add(ReadRoot(rootNode, plant.RelativeID + "." + rootID++.ToString(), null)); } // Annotations XmlNode annotationsNode = plantNode.SelectSingleNode("annotations"); if (annotationsNode != null) { plant.Annotations = ReadAnnotations(annotationsNode); } return(plant); }
void InitBounds(PlantInfo plantInfo) { mInitBounds = true; ItemDraggingBounds draggingBounds = gameObject.AddComponent <ItemDraggingBounds>(); Vector3 size = plantInfo.mSize * Vector3.one; size.y = plantInfo.mHeight; draggingBounds.ResetBounds(0.5f * plantInfo.mHeight * Vector3.up, size); }
public void AddDepartmentTest() { var testData = TestData.getDepartment(); var plantSetUpDal = new PlantInfo(); var result = 1;// plantSetUpDal.AddDepartment(testData); Assert.IsNotNull(result); Assert.AreNotEqual(result, 0); }
public static void LoadData() { stbInfoDic = new Dictionary <int, PlantInfo>(); SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("plant"); reader.Read(); // Firstline is exp while (reader.Read()) { PlantInfo addInfo = new PlantInfo(); addInfo.mTypeID = Convert.ToInt32(reader.GetString(reader.GetOrdinal("id"))); addInfo.mItemId = Convert.ToInt32(reader.GetString(reader.GetOrdinal("seedid"))); addInfo.mGrowTime = new float[3]; for (int i = 0; i < 3; i++) { addInfo.mGrowTime[i] = Convert.ToSingle(reader.GetString(reader.GetOrdinal("time" + (i + 1)))); } addInfo.mModelPath = new string[3]; for (int i = 0; i < 3; i++) { addInfo.mModelPath[i] = reader.GetString(reader.GetOrdinal("model" + (i + 1))); } addInfo.mDeadModePath = new string[3]; for (int i = 0; i < 3; i++) { addInfo.mDeadModePath[i] = reader.GetString(reader.GetOrdinal("dmodel" + (i + 1))); } addInfo.mDefaultWater = Convert.ToSingle(reader.GetString(reader.GetOrdinal("water0"))); addInfo.mWaterDS = Convert.ToSingle(reader.GetString(reader.GetOrdinal("waterDS"))); addInfo.mWaterLevel = new float[2]; addInfo.mWaterLevel[0] = Convert.ToSingle(reader.GetString(reader.GetOrdinal("water1"))); addInfo.mWaterLevel[1] = Convert.ToSingle(reader.GetString(reader.GetOrdinal("water2"))); addInfo.mDefaultClean = Convert.ToSingle(reader.GetString(reader.GetOrdinal("clean0"))); addInfo.mCleanDS = Convert.ToSingle(reader.GetString(reader.GetOrdinal("cleanDS"))); addInfo.mCleanLevel = new float[2]; addInfo.mCleanLevel[0] = Convert.ToSingle(reader.GetString(reader.GetOrdinal("clean1"))); addInfo.mCleanLevel[1] = Convert.ToSingle(reader.GetString(reader.GetOrdinal("clean2"))); addInfo.mSize = Convert.ToSingle(reader.GetString(reader.GetOrdinal("size"))); addInfo.mHeight = Convert.ToSingle(reader.GetString(reader.GetOrdinal("height"))); addInfo.mItemGetNum = Convert.ToInt32(reader.GetString(reader.GetOrdinal("maxgetnum"))); addInfo.mItemGetPro = new List <ResItemGot>(); string strList = reader.GetString(reader.GetOrdinal("itemget")); string[] spStr = strList.Split(';'); for (int i = 0; i < spStr.Length; i++) { string[] itemstr = spStr[i].Split(','); ResItemGot itemget = new ResItemGot(); itemget.m_id = Convert.ToInt32(itemstr[0]); itemget.m_probablity = Convert.ToSingle(itemstr[1]); addInfo.mItemGetPro.Add(itemget); } stbInfoDic[addInfo.mTypeID] = addInfo; } }