private void Awake() { s_Instance = this; this.m_addRewardsToCacheValues = !Login.IsLoginSceneActive(); this.m_InstancedObjects = new List <GameObject>(); this.m_doneCallbacks = new List <System.Action>(); CollectionManager.Get().RegisterAchievesCompletedListener(new CollectionManager.DelOnAchievesCompleted(this.OnCollectionAchievesCompleted)); RenderUtils.SetAlpha(this.m_ClickCatcher, 0f); }
public unsafe void Render(uint *bmpAddress, int bmpWidth, int bmpHeight, int x, int y, bool selected) { _background.DrawOn(bmpAddress, bmpWidth, bmpHeight, x, y); if (selected) { RenderUtils.DrawRectangle(bmpAddress, bmpWidth, bmpHeight, x, y, _background.Width, _background.Height, RenderUtils.Color(48, 180, 255, 200)); } _mini.DrawOn(bmpAddress, bmpWidth, bmpHeight, xOffset: x, yOffset: y); }
public static void CreateStandardYesNoChoices(Action <bool> clickAction, out TextGUIChoices choices, out Window window, float x = 0.8f, float y = 0.4f) { choices = new TextGUIChoices(0, 0, font: Font.Default, fontColors: Font.DefaultDarkGray_I, selectedColors: Font.DefaultYellow_O); choices.Add(new TextGUIChoice("Yes", () => clickAction(true))); choices.Add(new TextGUIChoice("No", () => clickAction(false))); choices.GetSize(out int width, out int height); window = new Window(x, y, width, height, RenderUtils.Color(255, 255, 255, 255)); choices.RenderChoicesOntoWindow(window); }
public unsafe void RenderTick(uint *bmpAddress, int bmpWidth, int bmpHeight) { RenderUtils.FillColor(bmpAddress, bmpWidth, bmpHeight, 0xFF000000); CameraObj.Render(bmpAddress, bmpWidth, bmpHeight); if (Overworld.ShouldRenderDayTint()) { DayTint.Render(bmpAddress, bmpWidth, bmpHeight); } }
public static RayTraceResult RayTraceBlocks(Vector3 start, Vector3 direction) { //GameClient.LOGGER.info("ray at start: " + start + "; facing: " + direction); //RenderUtils.RenderRay(new Ray(start, direction), Color.Blue, GameSettings.BlockOutlineWidth); Vector3Int Selected; Vector3Int PreviousSelected = -Vector3Int.One; Side face; foreach (Vector3Int coord in GetCellsOnRay(new Ray(start + new Vector3(0.5f, 0.5f, 0.5f), direction), (int)MAX_RAY_DISTANCE)) { uint id = GameClient.theWorld.GetBlockIdAt(coord); Vector3 renderPos = coord.ToVector3(); float i = Vector3.DistanceSquared(GameClient.World.player.camera.position, renderPos); if (i > Reach * Reach) { continue; //Dont let us choose blocks which are too far away } if (BlockManager.GetBlock(id).Selectable) //If we can pick the block { if (GameSettings.Debug.RenderRaycastLocations) { Vector3 min = new Vector3(renderPos.X - 0.5f, renderPos.Y - 0.5f, renderPos.Z - 0.5f); Vector3 max = new Vector3(renderPos.X + 0.5f, renderPos.Y + 0.5f, renderPos.Z + 0.5f); RenderUtils.RenderBox(new BoundingBox(min, max), Color.White, GameSettings.BlockOutlineWidth); } //TODO: Ray test Selected = coord; //Determine the facing face face = GetFace(Selected, PreviousSelected); return(new RayTraceResult(renderPos, face, coord)); } else { PreviousSelected = coord; if (GameSettings.Debug.RenderRaycastLocations) { Vector3 min = new Vector3(renderPos.X - 0.5f, renderPos.Y - 0.5f, renderPos.Z - 0.5f); Vector3 max = new Vector3(renderPos.X + 0.5f, renderPos.Y + 0.5f, renderPos.Z + 0.5f); RenderUtils.RenderBox(new BoundingBox(min, max), Color.Yellow, GameSettings.BlockOutlineWidth); } } } return(null); //return Cast(new Ray(start, direction), (int)MAX_RAY_DISTANCE); }
/// <summary> /// Draw specific border (top/bottom/left/right) with the box data (style/width/rounded).<br/> /// </summary> /// <param name="border">desired border to draw</param> /// <param name="box">the box to draw its borders, contain the borders data</param> /// <param name="g">the device to draw into</param> /// <param name="rect">the rectangle the border is enclosing</param> /// <param name="isLineStart">Specifies if the border is for a starting line (no bevel on left)</param> /// <param name="isLineEnd">Specifies if the border is for an ending line (no bevel on right)</param> private static void DrawBorder(Border border, CssBox box, IGraphics g, RectangleF rect, bool isLineStart, bool isLineEnd) { var style = GetStyle(border, box); var color = GetColor(border, box, style); var borderPath = GetRoundedBorderPath(border, box, rect); if (borderPath != null) { // rounded border need special path var smooth = g.SmoothingMode; if (box.HtmlContainer != null && !box.HtmlContainer.AvoidGeometryAntialias && box.IsRounded) { g.SmoothingMode = SmoothingMode.AntiAlias; } var pen = GetPen(style, color, GetWidth(border, box)); using (borderPath) g.DrawPath(pen, borderPath); g.SmoothingMode = smooth; } else { // non rounded border if (style == CssConstants.Inset || style == CssConstants.Outset) { // inset/outset border needs special rectangle SetInOutsetRectanglePoints(border, box, rect, isLineStart, isLineEnd); g.FillPolygon(RenderUtils.GetSolidBrush(color), _borderPts); } else { // solid/dotted/dashed border draw as simple line var pen = GetPen(style, color, GetWidth(border, box)); switch (border) { case Border.Top: g.DrawLine(pen, (float)Math.Ceiling(rect.Left), rect.Top + box.ActualBorderTopWidth / 2, rect.Right - 1, rect.Top + box.ActualBorderTopWidth / 2); break; case Border.Left: g.DrawLine(pen, rect.Left + box.ActualBorderLeftWidth / 2, (float)Math.Ceiling(rect.Top), rect.Left + box.ActualBorderLeftWidth / 2, (float)Math.Floor(rect.Bottom)); break; case Border.Bottom: g.DrawLine(pen, (float)Math.Ceiling(rect.Left), rect.Bottom - box.ActualBorderBottomWidth / 2, rect.Right - 1, rect.Bottom - box.ActualBorderBottomWidth / 2); break; case Border.Right: g.DrawLine(pen, rect.Right - box.ActualBorderRightWidth / 2, (float)Math.Ceiling(rect.Top), rect.Right - box.ActualBorderRightWidth / 2, (float)Math.Floor(rect.Bottom)); break; } } } }
private Control GetBoundContentControl(int index) { var itemValue = GetFieldValue(index, ContentField); var lbl = RenderUtils.CreateLabel(); lbl.ID = "content" + index; lbl.Text = itemValue.ToString(); return(lbl); }
private Control GetBoundHeaderControl(int index) { var itemKey = GetFieldValue(index, HeaderField); var lbl = RenderUtils.CreateLabel(); lbl.ID = "header" + index; lbl.Text = itemKey.ToString(); return(lbl); }
/// <summary> /// Creates a UISpriteBatch. Same as spritebatch with some extra functionality /// required by the UI system of this game. /// /// NumBuffers refers to a number of RenderTarget2D objects to create up front. /// These should be used for temp rendering for special effects. E.g. rendering /// part of the GUI to a texture and then painting it with opacity onto the main /// target. /// </summary> /// <param name="gd"></param> /// <param name="numBuffers">The number of rendering buffers to pre-alloc</param> public UISpriteBatch(GraphicsDevice gd, int numBuffers) : base(gd) { for (var i = 0; i < numBuffers; i++) { Buffers.Add( RenderUtils.CreateRenderTarget(gd, 1, SurfaceFormat.Color, gd.Viewport.Width, gd.Viewport.Height) ); } }
protected virtual void CreateHeaderECButton() { HeaderContentRow.Add( HeaderECButtonCell = RenderUtils.CreateTableCell().Add( HeaderECButton = new ASPxButton() ) ); HeaderECButton.ID = RoundPanel.GetHeaderECButtonID(); }
protected virtual void CreateHeaderTextBlock() { HeaderContentRow.Add( HeaderTextCell = RenderUtils.CreateTableCell().Add( HeaderText = RenderUtils.CreateWebControl(HtmlTextWriterTag.Span) ) ); HeaderText.ID = RoundPanel.GetHeaderTextContainerID(); }
protected virtual void CreateExpandAllButtonCell() { MainRow.Cells.Add( ExpandAllButtonCell = RenderUtils.CreateTableCell().Add( ExpandAllButton = new ASPxButton() ) ); ExpandAllButton.ID = GetControlID("ExpandAllButton"); }
protected virtual void CreateCollapseAllButtonCell() { MainRow.Cells.Add( CollapseAllButtonCell = RenderUtils.CreateTableCell().Add( CollapseAllButton = new ASPxButton() ) ); CollapseAllButton.ID = GetControlID("CollapseAllButton"); }
private void CreateCancelSearchButton() { CBContainerRow.Add( CBCancelSearchButtonCell = RenderUtils.CreateTableCell().Add( CancelSearchButton = new ASPxButton() ) ); CancelSearchButton.ID = RoundPanel.GetCancelSearchButtonID(); }
private void CreatePerformSearchButton() { CBContainerRow.Add( CBPerformSearchButtonCell = RenderUtils.CreateTableCell().Add( PerformSearchButton = new ASPxButton() ) ); PerformSearchButton.ID = RoundPanel.GetPerformSearchButtonID(); }
/// <summary>Expand the window and resize it to a larger size</summary> static void Expand() { Collapsed = false; MainClock.Pause(); RenderUtils.ResizeConsole(Math.Max(Console.WindowWidth, (MainClock.Width + ClockFont.Width + 4)), 34); //Console.SetBufferSize(Math.Max(Console.WindowWidth,(MainClock.Width + ClockFont.Width + 4)),34); //Console.SetWindowSize(Math.Max(Console.WindowWidth,(MainClock.Width + ClockFont.Width + 4)),34); DrawHelp(); MainClock.Resume(); }
protected virtual void CreateECStateControl() { HeaderContentRow.Add( RenderUtils.CreateTableCell().SetStyle("display", "none").Add( CStateElement = RenderUtils.CreateWebControl(HtmlTextWriterTag.Input) ) ); CStateElement.ID = RoundPanel.GetCStateControlID(); }
public void Update(LightType type) { if (forceShadows) { Mesh mesh = type == LightType.Point ? RenderUtils.GetMesh(PrimitiveType.Sphere) : VolumetricLightUtils.spotlightMesh; Graphics.DrawMesh(mesh, world, material, layer, null, 0, null, ShadowCastingMode.On, true); forceShadows = false; } }
private unsafe void RCB_RenderTick(uint *bmpAddress, int bmpWidth, int bmpHeight) { RenderUtils.ThreeColorBackground(bmpAddress, bmpWidth, bmpHeight, RenderUtils.Color(215, 231, 230, 255), RenderUtils.Color(231, 163, 0, 255), RenderUtils.Color(242, 182, 32, 255)); AnimatedImage.UpdateCurrentFrameForAll(); _pkmnImage.DrawOn(bmpAddress, bmpWidth, bmpHeight, RenderUtils.GetCoordinatesForCentering(bmpWidth, _pkmnImage.Width, 0.2f), RenderUtils.GetCoordinatesForEndAlign(bmpHeight, _pkmnImage.Height, 0.6f)); _pageImage.DrawOn(bmpAddress, bmpWidth, bmpHeight, 1f - PageImageWidth, 1f - PageImageHeight); }
public void HideSkin() { //hide previous skin if (m_ActiveModel != null) { RenderUtils.EnableRenderer(m_ActiveModel, false); m_ActiveModel = null; } m_ActiveId = ShopItemId.EmptyId; }
private void BringUpPkmnActions(int index) { string nickname; _textChoices = new TextGUIChoices(0, 0, backCommand: CloseChoicesThenGoToLogicTick, font: Font.Default, fontColors: Font.DefaultDarkGray_I, selectedColors: Font.DefaultYellow_O); switch (_mode) { case Mode.PkmnMenu: { PartyPokemon pkmn = _gameParty.Party[index]; nickname = pkmn.Nickname; _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index))); AddFieldMovesToActions(pkmn, index); break; } case Mode.SelectDaycare: { PartyPokemon pkmn = _gameParty.Party[index]; nickname = pkmn.Nickname; if (!pkmn.IsEgg) { _textChoices.Add(new TextGUIChoice("Select", () => Action_SelectPartyPkmn(index))); } _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index))); break; } case Mode.BattleSwitchIn: case Mode.BattleReplace: // Currently same logic { SpritedBattlePokemonParty party = _battleParty.Party; PBEBattlePokemon bPkmn = party.BattleParty[index]; SpritedBattlePokemon sPkmn = party[bPkmn]; PartyPokemon pkmn = sPkmn.PartyPkmn; nickname = pkmn.Nickname; // Cannot switch in if active already or fainted, or in the switch stand by if (!pkmn.IsEgg && bPkmn.FieldPosition == PBEFieldPosition.None && bPkmn.HP > 0 && !BattleGUI.Instance.StandBy.Contains(bPkmn)) { _textChoices.Add(new TextGUIChoice("Switch In", () => Action_SelectPartyPkmn(index))); } _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index))); break; } default: throw new Exception(); } _textChoices.Add(new TextGUIChoice("Cancel", CloseChoicesThenGoToLogicTick)); _textChoices.GetSize(out int width, out int height); _textChoicesWindow = new Window(0.6f, 0.3f, width, height, RenderUtils.Color(255, 255, 255, 255)); RenderChoicesOntoWindow(); _message = string.Format("Do what with {0}?", nickname); Game.Instance.SetCallback(CB_Choices); }
public void ShowSkin(ShopItemId skinId) { //Debug.Log("ShowActiveModel begin:" + skinId + " curr id " + m_ActiveId + " model: " + ((m_ActiveModel != null) ? m_ActiveModel.name : "none")); if (m_ActiveId == skinId) { return; } //hide previous skin HideSkin(); if (skinId.IsEmpty()) { return; } //store id m_ActiveId = skinId; m_ActiveModel = ShopDataBridge.Instance.GetOutfitModel(skinId); if (m_ActiveModel != null) { int HUDLayer = LayerMask.NameToLayer("HUD"); RenderUtils.EnableRenderer(m_ActiveModel, true); Renderer[] renderers = m_ActiveModel.GetComponentsInChildren <Renderer>(); foreach (Renderer r in renderers) { r.gameObject.layer = HUDLayer; r.useLightProbes = false; r.material = Object.Instantiate(r.material) as Material; r.material.SetFloat("_LightProbesLightingAmount", 0); r.material.SetVector("_FakeProbeTopColor", OutfitColors.m_PreviewColorGradTop); r.material.SetVector("_FakeProbeBotColor", OutfitColors.m_PreviewColorGradBot); } // prevent glitches caused by late update of animation - @see BUG #330 Character in A pose when player enters the equip section if (null != m_ActiveModel.GetComponent <Animation>()) { m_ActiveModel.GetComponent <Animation>().Sample(); } UpdatePos(); } else { Debug.LogError("Failed to get model for skin: " + skinId.Id + " " + skinId.ItemType); } //Debug.Log("ShowActiveModel end " + skinId + " curr id " + m_ActiveId + " model: " + ((m_ActiveModel != null) ? m_ActiveModel.name : "none")); }
private static void Type() { ConsoleKeyInfo CurrentKey; Redraw(false); while (true) { RenderUtils.SetPos(CurrentX, CurrentY + 1); CurrentKey = Console.ReadKey(true); //Save the file if (CurrentKey.Modifiers == ConsoleModifiers.Control) { switch (CurrentKey.Key) { case ConsoleKey.S: File.WriteAllLines(Filename, CurrentDocument); break; case ConsoleKey.R: Redraw(false); break; default: break; } } else { switch (CurrentKey.Key) { case ConsoleKey.LeftArrow: CurrentX = Math.Max(0, CurrentX - 1); break; case ConsoleKey.RightArrow: CurrentX = Math.Min(Editor.GetWidth(CurrentDocument) - 1, CurrentX + 1); break; case ConsoleKey.UpArrow: CurrentY = Math.Max(0, CurrentY - 1); break; case ConsoleKey.DownArrow: CurrentY = Math.Min(CurrentDocument.Length - 1, CurrentY + 1); break; default: Editor.KeyPress(ref CurrentDocument, CurrentX, CurrentY, CurrentKey); break; } } } }
/// <summary> /// Renders the space craft at it's correct scale and rotation according to the camera. /// The engines are rendered first and then the space craft body. /// </summary> public override void RenderGdi(Graphics graphics, Camera camera) { if (Terminated) { return; } // Only draws the ship if it's visible if (Visibility(camera.Bounds) > 0) { RectangleD bounds = ComputeBoundingBox(); // In range for render if (camera.Intersects(bounds)) { RectangleF screenBounds = RenderUtils.ComputeBoundingBox(Position, camera.Bounds, Width, Height); // Saftey if (screenBounds.Width > RenderUtils.ScreenWidth * 500) { return; } RenderBelow(graphics, camera); RenderShip(graphics, camera, screenBounds); RenderAbove(graphics, camera); } } // Only draw orbit traces and launch trails for detatched ships if (Parent == null) { camera.ApplyScreenRotation(graphics); if (camera.Bounds.Width > 1000) { if (GravitationalParent != null) { string parentName = GravitationalParent.ToString(); if (_launchTrails.ContainsKey(parentName)) { _launchTrails[parentName].Draw(graphics, camera, GravitationalParent); } } } // Don't draw orbit traces on the ground base.RenderGdi(graphics, camera); graphics.ResetTransform(); } }
public void RenderGdi(Graphics graphics, Camera camera) { // Update position and rotation given the parent's motion double currentRotation = (_parent.Pitch - _initialRotation) + _rotationOffset; DVector2 rotationNormal = DVector2.FromAngle(currentRotation); Position = _parent.Position + rotationNormal * _initialDistance; var bounds = new RectangleD(Position.X - Width * 0.5, Position.Y - Height * 0.5, Width, Height); // Not in range easy return if (!camera.Intersects(bounds)) { return; } RectangleF screenBounds = RenderUtils.ComputeBoundingBox(Position, camera.Bounds, Width, Height); // Saftey if (screenBounds.Width > RenderUtils.ScreenWidth * 500) { return; } double drawingRotation = currentRotation + Constants.PiOverTwo; var offset = new PointF(screenBounds.X + screenBounds.Width * 0.5f, screenBounds.Y + screenBounds.Height * 0.5f); camera.ApplyScreenRotation(graphics); camera.ApplyRotationMatrix(graphics, offset, drawingRotation); graphics.DrawImage(_texture, screenBounds.X, screenBounds.Y, screenBounds.Width, screenBounds.Height); graphics.ResetTransform(); double visibility = Visibility(camera.Bounds); if (visibility < 1) { PointF iconPoint = RenderUtils.WorldToScreen(Position, camera.Bounds); var iconBounds = new RectangleF(iconPoint.X - 5, iconPoint.Y - 5, 10, 10); var iconColor = Color.FromArgb((int)((1 - visibility) * 255), IconColor.R, IconColor.G, IconColor.B); camera.ApplyScreenRotation(graphics); graphics.FillEllipse(new SolidBrush(iconColor), iconBounds); graphics.ResetTransform(); } }
private bool TestIntersectionZ(Vector3Int block, BoundingBox collider, out float dist) { Vector3 Offset = new Vector3(-0.5f, -0.5f, -0.5f); BoundingBox blockCollider = GetBoxCollider(block).Offset(Offset); if (GameSettings.Debug.RenderPhysicsTestLocations) { RenderUtils.DebugRenderBox(blockCollider, Color.Purple, GameSettings.BlockOutlineWidth); } return(collider.IntersectsZ(blockCollider, out dist)); }
/// <summary>Draws this hicolor graphic at the specified position.</summary> /// <param name="LeftPos"></param> /// <param name="TopPos"></param> public override void Draw(int LeftPos, int TopPos) { foreach (String Line in Contents) { RenderUtils.SetPos(LeftPos, TopPos++); if (!string.IsNullOrEmpty(Line)) { HiColorDraw(Line); } } }
public unsafe void RenderTick(uint *bmpAddress, int bmpWidth, int bmpHeight) { RenderUtils.FillColor(bmpAddress, bmpWidth, bmpHeight, ((uint)(_counter / _transitionDurationF * 0xFF) << 24) + _color); if (_counter-- <= 0) { _onTransitionEnded.Invoke(); _onTransitionEnded = null; return; } }
public unsafe void Render(uint *bmpAddress, int bmpWidth, int bmpHeight, bool isSelected, int x1, int x2, int y, int height, int xOfs) { if (isSelected) { RenderUtils.FillRectangle_Points(bmpAddress, bmpWidth, bmpHeight, x1, y, x2, y + height - 1, RenderUtils.Color(255, 0, 0, 128)); } x1 += xOfs; x2 -= xOfs; Font.Default.DrawString(bmpAddress, bmpWidth, bmpHeight, x1, y, _itemName, Font.DefaultDarkGray_I); Font.Default.DrawString(bmpAddress, bmpWidth, bmpHeight, x2 - _quantityWidth, y, _quantityStr, Font.DefaultDarkGray_I); }
/// <summary>Collapse the window to a smaller size</summary> static void Collapse() { Collapsed = true; MainClock.Pause(); RenderUtils.ResizeConsole(Math.Max(Console.WindowWidth, (MainClock.Width + ClockFont.Width + 4)), 13); //Console.SetWindowSize(Math.Max(Console.WindowWidth,(MainClock.Width + ClockFont.Width + 4)),13); //Console.SetBufferSize(Math.Max(Console.WindowWidth,(MainClock.Width + ClockFont.Width + 4)),13); Console.Clear(); MainClock.Render(); Draw.Sprite(":", Console.BackgroundColor, Console.ForegroundColor, 0, 10); MainClock.Resume(); }