コード例 #1
0
ファイル: CuiManager.cs プロジェクト: StokesMagee/CuiBuilder
    private CUIObject CreateInternalParent()
    {
        var obj = PoolManager.Get(PrefabType.Cui);

        GameObject selectedObj = null;

        try {
            var selected = CUIObject.Selection; //Get the currently selected object, this throws errors if the selection is HUD/OVERLAY
            selectedObj = HierarchyView.GetCurrent().Where(selected.Contains).Select(p => p.gameObject).ToList()[0];
        } catch (Exception) {
        }

        var rTransform = obj.GetComponent <RectTransformComponent>();

        if (selectedObj != null)
        {
            obj.transform.SetParent(selectedObj.transform, false);
            Hierarchy.Lookup[obj].SetParent(Hierarchy.Lookup[selectedObj]);
            rTransform.SetPixelLocalPosition(new Vector2(0, 0));
        }
        else
        {
            obj.transform.SetParent(m_RootDefault.transform, false);
            Hierarchy.Lookup[obj].SetParent(Hierarchy.Lookup[m_RootDefault]);
            rTransform.SetPixelLocalPosition(new Vector2(100, 100));
        }
        rTransform.SetPixelSize(new Vector2(100, 100));

        return(CUIObject.Lookup[obj]);
    }
コード例 #2
0
ファイル: Hierarchy.cs プロジェクト: senyaa1/CuiBuilder
 public void OnPointerClick(PointerEventData eventData)
 {
     if (HierarchyView.Select(gameObject))
     {
         return;
     }
 }
コード例 #3
0
ファイル: Hierarchy.cs プロジェクト: senyaa1/CuiBuilder
    public void SetParent(Hierarchy newParent)
    {
        var rTransform = (RectTransform)transform;

        if (parent != null)
        {
            var position = rTransform.GetParent().GetWorldPoint(rTransform.anchorMin);
            var size     = rTransform.GetSizeWorld();
            transform.SetParent(newParent.transform, false);
            parent.RemoveChild(this);
            rTransform.SetPositionAnchorLocal(rTransform.GetParent().GetLocalPoint(position));
            rTransform.SetSizeWorld(size);
        }
        else
        {
            transform.SetParent(newParent.transform, false);
        }
        parent = newParent;
        parent.AddChild(this);
        if (!HierarchyView.IsCreated(gameObject))
        {
            HierarchyView.AddChild(gameObject);
        }
        HierarchyView.ChangeParent(parent.gameObject, gameObject);
    }
コード例 #4
0
    void OnEnable()
    {
        // 開閉状態や、どのTreeViewItemを選択しているかなどの状態が格納されるstateオブジェクト
        var state = new TreeViewState();

        hierarchyView = new HierarchyView(state);

        // 初期化のために呼び出す
        hierarchyView.Reload();
    }
コード例 #5
0
        public void ApplyHierarchyColors(Color enabledItem, Color disabledItem)
        {
            HierarchyView hierarchy = GetComponent <HierarchyView>();

            if (hierarchy != null)
            {
                hierarchy.EnabledItemColor  = enabledItem;
                hierarchy.DisabledItemColor = disabledItem;
            }
        }
コード例 #6
0
    private static void UnloadCurrent()
    {
        var objs = HierarchyView.GetCurrent();

        objs.Reverse();
        foreach (var obj in objs)
        {
            PoolManager.Release(PrefabType.Cui, obj.gameObject);
        }
    }
コード例 #7
0
 internal void SaveHierarchyView(HierarchyView viewData)
 {
     using (SqlCommand command = new SqlCommand("UPDATE HierarchyViews set HierarchyJson=@HierarchyJson, NodeSettingsJson=@NodeSettingsJson WHERE ViewName=@ViewName;" +
                                                "IF @@ROWCOUNT=0 INSERT INTO HierarchyViews(ViewName, HierarchyJson, NodeSettingsJson) VALUES (@ViewName, @HierarchyJson, @NodeSettingsJson)", connection))
     {
         command.Parameters.AddWithValue("@ViewName", "Default");
         command.Parameters.AddWithValue("@HierarchyJson", viewData.HierarchyJson);
         command.Parameters.AddWithValue("@NodeSettingsJson", viewData.NodeSettingsJson);
         command.ExecuteNonQuery();
     }
 }
