コード例 #1
0
        public void DrawWidget(KernelExplorer explorer)
        {
            explorer.Executor = null;
            explorer.Kernel   = null;

            var selection = Selection.activeGameObject;

            if (!selection)
            {
                _drawSelectFirst.DrawWidget(explorer);
                return;
            }

            explorer.Executor = selection.GetComponent <RentitasExecutor>();
            if (explorer.Executor)
            {
                _drawExecutor.DrawWidget(explorer);
                return;
            }

            explorer.Kernel = selection.GetComponent <KernelBehaviour>();
            if (explorer.Kernel)
            {
                _drawKernel.DrawWidget(explorer);
                return;
            }
        }
コード例 #2
0
        private void InjectAll(KernelExplorer explorer)
        {
            explorer.Executor.IsNotConfigurated = true;
            var assembly       = Assembly.GetAssembly(explorer.Executor.GetType());
            var poolTypes      = assembly.GetTypes().Where(t => typeof(IComponent).IsAssignableFrom(t) && t.IsInterface && t != typeof(IComponent)).ToArray();
            var componentTypes = poolTypes.ToDictionary(
                t => t,
                pool =>
            {
                return(assembly.GetTypes()
                       .Where(t => pool.IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface && t != pool).ToArray());
            });


            explorer.Executor.Configs = new RentitasExecutor.PoolInstallConfig[poolTypes.Length];

            for (int i = 0; i < poolTypes.Length; i++)
            {
                var pt = poolTypes[i];
                var ct = componentTypes[pt];
                explorer.Executor.Configs[i] = new RentitasExecutor.PoolInstallConfig(pt, ct);
            }

            explorer.Executor.IsNotConfigurated = true;
        }
コード例 #3
0
        public void DrawWidget(KernelExplorer explorer)
        {
            E = explorer;

            if (E.Executor.Configs.Length != _types.Count())
            {
                E.Executor.IsNotConfigurated = false;
            }

            if (_types == null)
            {
                GUILayout.Label("Create interfaces implemented IComponent to define Pool Types");
            }
            else
            {
                var rect = new Rect(StartRect);

                rect.x     += 30;
                rect.width  = 300;
                rect.height = 40;

                foreach (var type in _types)
                {
                    var selected = explorer.SelectedPoolType == type;
                    var style    = selected
                        ? _selectedStyle
                        : _unselectedStyle;
                    if (GUI.Button(rect, _typeNames[type], style))
                    {
                        explorer.SelectedPoolType = type;
                    }


                    var pinRect = new Rect(rect);

                    pinRect.x     -= 18;
                    pinRect.y     += 14;
                    pinRect.width  = 13;
                    pinRect.height = 13;

                    var config = explorer.Executor.GetConfig(type);

                    GUI.color = Color.green;
                    if (GUI.Button(pinRect, "", !config.IsActive ? "WinBtnCloseMac" : "WinBtnMaxMac"))
                    {
                        config.IsActive = !config.IsActive;
                    }
                    GUI.color = Color.white;

                    if (selected)
                    {
                        explorer.PoolRect       = new Rect(rect);
                        explorer.SelectedConfig = config;
                    }

                    rect.y += 40;
                }
            }
        }
コード例 #4
0
        public void DrawWidget(KernelExplorer explorer)
        {
            var height = 20;
            var start  = new Rect(PoolRect.x + PoolRect.width + 20, PoolRect.y, 300, 30);

            if (_poolComponents.Length > 0)
            {
                GUI.color = new Color(.6f, .6f, .6f, 1f);
                GUI.Box(new Rect(start.x - 20, start.y + 6, 10, 1), "", ComponentPath);
                GUI.Box(new Rect(start.x - 10, start.y + 6, 1, height * (_poolComponents.Length - 1)), "", ComponentPath);

                for (int i = 0; i < _poolComponents.Length; i++)
                {
                    GUI.color = new Color(.6f, .6f, .6f, 1f);
                    GUI.Box(new Rect(start.x - 10, start.y + 6 + height * i, 10, 1), "", ComponentPath);
                    GUI.color = Color.white;

                    var component = _poolComponents[i];
                    var name      = _componentNames[component];
                    var selected  = explorer.SelectedComponentType == component;
                    var rect      = new Rect(start.x, start.y + height * i, 200, 15);
                    var style     = selected ? ComponentStyleOn : ComponentStyleOff;

                    var tmp = GUI.depth;
                    if (GUI.Button(rect, name, style))
                    {
                        explorer.SelectedComponentType = _poolComponents[i];
                    }

                    var pinRect = new Rect(rect);

                    pinRect.x     -= 16;
                    pinRect.y     += 1;
                    pinRect.width  = 13;
                    pinRect.height = 13;

                    var config = explorer.SelectedConfig.ComponentTypes[i];//.First(c => c.ComponentType.Type == component);

                    GUI.depth = tmp + 1;
                    GUI.color = Color.green;
                    if (GUI.Button(pinRect, "", !config.IsActive ? "WinBtnCloseMac" : "WinBtnMaxMac"))
                    {
                        Debug.Log("Toggle");
                        config.IsActive = !config.IsActive;
                    }
                    GUI.color = Color.white;

                    if (selected)
                    {
                        explorer.ComponentRect = rect;
                    }

                    GUI.depth = tmp;
                }
            }
        }
