public string getName() { return(string.Format("Transistor de {0} [(mm²) {1} x {2} = {3} u. a {4}/s]", getSize(), MonoGame.GetPrefix(new BigInteger(mmSize) * new BigInteger(mmSize), UnitType.Metric, "{0}{1}"), unitsAdquired, MonoGame.GetPrefix(getTotal(), UnitType.Metric, "{0}{1}"), MonoGame.GetPrefix(getUHRate()))); }
public string getSize() { int pSize = (int)(1000000000f / mmSize); int fSize = pSize; int l = pSize.ToString().Length; if (l > 5) { int rounder = (int)(Mathf.Pow(10, l - 1) / 2); fSize = (int)(Mathf.Round(pSize / rounder) * rounder); } return(MonoGame.GetPrefix(fSize, UnitType.Small, "{0} {1}m", 1)); }
private void client_SignInCompleted(object sender, MonoGame.Framework.MonoLive.SignInCompletedEventArgs e) { if (this.SignInCompleted != null && e.Error != null) { ((IDisposable) e.UserState).Dispose(); MonoLiveClient.SignInCompletedEventHandler completedEventHandler = this.SignInCompleted; MonoLiveClient monoLiveClient = this; SignedInGamer signedInGamer = new SignedInGamer(); signedInGamer.Gamertag = e.Result.Gamer.GamerTag; signedInGamer.DisplayName = e.Result.Gamer.GamerTag; SignInCompletedEventArgs e1 = new SignInCompletedEventArgs((Microsoft.Xna.Framework.GamerServices.Gamer) signedInGamer); completedEventHandler((object) monoLiveClient, e1); } else this.SignInCompleted((object) this, (SignInCompletedEventArgs) null); }
/*WaveManager*/ IEnumerator StartWave() { Wave w = waves[curWave]; while ((MonoGame.PossiblePoints() + MonoGame.me.curPoints) < w.PointsToDefeat) { if (MonoGame.me.aliveEnemies.Count < w.maxQueuedEnemies) { Vector2 rnd = Random.insideUnitCircle * radiusSpawnDistance; MonoGame.SpawnEnemy(transform.position + new Vector3(rnd.x, 0, rnd.y)); } yield return(new WaitForSeconds(w.spawnTime)); } while (MonoGame.me.aliveEnemies.Count > 0) { yield return(null); } MonoGame.me.curWave++; MonoGame.me.StartCoroutine("Countdown"); }
public static void Draw(Rect pos, List <Transistors> transistors) { if ((Screen.height - pos.yMin) / pos.height < transistors.Count) { rightScroll = GUI.VerticalSlider(new Rect(pos.xMin + pos.width, pos.yMin, 10, Screen.height - pos.yMin), rightScroll, 0, pos.height * transistors.Count - (Screen.height - pos.yMin)); } GUI.BeginGroup(new Rect(pos.xMin, pos.yMin, pos.width + 10, pos.height * transistors.Count)); GUI.BeginGroup(new Rect(0, -rightScroll, pos.width + 10, pos.height * transistors.Count)); for (int i = 0; i < transistors.Count; ++i) { Rect gRect = new Rect(0, i * pos.height, pos.width + ((Screen.height - pos.yMin) / pos.height < transistors.Count ? 0 : 10), pos.height); try { if (GUI.Button(gRect, string.Format("{0}\n[{1}, coste: {2}, mining rig: {3}/s, h.minadas: {4}]", transistors[i].getName(), transistors[i].unitsAdquired, MonoGame.GetPrefix(transistors[i].unitCost, UnitType.Inter, "{0} {1}BTCs"), MonoGame.GetPrefix(transistors[i].getHRate()), MonoGame.GetPrefix(transistors[i].l_minedHashes)), new GUIStyle("box") { wordWrap = MonoGame.me.screenPerc < 1, fontSize = Mathf.RoundToInt(13 * MonoGame.me.screenPerc + (MonoGame.me.screenPerc < 1 ? .1f : 0)), alignment = TextAnchor.MiddleLeft, padding = new RectOffset(Mathf.RoundToInt(30 * MonoGame.me.screenPerc), 0, 0, 0), normal = new GUIStyleState() { background = GUI.skin.box.normal.background, textColor = ((transistors[i].unitCost > MonoGame.me.Bitcoins) ? Color.gray : Color.white) } })) { MonoGame.Buy(transistors[i]); } } catch (Exception ex) { Debug.LogError("Script generated " + ex.GetType() + "\n" + ex.Message); } } GUI.EndGroup(); GUI.EndGroup(); }
// Use this for initialization void Start() { me = this; MouseLook m = GameObject.Find("Player").GetComponent <FirstPersonController>().m_MouseLook; xSen = m.XSensitivity; ySen = m.YSensitivity; UnfreezeCamera(false); myHealth = maxHealth; //Textures pbBackground = new Texture2D(1, 1); pbBackground.SetPixel(0, 0, Color.black); pbBackground.Apply(); pbBar = new Texture2D(1, 1); pbBar.SetPixel(0, 0, Color.red); pbBar.Apply(); centerGrid = Resources.Load <Texture2D>("Textures/center_grid"); SetItem(0); }
// Use this for initialization void Start() { //Init me = this; //Needs to be here because of the next request to it in 'CentralBlockWidth' var separator1 = (new TextureBorder(new TextureCrop(metalTex, new Rect(0, 0, 15, metalTex.height)).GetTexture()) { leftBorder = 1, rightBorder = 1, topBorder = 0, bottomBorder = 0 }).GetTexture(); //Set the blocks' sizes //LeftBlockWidth = Mathf.Round((Screen.width - separator1.width * 2) * .3378f); //100 + stoneTex.width * 2; //CentralBlockWidth = Mathf.Round((Screen.width - separator1.width * 2) * .3371f); //RightBlockWidth = Mathf.Round((Screen.width - separator1.width * 2) * .3251f); //CentralBlockWidth = Screen.width - (LeftBlockWidth * 2 + separator1.width); //BackgroundWidth = CentralBlockWidth + separator1.width * 2; //Load textures animBtc = new AnimUtil("Textures/coin"); //Separators separator2 = (new TextureBorder(new TextureCrop(metalTex, new Rect(0, 0, CentralBlockWidth + 2, 15)).GetTexture()) { leftBorder = 0, rightBorder = 0, topBorder = 1, bottomBorder = 1 }).GetTexture(); separator3 = (new TextureBorder(new TextureCrop(metalTex, new Rect(0, 0, LeftBlockWidth + 2, 15)).GetTexture()) { leftBorder = 0, rightBorder = 0, topBorder = 1, bottomBorder = 1 }).GetTexture(); sep = new Texture2D(1, 1); sep.SetPixel(1, 1, new Color(.8f, .8f, .8f)); sep.Apply(); //Some rects... //LeftBlock = new Rect(0, 0, LeftBlockWidth, Screen.height); //RightBlock = new Rect(Screen.width - RightBlockWidth, 50 + separator3.height, RightBlockWidth, Screen.height); //Set stone props //stonePadd = Screen.width * .03f; //stoneWidth = LeftBlockWidth - stonePadd * 2; //stoneHeight = stoneTex.height * stoneWidth / stoneTex.width; //Load settings s_quality = QualitySettings.GetQualityLevel(); sr_quality = new Rect(5, 80, BackgroundWidth - 45, 20); s_runInBack = Application.runInBackground; sr_runInBack = new Rect(5, 100, BackgroundWidth - 45, 20); sr_padding = new Rect(LeftBlockWidth + separator1.width, 100 + separator2.height, 0, 0); h_Elems.Add(new HoveringElement(sr_quality.Change(-20, RectSides.Top).Change(20, RectSides.Bottom).Add(sr_padding), new Rect(0, 0, 500, 40), "Cambiar la calidad te dará unos FPS más, cámbia esta opción únicamente si tu ordenador es una verdadera patata.", Menu.Settings)); h_Elems.Add(new HoveringElement(sr_runInBack.Add(sr_padding), new Rect(0, 0, 500, 120), "Esta opción te permitirá seguir ejecutando el juego en segundo plano, es decir, si está opción está marcada y la aplicación del juego pierde el foco el juego seguirá ejecutándose.\nCompruébalo desactivando esta opción y haciendo click en algún lado de la página fuera del cuadro del juego.\nSi tu microprocesador no es muy potente le vendría bien un descanso de vez en cuando, entonces es cuando deberías activar esta opción.", Menu.Settings)); //Init machines transGroups.Add(new Transistors(5) { mmSize = 100 }); transGroups.Add(new Transistors(35) { mmSize = 166 }); transGroups.Add(new Transistors(225) { mmSize = 333 }); transGroups.Add(new Transistors(1180) { mmSize = 666 }); transGroups.Add(new Transistors(3333) { mmSize = 1000 }); transGroups.Add(new Transistors(6250) { mmSize = 1250 }); transGroups.Add(new Transistors(13000) { mmSize = 1666 }); transGroups.Add(new Transistors(43500) { mmSize = 2857 }); transGroups.Add(new Transistors(96000) { mmSize = 4000 }); transGroups.Add(new Transistors(205000) { mmSize = 5555 }); transGroups.Add(new Transistors(435000) { mmSize = 7692 }); transGroups.Add(new Transistors(990000) { mmSize = 11111 }); transGroups.Add(new Transistors(2050000) { mmSize = 15384 }); transGroups.Add(new Transistors(4600000) { mmSize = 22222 }); transGroups.Add(new Transistors(9765000) { mmSize = 31250 }); transGroups.Add(new Transistors(22000000) { mmSize = 45454 }); transGroups.Add(new Transistors(57500000) { mmSize = 71428 }); transGroups.Add(new Transistors(120000000) { mmSize = 100000 }); transGroups.Add(new Transistors(260000000) { mmSize = 142857 }); transGroups.Add(new Transistors(533333333) { mmSize = 200000 }); transGroups.Add(new Transistors(2240000000) { mmSize = 400000 }); transGroups.Add(new Transistors(3666666667) { mmSize = 500000 }); transGroups.Add(new Transistors(15333333333) { mmSize = 1000000 }); transGroups.Add(new Transistors(21160000000) { mmSize = 1150000 }); transGroups.Add(new Transistors(26050000000) { mmSize = 1250000 }); transGroups.Add(new Transistors(30815000000) { mmSize = 1333333 }); transGroups.Add(new Transistors(40500000000) { mmSize = 1500000 }); transGroups.Add(new Transistors(64000000000) { mmSize = 1850000 }); transGroups.Add(new Transistors(10240000000) { mmSize = 2300000 }); transGroups.Add(new Transistors(14600000000) { mmSize = 2700000 }); transGroups.Add(new Transistors(18600000000) { mmSize = 3000000 }); transGroups.Add(new Transistors(43200000000) { mmSize = 4500000 }); transGroups.Add(new Transistors(79200000000) { mmSize = 6000000 }); transGroups.Add(new Transistors(145000000000) { mmSize = 8000000 }); transGroups.Add(new Transistors(233333333333) { mmSize = 10000000 }); transGroups.Add(new Transistors(-1) { mmSize = -1 }); unblockedTrans.Add(transGroups[0]); }