コード例 #8
0
ファイル: InspectorView.cs プロジェクト: senyaa1/CuiBuilder
 private void Awake()
 {
     m_scrollRect  = GetComponent <ScrollRect>();
     m_rtcListener = GetComponentInChildren <RectTransformChangeListener>();
     m_rtcListener.RectTransformChanged += OnViewportRectTransformChanged;
     HierarchyView.AddSelectionListener(OnSelectionChanged);
     m_Components             = GetComponentsInChildren <ComponentEditor>();
     AspectManager.OnChanged += index =>
     {
         OnSelectionChanged(null, new SelectionChangedArgs(new object[] { }, new object[] { }));
     };
 }
コード例 #9
0
        //[EnableCors(origins: "http://localhost:3000,http://localhost:60000", headers: "*", methods: "*")]
        public ActionResult <HierarchyView> Post(HierarchyView viewData)
        {
            //Console.WriteLine("{0}, {1}, {2}", layout.Name, layout.LastUpdateTime, layout.LayoutJson);
            try
            {
                IsaeAprAccessor accessor = new IsaeAprAccessor("localhost");
                accessor.SaveHierarchyView(viewData);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }

            return(viewData);
        }
コード例 #10
0
        private void SetApplication(string appId)
        {
            Application oldApp = Application.Find(inspectedAppId);

            if (oldApp != null)
            {
                oldApp.onElementDestroyed -= Refresh;
                // oldApp.onViewAdded -= Refresh;
                oldApp.onElementEnabled -= Refresh;
                oldApp.onRefresh        -= OnRefresh;
            }

            treeView?.Destroy();

            inspectedAppId = appId;
            EditorPrefs.SetString(k_InspectedAppKey, appId);

            Application app = Application.Find(appId);

            if (app != null)
            {
                needsReload = true;

                treeView = new HierarchyView(app.GetViews(), state);
                treeView.onSelectionChanged += OnElementSelectionChanged;

                app.onElementDestroyed += Refresh;
                //app.onViewAdded += Refresh;
                app.onElementEnabled += Refresh;
                app.onRefresh        += OnRefresh;
            }

            if (s_SelectedApplication != null)
            {
                s_SelectedApplication.RenderSystem.DrawDebugOverlay2 -= DrawDebugOverlay;
            }

            if (app != null)
            {
                app.RenderSystem.DrawDebugOverlay2 += DrawDebugOverlay;
            }

            s_SelectedApplication = app;
            s_SelectedElementId   = -1;
        }
コード例 #11
0
ファイル: Hierarchy.cs プロジェクト: senyaa1/CuiBuilder
 public void OnPoolEnter()
 {
     foreach (var child in Children.ToList())
     {
         PoolManager.Release(PrefabType.Cui, child.gameObject);
     }
     Lookup.Remove(gameObject);
     history.Remove(this);
     HierarchyView.Remove(gameObject);
     if (parent != null)
     {
         parent.RemoveChild(this);
     }
     Children.Clear();
     OnChildAdded   = null;
     OnChildRemoved = null;
     parent         = null;
 }
