public override String GetToolTipInfo(IEditorClient Client) { String pluralize = ReleaseCount > 1 ? "s" : ""; return "Contains " + ReleaseCount.ToString() + " " + _PowerupType.Name + pluralize; }
public override void EditorDraw(Graphics g, IEditorClient Client) { //call default implementation first. Draw(g); //now, the extension for the editor is to also draw our powerup within us. //first, get an appropriately sized rect, the width and length is the minimum of our length and width. float usexy = Math.Min(BlockRectangle.Width, BlockRectangle.Height); //create a new bitmap of the given size. SizeF usesize = new SizeF(usexy,usexy); if (Math.Abs(cachedInnerSize.Width - usesize.Width) > 0.01f || Math.Abs(cachedInnerSize.Height - usesize.Height) > 0.01f || hasChanged) { //recreate the cached bitmap. Bitmap drawinner = new Bitmap((int)usesize.Width, (int)usesize.Height); Graphics drawhere = Graphics.FromImage(drawinner); //we need to Create our powerup. GameCharacterPowerup gcp = (GameCharacterPowerup)Activator.CreateInstance(_PowerupType, this); gcp.DrawSize = usesize; gcp.Location = new PointF(0, 0); gcp.Draw(drawhere); cachedInnerSize = usesize; cachedInnerImage = drawinner; } //Center cachedInnerSize on our rect. RectangleF useDrawLocation = new RectangleF(BlockRectangle.Left+(float)((BlockRectangle.Width / 2) - cachedInnerSize.Width / 2), BlockRectangle.Top + (float)((BlockRectangle.Height / 2) - cachedInnerSize.Height / 2), cachedInnerSize.Width, cachedInnerSize.Height); //now DRAW. if(cachedInnerImage!=null) g.DrawImage(cachedInnerImage, useDrawLocation); }
/// <summary> /// retrieves additional tooltip information for a block. /// </summary> /// <returns></returns> public override string GetToolTipInfo(IEditorClient Client) { return "Contains: " + _EnemySpawnType + ", with " + _EnemySpawnTriggers.Count + " Triggers."; }
/// <summary> /// called when this block is drawn in the editor. the "normal" implementation of Draw will not be called afterwards. /// </summary> /// <param name="g"></param> public override void EditorDraw(Graphics g, IEditorClient Client) { //nuttin' Draw(g); }
public override string GetToolTipInfo(IEditorClient Client) { String currbuild = base.GetToolTipInfo(Client); //add some information about this switch. //(In group with X others) //find the others in our group. //we can group based on AllActive and AllInActive. //first find Active group.. var ActiveGroup = from m in Client.GetBlocks() where m != this && m is SwitchBlock && (m as SwitchBlock).AllActiveID == AllActiveID select m; var InActiveGroup = from m in Client.GetBlocks() where m != this && m is SwitchBlock && (m as SwitchBlock).AllInactiveID == AllInactiveID select m; StringBuilder buildstr = new StringBuilder(); if (ActiveGroup.Any()) { buildstr.AppendLine("ActiveID #" + AllActiveID + " With " + ActiveGroup.Count() + " Others."); } if (InActiveGroup.Any()) { buildstr.AppendLine("ActiveID #" + AllInactiveID + " With " + InActiveGroup.Count() + " Others."); } return buildstr.ToString() + currbuild; }
public override void EditorDraw(Graphics g, IEditorClient Client) { base.EditorDraw(g,Client); String drawstring=""; if(_AllActiveID!=0) drawstring += "A:" + _AllActiveID + "\n"; if(_AllInactiveID!=0) drawstring += "I:" + _AllInactiveID + _AllInactiveID + "\n"; //draw our trigger number. Font usefont = BCBlockGameState.GetScaledFont(new Font(BCBlockGameState.GetMonospaceFont(), 12), (int)(BlockRectangle.Height / 2)); var textsize = BCBlockGameState.MeasureString(drawstring, usefont); PointF DrawLocation = new PointF(CenterPoint().X - textsize.Width / 2, CenterPoint().Y - textsize.Height / 2); }