Beispiel #1
0
    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 PUGameObject(
			cRect bounds,
			cVector3 rotation,
			bool hidden,
			float lastY,
			float lastX,
			int renderQueueOffset,
			bool clipDepth,
			bool clipStencil )
        : this()
    {
        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;
    }
Beispiel #4
0
    public PUTable(
			cRect bounds )
        : this()
    {
        this.bounds = bounds;
        this.boundsExists = true;
    }
Beispiel #5
0
    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;
    }
Beispiel #6
0
    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 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;
    }
Beispiel #8
0
    public PUPrefab(
			string name,
			cRect bounds )
        : this()
    {
        this.name = name;
        this.nameExists = true;

        this.bounds = bounds;
        this.boundsExists = true;
    }
Beispiel #9
0
    public PUCode(
			string _class,
			bool singleton,
			cRect bounds )
        : this()
    {
        this._class = _class;
        this._classExists = true;

        this.singleton = singleton;
        this.singletonExists = true;

        this.bounds = bounds;
        this.boundsExists = true;
    }
Beispiel #10
0
    public PUScene(
			bool adjustCamera,
			int fps,
			cRect bounds )
        : this()
    {
        this.adjustCamera = adjustCamera;
        this.adjustCameraExists = true;

        this.fps = fps;
        this.fpsExists = true;

        this.bounds = bounds;
        this.boundsExists = true;
    }
Beispiel #11
0
    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;
    }
Beispiel #12
0
    public PUSprite(
			string resourcePath,
			cVector3 position,
			float scale,
			cRect bounds )
        : this()
    {
        this.resourcePath = resourcePath;
        this.resourcePathExists = true;

        this.position = position;
        this.positionExists = true;

        this.scale = scale;
        this.scaleExists = true;

        this.bounds = bounds;
        this.boundsExists = true;
    }
Beispiel #13
0
    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;
    }
Beispiel #14
0
    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;
    }
Beispiel #15
0
    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 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( PUGameObject ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("bounds");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { bounds = attr; boundsExists = true; }

        attr = reader.GetAttribute("rotation");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { rotation = attr; rotationExists = true; }

        attr = reader.GetAttribute("hidden");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { hidden = bool.Parse(attr); hiddenExists = true; }

        attr = reader.GetAttribute("lastY");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { lastY = float.Parse(attr); lastYExists = true; }

        attr = reader.GetAttribute("lastX");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { lastX = float.Parse(attr); lastXExists = true; }

        attr = reader.GetAttribute("renderQueueOffset");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { renderQueueOffset = int.Parse(attr); renderQueueOffsetExists = true; }

        attr = reader.GetAttribute("clipDepth");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr == null) { attr = "false"; }
        if(attr != null) { clipDepth = bool.Parse(attr); clipDepthExists = true; }

        attr = reader.GetAttribute("clipStencil");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr == null) { attr = "false"; }
        if(attr != null) { clipStencil = bool.Parse(attr); clipStencilExists = true; }
    }
Beispiel #17
0
    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;
    }
Beispiel #18
0
    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;
    }
Beispiel #19
0
    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 SetBounds(cRect v)
 {
     bounds = v; boundsExists = true;
 }
    public PUGameObject(
			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.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 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;
    }