public Billboard(string description) { localPosition = new Default.Namespace.CGPoint(); localPosition.x = 0.0f; localPosition.y = 0.0f; string whatAmI = "BillBoardGameObject_" + description; myObject = new GameObject(whatAmI); myObject.AddComponent <MeshFilter>(); myObject.AddComponent <MeshRenderer>(); myObject.GetComponent <Renderer>().enabled = false; myAtlas = null; myTexture = null; myColour.a = 1.0f; myColour.r = 1.0f; myColour.g = 1.0f; myColour.b = 1.0f; currentSubtextureId = -1; oldScale = -1.0f; usingAlpha = false; materialForColourAndAlpha = null; prevAlpha = -1.0f; }
public TextMeshWrapper(string description) { string whatAmI = "TextMeshWrapperGameObject_" + description; materialForColourAndAlpha = null; myObject = new GameObject(whatAmI); myObject.AddComponent<TextMesh>(); myObject.AddComponent<MeshRenderer>(); myObject.layer = LayerMask.NameToLayer("guistuff"); // TextMesh textMesh = myObject.GetComponent<TextMesh>(); //textMesh.font = Default.Namespace.Globals.g_world.guiFont; myObject.GetComponent<Renderer>().enabled = false; myFontSize = kFontSize; myScale = 1.0f; myColour = Default.Namespace.Constants.kColourWhite; myAtlas = null; //myColour.a = 0.8f; // myColour.cRed = 1.0f; // myColour.cGreen = 1.0f; // myColour.cBlue = 1.0f; shown = false; this.SetAlpha(0.8f); currentSubtextureId = -1; }
public void SetupTileBox(ZAtlas inAtlas) { Zobject.TileBoxInfo info = new Zobject.TileBoxInfo(); info.tileBoxAtlas = inAtlas; info.tileBoxWidth = 4; info.tileBoxHeight = 3; backdrop.SetupTileBox(info); backdrop.SetShowScale(1.0f); }
public void SetFontAtlas(ZAtlas inAtlas) { myAtlas = inAtlas; for (int i = 0; i < (int)Enum.kMaxNumScoreDigits; i++) { zobject[i].SetAtlas(myAtlas); zobject[i].SetSubTextureId(0); //fake (zobject[i]).myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff"); } }
public void Begin(ZAtlas inZ) { #if TEST_SHORTS float width = (inZ.texture).pixelsWide; float height = (inZ.texture).pixelsHigh; //Globals.g_main.SetGLMatrixMode(GL_TEXTURE); //glLoadIdentity(); //glScalef(1.0f / width, 1.0f / height, 1.0f); #endif atlas = inZ; // (inZ.texture).Bind(); }
public void SetAtlas(Default.Namespace.ZAtlas inAtlas) { if (!Default.Namespace.Constants.ANDROID_25) { Default.Namespace.Globals.Assert(inAtlas.myMaterial.mainTexture != null); } // Debug.Log("SetAtlas " + inAtlas.myId + " for " + this.ToString()); if (myAtlas != inAtlas) { if (myAtlas == null) { // Debug.Log("ChangingAtlas from null to " + inAtlas.myId); } else { // Debug.Log("ChangingAtlas from " + myAtlas.myId + " to " + inAtlas.myId); } // Debug.Log("ChangingAtlas from " myAtlas.myId + " to " + inAtlas.myId); } myAtlas = inAtlas; //MeshRenderer meshRenderer = myObject.GetComponent<MeshRenderer>(); //meshRenderer.sharedMaterial = inAtlas.myMaterial; UnityEngine.Color tempC = new UnityEngine.Color(); tempC.a = 1.0f; tempC.r = myColour.r; tempC.g = myColour.g; tempC.b = myColour.b; myObject.GetComponent <Renderer>().sharedMaterial = inAtlas.myMaterial; /* * if (materialForColourAndAlpha == null) * { * materialForColourAndAlpha = new Material(Shader.Find( "Pi/TransparentOverlay" )); * } * * materialForColourAndAlpha.mainTexture = inAtlas.myMaterial.mainTexture; * materialForColourAndAlpha.color = tempC; * * myObject.renderer.material = materialForColourAndAlpha;*/ // Material mat = myObject.renderer.material; // mat.color = tempC; // meshRenderer.material.shader = Shader.Find( "Decal" ); }
public void Launch_RainbowStarTrail(CGPoint inStartPosition) { currentAnim = 0; isAnimated = false; isActive = true; timer = 0; int randNumber = 140 + (Utilities.GetRand(120)); float angle = ((float)randNumber) * (Constants.PI_ / 360.0f); float outSpeed = 1.2f * ((Globals.g_world.GetGame()).GetPlayer()).GetActualSpeed().y; velocity = Utilities.GetVectorFromAngleP1(angle, outSpeed); int randX = Utilities.GetRand(20); int randY = Utilities.GetRand(10); float plusX = (float)randX - 10.0f; float plusY = (float)randY - 5.0f; CGPoint startPosition = Utilities.CGPointMake(inStartPosition.x + plusX + velocity.x * 2, inStartPosition.y + plusY + velocity.y * 2); mapPosition = startPosition; const int kNumFrames = 6; int particleId = (int)ParticleTextureType.kParticleTexture_SparkleRed + ((Utilities.GetRand(5)) * kNumFrames); texture = (ParticleSystemRoss.Instance()).GetTexture((ParticleTextureType)particleId); atlas = Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles); myAtlasBillboard.SetAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles)); myAtlasBillboard.SetDetailsFromAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles), 0); subTextureId = (Utilities.GetRand(5)) * 6; for (int i = 0; i < kNumFrames; i++) { animFrame[i] = (ParticleSystemRoss.Instance()).GetTexture((ParticleTextureType)particleId + i); } currentAnim = 0; animTimer = 0; rotation = 0; type = ParticleType.kParticle_RainbowStarTrail; if (isAdditive) { alpha = 0.2f; } else { alpha = 1; } }
} ///@property(readwrite,assign) int subTextureId; public void SetAtlas(ZAtlas inThing) { atlas = inThing; //return; if (myAtlasBillboard == null) { myAtlasBillboard = new Billboard("mapObject_" + type.ToString() + "_atlas" + atlas.myId.ToString()); } myAtlasBillboard.SetAtlas(atlas); myAtlasBillboard.SetDetailsFromAtlas(atlas, 0); // myAtlasBillboard.SetRenderQueue(9000); this.ResetMapObject(); } ////@property(readwrite,assign) ZAtlas* atlas;
//This is for single textures - i.e. not atlases... //The material gets loaded once but could hypothetically be used for a bunch of gmaeobjects... public void SetTexture2D(Default.Namespace.Texture2D_Ross inTextureThing) { myAtlas = null; myTexture = inTextureThing; myObject.GetComponent <Renderer>().sharedMaterial = inTextureThing.myMaterial; if (false) //(Default.Namespace.Constants.ANDROID_25) && (Default.Namespace.Globals.g_main.loadADCQueue.state == LoadADCQueue.State.kStateBuildingUpAssetList)) { // this.SetHeightAndWidth(256.0f, 256.0f); } else { //won't work with ADC yet... this.SetHeightAndWidth(inTextureThing.myMaterial.mainTexture.width, inTextureThing.myMaterial.mainTexture.height); } }
public void AddToSceneP1P2P3(int inType, CGPoint mapPosition, float inRotation, float inAlpha) { isSimpleObject = false; isSelfRemoving = true; atlas = null; flaggedToRemoveNextFrame = false; flaggedToSwapbackwardNextFrame = false; flaggedToSwapForwardNextFrame = false; position = mapPosition; textureType = inType; texture = (Globals.g_world.game).GetTexture((TextureType)(TextureType)inType); mapObjectGone = false; isOnScreen = false; hasBeenDisplayed = false; rotation = inRotation; alpha = inAlpha; scale = 1; alphaSpeed = 0; subTextureId = -1; type = MapObjectType.e_Whatever; }
public int AddFunnyWordP1P2P3P4P5P6P7(ZFont inFont, ZAtlas inLinesAtlas, ZAtlas inColoursAtlas, CGPoint position, float scale, string inWord, bool isCentrePosition, Constants.RossColour inCol) { Globals.Assert(numFunnyWords < (int)Enum.kMaxFunnyWords); if (funnyWord[numFunnyWords] == null) { funnyWord[numFunnyWords] = new FunnyWord(); } (funnyWord[numFunnyWords]).SetFont(inFont); FunnyWord.WordInfo info; info.position = position; info.scale = scale; info.isCentrePos = isCentrePosition; (funnyWord[numFunnyWords]).SetColourAtlas(inColoursAtlas); (funnyWord[numFunnyWords]).InitWithWordP1(info, inWord); (funnyWord[numFunnyWords]).SetColour(inCol); (funnyWord[numFunnyWords]).SetLineAtlas(inLinesAtlas); numFunnyWords++; return(numFunnyWords - 1); }
public void AddLabelP1P2(ZAtlas inTex, int inSubTextureId, CGPoint inOffset) { labelOffset = inOffset; if (zobjectLabel == null) { zobjectLabel = new Zobject(); } Zobject.ZobjectInfo info = new Zobject.ZobjectInfo(); info.texture = null; info.startState = ZobjectState.kZobjectHidden; zobjectLabel.Initialise(info); zobjectLabel.SetAtlas(inTex); zobjectLabel.SetSubTextureId(inSubTextureId); zobjectLabel.SetShowStyle(zobject.showStyle); zobjectLabel.SetHideStyle(zobject.hideStyle); zobjectLabel.SetWaitToShow(zobject.waitToShow); CGPoint labePos = Utilities.CGPointMake(position.x + labelOffset.x, position.y + labelOffset.y); zobjectLabel.SetScreenPosition(labePos); zobjectLabel.SetState(ZobjectState.kZobjectHidden); }
public void Launch_GreenAntScreen(ParticleInfo inInfo) { currentAnim = 0; isAnimated = false; isActive = true; timer = 0; velocity = inInfo.velocity; CGPoint startPosition = inInfo.startPosition; mapPosition = startPosition; const int kNumFrames = 6; int particleId = (int)ParticleTextureType.kParticleTexture_SparkleRed + ((Utilities.GetRand(5)) * kNumFrames); texture = (ParticleSystemRoss.Instance()).GetTexture((ParticleTextureType)particleId); atlas = Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles); myAtlasBillboard.SetAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles)); myAtlasBillboard.SetDetailsFromAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_RainbowParticles), 0); subTextureId = (Utilities.GetRand(5)) * 6; currentAnim = 0; animTimer = 0; rotation = 0; type = ParticleType.kParticle_GreenAntScreen; if (isAdditive) { alpha = 0.2f; } else { alpha = 1.0f; } scale = 1; if (isAdditive) { scale = 1.35f; } }
} ////@property(readwrite,assign) ZAtlas* myAtlas; public Zscore() { // //if (!base.init()) return null; myAtlas = null; orientationButton = null; positionButton = null; for (int i = 0; i < (int)Enum.kMaxNumScoreDigits; i++) { zobject[i] = new Zobject(); } rotationWholeWord = 0.0f; scale = 1; state = ZscoreState.e_Hidden; prevScore = -1; decimalPoint = -1; digitWidth = 31; defaultColour = Constants.kColourWhite; dontDisplayLeadingZeros = false; xDigit[0] = 10.5f; xDigit[1] = 6.5f; xDigit[2] = 10.0f; xDigit[3] = 10.0f; xDigit[4] = 10.0f; xDigit[5] = 10.0f; xDigit[6] = 10.0f; xDigit[7] = 8.5f; xDigit[8] = 10.0f; xDigit[9] = 10.0f; xDigit[10] = 6.0f; timeBetweenShowingDigits = 0.05f; for (int i = 0; i < 11; i++) { xDigit[i] *= 3.0f; } // //return this; }
/* public void RenderAtPositionOld_(Default.Namespace.CGPoint inPosition, float inScale, float inRot, float inAlpha, int inSubtextureId) * { * if (currentSubtextureId != inSubtextureId) * { * currentSubtextureId = inSubtextureId; * if (myAtlas != null) * { * this.SetUVs(currentSubtextureId); * } * } * * this.CheckRender(); * * if (inAlpha != prevAlpha) * this.SetAlpha(inAlpha); * * MeshFilter mf = myObject.GetComponent<MeshFilter>(); * Vector3[] vertices = new Vector3[4]; * * inPosition.x -= 160.0f; * inPosition.y = 240.0f - inPosition.y; * * if (inRot == 0.0f) * { * float halfWidth = width * 0.5f * inScale;//(width * 0.5f); * float halfHeight = height * 0.5f * inScale;//(height * 0.5f); * * vertices[0] = new Vector3(inPosition.x - halfHeight, inPosition.y - halfWidth, Default.Namespace.Globals.renderCounter); * vertices[1] = new Vector3(inPosition.x + halfHeight, inPosition.y - halfWidth, Default.Namespace.Globals.renderCounter); * vertices[2] = new Vector3(inPosition.x - halfHeight, inPosition.y + halfWidth, Default.Namespace.Globals.renderCounter); * vertices[3] = new Vector3(inPosition.x + halfHeight, inPosition.y + halfWidth, Default.Namespace.Globals.renderCounter); * } * else * { * float rotationAngleToFirstPoint;// = myAtlas.GetRotationAngleToFirstPoint(inSubtextureId); * float rotationAngleToSecondPoint;// = myAtlas.GetRotationAngleToSecondPoint(inSubtextureId); * float useRotationScale;// = myAtlas.GetSubTextureRotationScale(inSubtextureId) * inScale; * * if (myAtlas == null) * { * //Just loading bar??? * * rotationAngleToFirstPoint = rotationAngle1; * rotationAngleToSecondPoint = rotationAngle2; * useRotationScale = rotationScale; * } * else * { * Default.Namespace.Globals.Assert(inSubtextureId != -1); * * rotationAngleToFirstPoint = myAtlas.GetRotationAngleToFirstPoint(inSubtextureId); * rotationAngleToSecondPoint = myAtlas.GetRotationAngleToSecondPoint(inSubtextureId); * useRotationScale = myAtlas.GetSubTextureRotationScale(inSubtextureId) * inScale; * } * * float radians = inRot + rotationAngleToFirstPoint; //kRadiansAngleFor2x1y; * float a = (Mathf.Cos(radians) * useRotationScale); * float b = (Mathf.Sin(radians) * useRotationScale); * radians += rotationAngleToSecondPoint; //0.9272f;//0.4636below*2//2.217f; //(M_PI - (kRadiansAngleFor2x1y * 2.0f)); * float c = (Mathf.Cos(radians) * useRotationScale); * float d = (Mathf.Sin(radians) * useRotationScale); * float topRightX = inPosition.x + a; * float topRightY = inPosition.y + b; * float topLeftX = inPosition.x + c; * float topLeftY = inPosition.y + d; * float bottomLeftX = inPosition.x - a; * float bottomLeftY = inPosition.y - b; * float bottomRightX = inPosition.x - c; * float bottomRightY = inPosition.y - d; * * vertices[2] = new Vector3(topLeftX, topLeftY, Default.Namespace.Globals.renderCounter); * vertices[3] = new Vector3(topRightX, topRightY, Default.Namespace.Globals.renderCounter); * vertices[0] = new Vector3(bottomLeftX, bottomLeftY, Default.Namespace.Globals.renderCounter); * vertices[1] = new Vector3(bottomRightX, bottomRightY, Default.Namespace.Globals.renderCounter); * * // float halfHeight = 50.0f; * // float halfWidth = 50.0f; * * // vertices[0] = new Vector3(inPosition.x - halfHeight, -80, Default.Namespace.Globals.renderCounter); * // vertices[1] = new Vector3(inPosition.x + halfHeight, -80, Default.Namespace.Globals.renderCounter); * // vertices[2] = new Vector3(inPosition.x - halfHeight, 85, Default.Namespace.Globals.renderCounter); * // vertices[3] = new Vector3(inPosition.x + halfHeight, 85, Default.Namespace.Globals.renderCounter); * * } * * Default.Namespace.Globals.renderCounter -= 0.5f; * * //could save this... * // MeshRenderer meshRenderer = myObject.GetComponent<MeshRenderer>(); * // meshRenderer.material.renderQueue = Default.Namespace.Globals.renderQueueCounter; * // Default.Namespace.Globals.renderQueueCounter += 1; * * mf.mesh.vertices = vertices; * }*/ public void SetDetailsFromAtlas(Default.Namespace.ZAtlas inAtlas, int subTextureId) { //Debug.Log ("SetDetailsFromAtlas"); currentSubtextureId = subTextureId; height = inAtlas.GetSubTextureWidth(subTextureId) * 2.0f; width = inAtlas.GetSubTextureHeight(subTextureId) * 2.0f; MeshFilter mf = myObject.GetComponent <MeshFilter>(); Mesh mesh; bool newMesh = false; if (mf.sharedMesh == null) { mesh = new Mesh(); newMesh = true; } else { mesh = mf.sharedMesh; } // var mesh = new Mesh(); // mf.mesh = mesh; Vector3[] vertices = new Vector3[4]; float halfWidth = (width * 0.5f); float halfHeight = (height * 0.5f); vertices[0] = new Vector3(-halfHeight, -halfWidth, 0); vertices[1] = new Vector3(halfHeight, -halfWidth, 0); vertices[2] = new Vector3(-halfHeight, halfWidth, 0); vertices[3] = new Vector3(halfHeight, halfWidth, 0); mesh.vertices = vertices; for (int i = 0; i < 4; i++) { // mesh.vertices[i].x = vertices[i].x; // mesh.vertices[i].y = vertices[i].y; // mesh.vertices[i].z = vertices[i].z; } // mesh.vertices = vertices; if (newMesh) { int[] tri = new int[6]; tri[0] = 0; tri[1] = 2; tri[2] = 1; tri[3] = 2; tri[4] = 3; tri[5] = 1; mesh.triangles = tri; Vector3[] normals = new Vector3[4]; normals[0] = -Vector3.forward; normals[1] = -Vector3.forward; normals[2] = -Vector3.forward; normals[3] = -Vector3.forward; mesh.normals = normals; } Vector2[] uv = new Vector2[4]; float ux = inAtlas.GetMinUVP1(subTextureId, 0); float uxm = inAtlas.GetMaxUVP1(subTextureId, 0); float vx = inAtlas.GetMinUVP1(subTextureId, 1); float vxm = inAtlas.GetMaxUVP1(subTextureId, 1); float textureWidth; float textureHeight; if ((Default.Namespace.Constants.ANDROID_25) && (Default.Namespace.Globals.g_main.loadADCQueue.state == LoadADCQueue.State.kStateBuildingUpAssetList)) { textureWidth = 256.0f; textureHeight = 256.0f; } else { textureWidth = inAtlas.myMaterial.mainTexture.width; textureHeight = inAtlas.myMaterial.mainTexture.height; } ux /= textureWidth; uxm /= textureWidth; vx /= textureHeight; vxm /= textureHeight; float tempVx = vx; vx = 1.0f - vxm; vxm = 1.0f - tempVx; //uv[0] = new Vector2(0.0f, 0.0f); //uv[1] = new Vector2(1.0f, 0.0f); //uv[2] = new Vector2(0.0f, 1.0f); //uv[3] = new Vector2(1.0f, 1.0f); uv[0] = new Vector2(ux, vx); uv[1] = new Vector2(uxm, vx); uv[2] = new Vector2(ux, vxm); uv[3] = new Vector2(uxm, vxm); //uv[0] = new Vector2(vx, ux); //uv[1] = new Vector2(vxm, ux); //uv[2] = new Vector2(vx, uxm); //uv[3] = new Vector2(vxm, uxm); mesh.uv = uv; for (int i = 0; i < 4; i++) { // mesh.uv[i].x = uv[i].x; //mesh.uv[i].y = uv[i].y; } mesh.RecalculateBounds(); mf.sharedMesh = mesh; //Now create a //MeshRenderer meshRenderer = new MeshRenderer();// GetComponent<MeshRenderer>(); // texture2D = inAtlas.GetMaterial().GetTexture2D();//Resources.Load(inTextureName, typeof(Texture2D)) as Texture2D; // if (texture2D != null) // { // meshRenderer.material.mainTexture = texture2D; // } }
public int AddFunnyWordP1P2P3P4P5(ZFont inFont, ZAtlas inLinesAtlas, ZAtlas inColoursAtlas, CGPoint position, float scale, string inWord) { return(this.AddFunnyWordP1P2P3P4P5P6(inFont, inLinesAtlas, inColoursAtlas, position, scale, inWord, false)); }
public int AddFunnyWordP1P2P3P4P5P6(ZFont inFont, ZAtlas inLinesAtlas, ZAtlas inColoursAtlas, CGPoint position, float scale, string inWord, bool isCentrePosition) { return(this.AddFunnyWordP1P2P3P4P5P6P7(inFont, inLinesAtlas, inColoursAtlas, position, scale, inWord, isCentrePosition, Constants.kColourLightGreen)); }
public void InitialiseNew(QueryInfoNew info) { waitToHide = 0.0f; if (unityText == null) { unityText = new FunnyWord(); } if (info.numButtons > 0) { myColour = Constants.kColourRed; } if (Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { info.inTextScale *= 2.0f; } if (Globals.g_world.DoesCurrentLanguageUseNSString() || info.useNSStringForAnyLanguage) { useNSString = true; } else { useNSString = false; } FunnyWord.WordInfo wInfo; wInfo.position = info.position; wInfo.isCentrePos = true; wInfo.scale = info.inTextScale * 0.32f; // * 0.25f; if (useNSString) { unityText.InitWithWordNewP1(wInfo, info.queryText); } else { position = info.position; this.DivideStringIntoFunnyWords(info.queryText); wInfo.scale = info.inTextScale * 0.012f; // * 0.1f;// * 0.25f; //unityText.SetFont(Globals.g_world.font); //unityText.SetColourAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontColours)); //unityText.InitWithWordP1(wInfo,info.queryText); } unityText.SetColour(myColour); if (useNSString) { unityText.myTextWrapper.SetBoundThing(); unityText.SetUseTextureInstead(true); unityText.myTextWrapper.SetFontSize(info.inTextScale * 0.32f); } newStyleWithAtlas = info.newStyleWithAtlas; newStyleQuery = true; useActualText = false; FrontEndQuery.QueryInfo qInfo = new FrontEndQuery.QueryInfo(); qInfo.noButton = info.noButton; qInfo.yesButton = info.yesButton; position = info.position; state = QueryState.e_Inactive; chosenButton = (QueryButton)(-1); queryText = (info.queryText); boxDimensions = Utilities.CGPointMake(info.boxDimensions.Width, info.boxDimensions.Height); scale.x = info.scale; scale.y = info.scale; atlas = info.inAtlas; if (newStyleWithAtlas) { this.SetupButtonsNew(info); } Zobject.ZobjectInfo zInfo = new Zobject.ZobjectInfo(); if (newStyleWithAtlas) { zInfo.texture = null; } else { zInfo.texture = info.backdropTexture; } zInfo.startState = ZobjectState.kZobjectHidden; zInfo.position = position; zInfo.isMapObject = false; backdrop.Initialise(zInfo); backdrop.SetShowScale(scale.x * 1.2f); if (newStyleWithAtlas) { backdrop.SetAtlasAndSubtextureP1(atlas, info.backdropId); } else { // backdrop.SetShowScale(1.2f); } if (backdrop.myAtlasBillboard != null) { backdrop.myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff"); } numButtons = info.numButtons; zInfo.position = Utilities.CGPointMake(160.0f, 240.0f); zInfo.texture = info.dimOverlayTexture; dimZob.Initialise(zInfo); dimZob.SetStretchToScreen(true); dimZob.SetShowStyle((int)ZobjectShowStyle.kZobjectShow_FadeIn); dimZob.SetHideStyle((int)ZobjectHideStyle.kZobjectHide_FadeOut); dimZob.SetShowAlpha(0.7f); if (newStyleWithAtlas) { dimZob.SetAtlasAndSubtextureP1(atlas, info.dimId); } if (dimZob.myAtlasBillboard != null) { dimZob.myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff"); } if (textTexture != null) { } CGSize dimensionsForText = info.boxDimensions; float textScale = info.inTextScale; if (Globals.deviceIPad) { dimensionsForText.Height *= 2.0f; dimensionsForText.Width *= 2.0f; textScale *= 2.0f; } textTexture = null; //new Texture2D_Ross(info.queryText, dimensionsForText, UITextAlignment.UITextAlignmentCenter, "Arial", textScale); zInfo.texture = textTexture; zInfo.position = position; if (Globals.g_currentLanguage == World.Enum11.kLanguage_Japanese) { if ((!Globals.deviceIPhone4) && (!Globals.deviceIPad)) { zInfo.position.y += 3.0f; } else { zInfo.position.y += 15.0f; } } text.Initialise(zInfo); text.SetShowScale(scale.x); if (text.myAtlasBillboard != null) { text.myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff"); } if (!newStyleWithAtlas) { boxDimensions.x = 200.0f; boxDimensions.y = 180.0f; if (info.numButtons == 0) { this.SetupButtons(qInfo); } } if (info.numButtons > 0) { queryButtonStyle = QueryButtonStyle.kQButtonsCentral; this.SetupCentralButtons(info); //This means we want the new style central hanging buttons } else { queryButtonStyle = QueryButtonStyle.kQButtonsEdges; } backdrop.SetShowStyle(ZobjectShowStyle.kZobjectShow_SlideInLeft); backdrop.SetHideStyle(ZobjectHideStyle.kZobjectHide_SlideToRight); backdrop.SetHideAcc(0.02f); unityText.SetPositionZob(backdrop); }
} ///@property(readwrite,assign) bool dontDisplayLeadingZeros; public void SetMyAtlas(ZAtlas inThing) { myAtlas = inThing; } ////@property(readwrite,assign) ZAtlas* myAtlas;
public void Render(FrontEndButton inButton, ZAtlas inAtlas) { if ((myButton.zobject).state == ZobjectState.kZobjectWaitingToShow) { return; } CGPoint renderPosition = (inButton.zobject).screenPosition; renderPosition.x += currentOffset.x; renderPosition.y += currentOffset.y; renderPosition.y += yOffset; renderPosition.y -= 35.0f; if (Globals.deviceIPad) { renderPosition.x += 32.0f; } if (myBillboard[0] == null) { myBillboard[0] = new Billboard("hangingButton1"); myBillboard[0].SetAtlas(inAtlas); myBillboard[0].SetDetailsFromAtlas(inAtlas, subTextureId); myBillboard[0].myObject.layer = LayerMask.NameToLayer("guistuff"); } (DrawManager.Instance()).AddTextureToListP1(myBillboard[0], renderPosition, subTextureId, 1.0f); if (longerRope > 0.0f) { if (myBillboard[1] == null) { myBillboard[1] = new Billboard("hangingButton2"); myBillboard[1].SetAtlas(inAtlas); myBillboard[1].SetDetailsFromAtlas(inAtlas, subTextureId); myBillboard[1].myObject.layer = LayerMask.NameToLayer("guistuff"); } renderPosition.y -= 65.0f; (DrawManager.Instance()).AddTextureToListP1(myBillboard[1], renderPosition, subTextureId, 1.0f); if (longerRope > 2.0f) { if (myBillboard[2] == null) { myBillboard[2] = new Billboard("hangingButton3"); myBillboard[2].SetAtlas(inAtlas); myBillboard[2].SetDetailsFromAtlas(inAtlas, subTextureId); myBillboard[2].myObject.layer = LayerMask.NameToLayer("guistuff"); } renderPosition.y -= 65.0f; (DrawManager.Instance()).AddTextureToListP1(myBillboard[2], renderPosition, subTextureId, 1.0f); renderPosition.y += 65.0f; } renderPosition.y += 65.0f; } renderPosition = (inButton.zobject).screenPosition; renderPosition.x += currentOffset2.x; renderPosition.y += currentOffset2.y; renderPosition.y += yOffset; renderPosition.y -= 35.0f; if (Globals.deviceIPad) { renderPosition.x += 32.0f; } if (myBillboard[4] == null) { myBillboard[4] = new Billboard("hangingButton4"); myBillboard[4].SetAtlas(inAtlas); myBillboard[4].SetDetailsFromAtlas(inAtlas, subTextureId); myBillboard[4].myObject.layer = LayerMask.NameToLayer("guistuff"); } (DrawManager.Instance()).AddTextureToListP1(myBillboard[4], renderPosition, subTextureId, hangingButtonScale); if (longerRope > 0.0f) { renderPosition.y -= 65.0f; // (DrawManager.Instance()).AddTextureToListP1(myBillboard[1],renderPosition, subTextureId); if (longerRope > 2.0f) { renderPosition.y -= 65.0f; // (DrawManager.Instance()).AddTextureToListP1(myBillboard[2],renderPosition, subTextureId); renderPosition.y += 65.0f; } renderPosition.y += 65.0f; } }