public RowInteraction( IRowClickableLocations <TSource> clickableLocations, IRowExpanderClicker <TSource> rowExpanderClicker, IRowContentClicker <TSource> rowContentClicker, IRowContentActivator <TSource> rowContentActivator) { if (clickableLocations == null) { throw new ArgumentNullException("clickableLocations"); } if (rowExpanderClicker == null) { throw new ArgumentNullException("rowExpanderClicker"); } if (rowContentClicker == null) { throw new ArgumentNullException("rowContentClicker"); } if (rowContentActivator == null) { throw new ArgumentNullException("rowContentActivator"); } this.clickableLocations = clickableLocations; this.rowExpanderClicker = rowExpanderClicker; this.rowContentClicker = rowContentClicker; this.rowContentActivator = rowContentActivator; }
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); }
////////////////////////////////////////////////////// //// 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; }