public PUScroll( cVector2 contentSize, bool bounces, bool pagingEnabled, bool scrollEnabled, PlanetUnity.ScrollDirection scrollDirection, bool directionalLockEnabled, cRect bounds ) : this() { this.contentSize = contentSize; this.contentSizeExists = true; this.bounces = bounces; this.bouncesExists = true; this.pagingEnabled = pagingEnabled; this.pagingEnabledExists = true; this.scrollEnabled = scrollEnabled; this.scrollEnabledExists = true; this.scrollDirection = scrollDirection; this.scrollDirectionExists = true; this.directionalLockEnabled = directionalLockEnabled; this.directionalLockEnabledExists = true; this.bounds = bounds; this.boundsExists = true; }
public static void CreateGradient(GameObject gameObject, PUGameObject puGameObject, cRect bounds, cVector2 anchor, Color a, Color b, string shader) { Mesh mesh = new Mesh (); Vector3[] vertices = new Vector3[] { new Vector3 (bounds.w - bounds.w * anchor.x, bounds.h - bounds.h * anchor.y, 0.0f), new Vector3 (bounds.w - bounds.w * anchor.x, -bounds.h * anchor.y, 0.0f), new Vector3 (0.0f - bounds.w * anchor.x, bounds.h - bounds.h * anchor.y, 0.0f), new Vector3 (0.0f - bounds.w * anchor.x, -bounds.h * anchor.y, 0.0f), }; int[] triangles = new int[] { 0, 1, 2, 2, 1, 3, }; mesh.vertices = vertices; mesh.colors = new Color[4] {Color.white, Color.white, Color.white, Color.white}; mesh.triangles = triangles; mesh.RecalculateNormals (); MeshFilter filter = (MeshFilter)gameObject.GetComponent (typeof(MeshFilter)); filter.mesh = mesh; if (shader == null) { shader = "PlanetUnity/Color"; } var shaderObj = Shader.Find (puGameObject.fullShaderPath(shader)); Material mat = new Material (shaderObj); gameObject.renderer.material = mat; gameObject.renderer.material.color = a; }
public PUImageButton( string normalResourcePath, string highlightedResourcePath, cColor touchColor, cVector2 touchSize, string onTouchUp, string onTouchDown, string resourcePath, cRect bounds ) : this() { this.normalResourcePath = normalResourcePath; this.normalResourcePathExists = true; this.highlightedResourcePath = highlightedResourcePath; this.highlightedResourcePathExists = true; this.touchColor = touchColor; this.touchColorExists = true; this.touchSize = touchSize; this.touchSizeExists = true; this.onTouchUp = onTouchUp; this.onTouchUpExists = true; this.onTouchDown = onTouchDown; this.onTouchDownExists = true; this.resourcePath = resourcePath; this.resourcePathExists = true; this.bounds = bounds; this.boundsExists = true; }
public PUColorButton( cVector2 touchSize, cColor touchColor, string onTouchUp, string onTouchDown, cColor color, cRect bounds ) : this() { this.touchSize = touchSize; this.touchSizeExists = true; this.touchColor = touchColor; this.touchColorExists = true; this.onTouchUp = onTouchUp; this.onTouchUpExists = true; this.onTouchDown = onTouchDown; this.onTouchDownExists = true; this.color = color; this.colorExists = true; this.bounds = bounds; this.boundsExists = true; }
public PUMovie( bool hasAlpha, bool looping, string resourcePath, string shader, cVector2 anchor, cColor color, cRect bounds ) : this() { this.hasAlpha = hasAlpha; this.hasAlphaExists = true; this.looping = looping; this.loopingExists = true; this.resourcePath = resourcePath; this.resourcePathExists = true; this.shader = shader; this.shaderExists = true; this.anchor = anchor; this.anchorExists = true; this.color = color; this.colorExists = true; this.bounds = bounds; this.boundsExists = true; }
public static void CreateGradient(GameObject gameObject, PUGameObject puGameObject, string meshName, cRect bounds, cVector2 anchor, Color a, Color b, string shader) { Transform model = Resources.Load<GameObject> (meshName).transform; Mesh mesh = null; foreach (Transform t in model.transform) { MeshFilter loadedFilter = (MeshFilter)t.GetComponent (typeof(MeshFilter)); if (loadedFilter != null) { mesh = loadedFilter.mesh; break; } } mesh = (Mesh)Mesh.Instantiate(mesh); /* // Scale the mesh by the width and the height... Vector3[] vertices = new Vector3[mesh.vertexCount]; for(int i = 0; i < mesh.vertexCount; i++){ Vector3 v = mesh.vertices [i]; v.x *= bounds.w; v.y *= bounds.h; vertices [i] = v; } mesh.vertices = vertices;*/ Vector3[] vertices = mesh.vertices; int i = 0; while (i < vertices.Length) { vertices [i].x *= bounds.w; vertices [i].y *= bounds.h; i++; } mesh.vertices = vertices; mesh.RecalculateBounds (); MeshFilter filter = (MeshFilter)gameObject.GetComponent (typeof(MeshFilter)); filter.sharedMesh = mesh; if (shader == null) { shader = "PlanetUnity/Color"; } var shaderObj = Shader.Find (puGameObject.fullShaderPath(shader)); Material mat = new Material (shaderObj); gameObject.renderer.material = mat; gameObject.renderer.material.color = a; }
public PULabel( string shader, string font, int fontSize, PlanetUnity.LabelAlignment alignment, cColor textColor, string value, cVector2 shadowOffset, cColor shadowColor, cRect bounds ) : this() { this.shader = shader; this.shaderExists = true; this.font = font; this.fontExists = true; this.fontSize = fontSize; this.fontSizeExists = true; this.alignment = alignment; this.alignmentExists = true; this.textColor = textColor; this.textColorExists = true; this.value = value; this.valueExists = true; this.shadowOffset = shadowOffset; this.shadowOffsetExists = true; this.shadowColor = shadowColor; this.shadowColorExists = true; this.bounds = bounds; this.boundsExists = true; }
public PUImage( string resourcePath, string shader, cVector2 anchor, cColor color, cRect bounds ) : this() { this.resourcePath = resourcePath; this.resourcePathExists = true; this.shader = shader; this.shaderExists = true; this.anchor = anchor; this.anchorExists = true; this.color = color; this.colorExists = true; this.bounds = bounds; this.boundsExists = true; }
public PUColor( string shader, cColor color, string mesh, cVector2 anchor, cRect bounds ) : this() { this.shader = shader; this.shaderExists = true; this.color = color; this.colorExists = true; this.mesh = mesh; this.meshExists = true; this.anchor = anchor; this.anchorExists = true; this.bounds = bounds; this.boundsExists = true; }
public void SetContentSize(cVector2 v) { contentSize = v; contentSizeExists = true; }
public PUImageButton( string normalResourcePath, string highlightedResourcePath, cColor touchColor, cVector2 touchSize, string onTouchUp, string onTouchDown, string resourcePath, string shader, cVector2 anchor, cColor color, cRect bounds, cVector3 rotation, bool hidden, float lastY, float lastX, int renderQueueOffset, bool clipDepth, bool clipStencil, string title, string tag, string tag1, string tag2, string tag3, string tag4, string tag5, string tag6 ) : this() { this.normalResourcePath = normalResourcePath; this.normalResourcePathExists = true; this.highlightedResourcePath = highlightedResourcePath; this.highlightedResourcePathExists = true; this.touchColor = touchColor; this.touchColorExists = true; this.touchSize = touchSize; this.touchSizeExists = true; this.onTouchUp = onTouchUp; this.onTouchUpExists = true; this.onTouchDown = onTouchDown; this.onTouchDownExists = true; this.resourcePath = resourcePath; this.resourcePathExists = true; this.shader = shader; this.shaderExists = true; this.anchor = anchor; this.anchorExists = true; this.color = color; this.colorExists = true; this.bounds = bounds; this.boundsExists = true; this.rotation = rotation; this.rotationExists = true; this.hidden = hidden; this.hiddenExists = true; this.lastY = lastY; this.lastYExists = true; this.lastX = lastX; this.lastXExists = true; this.renderQueueOffset = renderQueueOffset; this.renderQueueOffsetExists = true; this.clipDepth = clipDepth; this.clipDepthExists = true; this.clipStencil = clipStencil; this.clipStencilExists = true; this.title = title; this.titleExists = true; this.tag = tag; this.tagExists = true; this.tag1 = tag1; this.tag1Exists = true; this.tag2 = tag2; this.tag2Exists = true; this.tag3 = tag3; this.tag3Exists = true; this.tag4 = tag4; this.tag4Exists = true; this.tag5 = tag5; this.tag5Exists = true; this.tag6 = tag6; this.tag6Exists = true; }
public void SetTouchSize(cVector2 v) { touchSize = v; touchSizeExists = true; }
public override void gaxb_load(XmlReader reader, object _parent, Hashtable args) { base.gaxb_load(reader, _parent, args); if(reader == null && _parent == null) return; parent = _parent; if(this.GetType() == typeof( PUImageButton )) { gaxb_addToParent(); } xmlns = reader.GetAttribute("xmlns"); string attr; attr = reader.GetAttribute("normalResourcePath"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { normalResourcePath = attr; normalResourcePathExists = true; } attr = reader.GetAttribute("highlightedResourcePath"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { highlightedResourcePath = attr; highlightedResourcePathExists = true; } attr = reader.GetAttribute("touchColor"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { touchColor = attr; touchColorExists = true; } attr = reader.GetAttribute("touchSize"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { touchSize = attr; touchSizeExists = true; } attr = reader.GetAttribute("onTouchUp"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { onTouchUp = attr; onTouchUpExists = true; } attr = reader.GetAttribute("onTouchDown"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { onTouchDown = attr; onTouchDownExists = true; } }
public override void gaxb_load(XmlReader reader, object _parent, Hashtable args) { if(gameObject == null) gameObject = (GameObject)new GameObject ("<Color/>", typeof(MeshRenderer), typeof(MeshFilter)); base.gaxb_load (reader, _parent, args); if (titleExists) { gameObject.name = title; } if (anchorExists == false) { anchor = new cVector2 (0, 0); } CreateGeometry (); gameObject.renderer.material.renderQueue = scope ().getRenderQueue () + renderQueueOffset; }
public PULabel( string shader, string font, int fontSize, PlanetUnity.LabelAlignment alignment, cColor textColor, string value, cVector2 shadowOffset, cColor shadowColor, cRect bounds, cVector3 rotation, bool hidden, float lastY, float lastX, int renderQueueOffset, bool clipDepth, bool clipStencil, string title, string tag, string tag1, string tag2, string tag3, string tag4, string tag5, string tag6 ) : this() { this.shader = shader; this.shaderExists = true; this.font = font; this.fontExists = true; this.fontSize = fontSize; this.fontSizeExists = true; this.alignment = alignment; this.alignmentExists = true; this.textColor = textColor; this.textColorExists = true; this.value = value; this.valueExists = true; this.shadowOffset = shadowOffset; this.shadowOffsetExists = true; this.shadowColor = shadowColor; this.shadowColorExists = true; this.bounds = bounds; this.boundsExists = true; this.rotation = rotation; this.rotationExists = true; this.hidden = hidden; this.hiddenExists = true; this.lastY = lastY; this.lastYExists = true; this.lastX = lastX; this.lastXExists = true; this.renderQueueOffset = renderQueueOffset; this.renderQueueOffsetExists = true; this.clipDepth = clipDepth; this.clipDepthExists = true; this.clipStencil = clipStencil; this.clipStencilExists = true; this.title = title; this.titleExists = true; this.tag = tag; this.tagExists = true; this.tag1 = tag1; this.tag1Exists = true; this.tag2 = tag2; this.tag2Exists = true; this.tag3 = tag3; this.tag3Exists = true; this.tag4 = tag4; this.tag4Exists = true; this.tag5 = tag5; this.tag5Exists = true; this.tag6 = tag6; this.tag6Exists = true; }
public void SetShadowOffset(cVector2 v) { shadowOffset = v; shadowOffsetExists = true; }
public PUMovie( bool hasAlpha, bool looping, string resourcePath, string shader, cVector2 anchor, cColor color, cRect bounds, cVector3 rotation, bool hidden, float lastY, float lastX, int renderQueueOffset, bool clipDepth, bool clipStencil, string title, string tag, string tag1, string tag2, string tag3, string tag4, string tag5, string tag6 ) : this() { this.hasAlpha = hasAlpha; this.hasAlphaExists = true; this.looping = looping; this.loopingExists = true; this.resourcePath = resourcePath; this.resourcePathExists = true; this.shader = shader; this.shaderExists = true; this.anchor = anchor; this.anchorExists = true; this.color = color; this.colorExists = true; this.bounds = bounds; this.boundsExists = true; this.rotation = rotation; this.rotationExists = true; this.hidden = hidden; this.hiddenExists = true; this.lastY = lastY; this.lastYExists = true; this.lastX = lastX; this.lastXExists = true; this.renderQueueOffset = renderQueueOffset; this.renderQueueOffsetExists = true; this.clipDepth = clipDepth; this.clipDepthExists = true; this.clipStencil = clipStencil; this.clipStencilExists = true; this.title = title; this.titleExists = true; this.tag = tag; this.tagExists = true; this.tag1 = tag1; this.tag1Exists = true; this.tag2 = tag2; this.tag2Exists = true; this.tag3 = tag3; this.tag3Exists = true; this.tag4 = tag4; this.tag4Exists = true; this.tag5 = tag5; this.tag5Exists = true; this.tag6 = tag6; this.tag6Exists = true; }
public override void gaxb_load(XmlReader reader, object _parent, Hashtable args) { base.gaxb_load(reader, _parent, args); if(reader == null && _parent == null) return; parent = _parent; if(this.GetType() == typeof( PUMovie )) { gaxb_addToParent(); } xmlns = reader.GetAttribute("xmlns"); string attr; attr = reader.GetAttribute("hasAlpha"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { hasAlpha = bool.Parse(attr); hasAlphaExists = true; } attr = reader.GetAttribute("looping"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { looping = bool.Parse(attr); loopingExists = true; } attr = reader.GetAttribute("resourcePath"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { resourcePath = attr; resourcePathExists = true; } attr = reader.GetAttribute("shader"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { shader = attr; shaderExists = true; } attr = reader.GetAttribute("anchor"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "0,0"; } if(attr != null) { anchor = attr; anchorExists = true; } attr = reader.GetAttribute("color"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { color = attr; colorExists = true; } }
public override void gaxb_load(XmlReader reader, object _parent, Hashtable args) { base.gaxb_load(reader, _parent, args); if(reader == null && _parent == null) return; parent = _parent; if(this.GetType() == typeof( PUColor )) { gaxb_addToParent(); } xmlns = reader.GetAttribute("xmlns"); string attr; attr = reader.GetAttribute("shader"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { shader = attr; shaderExists = true; } attr = reader.GetAttribute("color"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { color = attr; colorExists = true; } attr = reader.GetAttribute("mesh"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { mesh = attr; meshExists = true; } attr = reader.GetAttribute("anchor"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "0,0"; } if(attr != null) { anchor = attr; anchorExists = true; } }
public override void gaxb_load(XmlReader reader, object _parent, Hashtable args) { base.gaxb_load(reader, _parent, args); if(reader == null && _parent == null) return; parent = _parent; if(this.GetType() == typeof( PUScroll )) { gaxb_addToParent(); } xmlns = reader.GetAttribute("xmlns"); string attr; attr = reader.GetAttribute("contentSize"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "0,0"; } if(attr != null) { contentSize = attr; contentSizeExists = true; } attr = reader.GetAttribute("bounces"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "true"; } if(attr != null) { bounces = bool.Parse(attr); bouncesExists = true; } attr = reader.GetAttribute("pagingEnabled"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { pagingEnabled = bool.Parse(attr); pagingEnabledExists = true; } attr = reader.GetAttribute("scrollEnabled"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "true"; } if(attr != null) { scrollEnabled = bool.Parse(attr); scrollEnabledExists = true; } attr = reader.GetAttribute("scrollDirection"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { scrollDirection = (PlanetUnity.ScrollDirection)System.Enum.Parse(typeof(PlanetUnity.ScrollDirection), attr); scrollDirectionExists = true; } attr = reader.GetAttribute("directionalLockEnabled"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "false"; } if(attr != null) { directionalLockEnabled = bool.Parse(attr); directionalLockEnabledExists = true; } }
public void SetAnchor(cVector2 v) { anchor = v; anchorExists = true; }
public override void gaxb_load(XmlReader reader, object _parent, Hashtable args) { base.gaxb_load(reader, _parent, args); if(reader == null && _parent == null) return; parent = _parent; if(this.GetType() == typeof( PULabel )) { gaxb_addToParent(); } xmlns = reader.GetAttribute("xmlns"); string attr; attr = reader.GetAttribute("shader"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { shader = attr; shaderExists = true; } attr = reader.GetAttribute("font"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { font = attr; fontExists = true; } attr = reader.GetAttribute("fontSize"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "12"; } if(attr != null) { fontSize = int.Parse(attr); fontSizeExists = true; } attr = reader.GetAttribute("alignment"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "center"; } if(attr != null) { alignment = (PlanetUnity.LabelAlignment)System.Enum.Parse(typeof(PlanetUnity.LabelAlignment), attr); alignmentExists = true; } attr = reader.GetAttribute("textColor"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr == null) { attr = "0,0,0,1"; } if(attr != null) { textColor = attr; textColorExists = true; } attr = reader.GetAttribute("value"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { value = attr; valueExists = true; } attr = reader.GetAttribute("shadowOffset"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { shadowOffset = attr; shadowOffsetExists = true; } attr = reader.GetAttribute("shadowColor"); if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); } if(attr != null) { shadowColor = attr; shadowColorExists = true; } }
public PUTable( cVector2 contentSize, bool bounces, bool pagingEnabled, bool scrollEnabled, PlanetUnity.ScrollDirection scrollDirection, bool directionalLockEnabled, cRect bounds, cVector3 rotation, bool hidden, float lastY, float lastX, int renderQueueOffset, bool clipDepth, bool clipStencil, string title, string tag, string tag1, string tag2, string tag3, string tag4, string tag5, string tag6 ) : this() { this.contentSize = contentSize; this.contentSizeExists = true; this.bounces = bounces; this.bouncesExists = true; this.pagingEnabled = pagingEnabled; this.pagingEnabledExists = true; this.scrollEnabled = scrollEnabled; this.scrollEnabledExists = true; this.scrollDirection = scrollDirection; this.scrollDirectionExists = true; this.directionalLockEnabled = directionalLockEnabled; this.directionalLockEnabledExists = true; this.bounds = bounds; this.boundsExists = true; this.rotation = rotation; this.rotationExists = true; this.hidden = hidden; this.hiddenExists = true; this.lastY = lastY; this.lastYExists = true; this.lastX = lastX; this.lastXExists = true; this.renderQueueOffset = renderQueueOffset; this.renderQueueOffsetExists = true; this.clipDepth = clipDepth; this.clipDepthExists = true; this.clipStencil = clipStencil; this.clipStencilExists = true; this.title = title; this.titleExists = true; this.tag = tag; this.tagExists = true; this.tag1 = tag1; this.tag1Exists = true; this.tag2 = tag2; this.tag2Exists = true; this.tag3 = tag3; this.tag3Exists = true; this.tag4 = tag4; this.tag4Exists = true; this.tag5 = tag5; this.tag5Exists = true; this.tag6 = tag6; this.tag6Exists = true; }
public void CalculateContentSize() { // if contentSize does not exist, run through planet children and calculate a content size float minX = 999999, maxX = -999999; float minY = 999999, maxY = -999999; foreach (PUGameObject go in children) { if (go.bounds.x < minX) minX = go.bounds.x; if (go.bounds.y < minY) minY = go.bounds.y; if ((go.bounds.x+go.bounds.w) > maxX) maxX = (go.bounds.x+go.bounds.w); if ((go.bounds.y+go.bounds.h) > maxY) maxY = (go.bounds.y+go.bounds.h); } contentSize = new cVector2 (maxX - minX, maxY - minY); CalculateScrollDirection (); }