public Dialog_NewBlueprint(Blueprint blueprint) { this.blueprint = blueprint; resizeable = true; draggable = true; bpHandler = new BlueprintWindowHandler(blueprint, BlueprintHandlerState.New); bpHandler.EventCancel += () => { Close(); }; bpHandler.EventAccept += () => { if (blueprint.IsValid()) { DroidManager.Instance.Blueprints.Add(blueprint); Close(); } else { Messages.Message(new Message("InvalidBlueprint".Translate(), MessageTypeDefOf.RejectInput)); } }; absorbInputAroundWindow = true; forcePause = true; StatsReportUtility.Reset(); }
public ITab_Droid_Design() { size = new Vector2(1280f, 800f); labelKey = "Blueprint".Translate(); bpHandler = new BlueprintWindowHandler(null, BlueprintHandlerState.Normal); bpHandler.EventClose += () => { CloseTab(); }; //TODO:: Handle edit button event. }
private void DrawDesignEntry(Rect rect, Blueprint bp, bool alternate) { try { GUI.BeginGroup(rect); Rect entryRect = new Rect(0f, 0f, rect.width, rect.height - DesignEntryMargin); if (Widgets.ButtonInvisible(entryRect)) { if (selBlueprint != null && selBlueprint == bp) { selBlueprint = null; } else { selBlueprint = bp; bpHandler = new BlueprintWindowHandler(selBlueprint, BlueprintHandlerState.Normal); bpHandler.CloseButtonVisible = false; bpHandler.EditButtonVisible = true; } } if (selBlueprint != null && selBlueprint == bp) { Widgets.DrawHighlightSelected(entryRect); } else if (Mouse.IsOver(entryRect)) { Widgets.DrawHighlight(entryRect); } else if (alternate) { Widgets.DrawAltRect(entryRect); } Rect textRect = new Rect(SectionMargin, 0, entryRect.width - SectionMargin, entryRect.height); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(textRect, bp.Label); Text.Anchor = TextAnchor.UpperLeft; string text = bp.ChassisType == ChassisType.Small ? "SmallChassis".Translate() : bp.ChassisType == ChassisType.Medium ? "MediumChassis".Translate() : bp.ChassisType == ChassisType.Large ? "LargeChassis".Translate() : "Undefined droid chassis "; text += " "; Text.Anchor = TextAnchor.LowerRight; Text.Font = GameFont.Tiny; Widgets.Label(textRect, text); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; } finally { GUI.EndGroup(); Text.Anchor = TextAnchor.UpperLeft; } }