public IEnumerator End(float duration) { yield return(new WaitForSeconds(duration)); MenuUtility.LerpOutFillAmount(ArrowColor, 1f, 0.1f); MenuUtility.LerpToTransparent(ArrowColor, 1 / 2f, 0f); MenuUtility.LerpToTransparent(ArrowBase, 1f, 0f); }
public void MenuFile_FromJson_1() { string text = "[{'code':'a','comment':'Comment for a'},{'code':'b','comment':'Comment for b'},{'code':'c','comment':'Comment for c'}]" .Replace("'", "\""); MenuFile second = MenuUtility.FromJson(text); MenuFile first = _GetMenu(); _CompareMenu(first, second); }
public void MenuUtility_FromJson_1() { MenuFile menu = MenuUtility.FromJson("[{\"code\":\"a\",\"comment\":\"Comment for a\"},{\"code\":\"b\",\"comment\":\"Comment for b\"},{\"code\":\"c\",\"comment\":\"Comment for c\"}]"); Assert.AreEqual(3, menu.Entries.Count); Assert.AreEqual("a", menu.Entries[0].Code); Assert.AreEqual("Comment for a", menu.Entries[0].Comment); Assert.AreEqual("b", menu.Entries[1].Code); Assert.AreEqual("Comment for b", menu.Entries[1].Comment); Assert.AreEqual("c", menu.Entries[2].Code); Assert.AreEqual("Comment for c", menu.Entries[2].Comment); }
public void MenuFile_ParseLocalJsonFile_1() { string fileName = Path.Combine ( TestDataPath, "test-menu.json" ); MenuFile first = _GetMenu(); MenuFile second = MenuUtility .ParseLocalJsonFile(fileName); _CompareMenu(first, second); }
public void Init(LocatableItem target, float duration = 15f) { Target = target; ArrowColor.color = target.Color; MenuUtility.LerpFromTransparent(ArrowBase, 1 / 4f, 0f); MenuUtility.LerpFromTransparent(ArrowColor, 1 / 2f, 0.3f); MenuUtility.LerpInFillAmount(ArrowColor, 1 / 2f, 0f); Path.Init(Target, duration, 0.4f); StartCoroutine(End(duration)); }
public void Invoke() { Console.WriteLine("Intast Gade navn"); string street = Console.ReadLine(); Console.WriteLine("Intast Hus nummer"); string housNb = Console.ReadLine(); Console.WriteLine("Intast Post Nummer"); List <string> zipCodes = databaseController.GetZipCodes(); string zipCode; MenuUtility.SearchMenu(zipCodes, out zipCode); databaseController.InsertAddress(street, housNb, zipCode); }
public IEnumerator End() { yield return(new WaitForSeconds(LocatorArrowDuration)); MenuUtility.LerpInFillAmount(OuterBorder, 1 / 3f, 0f); MenuUtility.LerpToTransparent(Thumbnail, 1 / 2f, 0.4f); MenuUtility.LerpToTransparent(Border, 1 / 32f, 0.5f); MenuUtility.LerpToTransparent(OuterBorder, 1 / 8f, 0.5f); MenuUtility.LerpToTransparent(Background, 1 / 8f, 0.6f); while (LeanTween.isTweening(Background.gameObject)) { yield return(null); } yield return(new WaitForEndOfFrame()); Destroy(gameObject); }
public void Init(LocatableItem target, Vector3 offset) { Target = target; transform.position += offset; Thumbnail.texture = target.Thumbnail; Border.color = target.Color; MenuUtility.LerpFromTransparent(Background, 0.5f, 0f); MenuUtility.LerpFromTransparent(Thumbnail, 0.5f, 0.2f); MenuUtility.LerpFromTransparent(OuterBorder, 0.125f, 0f); MenuUtility.LerpFromTransparent(Border, 0.125f, 0.2f); MenuUtility.LerpOutFillAmount(OuterBorder, 0.333f, 0.2f); StartCoroutine(End()); AddDirectionIndicator(target); }
public override void ProcessInput(Event ev) { // Show change color option List <FloatMenuOption> list = new List <FloatMenuOption> { new FloatMenuOption("MorePlanning.ChangeColor".Translate(), delegate { Find.WindowStack.Add(new ColorSelectorDialog(Color)); }) }; Find.WindowStack.Add(new FloatMenu(list)); // Select color MorePlanningMod.Instance.SelectedColor = Color; if (Find.DesignatorManager.SelectedDesignator == null) { var designatorPlanPaste = MenuUtility.GetPlanningDesignator <AddDesignator>(); Find.DesignatorManager.Select(designatorPlanPaste); } }
protected virtual void DoDataParse() { _sortData = _helper.Data.GetChildList(); MenuUtility.Sort(ref _sortData); }
public override void DesignateMultiCell(IEnumerable <IntVec3> cells) { var planDesignations = cells.Select(cell => MapUtility.GetPlanDesignationAt(cell, Map)).Where(cell => cell != null).ToList(); cells = planDesignations.Select(plan => plan.target.Cell); if (planDesignations.Count == 0) { Messages.Message("MorePlanning.MissingPlanningDesignations".Translate(), MessageTypeDefOf.RejectInput); return; } int left = cells.Min(cell => cell.x); int top = cells.Max(cell => cell.z); int right = cells.Max(cell => cell.x); int bottom = cells.Min(cell => cell.z); IntVec2 mousePos = new IntVec2((int)Math.Floor(UI.MouseMapPosition().x), (int)Math.Floor(UI.MouseMapPosition().z)); // Adjust mouse position to nearest planning designation if (mousePos.x < left) { mousePos.x = left; } else if (mousePos.x > left) { mousePos.x = right; } if (mousePos.z > top) { mousePos.z = top; } else if (mousePos.z < bottom) { mousePos.z = bottom; } int sizeCompX = mousePos.x; int sizeCompZ = mousePos.z; List <PlanInfo> planDesignationInfo = new List <PlanInfo>(); // Copy all data from designations foreach (var planDesignation in planDesignations) { var planInfo = new PlanInfo { Color = planDesignation.Color, Pos = new IntVec3(planDesignation.target.Cell.x - sizeCompX, planDesignation.target.Cell.y, planDesignation.target.Cell.z - sizeCompZ) }; planDesignationInfo.Add(planInfo); } var planCopy = new PlanInfoSet(planDesignationInfo); PasteDesignator.CurrentPlanCopy = planCopy; Finalize(true); var designatorPlanPaste = MenuUtility.GetPlanningDesignator <PasteDesignator>(); Find.DesignatorManager.Select(designatorPlanPaste); }