protected override void Layout(Flood.GUI.Skins.Skin skin) { base.Layout(skin); SetPosition( (Parent.Bounds.Width - Bounds.Width) / 2, Parent.Bounds.Height / 2 - Bounds.Height); }
public void OnTriggerExit2D(Collider2D other) { Flood otherFlood = other.GetComponent <Flood>(); if (otherFlood == flood) { flood = null; } }
public void OnTriggerEnter2D(Collider2D other) { Flood otherFlood = other.GetComponentInChildren <Flood>(); if (otherFlood != null) { flood = otherFlood; } }
public void OnLoad(Flood.Remoting.ServiceManager serviceManager) { var paneManager = serviceManager.GetGlobalService<IPaneManager>(); var textDocument = new TextDocument(); var textView = new TextView(null, textDocument); var pane = new Pane { Title = "CodeEdit", Control = textView }; paneManager.AddPane(pane); }
public Flood Update(Flood flood, int callerId) { using (UBContext ubc = new UBContext()) { Flood exists = ubc.Users_Flood .Where(x => x.GroupId == flood.GroupId && x.TelegramUserId == flood.TelegramUserId) .FirstOrDefault(); if (exists == null) { return(null); } try { exists.MessageCount = flood.MessageCount; exists.UtcDate = flood.UtcDate; ubc.SaveChanges(); return(flood); } catch (Exception ex) { Utils.Logging.AddLog(new SystemLog() { LoggerName = "Unifiedban", Date = DateTime.Now, Function = "Unifiedban.Data.FloodService.Update", Level = SystemLog.Levels.Warn, Message = ex.Message, UserId = callerId }); if (ex.InnerException != null) { Utils.Logging.AddLog(new SystemLog() { LoggerName = "Unifiedban.Data", Date = DateTime.Now, Function = "Unifiedban.Data.FloodService.Update", Level = SystemLog.Levels.Warn, Message = ex.InnerException.Message, UserId = callerId }); } } return(null); } }
private Flood ProcessFloodItem(EnvironmentAgencyFloodAlert item) { var flood = new Flood { Id = LastSegmentOfUri(item.Id), Region = item.EaRegionName, FloodAreaId = item.FloodAreaId, EaAreaName = item.EaAreaName, TimeRaised = item.TimeRaised, Severity = (SeverityLevel)item.SeverityLevel }; flood.Action = _floodActionStrategy.DetermineAction(flood); return(flood); }
public FloodAction DetermineAction(Flood flood) { switch (flood.EaAreaName.ToLower()) { case "yorkshire": case "west midlands": { return(FloodAction.MonitorHourly); } case "east anglia": { return(FloodAction.MonitorDaily); } default: { return(FloodAction.Ignore); } } }
public static void Initialize_NewGame() { AccusationEncounters.Initialize_Accusation(); Conversation.Initialize_Conversation(); Flood.Initialize_Flood(); // Lists.Initialize_Lists(); LocationEncounters.Initialize_Locations(); Map.Initialize_Map(); Movement.Initialize_Movement(); Notebook.Initialize_Notebook(); NPC_AI.Initialize_AI_Variables(); NPC_AI.Initialize_NPCs(); NPC_Traits.Initialize_Traits(); RandomEncounters.Initialize_Actors(); RandomEncounters.Initialize_RandomEncounters(); Search.Initialize_Search(); TheBunny.Initialize_Bunny(); Title.Initialize_TitleVars(); Title.Initialize_Secrets(); Variables.Initialize_MainVars(); }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { Fights.Dispose(); Bid.Dispose(); Roleplay.Dispose(); Flood.Dispose(); CharacterCreation.Dispose(); } Fights = null; Bid = null; Roleplay = null; Flood = null; CharacterCreation = null; _disposedValue = true; } }
internal void Init(Flood.Window window, RenderDevice renderDevice, RenderContext renderContext) { nativeWindow = window; device = renderDevice; if (renderContext == null) { RenderContext = window.CreateContext(new RenderContextSettings()); window.MakeCurrent(); RenderContext.Init(); } else { RenderContext = renderContext; nativeWindow.Context = RenderContext; } view = window.CreateView(); window.Render += Render; window.TargetResize += Resize; }
public Flood Add(Flood flood, int callerId) { using (UBContext ubc = new UBContext()) { try { ubc.Add(flood); ubc.SaveChanges(); return(flood); } catch (Exception ex) { Utils.Logging.AddLog(new SystemLog() { LoggerName = "Unifiedban", Date = DateTime.Now, Function = "Unifiedban.Data.FloodService.Add", Level = SystemLog.Levels.Warn, Message = ex.Message, UserId = callerId }); if (ex.InnerException != null) { Utils.Logging.AddLog(new SystemLog() { LoggerName = "Unifiedban.Data", Date = DateTime.Now, Function = "Unifiedban.Data.FloodService.Add", Level = SystemLog.Levels.Warn, Message = ex.InnerException.Message, UserId = callerId }); } } return(null); } }
public override Vector2 MeasureText(Flood.GUI.Font font, string text) { return TextRenderer.MeasureText(text,font); }
static void Main(string[] args) { Game_StartNewGame(); // Title screen. Title.ScreenDimensions(); Title.TitleScreen(); // Gah. Start the game. Get on with it already. while (Variables.bGameActive) { if (iInitializeGame == 1) { Lists.Initialize_Lists(); iInitializeGame = 2; } if (Variables.iRemainingTurns > Variables.iTurn60) // end of game, i.e. 0 turns remaining { // First, check for cutscene. These scenes preempt the game display. Cutscenes.ShouldSomethingBePlaying(); // Second, check for Bunny Text. And ditto the aforementioned preemption. TheBunny.BunnyText(); // NPCs Scavenge each round, behind the scenes. NPC_AI.NPCs_Go_Looting(); // Opening cutscene. Odd place for it but its a legacy of the port. Cutscenes.GameStart_Cutscene(); if (Variables.iRemainingTurns != 125) // Ugly, but this is to prevent text from flashing on screen and then instantly disappearing, on turn 125. { // Display Header Info (minutes remaining, current location). First thing player sees outside of story text. Display_UIHeader(); // If everyone is dead, set the proper variable accordingly. AnyoneStillAliveICanFixThat(); if (Variables.iRemainingTurns == (Variables.iTurn50 - 1)) // If turn = 19. { RandomEncounters.DitchTheBestie(); } // Reset the Lists I'm using to track data. Lists.ClearMostLists(); // Populate the NPC Roster list Lists.PopulateNPCRoster(); // Check/Increment Island Flooding Flood.HereComesTheFlood(); Flood.FloodBlocksSomeLocations(); // Add space before shuffler, if anyone is here: NPC_AI.AnyoneHere_NeedShufflerSpace(); // The "Shuffler" Loop where NPC actions are shown. // Order: NPCs come/go/emote, corpse, lightning, bunny. for (int i = 1; Lists.NPCRoster.Count > 0; i++) { NPC_AI.SetUpForShuffler(); NPC_AI.Shuffler_01To89(); NPC_AI.NPC100_ShufflerOverride(); NPC_AI.Shuffler_90To100(); Notebook.DoYouComeHereOftenYouLookFamiliar(); Flood.HopeYouNPCsCanSwim(); NPC_AI.SetAllNPCLocals(); NPC_AI.CanIStopShufflingYet(); // Note: Triggers SoWhoAllIsDead() when everyone has been accounted for. } TheBunny.BunnyCode(); Title.ButPopularityIsImportant(); // Reset NPC Roster, modify spacing. Lists.PopulateNPCRoster(); NPC_AI.IsAnyoneHere(); // The killer's attack routine. NPC_AI.NPC100_PantsDownGenderCheck(); Killer.KillerIsHunting(); } // Random Encounters RandomEncounters.PickAnyRandomEncounter(); // Launches Run_RandomEncounter##(); RandomEncounters.Resolve_RandomEncounters(); // Launches SetAllActorLocals(); & Initialize_Actors(); // Drown Player (if necessary, of course) Flood.ThePlayerCantSwim(); // Random Encounter #8, The Special Friend RandomEncounters.YourVeryOwnBestie(); // Player options. PlayerOptions.PlayerOptionsList(); // Dock one turn and Loop (unless game is over) Variables.waitMove = true; Variables.iRemainingTurns--; Console.Clear(); if (Variables.iRemainingTurns == 0) { Cutscenes.GameOver_OutOfTurns(); } } else { // Handle game over scoring, etc. Title.ShowScore(); } } }
public static bool GetPositionTextIndex(string text, Flood.GUI.Font font, float x, out int index) { float curX = 0; var ttfont = font.EngineFont.Resolve(); for(var i = 0; i < text.Length; i++) { var c = text[i]; Glyph glyph; var foundGlyph = ttfont.GetGlyphInfo(c, font.Size, out glyph); if (!foundGlyph) { Log.Warn("Glyph not found for character " + c); continue; } curX += glyph.Advance; if(i < text.Length - 1) curX += ttfont.GetKerning(text[i], text[i + 1], font.Size).X; if(curX >= x) { index = i; return true; } } index = 0; return false; }
public static Vector2 MeasureText(System.String text, Flood.GUI.Font font) { float curX = 0; var ttfont = font.EngineFont.Resolve(); for(var i = 0; i < text.Length; i++) { var c = text[i]; Glyph glyph; var foundGlyph = ttfont.GetGlyphInfo(c, font.Size, out glyph); if (!foundGlyph) { Log.Warn("Glyph not found for character " + c); continue; } curX += glyph.Advance; if(i < text.Length - 1) curX += ttfont.GetKerning(text[i], text[i + 1], font.Size).X; } return new Vector2(curX,font.Size);; }
protected override void Render(Flood.GUI.Skins.Skin skin) { skin.Renderer.DrawColor = Color.Red; var testRect = new Rectangle(0, 0, 20, 20); skin.Renderer.DrawFilledRect(testRect); base.Render(skin); }
internal static void DrawText(GUIGeometryBuffer geometryBuffer, Flood.GUI.Font font, Vector2 position, String text, Color color) { var ttfont = font.EngineFont.Resolve(); for(var i = 0; i < text.Length; i++) { char c = text[i]; Glyph glyph; var foundGlyph = ttfont.GetGlyphInfo(c, font.Size, out glyph); if (!foundGlyph) { Log.Warn("Glyph not found for character " + c); continue; } bool drawSubtexture = true; SubTexture subTexture; if(!glyphCache.TryGetGlyph(font, c, out subTexture)) { var imageHandle = ttfont.CreateGlyphImage(c, font.Size); if (imageHandle.Id == ResourceHandle<Resource>.Invalid) { drawSubtexture = false; } else { var subTextureFound = textureAtlas.GetImageSubTexture(imageHandle, out subTexture); if (!subTextureFound) { textureAtlas.AddImage(imageHandle); subTextureFound = textureAtlas.GetImageSubTexture(imageHandle, out subTexture); if (subTextureFound) { glyphCache.AddGlyph(font, c, subTexture); } else { Log.Warn("subTexture not Found\n"); continue; } } } } if (drawSubtexture) { var renderRect = new RectangleF( position.X + glyph.XOffset, position.Y + glyph.BaseLineOffset, glyph.Width, glyph.Height); geometryBuffer.AddRectangle(renderRect,subTexture.LeftTopUV,subTexture.RightTopUV,subTexture.RightBottomUV,subTexture.LeftBottomUV,textMaterial,color); } if (i < text.Length-1){ var kern = ttfont.GetKerning(text[i], text[i+1], font.Size); position.X += glyph.Advance + kern.X; position.Y += kern.Y; } } }
private void SetTextFromColor(Flood.Color color) { m_TextBox.Text = String.Format("{0} {1} {2}", color.R, color.G, color.B); }
public override void RenderText(Flood.GUI.Font font, Vector2i position, string text) { position = Translate(position); TextRenderer.DrawText(_guiBuffer, font, new Vector2(position.X,position.Y), text, DrawColor); }