Пример #1
0
 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())));
 }
Пример #2
0
    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));
    }
Пример #3
0
 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();
 }