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; }
} ///@property(readwrite,assign) bool usingStrings; //public void SetActionDone(bool inThing) {actionDone = inThing;}///@property(readwrite,assign) bool actionDone; public FrontEndQuery() { //if (!base.init()) return null; unityText = null; textTexture = null; for (int i = 0; i < (int)QueryButton.kNumButtonsOnQuery; i++) { button[i] = new FrontEndButton(i); } for (int i = 0; i < (int)Enum.kMaxFunnyWordsInQuery; i++) { funnyWord[i] = null; } for (int i = 0; i < (int)Enum.kMaxCentralButtonsInQuery; i++) { buttonText[i] = null; } dimZob = new Zobject(); backdrop = new Zobject(); text = new Zobject(); chosenButton = (QueryButton)(-1); noDimZob = false; wordScale = 0.42f; wordGap = 32.0f; wordOffset = 0.0f; myColour = Constants.kColourLightGreen; usingStrings = false; //return this; }
/* public void SetColour(Colours inColour, Default.Namespace.Constants.RossColour rossCol) { if (myMaterialWithColour[(int)inColour] == null) { myMaterialWithColour[(int)inColour] = new UnityEngine.Material(Shader.Find( "Pi/OpaqueOverlay" )); UnityEngine.Color tempC = new UnityEngine.Color(); tempC.a=0.8f; tempC.r=rossCol.cRed; tempC.g=rossCol.cGreen; tempC.b=rossCol.cBlue; myMaterialWithColour[(int)inColour].mainTexture = Default.Namespace.Globals.g_world.guiFont.material.mainTexture; myMaterialWithColour[(int)inColour].color = tempC; } TextMesh textMesh = myObject.GetComponent<TextMesh>(); textMesh.renderer.sharedMaterial = myMaterialWithColour[(int)inColour]; // return myMaterialWithColour[(int)inColour]; }*/ public void SetColour(Default.Namespace.Constants.RossColour inCol) { //return;// TextMesh textMesh = myObject.GetComponent<TextMesh>(); textMesh.GetComponent<Renderer>().material = Default.Namespace.Globals.g_world.GetFontColourMaterial(inCol); return;// myColour.cRed = inCol.cRed; myColour.cGreen = inCol.cGreen; myColour.cBlue = inCol.cBlue; //zatlas /* UnityEngine.Color tempC = new UnityEngine.Color(); tempC.a=0.8f; tempC.r=myColour.cRed; tempC.g=myColour.cGreen; tempC.b=myColour.cBlue; /* if (materialForColourAndAlpha == null) { materialForColourAndAlpha = new Material(Shader.Find( "Pi/TransparentOverlay" )); } materialForColourAndAlpha.mainTexture = TextMesh materialForColourAndAlpha.color = tempC; myObject.renderer.material = materialForColourAndAlpha;*/ // myObject.renderer.material.color = tempC; }
public void SetColour(Constants.RossColour inCol) { defaultColour = inCol; for (int i = 0; i < (int)Enum.kMaxNumScoreDigits; i++) { (zobject[i]).SetColour(inCol); } }
public void RenderBackSceneWithColour(Constants.RossColour inCol) { CGRect bounds = Utilities.CGRectMake(0, 0, 320, 480); //glDisable (GL_BLEND); backScreen.DrawInRectColourP1(bounds, inCol); //glEnable (GL_BLEND); }
public static Constants.RossColour GetColourBetweenP1P2(float ratio, Constants.RossColour col1, Constants.RossColour col2) { Constants.RossColour difference = new Constants.RossColour(col2.cRed - col1.cRed, col2.cGreen - col1.cGreen, col2.cBlue - col1.cBlue); difference.cRed *= ratio; difference.cGreen *= ratio; difference.cBlue *= ratio; Constants.RossColour outCol = new Constants.RossColour(col1.cRed + difference.cRed, col1.cGreen + difference.cGreen, col1.cBlue + difference.cBlue); return(outCol); }
public void SetColour(Default.Namespace.Constants.RossColour inCol) { myColour.r = inCol.cRed; myColour.g = inCol.cGreen; myColour.b = inCol.cBlue; UnityEngine.Color tempC = new UnityEngine.Color(); tempC.a = 0.9f; tempC.r = myColour.r; tempC.g = myColour.g; tempC.b = myColour.b; MeshFilter mf = myObject.GetComponent <MeshFilter>(); Mesh mesh; // = mf.mesh; if (mf.sharedMesh == null) { mesh = new Mesh(); } else { mesh = mf.sharedMesh; } Color[] colorThing = new Color[(int)mesh.vertices.Length]; // Color alphaColor = new Color(0.5f,0.5f,0.5f,1.0f); // Color alphaColor = new Color(1.0f,1.0f,1.0f,inAlpha); for (int i = 0; i < mesh.vertices.Length; i++) { colorThing[i] = tempC; //Color.Lerp(tempC,alphaColor,0.5f);//mesh.vertices[i].y); } mesh.colors = colorThing; mf.sharedMesh = mesh; return; this.SetupMyMaterialIfNull("Pi/TransparentOverlay"); materialForColourAndAlpha.color = tempC; myObject.GetComponent <Renderer>().material = materialForColourAndAlpha; if (!usingAlpha) { // MeshRenderer meshRenderer = myObject.GetComponent<MeshRenderer>(); usingAlpha = true; //myObject.renderer.material.shader = Shader.Find( "Pi/TransparentOverlay" ); } }
public void SetColour(Constants.RossColour inColour) { if (newStyleQuery) { myColour = inColour; } if (unityText != null) { unityText.SetColour(myColour); } }
public UnityEngine.Material ReturnColour(AtlasColours inColour, Constants.RossColour rossCol) { if (myMaterialWithColour[(int)inColour] == null) { myMaterialWithColour[(int)inColour] = new UnityEngine.Material(Shader.Find("Pi/OpaqueOverlay")); UnityEngine.Color tempC = new UnityEngine.Color(); tempC.a = 0.8f; tempC.r = rossCol.cRed; tempC.g = rossCol.cGreen; tempC.b = rossCol.cBlue; myMaterialWithColour[(int)inColour].color = tempC; } return(myMaterialWithColour[(int)inColour]); }
public UnityEngine.Material GetColourAtlasMaterial(Constants.RossColour inColour) { return(null); /* * * see TextureMesh * * switch(inColour) * { * case Constants.kColourWhite: * return this.ReturnColour(AtlasColours.kWhite,inColour); * break; * case Constants.kColourLightGreen: * return this.ReturnColour(AtlasColours.kLightGreen,inColour); * break; * case Constants.kColourRed: * return this.ReturnColour(AtlasColours.kRed,inColour); * break; * case Constants.kColourLilac: * return this.ReturnColour(AtlasColours.kLilac,inColour); * break; * case Constants.kColourLightBlue: * return this.ReturnColour(AtlasColours.kLightBlue,inColour); * break; * case Constants.kColourGreenMenuBack: * return this.ReturnColour(AtlasColours.kGreenMenuBack,inColour); * break; * case Constants.kColourGreenMenuBackRays: * return this.ReturnColour(AtlasColours.kGreenMenuBackRays,inColour); * break; * case Constants.kColourYellow: * return this.ReturnColour(AtlasColours.kYellow,inColour); * break; * case Constants.kColourPink: * return this.ReturnColour(AtlasColours.kPink,inColour); * break; * case Constants.kColourPurpleMenuBack: * return this.ReturnColour(AtlasColours.kPurpleMenuBack,inColour); * break; * case Constants.kColourDarkBlue: * return this.ReturnColour(AtlasColours.kDarkBlue,inColour); * break; * * }*/ }
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); }
} ////@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 AddTextureToListWithColourP1P2P3P4(Billboard inBillboard, CGPoint inPos, float scale, float alpha, Constants.RossColour inCol, int inSubTextureId) { inBillboard.SetColour(inCol); inBillboard.RenderAtPosition(inPos, scale, 0.0f, alpha, inSubTextureId); }
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) RossColour menuBackColour; public void SetMenuRaysColour(Constants.RossColour inThing) { menuRaysColour = inThing; } ///@property(readwrite,assign) RossColour menuRaysColour;
public void SetLevelColour(Constants.RossColour inThing) { levelColour = inThing; } ///@property(readwrite,assign) RossColour levelColour;
} ///@property(readwrite,assign) int lockedIconSet; public void SetFontColour(Constants.RossColour inThing) { fontColour = inThing; } ///@property(readwrite,assign) RossColour fontColour;
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 DrawAtPointColour(Constants.RossColour inCol) { }
public void DrawInRectColourP1(CGRect rect, Constants.RossColour inCol) { }
public void ShowNextText() { aardmanAlpha = 0.0f; string[,] newText = new string[3, (int)Enum.kCTNumTexts]; int creditIndex = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < (int)Enum.kCTNumTexts; j++) { newText[i, j] = "\n"; } } newText[0, creditIndex] = "made by\n"; newText[1, creditIndex] = "green ant\n"; newText[2, creditIndex] = "games\n"; creditIndex++; newText[0, creditIndex] = "art design\n"; newText[1, creditIndex++] = "and animation by\n"; newText[0, creditIndex] = "game designed by\n"; newText[1, creditIndex++] = "Ross Styants\n"; newText[0, creditIndex] = "special thanks to\n"; newText[1, creditIndex++] = "ben greenfield\n"; newText[0, creditIndex] = "huge thanks to\n"; newText[1, creditIndex] = "all the\n"; newText[2, creditIndex++] = "testers!\n"; newText[0, creditIndex] = "Derek Styants\n"; newText[1, creditIndex] = "Mai Styants\n"; newText[2, creditIndex++] = "Richard Styants\n"; newText[0, creditIndex] = "Hannah Williams\n"; newText[1, creditIndex] = "Ethan Williams\n"; newText[2, creditIndex++] = "David Williams\n"; newText[0, creditIndex] = "Michael Jones\n"; newText[1, creditIndex] = "Rhys Jones\n"; newText[2, creditIndex++] = "Tanya Gambling\n"; newText[0, creditIndex] = "Irene Styants\n"; newText[1, creditIndex] = "Simeon Smith\n"; newText[2, creditIndex++] = "Mark Styants\n"; newText[0, creditIndex] = "Thom Wilson\n"; newText[1, creditIndex] = "Patrick Hughes\n"; newText[2, creditIndex++] = "Adrian Hidalgo\n"; newText[0, creditIndex] = "\n"; newText[1, creditIndex++] = "\n"; newText[0, creditIndex] = "\n"; newText[1, creditIndex++] = "thanks for playing\n"; newText[0, creditIndex] = "\n"; newText[1, creditIndex++] = "\n"; FunnyWord.WordInfo wInfo; wInfo.position = Utilities.CGPointMake(160.0f, 312.0f); wInfo.isCentrePos = true; wInfo.scale = 0.45f; Constants.RossColour textColour = Constants.kColourLilac; if (currentText == 1) { wInfo.scale = 0.55f; } if ((currentText >= 5) && (currentText <= 9)) { wInfo.scale = 0.55f; textColour = Constants.kColourLightblue; } (funnyWord[0]).SetFont(Globals.g_world.font); (funnyWord[0]).SetLineAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontLines)); (funnyWord[0]).SetColourAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontColours)); (funnyWord[0]).InitWithWordP1(wInfo, newText[0, currentText]); (funnyWord[0]).SetColour(textColour); (funnyWord[0]).SetShowStyle(FunnyWordShowStyle.kFunnyWordShow_ZoomAndWobble); (funnyWord[0]).SetHideStyle((int)ZobjectHideStyle.kZobjectHide_Zoom); (funnyWord[0]).Show(); wInfo.scale = 0.8f; float waitForNextWord = 0.78f; textColour = Constants.kColourLightblue; wInfo.position = Utilities.CGPointMake(160.0f, 365.0f); if (currentText == 1) { wInfo.scale = 0.55f; waitForNextWord = 0.2f; wInfo.position.y = 340.0f; aardmanCredit.Show(); } if (currentText == 2) { aardmanCredit.Hide(); } if (currentText == 3) { } if ((currentText >= 5) && (currentText <= 9)) { wInfo.scale = 0.55f; waitForNextWord = 0.6f; wInfo.position.y = 340.0f; (funnyWord[0]).Jiggle(0.5f); } if (currentText == 11) { wInfo.scale = 0.6f; } (funnyWord[1]).SetFont(Globals.g_world.font); (funnyWord[1]).SetLineAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontLines)); (funnyWord[1]).SetColourAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontColours)); (funnyWord[1]).InitWithWordP1(wInfo, newText[1, currentText]); (funnyWord[1]).SetColour(textColour); (funnyWord[1]).SetShowStyle(FunnyWordShowStyle.kFunnyWordShow_ZoomAndWobble); (funnyWord[1]).Show(waitForNextWord); (funnyWord[1]).Jiggle(0.5f); (funnyWord[1]).SetHideStyle((int)(int)ZobjectHideStyle.kZobjectHide_DropOut); wInfo.position = Utilities.CGPointMake(160.0f, 410.0f); if ((currentText >= 5) && (currentText <= 11)) { wInfo.position.y = 368.0f; } if (currentText == 2) { wInfo.scale = 0.8f; } (funnyWord[2]).SetFont(Globals.g_world.font); (funnyWord[2]).SetLineAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontLines)); (funnyWord[2]).SetColourAtlas(Globals.g_world.GetAtlas(AtlasType.kAtlas_FontColours)); (funnyWord[2]).InitWithWordP1(wInfo, newText[2, currentText]); (funnyWord[2]).SetColour(Constants.kColourLightblue); (funnyWord[2]).SetShowStyle(FunnyWordShowStyle.kFunnyWordShow_ZoomAndWobble); (funnyWord[2]).Show(1.2f); (funnyWord[2]).Jiggle(0.5f); currentText += 1; if (currentText >= (int)Enum.kCTNumTexts) { currentText = 0; } }