Ejemplo n.º 1
0
        public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
        {
            SerializedProperty useAlias = prop.FindPropertyRelative("useAlias");

            GUITools.Box(new Rect(pos.x, pos.y, pos.width, CalcHeight(useAlias)), new Color32(0, 0, 0, 32));

            pos.height = GUITools.singleLineHeight;
            GUITools.Label(pos, label, GUITools.black, GUITools.boldLabel);

            GUITools.DrawIconToggle(useAlias, new GUIContent("A", "Use Alias"), pos.x + (pos.width - GUITools.iconButtonWidth), pos.y);


            pos.y += GUITools.singleLineHeight;

            if (useAlias.boolValue)
            {
                SerializedProperty aliasProp = prop.FindPropertyRelative("alias");
                DrawKeySelect(pos, aliasProp);

                GUI.enabled = !string.IsNullOrEmpty(aliasProp.stringValue);

                if (GUITools.IconButton(pos.x + (pos.width - GUITools.iconButtonWidth), pos.y, new GUIContent("G", "Go To Scene / Location"), GUITools.white))
                {
                    LocationKey key = LocationAliases.GetLocationKey(aliasProp.stringValue);
                    if (key != null)
                    {
                        LocationKeyDrawer.FastTravelToLocation(key.scene, key.name);
                    }
                }
                GUI.enabled = true;
            }
            else
            {
                EditorGUI.PropertyField(pos, prop.FindPropertyRelative("key"), true);
            }
        }
 public static void MoveObject(string key, string alias)
 {
     MoveObject(key, LocationAliases.GetLocationKey(alias));
 }
 public static void MovePlayer(string alias, bool forceReload)
 {
     MovePlayer(LocationAliases.GetLocationKey(alias), forceReload);
 }
Ejemplo n.º 4
0
 public LocationKey GetKey()
 {
     return(useAlias ? LocationAliases.GetLocationKey(alias) : key);
 }