public AuthSignOutDialog() { blob = new TextBlob(UI2D.Shared.GetGameFont20, "", 400); signOutButton = new Button(Strings.Localize("auth.signOut"), Color.White, null, UI2D.Shared.GetGameFont20); cancelButton = new Button(Strings.Localize("auth.cancel"), Color.White, null, UI2D.Shared.GetGameFont20); } // end of c'tor
public DrawTextBlobCanvasCommand(TextBlob textBlob, float x, float y, Paint paint) { TextBlob = textBlob; X = x; Y = y; Paint = paint; }
public List <FeedMs> GetFeedList(int width, Shared.GetFont titleFont, Shared.GetFont dateFont, Shared.GetFont bodyFont) { TextBlob textBlob = new TextBlob(bodyFont, "label", width); //parse JSON string into List of Dictionaries. List <FeedMs> allFeeds = new List <FeedMs>(); try { #if NETFX_CORE // For some reason the WinRT Json Serializer doesn't want to // deserialize our objects so we'll just have to do it manually. //var items = Deserialize<List<Dictionary<string, string>>>(rawGetData); List <Dictionary <string, string> > items = HackDeserialize(rawGetData); #else var js = new System.Web.Script.Serialization.JavaScriptSerializer(); var items = js.Deserialize <List <Dictionary <string, string> > >(rawGetData); #endif //build news feed. foreach (var item in items) { FeedMs feedItem = new FeedMs(new Vector2(24, 0), textBlob, titleFont, dateFont, bodyFont); feedItem.Title = item["Title"]; feedItem.Body = item["Text"]; feedItem.DateString = item["Date"]; feedItem.CreateHyperlink(HyperlinkType.URL, Strings.Localize("mainMenu.readMoreHere"), item["URL"]); allFeeds.Add(feedItem); } } catch { } return(allFeeds); }
// c'tor public LoadLevelPopup() { itemList = new List <PopupItem>(); blob = new TextBlob(ItemFont, "foo", 500); blob.Justification = UIGridElement.Justification.Right; }
public FeedMs(Vector2 size, TextBlob tBlob, Shared.GetFont titleFont, Shared.GetFont dateFont, Shared.GetFont bodyFont) : base(size) { this.titleFont = titleFont; this.dateFont = dateFont; this.bodyFont = bodyFont; this.textBlob = tBlob; titleBlob = new TextBlob(titleFont, "", 160); dateBlob = new TextBlob(dateFont, "", 160); size.Y = (tBlob.NumLines - 1 + 1) * tBlob.TotalSpacing; size.Y += bodyFont().LineSpacing; if (titleBlob != null) { size.Y += titleBlob.TotalSpacing + titleFont().LineSpacing; } if (dateBlob != null) { size.Y += dateBlob.TotalSpacing + dateFont().LineSpacing; } base.Height = size.Y; titleBlob.Justification = UIGridElement.Justification.Left; dateBlob.Justification = UIGridElement.Justification.Left; }
public TextBlob make() { var result = new TextBlob(this._text, this._textOffset, this._size, this._positionXs, this._bounds, this._style); return(result); }
private void Update() { if (Input.GetKeyDown(KeyCode.K)) { TextBlob.SetMessage("testGraphic"); } }
static void Main(string[] args) { if (args == null || args.Length == 0) { Console.WriteLine(HELP_MESSAGE); PressAnyKey(); return; } if (args[0] == ARG_FROM_STRING) { if (args.Length < 2 || args[1] == null) { Console.WriteLine(HELP_MESSAGE); return; } string str = args[1]; TextBlob textBlob = TextBlob.FromString(str, ","); Console.WriteLine("ASCII Output\n{0}\n", textBlob.ToBinaryBlob()); } else { string blob = args[0]; TextBlob textBlob = new TextBlob(blob); Console.WriteLine("ASCII to String (7bit):\n{0}\n\nExtended ASCII to String (8bit):\n{1}\n\n", textBlob.Ascii7Value, textBlob.Ascii8Value); } PressAnyKey(); }
// c'tor public LiveFeedDisplay() { this.msNewsFeed = new NewsFeeds(); this.smallblob = new TextBlob(UI2D.Shared.GetGameFont18Bold, Strings.Localize("mainMenu.news"), 300); this.smallblob.Justification = UIGridElement.Justification.Left; this.flagMoreBlob = new TextBlob(expandFlagFont, Strings.Localize("mainMenu.more"), 80); this.flagLessBlob = new TextBlob(expandFlagFont, Strings.Localize("mainMenu.less"), 80); this.newsScroller = new ItemScroller(scrollBoxPos, FeedSize, new Color(0.0f, 0.0f, 0.0f, 0.0f), null, null); this.hitBox = new AABB2D(new Vector2(0, 0), FeedSize); // this.Header_bg = BokuGame.Load<Texture2D>(BokuGame.Settings.MediaPath + @"Textures\twitter_Icon"); this.cloudTR = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudTR"); this.cloudBR = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudBR"); this.cloudTL = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudTL"); this.cloudBL = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudBL"); this.cloudTC = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudTC"); this.cloudBC = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudBC"); this.cloudLC = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudLC"); this.cloudRC = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudRC"); this.cloudCenter = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\MainMenu\cloudCenter"); newsScroller.Clear(); FeedMs item = new FeedMs(FeedSize, "Getting News feed...", TitleFont, DateFont, BodyFont); newsScroller.AddItem(item); //Twitter.GetTweets(); msNewsFeed.BeginFetchNews(); gettingFeeds = true; } // end of c'tor
public RenderObj(ShareHub parent, Shared shared) { this.shared = shared; this.parent = parent; tile1Blob = new TextBlob(UI2D.Shared.GetGameFont20, Strings.Localize("shareHub.invite"), 365); tile2Blob = new TextBlob(UI2D.Shared.GetGameFont20, Strings.Localize("shareHub.start"), 435); }
} // end of TextInput() // TODO (****) Clean this up. We're mixing text as input with text as control here. // Probably the right thing to do would be to push/pop the text input callbacks // dynamically to mirror the state we're in. public void KeyInput(Keys key) { if (EditingCreator || EditingPin) { KeyboardInput.ClearAllWasPressedState(key); TextBlob curBlob = EditingCreator ? creatorBlob : pinBlob; //string curString = EditingCreator ? curCreator : curPin; //int curLength = curString.Length; switch (key) { case Keys.Enter: Foley.PlayClickDown(); OnAccept(); break; case Keys.Escape: Foley.PlayClickDown(); OnCancel(); break; case Keys.Left: curBlob.CursorLeft(); Foley.PlayClickDown(); break; case Keys.Right: curBlob.CursorRight(); Foley.PlayClickDown(); break; case Keys.Home: Foley.PlayClickDown(); creatorBlob.Home(); break; case Keys.End: Foley.PlayClickDown(); curBlob.End(); break; case Keys.Back: curBlob.Backspace(); Foley.PlayClickDown(); break; case Keys.Delete: curBlob.Delete(); break; case Keys.Tab: ToggleEditTarget(); break; } // end of switch on special characters. } } // end of KeyInput()
public Tweet(Vector2 size, TextBlob tweetBlob) : base(size) { this.tweetBlob = tweetBlob; size.Y = (tweetBlob.NumLines - 1) * tweetBlob.TotalSpacing; size.Y += UI2D.Shared.GetGameFont13_5().LineSpacing; base.Height = size.Y; }
public PaintRecord(TextStyle style, float dx, float dy, TextBlob text, FontMetrics metrics, float runWidth) { this._style = style; this._text = text; this._runWidth = runWidth; this._metrics = metrics; this._dx = dx; this._dy = dy; }
public static uiDrawTextBlob create(TextBlob textBlob, uiOffset?offset, uiPaint paint) { var drawTextBlob = ObjectPool <uiDrawTextBlob> .alloc(); drawTextBlob.textBlob = textBlob; drawTextBlob.offset = offset; drawTextBlob.paint = paint; return(drawTextBlob); }
} // end of Update() public void Render() { if (blob == null) { blob = new TextBlob(UI2D.Shared.GetGameFont30Bold, "foo", 1000); } // NOTE: Assumes Begin has already been called on batch // and End will be called elsewhere. SpriteBatch batch = UI2D.Shared.SpriteBatch; bool invertColors = false; if (pressed && OnKey == null) { invertColors = true; } // KeyCap batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); Rectangle rect = new Rectangle((int)hitBox.Min.X, (int)hitBox.Min.Y, (int)hitBox.Size.X, (int)hitBox.Size.Y); batch.Draw(VirtualKeyboard.whiteTexture, rect, invertColors ? labelColor : keyCapColor); batch.End(); // Texture // Note we render textures before labels just in case key has both. if (texture != null) { // Center texture on keycap. Vector2 size = new Vector2(texture.Width, texture.Height); Vector2 pos = this.position; pos += (hitBox.Size - size) / 2.0f; batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); batch.Draw(texture, pos, labelColor); batch.End(); } // Label if (!string.IsNullOrEmpty(label)) { blob.Font = Font; blob.RawText = label; float width = blob.GetLineWidth(0); // Center side to side based on actual width but top to bottom based on line spacing. Vector2 pos = this.position; pos.X += (hitBox.Size.X - width) / 2.0f; pos.Y += (hitBox.Size.Y - Font().LineSpacing) / 2.0f; // Clamp to int to get better looking glyphs. pos.X = (int)pos.X; pos.Y = (int)pos.Y; blob.RenderWithButtons(pos, invertColors ? keyCapColor : labelColor); } } // end of Render()
public static void Init() { for (int i = 0; i < kNumButtons; i++) { Color color = Classification.XnaColor((Classification.Colors)((int)Classification.ColorInfo.First + i)); buttons[i] = new GUIButton(color); } blob = new TextBlob(UI2D.Shared.GetGameFont20, "", (int)(GUIButton.DefaultSize.X - 2 * margin)); } // end of Init()
public Tweet(Vector2 size, string text) : base(size) { tweetBlob = new TextBlob(UI2D.Shared.GetGameFont13_5, text, 150); tweetBlob.Width = (int)size.X; size.Y = (tweetBlob.NumLines - 1) * tweetBlob.TotalSpacing; size.Y += UI2D.Shared.GetGameFont13_5().LineSpacing; base.Height = size.Y; }
public PaintRecord(TextStyle style, Offset offset, TextBlob _text, FontMetrics metrics, int line, double runWidth) { this._style = style; this._text = _text; this._line = line; this._runWidth = runWidth; this._metrics = metrics; this._offset = offset; }
public void Activate(string gamepadText, string mouseText, string touchText, bool useBackgroundThumbnail, bool useOverscanForHitTesting) { this.gamepadText = gamepadText; this.mouseText = mouseText; this.touchText = touchText; if (gamepadText == null && mouseText == null && touchText == null) { Debug.Assert(false, "What are you trying to do?"); return; } if (state != States.Active) { this.useBackgroundThumbnail = useBackgroundThumbnail; this.useRtCoords = useOverscanForHitTesting; // Do stack handling here. If we do it in the update object we have no // clue which order things get pushed and popped and madness ensues. CommandStack.Push(commandMap); state = States.Active; // Get the current scene thumbnail. If we're using this from the main menu (options) // then use the title screen image instead. if (InGame.inGame.State == InGame.States.Inactive) { thumbnail = BokuGame.bokuGame.mainMenu.BackgroundTexture; } else { thumbnail = InGame.inGame.SmallThumbNail; } // Tell InGame we're using the thumbnail so no need to do full render. prevRenderWorldAsThumbnail = InGame.inGame.RenderWorldAsThumbnail; if (!prevRenderWorldAsThumbnail) { InGame.inGame.RenderWorldAsThumbnail = true; } Time.Paused = true; HelpOverlay.Push(@"ScrollableTextDisplay"); // Get text string. blob = new TextBlob(UI2D.Shared.GetGameFont20, mouseText, textWidth); blob.LineSpacingAdjustment = 6; // Taller lines to make programming tiles fit better. topLine = 0; textOffset = 0; PreRender(); // Set up text rendering for first frame. } } // end of Activate
static void Main(string[] args) { var blobstorage = new BaseBlobStorage("UseDevelopmentStorage=true"); var random = new Random(); int randomNumber = random.Next(0, 100); var fileName = randomNumber + ".txt"; var blob = new TextBlob { Content = "This is a sample text", Name = fileName, Path = "BlobSample" }; blobstorage.Put(blob); }
public AuthSignInDialog() { blob = new TextBlob(UI2D.Shared.GetGameFont20, "", 400); creatorBlob = new TextBlob(UI2D.Shared.GetGameFont20, Auth.DefaultCreatorName, 400); pinBlob = new TextBlob(UI2D.Shared.GetGameFont20, Auth.DefaultCreatorPin, 400); okButton = new Button(Strings.Localize("auth.ok"), Color.White, null, UI2D.Shared.GetGameFont20); cancelButton = new Button(Strings.Localize("auth.cancel"), Color.White, null, UI2D.Shared.GetGameFont20); scrollableTextDisplay = new ScrollableTextDisplay(); } // end of c'tor
public Hyperlink(string text, string linkUrl) { linkType = HyperlinkType.URL; this.text = text; this.linkUrl = linkUrl; blob = new TextBlob(Shared.GetGameFont10, text, 390); // Need to set once we know the correct position. hitBox = new AABB2D(); }
public async Task <TextBlob> AddText(string text) { if (text == null) { return new TextBlob { Hash = null, Text = null } } ; if (text.Length > MaxTextSize) { text = text.Substring(0, MaxTextSize); } var hash = GetHash(text); var blob = db.Texts.Find(hash); if (blob != null) { return(blob); } blob = new TextBlob { Hash = hash, Text = text }; db.Texts.AddOrUpdate(blob); try { await db.SaveChangesAsync(); } catch (DbEntityValidationException e) { throw new Exception( string.Join("\r\n", e.EntityValidationErrors.SelectMany(v => v.ValidationErrors).Select(err => err.PropertyName + " " + err.ErrorMessage))); } catch (DbUpdateException) { // It's ok, just tried to insert text with hash which already exists, try to find it if (!db.Texts.AsNoTracking().Any(t => t.Hash == hash)) { throw; } db.Entry(blob).State = EntityState.Unchanged; } return(blob); }
// constructor // @params: item icon, optional text public PieMenuSlice(Object menuItem, Texture2D iconTexture, UI2D.Shared.GetFont font, string displayText) { int textWidth = 80; Debug.Assert(iconTexture != null || font != null); this.menuItem = menuItem; this.texture = iconTexture; this.font = font; this.label = displayText; this.textBlob = new TextBlob(font, displayText, textWidth); this.sliceType = PieSelector.SliceType.single; }
public async Task <TextBlob> AddText(string text) { if (text == null) { return new TextBlob { Hash = null, Text = null } } ; if (text.Length > MaxTextSize) { text = text.Substring(0, MaxTextSize); } if (text.Contains('\0')) { text = text.Replace("\0", ""); // postgres не поддерживает \0 в строках } var hash = GetHash(text); var blob = db.Texts.Find(hash); if (blob != null) { return(blob); } blob = new TextBlob { Hash = hash, Text = text }; db.Texts.AddOrUpdate(blob); try { await db.SaveChangesAsync().ConfigureAwait(false); } catch (DbUpdateException) { // It's ok, just tried to insert text with hash which already exists, try to find it if (!db.Texts.AsNoTracking().Any(t => t.Hash == hash)) { throw; } db.Entry(blob).State = EntityState.Unchanged; } return(blob); }
public NewWorldDialog(OnAction OnSelectWorld, OnAction OnCancel) { SelectWorldDelegate = OnSelectWorld; CancelDelegate = OnCancel; blob = new TextBlob(UI2D.Shared.GetGameFont20, "", 400); cancelButton = new Button(Strings.Localize("auth.cancel"), Color.White, null, UI2D.Shared.GetGameFont20); levels.Add(new NewWorldLevel(@"03a1b038-fd3f-492f-b18c-2a197fe68701")); levels.Add(new NewWorldLevel(@"71b3660d-f472-49b2-90c3-2de1758e1f64")); levels.Add(new NewWorldLevel(@"be4ca04b-a3cc-4f76-ba7a-84eb917bcf92")); } // end of c'tor
} // end of UIGrid2DProgrammedBotElement LoadContent() public override void InitDeviceResources(GraphicsDevice device) { // Before we can decide on a size, we need to know how many lines of text we need. int labelLineWidth = 530; textBlob = new TextBlob(UI2D.Shared.GetGameFont24, actorHelp.programs[exampleIndex].description.Trim(), labelLineWidth); const int dpi = 96; int w = (int)(dpi * width); int h = (int)(dpi * height); int originalWidth = w; int originalHeight = h; } // end of UIGrid2DProgrammedBotElement InitDeviceResources()
} // end of DegviceReset() public void Activate(BaseHint curHint, bool useBackgroundThumbnail, bool useRtCoords) { this.curHint = curHint; if (curHint == null) { return; } if (state != States.Active) { this.useBackgroundThumbnail = useBackgroundThumbnail; this.useRtCoords = useRtCoords; // Do stack handling here. If we do it in the update object we have no // clue which order things get pushed and popped and madness ensues. CommandStack.Push(commandMap); state = States.Active; // Get the current scene thumbnail. If we're using this from the main menu (options) // then use the title screen image instead. if (InGame.inGame.State == InGame.States.Inactive) { thumbnail = BokuGame.bokuGame.mainMenu.BackgroundTexture; } else { thumbnail = InGame.inGame.SmallThumbNail; } // Tell InGame we're using the thumbnail so no need to do full render. prevRenderWorldAsThumbnail = InGame.inGame.RenderWorldAsThumbnail; if (!prevRenderWorldAsThumbnail) { InGame.inGame.RenderWorldAsThumbnail = true; } Time.Paused = true; HelpOverlay.Push(@"ScrollableModalHint"); // Get text string. blob = new TextBlob(UI2D.Shared.GetGameFont20, curHint.ModalText, textWidth); topLine = 0; textOffset = 0; PreRender(); // Set up text rendering for first frame. } } // end of Activate
} // end of ThoughtBalloon Activate() public void RefreshTexture() { RenderTarget2D rt = UI2D.Shared.RenderTarget256_256; // // Render the frame and text to the rendertarget. // InGame.SetRenderTarget(rt); ScreenSpaceQuad ssquad = ScreenSpaceQuad.GetInstance(); InGame.Clear(Color.Transparent); // Frame ssquad.Render(ThoughtBalloonManager.FrameTexture, Vector2.Zero, new Vector2(rt.Width, rt.Height), "TexturedRegularAlpha"); int width = 238; TextBlob blob = new TextBlob(UI2D.Shared.GetGameFont30Bold, text, width); blob.Justification = Boku.UI2D.UIGridElement.Justification.Center; if (blob.NumLines > 3) { blob.Font = UI2D.Shared.GetGameFont24Bold; if (blob.NumLines > 3) { blob.Font = UI2D.Shared.GetGameFont24Bold; } } duration = defaultDuration * blob.NumLines; int margin = 8; int middle = 76; // Vertical midpoint of space for text. int lineSpacing = blob.Font().LineSpacing; int numLines = Math.Min(4, blob.NumLines); Vector2 pos = new Vector2(margin, middle - (numLines * 0.5f) * lineSpacing); blob.RenderWithButtons(pos, Color.Black, maxLines: numLines); InGame.RestoreRenderTarget(); // // Copy result to local texture. // rt.GetData <int>(_scratchData); contentTexture.SetData <int>(_scratchData); } // end of ThoughtBalloon RefreshTexture()
public async Task <TextBlob> AddText(string text) { if (text == null) { return new TextBlob { Hash = null, Text = null } } ; if (text.Length > MaxTextSize) { text = text.Substring(0, MaxTextSize); } var hash = GetHash(text); var blob = db.Texts.Find(hash); if (blob != null) { return(blob); } blob = new TextBlob { Hash = hash, Text = text }; db.AddOrUpdate(blob, b => b.Hash == hash); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { // It's ok, just tried to insert text with hash which already exists, try to find it if (!db.Texts.AsNoTracking().Any(t => t.Hash == hash)) { throw; } db.Entry(blob).State = EntityState.Unchanged; } return(blob); }
} // end of ShowTip() /// <summary> /// Removes any acitve tooltip. /// </summary> public static void Clear() { // If a tip is active but not yet visible, just get rid of it. if (mode == Mode.PreDelay) { mode = Mode.None; curTip = null; blob = null; } else if (mode == Mode.Visible) { mode = Mode.None; curTip = null; blob = null; startFadeTime = Time.WallClockTotalSeconds; } } // end of Clear()