fix editor offset bug(?)
This commit is contained in:
parent
8686f090de
commit
f334ae4b3a
|
|
@ -970,119 +970,6 @@ namespace HeavenStudio.Editor.Track
|
||||||
CommandManager.Instance.AddCommand(new Commands.Paste(CopiedEntities));
|
CommandManager.Instance.AddCommand(new Commands.Paste(CopiedEntities));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public TimelineEventObj AddEventObject(string eventName, bool dragNDrop = false, Vector3 pos = new Vector3(), RiqEntity entity = null, bool addEvent = false)
|
|
||||||
{
|
|
||||||
var game = EventCaller.instance.GetMinigame(eventName.Split(0));
|
|
||||||
var action = EventCaller.instance.GetGameAction(game, eventName.Split(1));
|
|
||||||
GameObject g = Instantiate(TimelineEventObjRef.gameObject, TimelineEventObjRef.parent);
|
|
||||||
g.transform.localPosition = pos;
|
|
||||||
|
|
||||||
TimelineEventObj eventObj = g.GetComponent<TimelineEventObj>();
|
|
||||||
eventObj.eventLabel.text = action.displayName;
|
|
||||||
|
|
||||||
if (eventName.Split(1) == "switchGame")
|
|
||||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(2));
|
|
||||||
else
|
|
||||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(0));
|
|
||||||
|
|
||||||
Minigames.GameAction gameAction = EventCaller.instance.GetGameAction(EventCaller.instance.GetMinigame(eventName.Split(0)), eventName.Split(1));
|
|
||||||
|
|
||||||
if (gameAction != null)
|
|
||||||
{
|
|
||||||
if (gameAction.resizable == false)
|
|
||||||
{
|
|
||||||
g.GetComponent<RectTransform>().sizeDelta = new Vector2(gameAction.defaultLength * Timeline.instance.PixelsPerBeat, LayerHeight());
|
|
||||||
float length = gameAction.defaultLength;
|
|
||||||
eventObj.length = length;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
eventObj.resizable = true;
|
|
||||||
if (entity != null && gameAction.defaultLength != entity.length && dragNDrop == false)
|
|
||||||
{
|
|
||||||
g.GetComponent<RectTransform>().sizeDelta = new Vector2(entity.length * Timeline.instance.PixelsPerBeat, LayerHeight());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g.GetComponent<RectTransform>().sizeDelta = new Vector2(gameAction.defaultLength * Timeline.instance.PixelsPerBeat, LayerHeight());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dragNDrop)
|
|
||||||
{
|
|
||||||
var mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
|
|
||||||
g.transform.position = new Vector3(mousePos.x, mousePos.y, 0);
|
|
||||||
|
|
||||||
Selections.instance.ClickSelect(eventObj);
|
|
||||||
eventObj.moving = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
entity["track"] = eventObj.GetTrack();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addEvent)
|
|
||||||
{
|
|
||||||
RiqEntity tempEntity = entity;
|
|
||||||
|
|
||||||
if (entity == null)
|
|
||||||
{
|
|
||||||
RiqEntity en = GameManager.instance.Beatmap.AddNewEntity(eventName, g.transform.localPosition.x, gameAction.defaultLength);
|
|
||||||
|
|
||||||
tempEntity = en;
|
|
||||||
|
|
||||||
// default param values
|
|
||||||
var ep = action.parameters;
|
|
||||||
|
|
||||||
if (ep != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < ep.Count; i++)
|
|
||||||
{
|
|
||||||
object returnVal = ep[i].parameter;
|
|
||||||
|
|
||||||
var propertyType = returnVal.GetType();
|
|
||||||
if (propertyType == typeof(EntityTypes.Integer))
|
|
||||||
{
|
|
||||||
returnVal = ((EntityTypes.Integer)ep[i].parameter).val;
|
|
||||||
}
|
|
||||||
else if (propertyType == typeof(EntityTypes.Float))
|
|
||||||
{
|
|
||||||
returnVal = ((EntityTypes.Float)ep[i].parameter).val;
|
|
||||||
}
|
|
||||||
else if (propertyType.IsEnum)
|
|
||||||
{
|
|
||||||
returnVal = (int) ep[i].parameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
//tempEntity[ep[i].propertyName] = returnVal;
|
|
||||||
tempEntity.CreateProperty(ep[i].propertyName, returnVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GameManager.instance.Beatmap.Entities.Add(tempEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameManager.instance.SortEventsList();
|
|
||||||
eventObj.entity = tempEntity;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
eventObj.entity = entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
eventObjs.Add(eventObj);
|
|
||||||
eventObj.eventObjID = eventObj.entity.uid;
|
|
||||||
|
|
||||||
g.SetActive(true);
|
|
||||||
|
|
||||||
return eventObj;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
private List<TimelineEventObj> duplicatedEventObjs = new List<TimelineEventObj>();
|
private List<TimelineEventObj> duplicatedEventObjs = new List<TimelineEventObj>();
|
||||||
public TimelineEventObj CopyEventObject(TimelineEventObj e)
|
public TimelineEventObj CopyEventObject(TimelineEventObj e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -60,11 +60,11 @@ namespace HeavenStudio.Editor.Track
|
||||||
private bool altWhenClicked = false;
|
private bool altWhenClicked = false;
|
||||||
private bool dragging = false;
|
private bool dragging = false;
|
||||||
|
|
||||||
private float initMoveX = 0.0f;
|
private double initMoveX = 0;
|
||||||
private float initMoveY = 0.0f;
|
private float initMoveY = 0;
|
||||||
|
|
||||||
private bool movedEntity = false;
|
private bool movedEntity = false;
|
||||||
private float lastBeat = 0.0f;
|
private double lastBeat = 0;
|
||||||
private int lastLayer = 0;
|
private int lastLayer = 0;
|
||||||
|
|
||||||
private int lastSiblingIndex;
|
private int lastSiblingIndex;
|
||||||
|
|
@ -125,6 +125,12 @@ namespace HeavenStudio.Editor.Track
|
||||||
SetColor((int)entity["track"]);
|
SetColor((int)entity["track"]);
|
||||||
SetWidthHeight();
|
SetWidthHeight();
|
||||||
selectedImage.gameObject.SetActive(false);
|
selectedImage.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
lastBeat = entity.beat;
|
||||||
|
initMoveX = 0.0f;
|
||||||
|
initMoveY = 0.0f;
|
||||||
|
lastResizeBeat = 0;
|
||||||
|
lastResizeLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEntity(RiqEntity entity)
|
public void SetEntity(RiqEntity entity)
|
||||||
|
|
@ -232,7 +238,7 @@ namespace HeavenStudio.Editor.Track
|
||||||
{
|
{
|
||||||
foreach (var marker in Selections.instance.eventsSelected)
|
foreach (var marker in Selections.instance.eventsSelected)
|
||||||
{
|
{
|
||||||
marker.entity.beat = Mathf.Max(Timeline.instance.MousePos2BeatSnap - marker.initMoveX, 0);
|
marker.entity.beat = System.Math.Max(Timeline.instance.MousePos2BeatSnap - marker.initMoveX, 0);
|
||||||
marker.entity["track"] = Mathf.Clamp(Timeline.instance.MousePos2Layer - marker.initMoveY, 0, Timeline.instance.LayerCount - 1);
|
marker.entity["track"] = Mathf.Clamp(Timeline.instance.MousePos2Layer - marker.initMoveY, 0, Timeline.instance.LayerCount - 1);
|
||||||
marker.SetColor((int)entity["track"]);
|
marker.SetColor((int)entity["track"]);
|
||||||
marker.SetWidthHeight();
|
marker.SetWidthHeight();
|
||||||
|
|
@ -281,10 +287,10 @@ namespace HeavenStudio.Editor.Track
|
||||||
foreach (var marker in Selections.instance.eventsSelected)
|
foreach (var marker in Selections.instance.eventsSelected)
|
||||||
{
|
{
|
||||||
if (setMovedEntity) marker.movedEntity = true;
|
if (setMovedEntity) marker.movedEntity = true;
|
||||||
marker.lastBeat = (float)marker.entity.beat;
|
marker.lastBeat = marker.entity.beat;
|
||||||
marker.lastLayer = (int)marker.entity["track"];
|
marker.lastLayer = (int)marker.entity["track"];
|
||||||
|
|
||||||
marker.initMoveX = Timeline.instance.MousePos2BeatSnap - (float)marker.entity.beat;
|
marker.initMoveX = Timeline.instance.MousePos2BeatSnap - marker.entity.beat;
|
||||||
marker.initMoveY = Timeline.instance.MousePos2Layer - (int)marker.entity["track"];
|
marker.initMoveY = Timeline.instance.MousePos2Layer - (int)marker.entity["track"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue