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 void RenderTileAtPosition(Default.Namespace.CGPoint inPosition, int inSubtextureId) { if (currentSubtextureId != inSubtextureId) { currentSubtextureId = inSubtextureId; if (myAtlas != null) { this.SetUVs(currentSubtextureId); height = myAtlas.GetSubTextureWidth(inSubtextureId) * 2.0f; width = myAtlas.GetSubTextureHeight(inSubtextureId) * 2.0f; } // debugCounter++; // if (debugCounter >= 40) // { // debugCounter = 0; // Debug.Log("tile width " + width); // Debug.Log("tile scale " + myObject.transform.localScale); // MeshFilter mf = myObject.GetComponent<MeshFilter>(); // // // Debug.Log("mf.mesh.bounds " + mf.mesh.bounds.ToString()); // // // } } this.CheckRender(); inPosition.x -= 160.0f; inPosition.y = 240.0f - inPosition.y; Vector3 newPos; newPos.x = inPosition.x; newPos.y = inPosition.y; newPos.z = Default.Namespace.Globals.renderCounter; if (Default.Namespace.Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { newPos.x *= 2.0f; newPos.y *= 2.0f; } myObject.transform.localPosition = newPos; //should just be done at start of race... //because tiles can be scaled down for race tip... //myObject.transform.localScale = new Vector3(1,1,1); // MeshFilter mf = myObject.GetComponent<MeshFilter>(); // // mf.mesh.RecalculateBounds(); Default.Namespace.Globals.renderCounter -= 0.1f; }
public void RenderAtPosition(Default.Namespace.CGPoint inPosition) { if (shown) this.CheckRender(); inPosition.x -= 160.0f; inPosition.y = 240.0f - inPosition.y; Vector3 newPos; newPos.x = inPosition.x; newPos.y = inPosition.y; newPos.z = Default.Namespace.Globals.renderCounter; if (Default.Namespace.Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { newPos.x *= 2.0f; newPos.y *= 2.0f; } myObject.transform.position = newPos; Default.Namespace.Globals.renderCounter -= 0.1f; }
public void SetXPosition(float xPos) { CGPoint nowPos = zobject.screenPosition; zobject.SetScreenPosition(Utilities.CGPointMake(xPos, nowPos.y)); }
public void SetYPosition(float yPos) { CGPoint nowPos = zobject.screenPosition; zobject.SetScreenPosition(Utilities.CGPointMake(nowPos.x, yPos)); }
public void InitialiseP1(int xPos, int yPos) { pos = Utilities.CGPointMake(xPos, yPos); }
public void SetupCentralButtons(QueryInfoNew qInfo) { const float kButtonInX = 30; const float kButtonUpY = 20; CGPoint querySize = Utilities.CGPointMake(124.0f, 85.0f); float buttonPosY = position.y + ((querySize.y + kButtonUpY) * (scale.y)); FrontEnd.ButtonInfo info = new FrontEnd.ButtonInfo(); info.textureLabel = null; info.goToScreen = FrontEndScreenEnum.kFrontEndScreen_Invalid; HangingButton.HangingButtonInfo hInfo = new HangingButton.HangingButtonInfo(); hInfo.showWobbleMultiplier = 1.2f; hInfo.type = HangingButtonType.kHB_Rope; hInfo.subTextureId = 0; //(int)World.Enum6.kSSH_Rope; hInfo.offset = Utilities.CGPointMake(98.0f * qInfo.scale, -15.0f * qInfo.scale); buttonPosY += (65.0f * ((float)(qInfo.numButtons - 1)) * qInfo.scale); FunnyWord.WordInfo wInfo = new FunnyWord.WordInfo(); wInfo.isCentrePos = true; wInfo.scale = qInfo.inTextScale * 0.32f; // * 0.25f; for (int i = 0; i < (int)Enum.kMaxCentralButtonsInQuery; i++) { if (buttonText[i] != null) { buttonText[i].Disappear(); } if (button[i] != null) { button[i].Disappear(); } } for (int buttonIndex = 0; buttonIndex < qInfo.numButtons; buttonIndex++) { if (buttonText[buttonIndex] == null) { buttonText[buttonIndex] = new FunnyWord(); } info.position = Utilities.CGPointMake(position.x, buttonPosY); info.texture = null; (button[buttonIndex]).Initialise(info); ((button[buttonIndex]).zobject).SetShowScale(scale.x); ((button[buttonIndex]).zobject).SetAtlasAndSubtextureP1(atlas, 2); //qInfo.buttonBackdropId); ((button[buttonIndex]).zobject).myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff"); (button[buttonIndex]).SetWidth(220.0f); (button[buttonIndex]).SetHeight(60.0f); (button[buttonIndex]).SetClickStyle(ButtonClickStyle.kButtonClick_Throb); (button[buttonIndex]).AddHangingButton(hInfo); (button[buttonIndex]).hangingButton.SetWobbleDeclineMultiplier(0.5f); ((button[buttonIndex]).zobject).SetShowStyle(ZobjectShowStyle.kZobjectShow_SlideInLeft); ((button[buttonIndex]).zobject).SetHideStyle(ZobjectHideStyle.kZobjectHide_SlideToRight); ((button[buttonIndex]).zobject).SetHideAcc(0.02f); wInfo.position = info.position; wInfo.position.y += 10.0f; if (useNSString) { buttonText[buttonIndex].InitWithWordNewP1(wInfo, qInfo.buttonString[buttonIndex]); } else { wInfo.scale = qInfo.inTextScale * 0.018f; // * 0.1f;// * 0.25f; buttonText[buttonIndex].SetFont(Globals.g_world.font); buttonText[buttonIndex].SetColourAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontColours)); buttonText[buttonIndex].InitWithWordP1(wInfo, qInfo.buttonString[buttonIndex]); } buttonText[buttonIndex].SetPositionZob(((button[buttonIndex]).zobject)); buttonText[buttonIndex].SetColour(myColour); if (useNSString) { buttonText[buttonIndex].myTextWrapper.SetBoundThing(); buttonText[buttonIndex].SetUseTextureInstead(true); buttonText[buttonIndex].myTextWrapper.SetFontSize(qInfo.inTextScale * 0.32f); } buttonText[buttonIndex].SetOrientationButton((button[buttonIndex]).hangingButton); buttonPosY -= (65.0f * qInfo.scale); } }
public void RenderAtPosition(Default.Namespace.CGPoint inPosition, float inScale, float inRot, float inAlpha, int inSubtextureId) { // if (true)//currentSubtextureId != inSubtextureId) if (currentSubtextureId != inSubtextureId) { currentSubtextureId = inSubtextureId; if (myAtlas != null) { this.SetUVs(currentSubtextureId); height = myAtlas.GetSubTextureWidth(inSubtextureId) * 2.0f; width = myAtlas.GetSubTextureHeight(inSubtextureId) * 2.0f; MeshFilter mf1 = myObject.GetComponent <MeshFilter>(); Mesh mesh1; // = mf.mesh; if (mf1.sharedMesh == null) { mesh1 = new Mesh(); } else { mesh1 = mf1.sharedMesh; } Vector3[] vertices = new Vector3[4]; float halfWidth = width * 0.5f * 1.0f; //(width * 0.5f); float halfHeight = height * 0.5f * 1.0f; //(height * 0.5f); vertices[0] = new Vector3(-halfHeight, -halfWidth, 0.0f); vertices[1] = new Vector3(halfHeight, -halfWidth, 0.0f); vertices[2] = new Vector3(-halfHeight, halfWidth, 0.0f); vertices[3] = new Vector3(halfHeight, halfWidth, 0.0f); mesh1.vertices = vertices; mesh1.RecalculateBounds(); mf1.sharedMesh = mesh1; } } //--------------------------------------------------------------------------------- //trying something... MeshFilter mf = myObject.GetComponent <MeshFilter>(); Mesh mesh; // = mf.mesh; if (mf.sharedMesh == null) { mesh = new Mesh(); Vector3[] vertices = new Vector3[4]; float halfWidth = width * 0.5f * 1.0f; //(width * 0.5f); float halfHeight = height * 0.5f * 1.0f; //(height * 0.5f); vertices[0] = new Vector3(-halfHeight, -halfWidth, 0.0f); vertices[1] = new Vector3(halfHeight, -halfWidth, 0.0f); vertices[2] = new Vector3(-halfHeight, halfWidth, 0.0f); vertices[3] = new Vector3(halfHeight, halfWidth, 0.0f); mesh.vertices = vertices; mesh.RecalculateBounds(); mf.sharedMesh = mesh; } myObject.transform.localScale = new Vector3(inScale, inScale, inScale); //--------------------------------------------------------------------------------- /* * //Debug.Log ("RenderAtPosition"); * * MeshFilter mf = myObject.GetComponent<MeshFilter>(); * * Mesh mesh;// = mf.mesh; * * if (mf.sharedMesh == null) * { * mesh = new Mesh(); * } * else * { * mesh = mf.sharedMesh; * } * * Vector3[] vertices = new Vector3[4]; * * float halfWidth = width * 0.5f * inScale;//(width * 0.5f); * float halfHeight = height * 0.5f * inScale;//(height * 0.5f); * * vertices[0] = new Vector3(-halfHeight, -halfWidth, 0.0f); * vertices[1] = new Vector3(halfHeight, -halfWidth, 0.0f); * vertices[2] = new Vector3(-halfHeight, halfWidth, 0.0f); * vertices[3] = new Vector3(halfHeight, halfWidth, 0.0f); * * mesh.vertices = vertices; * * mesh.RecalculateBounds(); * * mf.sharedMesh = mesh; * // mf.mesh = mesh; * */ for (int i = 0; i < 4; i++) { // mf.mesh.vertices[i].x = vertices[i].y; //mf.mesh.vertices[i].y = vertices[i].x; //mf.mesh.vertices[i].z = vertices[i].z; } this.CheckRender(); if (inAlpha != prevAlpha) { this.SetAlpha(inAlpha); } myObject.transform.localEulerAngles = new Vector3(0.0f, 0.0f, inRot * Mathf.Rad2Deg); inPosition.x -= 160.0f; inPosition.y = 240.0f - inPosition.y; if (myObject.transform.parent != null) { Vector3 newPos; newPos.x = localPosition.x; newPos.y = localPosition.y; newPos.z = -0.1f; if (Default.Namespace.Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { newPos.x *= 2.0f; newPos.y *= 2.0f; } myObject.transform.localPosition = newPos; } else { Vector3 newPos; newPos.x = inPosition.x; newPos.y = inPosition.y; newPos.z = Default.Namespace.Globals.renderCounter; if (Default.Namespace.Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { newPos.x *= 2.0f; newPos.y *= 2.0f; } myObject.transform.position = newPos; } Default.Namespace.Globals.renderCounter -= 0.1f; }
public void DrawAtPointScaleAndRotateP1P2(CGPoint point, float inScale, float rotation) { }
public void DrawAtPointAndScaleP1(CGPoint point, float inScale) { }
public void DrawAtPoint(CGPoint point) { // myBillboard.RenderAtPosition(point,1.0f,0.0f,1.0f,-1); }
public void DrawAtPointScaledWithColourAlphaP1P2P3(Billboard useB, CGPoint inPos, float scaleX, float scaleY, float rotation, Constants.RossColour inCol, float inAlpha) { useB.RenderAtPosition(inPos, scaleX, rotation, inAlpha, -1); }
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); }
public void Initialise(QueryInfo info) { waitToHide = 0.0f; newStyleQuery = false; for (int i = 0; i < (int)Enum.kMaxFunnyWordsInQuery; i++) { if (funnyWord[i] == null) { funnyWord[i] = new FunnyWord(); } (funnyWord[i]).Disappear(); } state = QueryState.e_Inactive; chosenButton = (QueryButton)(-1); useActualText = info.useActualText; theInfo1 = info.theInfo1; theInfo2 = info.theInfo2; theInfo3 = info.theInfo3; theInfo4 = info.theInfo4; theInfo5 = info.theInfo5; theInfo6 = info.theInfo6; theInfo7 = info.theInfo7; position = info.position; boxDimensions = info.boxDimensions; if (info.backdropTexture == null) { scale.x = boxDimensions.x / 128; scale.y = boxDimensions.y / 128; } else { scale.x = 1.0f; scale.y = 1.0f; } this.SetupButtons(info); Zobject.ZobjectInfo zInfo = new Zobject.ZobjectInfo(); zInfo.texture = info.backdropTexture; zInfo.startState = ZobjectState.kZobjectHidden; zInfo.position = position; zInfo.isMapObject = false; backdrop.Initialise(zInfo); backdrop.SetShowScale(scale.x); if (zInfo.texture != null) { backdrop.myAtlasBillboard.myObject.layer = LayerMask.NameToLayer("guistuff"); } zInfo.texture = info.dimTexture; zInfo.position = Utilities.CGPointMake(160.0f, 240.0f); dimZob.Initialise(zInfo); dimZob.SetStretchToScreen(true); dimZob.SetShowStyle((int)ZobjectShowStyle.kZobjectShow_FadeIn); dimZob.SetHideStyle((int)ZobjectHideStyle.kZobjectHide_FadeOut); dimZob.SetShowAlpha(0.9f); zInfo.texture = info.textTexture; zInfo.position = Utilities.CGPointMake(position.x, position.y - 40); text.Initialise(zInfo); text.SetShowScale(scale.x); }
public void HandleTap(Default.Namespace.CGPoint position) { }
public void DrawAtPointNoVertShorts(CGPoint point) { }
public void DrawAtPointxyScaled(CGPoint xyscale) { }
public void RenderAtPosition(Default.Namespace.CGPoint inPosition) { this.RenderAtPosition(inPosition, 1.0f, 0.0f, 1.0f, 0); }
} ///@property(readwrite,assign) int ghostCurrentFrame; public void SetPosition(CGPoint inThing) { position = inThing; } ///@property(readwrite,assign) CGPoint position;
public void RenderAtPositionOld(Default.Namespace.CGPoint inPosition, float inScale, float inRot, float inAlpha, int inSubtextureId) { //return; if (currentSubtextureId != inSubtextureId) { currentSubtextureId = inSubtextureId; if (myAtlas != null) { this.SetUVs(currentSubtextureId); height = myAtlas.GetSubTextureWidth(inSubtextureId) * 2.0f; width = myAtlas.GetSubTextureHeight(inSubtextureId) * 2.0f; } } this.CheckRender(); if (inAlpha != prevAlpha) { this.SetAlpha(inAlpha); } MeshFilter mf = myObject.GetComponent <MeshFilter>(); Vector3[] vertices = new Vector3[4]; myObject.transform.localEulerAngles = new Vector3(0.0f, 0.0f, inRot * Mathf.Rad2Deg); // bool makeVectors = false; if (oldScale == inScale) { // makeVectors = true; } if (true) //inRot == 0.0f) { // oldScale = inScale; float halfWidth = width * 0.5f * inScale; //(width * 0.5f); float halfHeight = height * 0.5f * inScale; //(height * 0.5f); vertices[0] = new Vector3(-halfHeight, -halfWidth, 0.0f); vertices[1] = new Vector3(halfHeight, -halfWidth, 0.0f); vertices[2] = new Vector3(-halfHeight, halfWidth, 0.0f); vertices[3] = new Vector3(halfHeight, halfWidth, 0.0f); } /// 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 = a; * float topRightY = b; * float topLeftX = c; * float topLeftY = d; * float bottomLeftX = -a; * float bottomLeftY = -b; * float bottomRightX = -c; * float bottomRightY = -d; * * vertices[2] = new Vector3(topLeftX, topLeftY, 0.0f); * vertices[3] = new Vector3(topRightX, topRightY, 0.0f); * vertices[0] = new Vector3(bottomLeftX, bottomLeftY, 0.0f); * vertices[1] = new Vector3(bottomRightX, bottomRightY, 0.0f); */ // } inPosition.x -= 160.0f; inPosition.y = 240.0f - inPosition.y; if (myObject.transform.parent != null) { Vector3 newPos; newPos.x = localPosition.x; newPos.y = localPosition.y; newPos.z = -0.1f; if (Default.Namespace.Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { newPos.x *= 2.0f; newPos.y *= 2.0f; } myObject.transform.localPosition = newPos; } else { Vector3 newPos; newPos.x = inPosition.x; newPos.y = inPosition.y; newPos.z = Default.Namespace.Globals.renderCounter; if (Default.Namespace.Globals.g_main.usingTextureResolution == TextureResolutionEnum.kTextureResolution_High) { newPos.x *= 2.0f; newPos.y *= 2.0f; } myObject.transform.position = newPos; } //if (makeVectors) mf.mesh.vertices = vertices; for (int i = 0; i < 4; i++) { // mf.mesh.vertices[i].x = vertices[i].x; //mf.mesh.vertices[i].y = vertices[i].y; // mf.mesh.vertices[i].z = vertices[i].z; } Default.Namespace.Globals.renderCounter -= 0.1f; }
public float GetGroundLevel(CGPoint inMapPos) { return(0.0f); }