コード例 #1
0
        public GuiTreeviewRenderer(
            IGuiLayout guiLayout,
            IRowClickableLocations <TSource> rowClickableLocations,
            ICachingObserver <TSource> itemCache,
            ITreeviewRowRenderer <TSource> treeviewRowRenderer)
        {
            if (guiLayout == null)
            {
                throw new ArgumentNullException("guiLayout");
            }

            if (rowClickableLocations == null)
            {
                throw new ArgumentNullException("rowClickableLocations");
            }

            if (itemCache == null)
            {
                throw new ArgumentNullException("itemCache");
            }

            if (treeviewRowRenderer == null)
            {
                throw new ArgumentNullException("treeviewRowRenderer");
            }

            this.guiLayout             = guiLayout;
            this.rowClickableLocations = rowClickableLocations;
            this.itemCache             = itemCache;
            this.treeviewRowRenderer   = treeviewRowRenderer;

            this.itemCache = itemCache;
        }
コード例 #2
0
 private void InitaliseTreeview()
 {
     this.gui                   = new GuiWrapper();
     this.guiLayout             = new GuiLayoutWrapper();
     this.log                   = new UnityLog();
     this.rowClickableLocations = new RowClickableLocations <Treeview_DataModel>();
     this.rowContentClicker     = new RowContentClicker <Treeview_DataModel>();
     this.rowExpanderClicker    = new RowExpanderClicker <Treeview_DataModel>();
     this.rowContentActivator   = new RowContentActivator <Treeview_DataModel>();
     this.cachingObserver       = new CachingObserver <Treeview_DataModel>(this.log);
     this.rowInteraction        = new RowInteraction <Treeview_DataModel>(rowClickableLocations, rowExpanderClicker, rowContentClicker, rowContentActivator);
 }
コード例 #3
0
    //////////////////////////////////////////////////////
    //// FUNCIONS FOR EXTERNAL ACCESS

    public void AddUnknownEntityToTreeview(int entityID)
    {
        finishedInitTreeviewHandler = false;

        //cloning entity
        GameObject clone = new GameObject();

        clone.name = "" + entityID;
        GameObject model = Instantiate(Resources.Load("Models/vojak") as GameObject);

        model.transform.parent   = clone.transform;
        clone.transform.position = new Vector3(0, UnityEngine.Random.Range(-1000000, -10000));

        foreach (Transform child in model.transform)
        {
            child.GetComponent <Renderer>().material             = this.entityHandlerScript.materialUnknownForces;
            child.GetComponent <Renderer>().material.mainTexture = this.entityHandlerScript.militaryTexture;
        }

        // should not occur
        // adding to treeview
        if (TreeView.ItemsSource.Children.Count < 3)
        {
            Debug.Log("Not enough children of root parent!");
            finishedInitTreeviewHandler = true;
            return;
        }

        TreeView.ItemsSource.Children[3].Children.Add(
            new Treeview_DataModel {
            Text = Constants.UnknownEntityName + entityID, EntityID = entityID, IsUnit = false, Health = 0, Father = TreeView.ItemsSource.Children[3]
        });

        this.rowContentActivator = new RowContentActivator <Treeview_DataModel>();
        this.cachingObserver     = new CachingObserver <Treeview_DataModel>(this.log);
        this.treeviewRenderer    = new GuiTreeviewRenderer <Treeview_DataModel>(this.guiLayout, this.rowClickableLocations, this.cachingObserver, this.rowRenderer);

        RecursionUtil.Treeview_SetGameObjects_Rec(TreeView.ItemsSource);
        finishedInitTreeviewHandler = true;
    }