public void Correct() { if (ScreenManager.Instance.OpenedCustomizationScreen == "DecorEvent") { EventManagment.Instance.DecorEventList.Clear(); StartCoroutine(SetPositionForEvent()); EventManagment.Instance._registerButton.interactable = true; for (int i = 0; i < DecorController.Instance.TempDecorForEvent.Count; i++) { if (decorInfo.Name == DecorController.Instance.TempDecorForEvent [i].Name) { DecorController.Instance.TempDecorForEvent.Remove(DecorController.Instance.TempDecorForEvent [i]); if (DecorController.Instance.TempDecorForEvent.Count == 0) { DecorController.AddItemEnable = false; } } } } else if (isForSociety) { StartCoroutine(SetPositionForSociety()); } else { ScreenManager.Instance.CellPhone.transform.FindChild("CellButton").gameObject.SetActive(true); ScreenManager.Instance.MenuScreen.transform.FindChild("OpenCloseSlider").gameObject.SetActive(true); ChangeFlatmateTouch(true); DragSnap dragSnap = GetComponent <DragSnap> (); if (!dragSnap.CanBePlacedHere) { dragSnap.CanBePlacedHere = true; if (dragSnap.nearestFinal) { this.transform.position = dragSnap.nearestFinal.transform.position; } else { var objPosition = Decor3DView.DeserializeVector3Array(PlayerPrefs.GetString("ObjPosition" + decorInfo.Name)); this.transform.position = objPosition; } } if (!Placed) { DecorController.Instance.PlacedDecors.Add(this); DecorController.Instance.PlacedDecorsName.Add(decorInfo.Name); Placed = true; } StartCoroutine(SetPosition()); ScreenAndPopupCall.Instance.placementEnabled = false; } }
public IEnumerator SetPositionForSociety() { var societyHomeRoom = ScreenManager.Instance.HomeRoomSociety.GetComponent <SocietyHomeRoom>(); var postionString = SerializeVector3Array(transform.localPosition); CoroutineWithData cd = new CoroutineWithData(societyHomeRoom, societyHomeRoom.SavePositionInSocietyRoom(decorInfo.Id, postionString, direction)); yield return(cd.coroutine); if (cd.result.ToString() == "True" || cd.result.ToString() == "true") { DragSnap dragSnap = GetComponent <DragSnap> (); if (!dragSnap.CanBePlacedHere) { dragSnap.CanBePlacedHere = true; if (dragSnap.nearestFinal) { this.transform.localPosition = dragSnap.nearestFinal.transform.position; } } objPosition = transform.localPosition; if (!Placed) { var Pd = new SocietyDecor(); Pd.Id = decorInfo.Id; Pd.Position = transform.localPosition; Pd.Rotation = direction; societyHomeRoom.PlacedDecorInRoom.Add(Pd); } Placed = true; ScreenAndPopupCall.Instance.placementEnabled = false; transform.FindChild("Check").gameObject.SetActive(false); this.transform.GetChild(1).gameObject.SetActive(false); this.gameObject.GetComponent <DragSnap> ().enabled = false; var placementForSociety = ScreenManager.Instance.HomeRoomSociety.GetComponent <SocietyHomeRoom>().PlacementButton; placementForSociety.gameObject.SetActive(false); var AllDecorInSociety = transform.parent.GetComponentsInChildren <Decor3DView>(); for (int i = 0; i < AllDecorInSociety.Length; i++) { this.GetComponent <DragSnap> ().FindNearTilesInSociety(AllDecorInSociety [i].transform.FindChild("New Sprite"), false); } } else { CrossSociety(); } }
public void DragTo(double coordinateX, double coordinateY, bool fixedSize) { if (!DragEnabled || IndexUnderMouse < 0) { return; } Coordinate requested = new(coordinateX, coordinateY); Coordinate snapped = DragSnap.Snap(requested); Coordinate actual = MovePointFunc(Xs, Ys, IndexUnderMouse, snapped); Xs[IndexUnderMouse] = actual.X; Ys[IndexUnderMouse] = actual.Y; Dragged(this, EventArgs.Empty); }