コード例 #12
0
        private async Task <HierarchyView> GetHierarchyViewByUrl(string url)
        {
            DateTime      now    = DateTime.Now;
            HttpClient    client = null;
            HierarchyView view   = new HierarchyView();

            try
            {
                client = new HttpClient();

                //var base64stuff = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(string.Format("{0}:{1}", userId, token)));
                //client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64stuff);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                HttpResponseMessage response = await client.GetAsync(url);

                string responseString = await response.Content.ReadAsStringAsync();

                if (!response.IsSuccessStatusCode)
                {
                    throw new Exception("GetHierarchyViewByUrl returned: " + response.StatusCode);
                }

                view = JsonConvert.DeserializeObject <HierarchyView>(responseString,
                                                                     new JsonSerializerSettings()
                {
                    NullValueHandling = NullValueHandling.Ignore
                });
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(view);
        }
コード例 #13
0
        private void DisplayItems()
        {
            SelectedItemIndex = -1;
            Items.Clear();

            if (SelectedNodeType == NodeType.None)
            {
                return;
            }

            var handler = GetNodeTypeHandler(SelectedNodeType);

            if (handler != null)
            {
                Items.AddRange(handler.GetListItems(selectedNode));
            }

            HierarchyView.ShowCurrentSelection();
        }
コード例 #14
0
        private void OnRefresh()
        {
            s_SelectedElementId = -1;
            treeView?.Destroy();

            Application app = Application.Find(inspectedAppId);

            if (app == null)
            {
                return;
            }

            if (s_SelectedApplication != null)
            {
                s_SelectedApplication.RenderSystem.DrawDebugOverlay2 -= DrawDebugOverlay;
            }

            app.RenderSystem.DrawDebugOverlay2 += DrawDebugOverlay;
            treeView = new HierarchyView(app.GetViews(), state);
            treeView.onSelectionChanged += OnElementSelectionChanged;
//            treeView.view = app.GetView(0);
        }
コード例 #15
0
ファイル: HierarchyView.cs プロジェクト: senyaa1/CuiBuilder
 private void Awake()
 {
     m_Instance = this;
 }
コード例 #16
0
 public static CuiElementContainer GetCurrentCui()
 {
     return(new CuiElementContainer(HierarchyView.GetCurrent().Select(p => p.GetCuiElement()).ToList()));
 }
コード例 #17
0
    public static CuiElementContainer GetSelectedCui()
    {
        var selected = CUIObject.Selection;

        return(new CuiElementContainer(HierarchyView.GetCurrent().Where(selected.Contains).Select(p => p.GetCuiElement()).ToList()));
    }
コード例 #18
0
ファイル: Program.cs プロジェクト: axel-kaliff/logik
        // VERY IMPORTANT!!!!!!!!!!!!
        // After the call to Application.Init() NullReferenceExceptions
        // will no longer be thrown. This is an active bug in GtkSharp
        // and can be tracked here https://github.com/GtkSharp/GtkSharp/issues/155
        // Hopefully this can be fixed sooner rather than later...
        static void Main()
        {
            Backend = Logic.Init();

            CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;

            Value a = new Value(0b00_00_00_00_01_01_01_01_10_10_10_10_11_11_11_11, 16);
            Value b = new Value(0b00_01_10_11_00_01_10_11_00_01_10_11_00_01_10_11, 16);

            Console.WriteLine($"Resolve: {Value.Resolve(a, b)}");
            Console.WriteLine($"And: {Value.And(a, b)}");
            Console.WriteLine($"Or: {Value.Or(a, b)}");
            Console.WriteLine($"Not: {Value.Not(a)}");

            Application.Init();

            GLib.ExceptionManager.UnhandledException += ExceptionManager_UnhandledException;

            Window wnd = new Window("Logik");

            wnd.Resize(1600, 800);

            Notebook nbook         = new Notebook();
            var      circuitEditor = new CircuitEditor();

            nbook.AppendPage(circuitEditor.DrawingArea, new Label("Circuit editor"));
            nbook.AppendPage(new Label("TODO: Package editor"), new Label("Package editor"));

            Notebook sideBar    = new Notebook();
            var      components = new ComponentView(new List <ComponentFolder> {
                new ComponentFolder("Test folder 1", new List <Component.Component>()
                {
                    new Component.Component("Test comp 1", "x-office-document"),
                    new Component.Component("Test comp 2", "x-office-document"),
                    new Component.Component("Test comp 3", "x-office-document"),
                }),
                new ComponentFolder("Test folder 2", new List <Component.Component>()
                {
                    new Component.Component("Another test comp 1", "x-office-document"),
                    new Component.Component("Another test comp 2", "x-office-document"),
                    new Component.Component("Another test comp 3", "x-office-document"),
                }),
            });

            sideBar.AppendPage(components.TreeView, new Label("Components"));
            var hierarchy = new HierarchyView(new HierarchyComponent("Top comp", "x-office-document", new List <HierarchyComponent>()
            {
                new HierarchyComponent("Test Comp 1", "x-office-document", new List <HierarchyComponent>()
                {
                    new HierarchyComponent("Test Nested Comp 1", "x-office-document", new List <HierarchyComponent>()),
                }),
                new HierarchyComponent("Test Comp 2", "x-office-document", new List <HierarchyComponent>()
                {
                    new HierarchyComponent("Test Nested Comp 1", "x-office-document", new List <HierarchyComponent>()),
                    new HierarchyComponent("Test Nested Comp 2", "x-office-document", new List <HierarchyComponent>()),
                }),
                new HierarchyComponent("Test Comp 3", "x-office-document", new List <HierarchyComponent>()),
            }));

            sideBar.AppendPage(hierarchy.TreeView, new Label("Hierarchy"));

            HPaned hPaned = new HPaned();

            hPaned.Pack1(sideBar, false, false);
            hPaned.Pack2(nbook, true, false);

            //Add the label to the form
            VBox box = new VBox(false, 0);

            box.PackStart(CreateMenuBar(wnd), false, false, 0);
            box.PackStart(CreateToolbar(circuitEditor), false, false, 0);
            box.PackEnd(hPaned, true, true, 0);
            box.Expand = true;
            wnd.Add(box);

            wnd.Destroyed += Wnd_Destroyed;

            wnd.ShowAll();
            Application.Run();
        }
コード例 #19
0
ファイル: ItemRepository.cs プロジェクト: erpforall/myItems
 public Task <HierarchyView> AddHierarchy(HierarchyView hierarchyView)
 {
     throw new NotImplementedException();
 }
コード例 #20
0
 public HierarchyDataPlainListView(HierarchyView hierarchyView)
 {
     HierarchyView = hierarchyView;
 }
コード例 #21
0
 private void OnSelectedItemChanged()
 {
     HierarchyView.ShowCurrentSelection();
     PropertyView?.ShowProperties(SelectedNode, SelectedItemIndex);
     RenderView?.SelectObject(SelectedNode, SelectedItemIndex);
 }
コード例 #22
0
 public void SetUp()
 {
     _hierarchyView = new HierarchyView();
 }
コード例 #23
0
 public void ChangeName(string newName)
 {
     HierarchyView.ChangeName(gameObject, newName);
 }
コード例 #24
0
        private void DrawHierarchyInfo()
        {
            EditorGUILayout.BeginVertical();
            string[] names = new string[Application.Applications.Count + 1];
            names[0] = "None";

            int oldIdx = 0;

            for (int i = 1; i < names.Length; i++)
            {
                names[i] = Application.Applications[i - 1].id;
                if (names[i] == inspectedAppId)
                {
                    oldIdx = i;
                }
            }

            int idx = EditorGUILayout.Popup(new GUIContent("Application"), oldIdx, names);

            if (firstLoad || idx != oldIdx)
            {
                SetApplication(names[idx]);
                if (firstLoad)
                {
                    SetApplication(names[idx]);
                    s_SelectedElementId = -1;
                    firstLoad           = false;
                }
            }

            if (s_SelectedApplication == null)
            {
                treeView?.Destroy();
                treeView = null;
            }

            if (treeView == null)
            {
                EditorGUILayout.EndVertical();
                return;
            }

            treeView.showChildrenAndId = EditorGUILayout.ToggleLeft("Show Meta Data", treeView.showChildrenAndId);
            treeView.selectMode        = EditorGUILayout.ToggleLeft("Activate Select Mode", treeView.selectMode);

            bool wasShowingDisabled = treeView.showDisabled;

            treeView.showDisabled    = EditorGUILayout.ToggleLeft("Show Disabled", treeView.showDisabled);
            treeView.showLayoutStats = EditorGUILayout.ToggleLeft("Show Layout Stats", treeView.showLayoutStats);

            if (treeView.showDisabled != wasShowingDisabled)
            {
                needsReload = true;
            }
            if (needsReload)
            {
                needsReload    = false;
                treeView.views = s_SelectedApplication.GetViews();
                treeView.Reload();
                treeView.ExpandAll();
            }

            needsReload = treeView.RunGUI();

            EditorGUILayout.EndVertical();
        }