Ejemplo n.º 1
0
 public void Awake(GetAPI getAPI)
 {
     api                = getAPI(1) as RelationsInspectorAPI;
     sceneObj           = new GameObject();
     sceneObj.name      = "Scene";
     sceneObj.hideFlags = HideFlags.HideAndDontSave;
 }
        void OnEnable()
        {
            var riWindow = Resources.FindObjectsOfTypeAll <RelationsInspectorWindow>().FirstOrDefault();

            api      = riWindow == null ? null : riWindow.GetAPI(1) as RelationsInspectorAPI;
            settings = target as RelationsInspectorSettings;
        }
Ejemplo n.º 3
0
        internal Workspace(Type backendType, object[] targets, GetAPI getAPI, Action Repaint, Action <Action> Exec)
        {
            this.Repaint = Repaint;
            this.Exec    = Exec;
            this.api     = getAPI(1) as RelationsInspectorAPI;

            graphBackend = (IGraphBackendInternal <T, P>)BackendTypeUtil.CreateBackendDecorator(backendType);
            graphBackend.Awake(getAPI);

            // create new layout params, they are not comming from the cfg yet
            this.layoutType     = (LayoutType)GUIUtil.GetPrefsInt(GetPrefsKeyLayout(), (int)LayoutType.Tree);
            this.graphPosTweens = new TweenCollection();

            this.builderRNG = new RNG(4);               // chosen by fair dice role. guaranteed to be random.

            expectedTargetType = BackendTypeUtil.BackendAttrType(backendType) ?? typeof(T);

            // when targets is null, show the toolbar only. don't create a graph (and view)
            // when rootEntities is empty, create graph and view anyway, so the user can add entities
            if (targets != null)
            {
                seedEntities = targets.SelectMany(graphBackend.Init).ToHashSet();
                InitGraph();
            }
        }
Ejemplo n.º 4
0
        public static string DrawEntitySelectSearchField(string searchString, RelationsInspectorAPI api)
        {
            // when the search string changes, select the entities with matching names
            System.Action <string> onSearchStringChange = searchStr =>
            {
                if (string.IsNullOrEmpty(searchStr))
                {
                    api.SelectEntityNodes(x => { return(false); });
                }
                else
                {
                    api.SelectEntityNodes(x =>
                    {
                        return((x is Object) ?
                               (x as Object).name.ToLower().Contains(searchStr.ToLower()) :
                               false);
                    });
                }
            };

            return(DrawSearchField(searchString, onSearchStringChange));
        }
Ejemplo n.º 5
0
 public virtual void Awake(GetAPI getAPI)
 {
     this.api = getAPI(1) as RelationsInspectorAPI;
 }
 public virtual void Awake(GetAPI getAPI)
 {
     api     = getAPI(1) as RelationsInspectorAPI;
     toolbar = new ScriptableObjectBackendToolbar <T>(api);
 }
Ejemplo n.º 7
0
 public void Awake(GetAPI getAPI)
 {
     api      = getAPI(1) as RelationsInspectorAPI;
     sceneObj = EditorGUIUtility.whiteTexture;               // any object will do
 }
        Vector2 createEntityPosition;       // widget coordinates of the entity to create

        // ctor
        public ScriptableObjectBackendToolbar(RelationsInspectorAPI api)
        {
            this.api       = api;
            this.assetPath = string.Empty;
        }