コード例 #5
0
        public void DrawWidget(KernelExplorer explorer)
        {
            GUILayout.BeginHorizontal(GUI.skin.button);
            {
                GUILayout.Label("Kernel Explorer");
                if (GUILayout.Button("Test", GUILayout.Width(35)))
                {
                    Debug.Log("Test");
                }
            }
            GUILayout.EndHorizontal();

            _targetSelect.DrawWidget(explorer);
        }
コード例 #6
0
        public void DrawWidget(KernelExplorer explorer)
        {
            var rect = new Rect(ComponentRect);

            rect.x     += rect.width + 20;
            rect.width  = 300;
            rect.height = 20;

            GUI.color = new Color(.6f, .6f, .6f, 1f);
            GUI.Box(new Rect(rect.x - 20, rect.y + 7, 10, 1), "", ComponentPath);
            GUI.Box(new Rect(rect.x - 10, rect.y + 7, 1, 20 * _componentFields.Length), "", ComponentPath);

            rect.width = 100;
            GUI.Box(rect, "Type");
            rect.width = 200;
            rect.x    += 100;
            GUI.Box(rect, "Name");
            rect.x -= 100;
            rect.y += 20;

            for (int i = 0; i < _componentFields.Length; i++)
            {
                var componentField = _componentFields[i];
                GUI.color = new Color(.6f, .6f, .6f, 1f);
                GUI.Box(new Rect(rect.x - 10, rect.y + 7, 10, 1), "", ComponentPath);
                GUI.color = Color.white;

                rect.width = 100;
                GUI.Box(rect, componentField.FieldType.ToString());
                rect.width = 200;
                rect.x    += 100;
                GUI.Box(rect, componentField.Name);
                rect.x -= 100;
                rect.y += 20;
            }
        }
コード例 #7
0
        public void DrawWidget(KernelExplorer explorer)
        {
            if (!explorer.Executor.IsNotConfigurated)
            {
                _drawExplorerConfig.DrawWidget(explorer);
            }
            else
            {
                _scrollPoolTypes = GUILayout.BeginScrollView(_scrollPoolTypes);
                GUILayout.EndScrollView();

                GUI.BeginGroup(GUILayoutUtility.GetLastRect());
                _drawPoolTypes.DrawWidget(explorer);
                if (explorer.SelectedPoolType != null)
                {
                    _drawComponentTypes.PoolType = explorer.SelectedPoolType;
                    _drawComponentTypes.PoolRect = explorer.PoolRect;
                    _drawComponentTypes.DrawWidget(explorer);

                    if (explorer.SelectedComponentType != null)
                    {
                        if (!explorer.SelectedPoolType.IsAssignableFrom(explorer.SelectedComponentType))
                        {
                            explorer.SelectedComponentType = null;
                        }
                        else
                        {
                            _drawComponentFields.ComponentType = explorer.SelectedComponentType;
                            _drawComponentFields.ComponentRect = explorer.ComponentRect;
                            _drawComponentFields.DrawWidget(explorer);
                        }
                    }
                }
                GUI.EndGroup();
            }
        }
コード例 #8
0
 public void DrawWidget(KernelExplorer explorer)
 {
     GUILayout.Label("Select Executor or KernelBehaviour first!", EditorStyles.boldLabel);
 }
コード例 #9
0
 public void DrawWidget(KernelExplorer explorer)
 {
     GUILayout.Label("Initial configuration menu", EditorStyles.boldLabel);
     InjectAll(explorer);
 }