public override void LoadIntoPUGameObject(PUTable parent, object data, int baseRenderQueue) { DemoHeader info = data as DemoHeader; // call the base method to have it load all of our PlanetUnity stuff base.LoadIntoPUGameObject(parent, data, baseRenderQueue); // Now everything is defined, we can fill in the data for our cell as we see fit Name.LoadTextString (info.name); }
public override void LoadIntoPUGameObject(PUTable parent, object data, int baseRenderQueue) { Demo info = data as Demo; // call the base method to have it load all of our PlanetUnity stuff base.LoadIntoPUGameObject(parent, data, baseRenderQueue); // We're going to pass the information we want through the entity tag Name.tag = info.scene; // Now everything is defined, we can fill in the data for our cell as we see fit Name.LoadTextString (info.name); }
public override void LoadIntoPUGameObject(PUTable parent, object data, int baseRenderQueue) { Toy info = data as Toy; // call the base method to have it load all of our PlanetUnity stuff base.LoadIntoPUGameObject(parent, data, baseRenderQueue); // Now everything is defined, we can fill in the data for our cell as we see fit ToyName.LoadTextString (info.name); ToyDesc.LoadTextString (info.description); ToyIcon.LoadImageResource (info.image); // Wouldn't it be cool to support multiple row heights? Its easier than you'd think. // Just remember at this level we're in unity coords, so 0 is the bottom of the cell. puGameObject.bounds.h = ToyDesc.textMesh.renderer.bounds.size.y + ( puGameObject.bounds.h - ToyDesc.bounds.y ); // We want the line to attach to the bottom of the cell Vector2 pos = Line.gameObject.transform.localPosition; pos.y -= ToyDesc.textMesh.renderer.bounds.size.y ; Line.gameObject.transform.localPosition = pos; }
public virtual void LoadIntoPUGameObject(PUTable parent, object data, int baseRenderQueue) { table = parent; cellData = data; puGameObject = (PUGameObject)PlanetUnity.loadXML (PlanetUnityOverride.xmlFromPath(XmlPath ()), parent, NotificationCenter.Args ("baseRenderQueue", baseRenderQueue)); // Attach all of the PlanetUnity objects try { FieldInfo field = this.GetType ().GetField ("scene"); if (field != null) { field.SetValue (this, puGameObject); } puGameObject.performOnChildren (val => { PUGameObject oo = val as PUGameObject; if (oo != null && oo.title != null) { field = this.GetType ().GetField (oo.title); if (field != null) { field.SetValue (this, oo); } } return true; }); } catch (Exception e) { UnityEngine.Debug.Log ("TableCell error: " + e); } try { // Attach all of the named GameObjects FieldInfo[] fields = this.GetType ().GetFields (); foreach (FieldInfo field in fields) { if (field.FieldType == typeof(GameObject)) { GameObject[] pAllObjects = (GameObject[])Resources.FindObjectsOfTypeAll (typeof(GameObject)); foreach (GameObject pObject in pAllObjects) { if (pObject.name.Equals (field.Name)) { field.SetValue (this, pObject); } } } } } catch (Exception e) { UnityEngine.Debug.Log ("TableCell error: " + e); } if (IsHeader ()) { PUTableHeaderScript script = (PUTableHeaderScript)puGameObject.gameObject.AddComponent (typeof(PUTableHeaderScript)); script.table = table; script.tableCell = this; } // We want to bridge all notifications to my scope; this allows developers to handle notifications // at the table cell level, or at the scene controller level, with ease NotificationCenter.addObserver (this, "*", puGameObject, (args,name) => { NotificationCenter.postNotification(table.scope(), name, args); }); }