Example #1
0
    private void DrawSelected()
    {
        BlueprintDesign   bd = GetSelectedBlueprintDesign();
        StructureReusable sr = GetStructureReusable(selectedRect, bd);

        sr.Draw(selectedRect, true);
    }
Example #2
0
 private StructureReusable GetStructureReusable(Rect drawRect, BlueprintDesign blueprintDesign)
 {
     if (!structureReusables.ContainsKey(blueprintDesign))
     {
         Thing             thing = ThingFactory.MakeThing(blueprintDesign.thingType);
         StructureReusable sr    = new StructureReusable(drawRect, thing.iconTexture, thing.longName, blueprintDesign);
         structureReusables.Add(blueprintDesign, sr);
     }
     return(structureReusables[blueprintDesign]);
 }
Example #3
0
    private void DrawList()
    {
        viewRect.height = BlueprintDesignManager.blueprintDesigns.Count * selectedRect.height;
        scrollPosition  = GUI.BeginScrollView(scrollRect, scrollPosition, viewRect);

        int hoverIndex = GetMouseHoverListIndex();
        int row        = 0;

        foreach (BlueprintDesign bd in BlueprintDesignManager.blueprintDesigns)
        {
            float y       = row * selectedRect.height;
            Rect  rowRect = new Rect(selectedRect.x, y, selectedRect.width, selectedRect.height);

            StructureReusable sr = GetStructureReusable(rowRect, bd);

            bool drawHighlighted = row == blueprintIndex || (hoverIndex != -1 && row == hoverIndex);
            sr.Draw(rowRect, drawHighlighted);
            row++;
        }
        GUI.EndScrollView();
    }