コード例 #1
0
ファイル: WindowComponents.cs プロジェクト: wty0512/FyWorld
        /// SimpleStat
        public static void SimpleStat(Rect rect, string text, float value, float baseValue = -1f)
        {
            Rect[] hGrid = rect.HorizontalGrid(new float[] { rect.width - 70, 70 }, 5);

            WindowComponents.Label(hGrid[1], text);
            WindowComponents.Label(hGrid[2], "<b>" + value.ToString() + "</b>");
        }
コード例 #2
0
ファイル: WindowComponents.cs プロジェクト: wty0512/FyWorld
 /// FillableBar()
 public static void FillableBar(Rect rect, float percent, Vital vital, Color fillColor)
 {
     WindowComponents.DrawTextureWithBorder(rect, Res.textures["fillable_border"]);
     rect = rect.Contract(2f);
     GUI.DrawTexture(rect.Width(rect.width * percent), Res.TextureUnicolor(fillColor));
     GUI.Label(rect, Mathf.Round(vital.currentValue).ToString() + " / " + vital.value.ToString(), WindowComponents.vitalLabelStyle);
 }
コード例 #3
0
ファイル: WindowComponents.cs プロジェクト: wty0512/FyWorld
        /// FillableBarWithLabelValue
        public static void FillableBarWithLabelValue(Rect rect, string name, Vital vital, Color fillColor)
        {
            float percent = Utils.Normalize(0, vital.value, vital.currentValue);

            Rect[] hGrid = rect.HorizontalGrid(new float[] { 70, rect.width - 140, 70 }, 5);
            WindowComponents.Label(hGrid[1], name);
            WindowComponents.FillableBar(hGrid[2], percent, vital, fillColor);
            WindowComponents.Label(hGrid[3], Mathf.Round(percent * 100).ToString() + "%");
        }
コード例 #4
0
ファイル: WindowComponents.cs プロジェクト: wty0512/FyWorld
        public static void DrawTextureWithBorder(Rect rect, Texture2D texture)
        {
            Rect r = rect.RoundToInt();

            GUI.BeginGroup(r);

            foreach (KeyValuePair <Rect, Rect> kv in WindowComponents.SplitTextureBorderUV(r, texture.width))
            {
                GUI.DrawTextureWithTexCoords(kv.Key, texture, kv.Value.InvertY());
            }

            GUI.EndGroup();
        }
コード例 #5
0
 public override void Content()
 {
     if (this.activeTab == 0)
     {
         this.vGrid.H2("Vitals");
         if (this._character.brain.currentTask != null)
         {
             this.vGrid.Span(this._character.brain.currentTask.def.uid);
         }
         else
         {
             this.vGrid.Span("Doing nothing...");
         }
         foreach (Vital vital in this._character.stats.vitals.Values)
         {
             WindowComponents.FillableBarWithLabelValue(
                 this.vGrid.GetNewRect(20f),
                 vital.name,
                 vital,
                 Defs.namedColorPallets["cols_vitals"].colors[vital.name]
                 );
         }
         this.vGrid.H2("Stats");
         foreach (Stat stat in this._character.stats.stats.Values)
         {
             WindowComponents.SimpleStat(this.vGrid.GetNewRect(20f), stat.name, stat.value, stat.baseValue);
         }
     }
     else if (this.activeTab == 1)
     {
         this.vGrid.H2("Infos");
         this.vGrid.Paragraph(this._character.def.shortDesc);
         this.vGrid.H2("Detailled Stats");
         foreach (Stat attr in this._character.stats.attributes.Values)
         {
             WindowComponents.SimpleStat(this.vGrid.GetNewRect(20f), attr.name, attr.value, attr.baseValue);
         }
     }
     else if (this.activeTab == 2)
     {
         this.vGrid.H2("Inventory");
         if (this._character.inventory.def != null)
         {
             this.vGrid.Paragraph(this._character.inventory.def.name + " : " + this._character.inventory.count + "/" + this._character.inventory.max);
         }
         else
         {
             this.vGrid.Paragraph("Empty");
         }
     }
 }